aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX18
-rw-r--r--Documentation/CodingStyle7
-rw-r--r--Documentation/DMA-mapping.txt20
-rw-r--r--Documentation/DocBook/deviceiobook.tmpl10
-rw-r--r--Documentation/DocBook/filesystems.tmpl36
-rw-r--r--Documentation/DocBook/gadget.tmpl6
-rw-r--r--Documentation/DocBook/kernel-api.tmpl5
-rw-r--r--Documentation/HOWTO2
-rw-r--r--Documentation/RCU/00-INDEX22
-rw-r--r--Documentation/SM501.txt5
-rw-r--r--Documentation/accounting/getdelays.c1
-rw-r--r--Documentation/atomic_ops.txt59
-rw-r--r--Documentation/dontdiff8
-rw-r--r--Documentation/early-userspace/README6
-rw-r--r--Documentation/email-clients.txt217
-rw-r--r--Documentation/feature-removal-schedule.txt11
-rw-r--r--Documentation/filesystems/00-INDEX6
-rw-r--r--Documentation/filesystems/quota.txt59
-rw-r--r--Documentation/filesystems/ramfs-rootfs-initramfs.txt14
-rw-r--r--Documentation/firmware_class/firmware_sample_firmware_class.c10
-rw-r--r--Documentation/initrd.txt12
-rw-r--r--Documentation/kdump/kdump.txt63
-rw-r--r--Documentation/kernel-parameters.txt21
-rw-r--r--Documentation/keys-request-key.txt25
-rw-r--r--Documentation/keys.txt93
-rw-r--r--Documentation/local_ops.txt25
-rw-r--r--Documentation/m68k/kernel-options.txt4
-rw-r--r--Documentation/make/headers_install.txt46
-rw-r--r--Documentation/mips/00-INDEX8
-rw-r--r--Documentation/mutex-design.txt3
-rw-r--r--Documentation/networking/rxrpc.txt7
-rw-r--r--Documentation/power/00-INDEX34
-rw-r--r--Documentation/power/drivers-testing.txt4
-rw-r--r--Documentation/powerpc/00-INDEX4
-rw-r--r--Documentation/ramdisk.txt18
-rw-r--r--Documentation/scsi/ChangeLog.ncr53c8xx6
-rw-r--r--Documentation/scsi/ibmmca.txt2
-rw-r--r--Documentation/scsi/ncr53c8xx.txt14
-rw-r--r--Documentation/sysctl/00-INDEX16
-rw-r--r--Documentation/sysctl/kernel.txt8
-rw-r--r--Documentation/sysctl/vm.txt28
-rw-r--r--Documentation/telephony/00-INDEX4
-rw-r--r--Documentation/vm/00-INDEX20
-rw-r--r--Documentation/vm/slabinfo.c27
-rw-r--r--Documentation/w1/00-INDEX8
-rw-r--r--Documentation/w1/masters/00-INDEX6
-rw-r--r--Documentation/w1/masters/ds24822
-rw-r--r--Documentation/w1/masters/ds24902
-rw-r--r--Documentation/xterm-linux.xpm61
-rw-r--r--MAINTAINERS8
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c2
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c6
-rw-r--r--arch/arm/plat-s3c24xx/dma.c2
-rw-r--r--arch/avr32/mm/dma-coherent.c6
-rw-r--r--arch/cris/kernel/sys_cris.c2
-rw-r--r--arch/frv/kernel/sys_frv.c2
-rw-r--r--arch/h8300/kernel/sys_h8300.c2
-rw-r--r--arch/i386/Kconfig18
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/ia32/binfmt_elf32.c2
-rw-r--r--arch/ia64/ia32/elfcore32.h1
-rw-r--r--arch/ia64/kernel/machine_kexec.c28
-rw-r--r--arch/ia64/mm/discontig.c2
-rw-r--r--arch/m32r/kernel/sys_m32r.c2
-rw-r--r--arch/m68k/kernel/sys_m68k.c2
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c2
-rw-r--r--arch/mips/Makefile1
-rw-r--r--arch/mips/kernel/irixelf.c12
-rw-r--r--arch/mips/kernel/linux32.c2
-rw-r--r--arch/mips/kernel/syscall.c2
-rw-r--r--arch/mips/mm/cache.c2
-rw-r--r--arch/mips/pci/ops-pmcmsp.c2
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/kernel/binfmt_elf32.c67
-rw-r--r--arch/powerpc/kernel/process.c28
-rw-r--r--arch/powerpc/kernel/rtas_flash.c2
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c2
-rw-r--r--arch/powerpc/kernel/syscalls.c1
-rw-r--r--arch/powerpc/mm/hugetlbpage.c2
-rw-r--r--arch/powerpc/mm/init_64.c2
-rw-r--r--arch/powerpc/mm/slice.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c2
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c56
-rw-r--r--arch/s390/kernel/compat_linux.c2
-rw-r--r--arch/s390/kernel/sys_s390.c2
-rw-r--r--arch/s390/mm/cmm.c1
-rw-r--r--arch/sh/drivers/pci/dma-dreamcast.c2
-rw-r--r--arch/sh/kernel/sys_sh.c2
-rw-r--r--arch/sh/mm/consistent.c8
-rw-r--r--arch/sh/mm/pmb.c3
-rw-r--r--arch/sh64/kernel/sys_sh64.c2
-rw-r--r--arch/sh64/mm/consistent.c3
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/kernel/sys_sparc.c2
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/sparc64/kernel/binfmt_aout32.c17
-rw-r--r--arch/sparc64/kernel/sys_sparc.c1
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c1
-rw-r--r--arch/sparc64/solaris/ipc.c2
-rw-r--r--arch/um/sys-i386/syscalls.c2
-rw-r--r--arch/v850/kernel/syscalls.c1
-rw-r--r--arch/x86/boot/Makefile1
-rw-r--r--arch/x86/ia32/ia32_aout.c10
-rw-r--r--arch/x86/ia32/ia32_binfmt.c1
-rw-r--r--arch/x86/ia32/ipc32.c2
-rw-r--r--arch/x86/kernel/e820_64.c19
-rw-r--r--arch/x86/kernel/early_printk.c15
-rw-r--r--arch/x86/kernel/efi_32.c15
-rw-r--r--arch/x86/kernel/head64.c20
-rw-r--r--arch/x86/kernel/machine_kexec_32.c13
-rw-r--r--arch/x86/kernel/machine_kexec_64.c9
-rw-r--r--arch/x86/kernel/mce_64.c3
-rw-r--r--arch/x86/kernel/setup64.c4
-rw-r--r--arch/x86/kernel/setup_32.c67
-rw-r--r--arch/x86/kernel/setup_64.c51
-rw-r--r--arch/x86/kernel/sys_i386_32.c2
-rw-r--r--arch/x86/mach-default/setup.c12
-rw-r--r--arch/x86/mach-visws/setup.c2
-rw-r--r--arch/x86/mach-voyager/setup.c14
-rw-r--r--arch/x86/mm/discontig_32.c5
-rw-r--r--arch/x86/mm/pgtable_32.c2
-rw-r--r--arch/x86/xen/enlighten.c7
-rw-r--r--arch/x86_64/Kconfig22
-rw-r--r--block/ll_rw_blk.c13
-rw-r--r--drivers/acorn/char/defkeymap-l7200.c2
-rw-r--r--drivers/base/dmapool.c2
-rw-r--r--drivers/block/aoe/aoe.h9
-rw-r--r--drivers/block/aoe/aoecmd.c14
-rw-r--r--drivers/block/aoe/aoenet.c2
-rw-r--r--drivers/block/cciss.c135
-rw-r--r--drivers/block/floppy.c167
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/nbd.c114
-rw-r--r--drivers/block/rd.c27
-rw-r--r--drivers/char/Kconfig21
-rw-r--r--drivers/char/agp/hp-agp.c9
-rw-r--r--drivers/char/agp/i460-agp.c5
-rw-r--r--drivers/char/agp/parisc-agp.c7
-rw-r--r--drivers/char/consolemap.c25
-rw-r--r--drivers/char/defkeymap.c_shipped2
-rw-r--r--drivers/char/epca.c2611
-rw-r--r--drivers/char/hvc_console.c56
-rw-r--r--drivers/char/ip2/ip2main.c11
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c2
-rw-r--r--drivers/char/keyboard.c37
-rw-r--r--drivers/char/lp.c17
-rw-r--r--drivers/char/mbcs.c1
-rw-r--r--drivers/char/mem.c5
-rw-r--r--drivers/char/mxser.h3
-rw-r--r--drivers/char/n_hdlc.c2
-rw-r--r--drivers/char/ppdev.c1
-rw-r--r--drivers/char/synclink.c4
-rw-r--r--drivers/char/sysrq.c5
-rw-r--r--drivers/char/tpm/tpm_tis.c22
-rw-r--r--drivers/char/tty_ioctl.c82
-rw-r--r--drivers/char/vt.c6
-rw-r--r--drivers/char/vt_ioctl.c48
-rw-r--r--drivers/dma/iop-adma.c9
-rw-r--r--drivers/i2c/chips/menelaus.c10
-rw-r--r--drivers/lguest/lguest.c4
-rw-r--r--drivers/md/md.c51
-rw-r--r--drivers/md/raid0.c10
-rw-r--r--drivers/md/raid1.c3
-rw-r--r--drivers/message/i2o/exec-osm.c94
-rw-r--r--drivers/misc/Kconfig12
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/atmel-ssc.c174
-rw-r--r--drivers/mtd/ubi/eba.c3
-rw-r--r--drivers/net/spider_net.h3
-rw-r--r--drivers/pcmcia/Kconfig7
-rw-r--r--drivers/pcmcia/Makefile1
-rw-r--r--drivers/pcmcia/electra_cf.c377
-rw-r--r--drivers/pnp/Makefile4
-rw-r--r--drivers/pnp/card.c71
-rw-r--r--drivers/pnp/core.c28
-rw-r--r--drivers/pnp/driver.c5
-rw-r--r--drivers/pnp/interface.c3
-rw-r--r--drivers/pnp/manager.c56
-rw-r--r--drivers/pnp/pnpacpi/core.c16
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c10
-rw-r--r--drivers/pnp/pnpbios/core.c28
-rw-r--r--drivers/pnp/pnpbios/proc.c5
-rw-r--r--drivers/pnp/quirks.c12
-rw-r--r--drivers/pnp/resource.c2
-rw-r--r--drivers/pnp/system.c29
-rw-r--r--drivers/s390/char/defkeymap.c2
-rw-r--r--drivers/s390/char/keyboard.c66
-rw-r--r--drivers/s390/char/keyboard.h4
-rw-r--r--drivers/serial/jsm/jsm_tty.c43
-rw-r--r--drivers/tc/.gitignore1
-rw-r--r--drivers/tc/Makefile15
-rw-r--r--drivers/tc/lk201-map.c_shipped265
-rw-r--r--drivers/tc/lk201-map.map356
-rw-r--r--drivers/tc/lk201-remap.c172
-rw-r--r--drivers/tc/lk201.c439
-rw-r--r--drivers/tc/lk201.h125
-rw-r--r--drivers/usb/core/usb.c1
-rw-r--r--drivers/usb/mon/mon_text.c4
-rw-r--r--drivers/usb/storage/libusual.c4
-rw-r--r--drivers/video/console/dummycon.c4
-rw-r--r--drivers/video/console/vgacon.c51
-rw-r--r--drivers/video/intelfb/intelfbdrv.c5
-rw-r--r--drivers/video/omap/lcd_h3.c6
-rw-r--r--drivers/video/omap/lcd_inn1610.c6
-rw-r--r--drivers/video/vga16fb.c2
-rw-r--r--drivers/w1/masters/matrox_w1.c1
-rw-r--r--fs/Kconfig52
-rw-r--r--fs/Makefile2
-rw-r--r--fs/adfs/super.c2
-rw-r--r--fs/affs/bitmap.c2
-rw-r--r--fs/affs/super.c2
-rw-r--r--fs/afs/callback.c2
-rw-r--r--fs/afs/cell.c19
-rw-r--r--fs/afs/cmservice.c2
-rw-r--r--fs/afs/internal.h1
-rw-r--r--fs/afs/mntpt.c2
-rw-r--r--fs/afs/proc.c2
-rw-r--r--fs/afs/rxrpc.c3
-rw-r--r--fs/afs/server.c2
-rw-r--r--fs/afs/super.c6
-rw-r--r--fs/afs/vlocation.c6
-rw-r--r--fs/afs/write.c8
-rw-r--r--fs/aio.c6
-rw-r--r--fs/anon_inodes.c25
-rw-r--r--fs/attr.c9
-rw-r--r--fs/autofs4/inode.c4
-rw-r--r--fs/befs/linuxvfs.c2
-rw-r--r--fs/bfs/inode.c2
-rw-r--r--fs/binfmt_aout.c16
-rw-r--r--fs/binfmt_elf.c118
-rw-r--r--fs/binfmt_elf_fdpic.c13
-rw-r--r--fs/binfmt_flat.c18
-rw-r--r--fs/binfmt_som.c2
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/buffer.c3
-rw-r--r--fs/char_dev.c1
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/coda/inode.c2
-rw-r--r--fs/compat_ioctl.c1
-rw-r--r--fs/configfs/configfs_internal.h2
-rw-r--r--fs/configfs/dir.c5
-rw-r--r--fs/configfs/inode.c8
-rw-r--r--fs/configfs/mount.c9
-rw-r--r--fs/cramfs/inode.c11
-rw-r--r--fs/dcache.c44
-rw-r--r--fs/dlm/Kconfig8
-rw-r--r--fs/dquot.c144
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/efs/super.c2
-rw-r--r--fs/exec.c165
-rw-r--r--fs/ext2/balloc.c1361
-rw-r--r--fs/ext2/ext2.h36
-rw-r--r--fs/ext2/file.c7
-rw-r--r--fs/ext2/ialloc.c31
-rw-r--r--fs/ext2/inode.c526
-rw-r--r--fs/ext2/ioctl.c45
-rw-r--r--fs/ext2/super.c122
-rw-r--r--fs/ext2/xattr.c3
-rw-r--r--fs/ext3/balloc.c58
-rw-r--r--fs/ext3/bitmap.c2
-rw-r--r--fs/ext3/dir.c9
-rw-r--r--fs/ext3/ialloc.c17
-rw-r--r--fs/ext3/namei.c19
-rw-r--r--fs/ext3/resize.c55
-rw-r--r--fs/ext3/super.c97
-rw-r--r--fs/ext4/balloc.c66
-rw-r--r--fs/ext4/bitmap.c2
-rw-r--r--fs/ext4/dir.c2
-rw-r--r--fs/ext4/ialloc.c17
-rw-r--r--fs/ext4/resize.c4
-rw-r--r--fs/ext4/super.c107
-rw-r--r--fs/fat/cache.c2
-rw-r--r--fs/fat/inode.c2
-rw-r--r--fs/fcntl.c12
-rw-r--r--fs/file_table.c65
-rw-r--r--fs/fs-writeback.c164
-rw-r--r--fs/fuse/dev.c68
-rw-r--r--fs/fuse/dir.c154
-rw-r--r--fs/fuse/file.c90
-rw-r--r--fs/fuse/fuse_i.h30
-rw-r--r--fs/fuse/inode.c52
-rw-r--r--fs/gfs2/main.c4
-rw-r--r--fs/gfs2/ops_file.c2
-rw-r--r--fs/hfs/super.c2
-rw-r--r--fs/hfsplus/super.c2
-rw-r--r--fs/hpfs/super.c2
-rw-r--r--fs/hugetlbfs/inode.c35
-rw-r--r--fs/inode.c28
-rw-r--r--fs/inotify_user.c4
-rw-r--r--fs/isofs/compress.c25
-rw-r--r--fs/isofs/inode.c2
-rw-r--r--fs/isofs/namei.c3
-rw-r--r--fs/jffs2/super.c2
-rw-r--r--fs/jfs/jfs_metapage.c2
-rw-r--r--fs/jfs/jfs_txnmgr.c9
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/libfs.c5
-rw-r--r--fs/locks.c2
-rw-r--r--fs/minix/bitmap.c2
-rw-r--r--fs/minix/inode.c2
-rw-r--r--fs/minix/itree_v1.c9
-rw-r--r--fs/minix/itree_v2.c9
-rw-r--r--fs/namei.c107
-rw-r--r--fs/namespace.c2
-rw-r--r--fs/ncpfs/inode.c2
-rw-r--r--fs/nfs/client.c6
-rw-r--r--fs/nfs/inode.c2
-rw-r--r--fs/nfs/write.c11
-rw-r--r--fs/nfsd/vfs.c19
-rw-r--r--fs/nls/Kconfig50
-rw-r--r--fs/nls/nls_ascii.c12
-rw-r--r--fs/nls/nls_base.c18
-rw-r--r--fs/nls/nls_cp1250.c20
-rw-r--r--fs/nls/nls_cp1251.c18
-rw-r--r--fs/nls/nls_cp1255.c22
-rw-r--r--fs/nls/nls_cp437.c24
-rw-r--r--fs/nls/nls_cp737.c20
-rw-r--r--fs/nls/nls_cp775.c20
-rw-r--r--fs/nls/nls_cp850.c18
-rw-r--r--fs/nls/nls_cp852.c18
-rw-r--r--fs/nls/nls_cp855.c18
-rw-r--r--fs/nls/nls_cp857.c16
-rw-r--r--fs/nls/nls_cp860.c22
-rw-r--r--fs/nls/nls_cp861.c24
-rw-r--r--fs/nls/nls_cp862.c26
-rw-r--r--fs/nls/nls_cp863.c24
-rw-r--r--fs/nls/nls_cp864.c22
-rw-r--r--fs/nls/nls_cp865.c24
-rw-r--r--fs/nls/nls_cp866.c20
-rw-r--r--fs/nls/nls_cp869.c18
-rw-r--r--fs/nls/nls_cp874.c16
-rw-r--r--fs/nls/nls_cp932.c300
-rw-r--r--fs/nls/nls_cp936.c470
-rw-r--r--fs/nls/nls_cp949.c552
-rw-r--r--fs/nls/nls_cp950.c384
-rw-r--r--fs/nls/nls_euc-jp.c4
-rw-r--r--fs/nls/nls_iso8859-1.c12
-rw-r--r--fs/nls/nls_iso8859-13.c16
-rw-r--r--fs/nls/nls_iso8859-14.c16
-rw-r--r--fs/nls/nls_iso8859-15.c16
-rw-r--r--fs/nls/nls_iso8859-2.c16
-rw-r--r--fs/nls/nls_iso8859-3.c16
-rw-r--r--fs/nls/nls_iso8859-4.c16
-rw-r--r--fs/nls/nls_iso8859-5.c16
-rw-r--r--fs/nls/nls_iso8859-6.c14
-rw-r--r--fs/nls/nls_iso8859-7.c18
-rw-r--r--fs/nls/nls_iso8859-9.c14
-rw-r--r--fs/nls/nls_koi8-r.c20
-rw-r--r--fs/nls/nls_koi8-u.c20
-rw-r--r--fs/ntfs/file.c2
-rw-r--r--fs/ntfs/super.c7
-rw-r--r--fs/ocfs2/dir.c10
-rw-r--r--fs/ocfs2/dlm/dlmfs.c14
-rw-r--r--fs/ocfs2/super.c4
-rw-r--r--fs/open.c5
-rw-r--r--fs/openpromfs/inode.c2
-rw-r--r--fs/proc/base.c99
-rw-r--r--fs/proc/inode.c6
-rw-r--r--fs/proc/mmu.c21
-rw-r--r--fs/proc/proc_misc.c3
-rw-r--r--fs/qnx4/inode.c3
-rw-r--r--fs/ramfs/Makefile2
-rw-r--r--fs/ramfs/inode.c12
-rw-r--r--fs/reiserfs/bitmap.c57
-rw-r--r--fs/reiserfs/dir.c10
-rw-r--r--fs/reiserfs/inode.c4
-rw-r--r--fs/reiserfs/journal.c145
-rw-r--r--fs/reiserfs/super.c20
-rw-r--r--fs/romfs/inode.c6
-rw-r--r--fs/select.c133
-rw-r--r--fs/signalfd.c44
-rw-r--r--fs/smbfs/inode.c2
-rw-r--r--fs/splice.c13
-rw-r--r--fs/super.c1
-rw-r--r--fs/sysfs/dir.c7
-rw-r--r--fs/sysfs/inode.c5
-rw-r--r--fs/sysfs/mount.c4
-rw-r--r--fs/sysfs/sysfs.h1
-rw-r--r--fs/sysv/inode.c2
-rw-r--r--fs/udf/balloc.c2
-rw-r--r--fs/udf/super.c53
-rw-r--r--fs/udf/udftime.c8
-rw-r--r--fs/ufs/balloc.c1
-rw-r--r--fs/ufs/cylinder.c1
-rw-r--r--fs/ufs/dir.c1
-rw-r--r--fs/ufs/file.c3
-rw-r--r--fs/ufs/ialloc.c1
-rw-r--r--fs/ufs/inode.c1
-rw-r--r--fs/ufs/namei.c3
-rw-r--r--fs/ufs/super.c98
-rw-r--r--fs/ufs/symlink.c2
-rw-r--r--fs/ufs/truncate.c1
-rw-r--r--fs/ufs/ufs.h157
-rw-r--r--fs/ufs/util.c1
-rw-r--r--fs/ufs/util.h50
-rw-r--r--fs/utimes.c13
-rw-r--r--fs/xfs/Makefile-linux-2.63
-rw-r--r--fs/xfs/linux-2.6/kmem.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c62
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c26
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c20
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c174
-rw-r--r--fs/xfs/linux-2.6/xfs_fs_subr.c54
-rw-r--r--fs/xfs/linux-2.6/xfs_fs_subr.h4
-rw-r--r--fs/xfs/linux-2.6/xfs_globals.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_globals.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c242
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c8
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c200
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.h8
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h3
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c104
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h23
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c301
-rw-r--r--fs/xfs/linux-2.6/xfs_super.h5
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.c327
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.h168
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c100
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h345
-rw-r--r--fs/xfs/quota/xfs_qm.c51
-rw-r--r--fs/xfs/quota/xfs_qm.h6
-rw-r--r--fs/xfs/quota/xfs_qm_bhv.c239
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c21
-rw-r--r--fs/xfs/support/move.c51
-rw-r--r--fs/xfs/support/move.h70
-rw-r--r--fs/xfs/xfs_acl.c33
-rw-r--r--fs/xfs/xfs_acl.h19
-rw-r--r--fs/xfs/xfs_ag.h4
-rw-r--r--fs/xfs/xfs_attr.c50
-rw-r--r--fs/xfs/xfs_attr.h17
-rw-r--r--fs/xfs/xfs_behavior.c183
-rw-r--r--fs/xfs/xfs_behavior.h185
-rw-r--r--fs/xfs/xfs_bmap.c150
-rw-r--r--fs/xfs/xfs_bmap.h4
-rw-r--r--fs/xfs/xfs_bmap_btree.c255
-rw-r--r--fs/xfs/xfs_bmap_btree.h68
-rw-r--r--fs/xfs/xfs_buf_item.c1
-rw-r--r--fs/xfs/xfs_clnt.h1
-rw-r--r--fs/xfs/xfs_dfrag.c6
-rw-r--r--fs/xfs/xfs_dinode.h65
-rw-r--r--fs/xfs/xfs_dir2.c117
-rw-r--r--fs/xfs/xfs_dir2.h17
-rw-r--r--fs/xfs/xfs_dir2_block.c64
-rw-r--r--fs/xfs/xfs_dir2_block.h5
-rw-r--r--fs/xfs/xfs_dir2_data.c1
-rw-r--r--fs/xfs/xfs_dir2_leaf.c76
-rw-r--r--fs/xfs/xfs_dir2_leaf.h6
-rw-r--r--fs/xfs/xfs_dir2_node.c1
-rw-r--r--fs/xfs/xfs_dir2_sf.c122
-rw-r--r--fs/xfs/xfs_dir2_sf.h5
-rw-r--r--fs/xfs/xfs_dmapi.h17
-rw-r--r--fs/xfs/xfs_dmops.c43
-rw-r--r--fs/xfs/xfs_error.c21
-rw-r--r--fs/xfs/xfs_error.h5
-rw-r--r--fs/xfs/xfs_extfree_item.c1
-rw-r--r--fs/xfs/xfs_fsops.c17
-rw-r--r--fs/xfs/xfs_ialloc.c6
-rw-r--r--fs/xfs/xfs_ialloc.h7
-rw-r--r--fs/xfs/xfs_iget.c605
-rw-r--r--fs/xfs/xfs_inode.c383
-rw-r--r--fs/xfs/xfs_inode.h158
-rw-r--r--fs/xfs/xfs_iocore.c4
-rw-r--r--fs/xfs/xfs_iomap.c8
-rw-r--r--fs/xfs/xfs_iomap.h1
-rw-r--r--fs/xfs/xfs_itable.c78
-rw-r--r--fs/xfs/xfs_log.c100
-rw-r--r--fs/xfs/xfs_log_priv.h21
-rw-r--r--fs/xfs/xfs_log_recover.c32
-rw-r--r--fs/xfs/xfs_mount.c242
-rw-r--r--fs/xfs/xfs_mount.h176
-rw-r--r--fs/xfs/xfs_qmops.c40
-rw-r--r--fs/xfs/xfs_quota.h10
-rw-r--r--fs/xfs/xfs_rename.c38
-rw-r--r--fs/xfs/xfs_rw.c5
-rw-r--r--fs/xfs/xfs_rw.h34
-rw-r--r--fs/xfs/xfs_sb.h68
-rw-r--r--fs/xfs/xfs_trans.c76
-rw-r--r--fs/xfs/xfs_trans_ail.c1
-rw-r--r--fs/xfs/xfs_trans_extfree.c1
-rw-r--r--fs/xfs/xfs_types.h12
-rw-r--r--fs/xfs/xfs_utils.c9
-rw-r--r--fs/xfs/xfs_utils.h6
-rw-r--r--fs/xfs/xfs_vfsops.c351
-rw-r--r--fs/xfs/xfs_vfsops.h28
-rw-r--r--fs/xfs/xfs_vnodeops.c745
-rw-r--r--fs/xfs/xfs_vnodeops.h86
-rw-r--r--include/Kbuild1
-rw-r--r--include/asm-alpha/elf.h1
-rw-r--r--include/asm-alpha/floppy.h2
-rw-r--r--include/asm-alpha/io.h6
-rw-r--r--include/asm-alpha/semaphore.h1
-rw-r--r--include/asm-alpha/system.h1
-rw-r--r--include/asm-arm/floppy.h2
-rw-r--r--include/asm-arm/ipc.h1
-rw-r--r--include/asm-arm/semaphore.h1
-rw-r--r--include/asm-arm/types.h6
-rw-r--r--include/asm-arm26/irq_regs.h1
-rw-r--r--include/asm-avr32/io.h7
-rw-r--r--include/asm-avr32/semaphore.h1
-rw-r--r--include/asm-avr32/types.h6
-rw-r--r--include/asm-blackfin/io.h4
-rw-r--r--include/asm-blackfin/ipc.h1
-rw-r--r--include/asm-blackfin/semaphore.h1
-rw-r--r--include/asm-blackfin/types.h6
-rw-r--r--include/asm-cris/ipc.h1
-rw-r--r--include/asm-cris/irq_regs.h1
-rw-r--r--include/asm-cris/semaphore.h1
-rw-r--r--include/asm-cris/types.h6
-rw-r--r--include/asm-frv/ipc.h1
-rw-r--r--include/asm-frv/semaphore.h1
-rw-r--r--include/asm-frv/types.h6
-rw-r--r--include/asm-generic/Kbuild1
-rw-r--r--include/asm-generic/Kbuild.asm1
-rw-r--r--include/asm-generic/ipc.h31
-rw-r--r--include/asm-h8300/io.h6
-rw-r--r--include/asm-h8300/ipc.h1
-rw-r--r--include/asm-h8300/semaphore.h1
-rw-r--r--include/asm-h8300/types.h6
-rw-r--r--include/asm-ia64/elf.h1
-rw-r--r--include/asm-ia64/io.h4
-rw-r--r--include/asm-ia64/numa.h1
-rw-r--r--include/asm-ia64/semaphore.h1
-rw-r--r--include/asm-ia64/system.h2
-rw-r--r--include/asm-m32r/ipc.h1
-rw-r--r--include/asm-m32r/semaphore.h1
-rw-r--r--include/asm-m32r/types.h6
-rw-r--r--include/asm-m68k/floppy.h3
-rw-r--r--include/asm-m68k/io.h6
-rw-r--r--include/asm-m68k/ipc.h1
-rw-r--r--include/asm-m68k/semaphore.h1
-rw-r--r--include/asm-m68k/types.h6
-rw-r--r--include/asm-m68knommu/io.h6
-rw-r--r--include/asm-m68knommu/ipc.h1
-rw-r--r--include/asm-m68knommu/semaphore.h1
-rw-r--r--include/asm-mips/floppy.h2
-rw-r--r--include/asm-mips/io.h2
-rw-r--r--include/asm-mips/ipc.h1
-rw-r--r--include/asm-mips/semaphore.h1
-rw-r--r--include/asm-mips/types.h6
-rw-r--r--include/asm-parisc/floppy.h4
-rw-r--r--include/asm-parisc/io.h5
-rw-r--r--include/asm-parisc/semaphore.h1
-rw-r--r--include/asm-parisc/types.h6
-rw-r--r--include/asm-powerpc/Kbuild2
-rw-r--r--include/asm-powerpc/elf.h47
-rw-r--r--include/asm-powerpc/floppy.h2
-rw-r--r--include/asm-powerpc/io.h17
-rw-r--r--include/asm-powerpc/ipc.h1
-rw-r--r--include/asm-powerpc/semaphore.h1
-rw-r--r--include/asm-powerpc/system.h1
-rw-r--r--include/asm-powerpc/types.h6
-rw-r--r--include/asm-ppc/floppy.h2
-rw-r--r--include/asm-ppc/io.h17
-rw-r--r--include/asm-ppc/irq_regs.h1
-rw-r--r--include/asm-s390/ipc.h1
-rw-r--r--include/asm-s390/semaphore.h1
-rw-r--r--include/asm-s390/types.h6
-rw-r--r--include/asm-sh/elf.h1
-rw-r--r--include/asm-sh/floppy.h6
-rw-r--r--include/asm-sh/io.h25
-rw-r--r--include/asm-sh/ipc.h1
-rw-r--r--include/asm-sh/semaphore.h1
-rw-r--r--include/asm-sh/system.h1
-rw-r--r--include/asm-sh/types.h6
-rw-r--r--include/asm-sh64/dma-mapping.h6
-rw-r--r--include/asm-sh64/io.h48
-rw-r--r--include/asm-sh64/ipc.h1
-rw-r--r--include/asm-sh64/semaphore.h1
-rw-r--r--include/asm-sh64/types.h6
-rw-r--r--include/asm-sparc/floppy.h2
-rw-r--r--include/asm-sparc/io.h7
-rw-r--r--include/asm-sparc/ipc.h1
-rw-r--r--include/asm-sparc/semaphore.h1
-rw-r--r--include/asm-sparc64/Kbuild1
-rw-r--r--include/asm-sparc64/floppy.h4
-rw-r--r--include/asm-sparc64/io.h6
-rw-r--r--include/asm-sparc64/ipc.h1
-rw-r--r--include/asm-sparc64/semaphore.h1
-rw-r--r--include/asm-sparc64/shmparam.h2
-rw-r--r--include/asm-um/ipc.h1
-rw-r--r--include/asm-v850/ipc.h1
-rw-r--r--include/asm-v850/irq_regs.h1
-rw-r--r--include/asm-v850/semaphore.h1
-rw-r--r--include/asm-v850/types.h6
-rw-r--r--include/asm-x86/Kbuild1
-rw-r--r--include/asm-x86/bootparam.h3
-rw-r--r--include/asm-x86/bootsetup.h40
-rw-r--r--include/asm-x86/elf_32.h2
-rw-r--r--include/asm-x86/floppy_32.h4
-rw-r--r--include/asm-x86/floppy_64.h4
-rw-r--r--include/asm-x86/io_32.h11
-rw-r--r--include/asm-x86/io_64.h6
-rw-r--r--include/asm-x86/ipc.h1
-rw-r--r--include/asm-x86/pgtable_32.h2
-rw-r--r--include/asm-x86/semaphore_32.h1
-rw-r--r--include/asm-x86/semaphore_64.h1
-rw-r--r--include/asm-x86/setup_32.h29
-rw-r--r--include/asm-x86/setup_64.h13
-rw-r--r--include/asm-x86/system_32.h1
-rw-r--r--include/asm-x86/types_32.h6
-rw-r--r--include/asm-xtensa/semaphore.h1
-rw-r--r--include/asm-xtensa/types.h6
-rw-r--r--include/keys/rxrpc-type.h2
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/atmel-ssc.h312
-rw-r--r--include/linux/auxvec.h4
-rw-r--r--include/linux/backing-dev.h94
-rw-r--r--include/linux/binfmts.h9
-rw-r--r--include/linux/capability.h48
-rw-r--r--include/linux/compiler-gcc.h4
-rw-r--r--include/linux/compiler-gcc3.h4
-rw-r--r--include/linux/compiler-gcc4.h4
-rw-r--r--include/linux/compiler-intel.h4
-rw-r--r--include/linux/consolemap.h1
-rw-r--r--include/linux/cpuset.h6
-rw-r--r--include/linux/cramfs_fs.h1
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/elfcore-compat.h55
-rw-r--r--include/linux/ext2_fs.h23
-rw-r--r--include/linux/ext2_fs_sb.h51
-rw-r--r--include/linux/ext3_fs.h14
-rw-r--r--include/linux/ext3_fs_sb.h1
-rw-r--r--include/linux/ext4_fs_sb.h1
-rw-r--r--include/linux/fcntl.h15
-rw-r--r--include/linux/file.h9
-rw-r--r--include/linux/fs.h85
-rw-r--r--include/linux/if_fddi.h2
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/interrupt.h22
-rw-r--r--include/linux/ipc.h28
-rw-r--r--include/linux/kbd_diacr.h2
-rw-r--r--include/linux/kd.h10
-rw-r--r--include/linux/kernel.h35
-rw-r--r--include/linux/kexec.h33
-rw-r--r--include/linux/key-type.h112
-rw-r--r--include/linux/key.h99
-rw-r--r--include/linux/list.h12
-rw-r--r--include/linux/log2.h25
-rw-r--r--include/linux/magic.h3
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/mm_types.h7
-rw-r--r--include/linux/mmzone.h42
-rw-r--r--include/linux/module.h18
-rw-r--r--include/linux/moduleparam.h18
-rw-r--r--include/linux/mutex.h3
-rw-r--r--include/linux/namei.h4
-rw-r--r--include/linux/nbd.h2
-rw-r--r--include/linux/nls.h8
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/oom.h26
-rw-r--r--include/linux/percpu_counter.h55
-rw-r--r--include/linux/pnp.h6
-rw-r--r--include/linux/profile.h3
-rw-r--r--include/linux/proportions.h119
-rw-r--r--include/linux/quota.h31
-rw-r--r--include/linux/raid/bitmap.h2
-rw-r--r--include/linux/rcupdate.h14
-rw-r--r--include/linux/reiserfs_fs.h7
-rw-r--r--include/linux/sched.h34
-rw-r--r--include/linux/screen_info.h9
-rw-r--r--include/linux/security.h1237
-rw-r--r--include/linux/seq_file.h2
-rw-r--r--include/linux/shm.h2
-rw-r--r--include/linux/signalfd.h32
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/slub_def.h2
-rw-r--r--include/linux/swap.h5
-rw-r--r--include/linux/time.h2
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/ufs_fs.h179
-rw-r--r--include/linux/ufs_fs_i.h33
-rw-r--r--include/linux/ufs_fs_sb.h37
-rw-r--r--include/linux/vt_kern.h1
-rw-r--r--include/linux/writeback.h13
-rw-r--r--include/scsi/Kbuild4
-rw-r--r--init/Kconfig3
-rw-r--r--ipc/ipc_sysctl.c4
-rw-r--r--ipc/mqueue.c2
-rw-r--r--ipc/shm.c18
-rw-r--r--kernel/Kconfig.preempt3
-rw-r--r--kernel/auditsc.c1
-rw-r--r--kernel/capability.c4
-rw-r--r--kernel/cpuset.c43
-rw-r--r--kernel/exit.c116
-rw-r--r--kernel/fork.c18
-rw-r--r--kernel/futex.c3
-rw-r--r--kernel/irq/chip.c3
-rw-r--r--kernel/irq/manage.c31
-rw-r--r--kernel/kexec.c113
-rw-r--r--kernel/ksysfs.c10
-rw-r--r--kernel/module.c130
-rw-r--r--kernel/nsproxy.c3
-rw-r--r--kernel/params.c17
-rw-r--r--kernel/posix-timers.c3
-rw-r--r--kernel/printk.c52
-rw-r--r--kernel/profile.c2
-rw-r--r--kernel/rcupdate.c1
-rw-r--r--kernel/rcutorture.c10
-rw-r--r--kernel/rtmutex-debug.c7
-rw-r--r--kernel/sched.c26
-rw-r--r--kernel/signal.c24
-rw-r--r--kernel/softlockup.c54
-rw-r--r--kernel/sys_ni.c4
-rw-r--r--kernel/sysctl.c44
-rw-r--r--kernel/taskstats.c1
-rw-r--r--kernel/time.c1
-rw-r--r--kernel/time/tick-broadcast.c17
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--kernel/time/timekeeping.c5
-rw-r--r--kernel/user.c12
-rw-r--r--lib/Makefile3
-rw-r--r--lib/argv_split.c4
-rw-r--r--lib/bust_spinlocks.c6
-rw-r--r--lib/idr.c3
-rw-r--r--lib/iomap.c2
-rw-r--r--lib/ioremap.c1
-rw-r--r--lib/percpu_counter.c48
-rw-r--r--lib/proportions.c384
-rw-r--r--lib/radix-tree.c16
-rw-r--r--lib/sort.c2
-rw-r--r--mm/backing-dev.c47
-rw-r--r--mm/filemap.c15
-rw-r--r--mm/fremap.c26
-rw-r--r--mm/mmap.c3
-rw-r--r--mm/nommu.c1
-rw-r--r--mm/oom_kill.c107
-rw-r--r--mm/page-writeback.c300
-rw-r--r--mm/page_alloc.c23
-rw-r--r--mm/readahead.c6
-rw-r--r--mm/rmap.c4
-rw-r--r--mm/shmem.c20
-rw-r--r--mm/slab.c14
-rw-r--r--mm/slob.c6
-rw-r--r--mm/slub.c30
-rw-r--r--mm/swap.c5
-rw-r--r--mm/tiny-shmem.c19
-rw-r--r--mm/truncate.c3
-rw-r--r--mm/vmscan.c40
-rw-r--r--mm/vmstat.c2
-rw-r--r--net/rxrpc/af_rxrpc.c1
-rw-r--r--net/rxrpc/ar-key.c32
-rw-r--r--net/sctp/protocol.c1
-rw-r--r--net/socket.c20
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rwxr-xr-xscripts/checkpatch.pl254
-rwxr-xr-xscripts/checkstack.pl3
-rwxr-xr-xscripts/kernel-doc41
-rw-r--r--security/Kconfig16
-rw-r--r--security/capability.c30
-rw-r--r--security/commoncap.c260
-rw-r--r--security/dummy.c25
-rw-r--r--security/inode.c8
-rw-r--r--security/keys/internal.h35
-rw-r--r--security/keys/key.c34
-rw-r--r--security/keys/process_keys.c16
-rw-r--r--security/keys/request_key.c556
-rw-r--r--security/keys/request_key_auth.c11
-rw-r--r--security/root_plug.c31
-rw-r--r--security/security.c1012
-rw-r--r--security/selinux/hooks.c96
-rw-r--r--security/selinux/xfrm.c1
764 files changed, 16571 insertions, 14509 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index cc10ce7dc339..299615d821ac 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -22,6 +22,8 @@ CodingStyle
22 - how the boss likes the C code in the kernel to look. 22 - how the boss likes the C code in the kernel to look.
23DMA-API.txt 23DMA-API.txt
24 - DMA API, pci_ API & extensions for non-consistent memory machines. 24 - DMA API, pci_ API & extensions for non-consistent memory machines.
25DMA-ISA-LPC.txt
26 - How to do DMA with ISA (and LPC) devices.
25DMA-mapping.txt 27DMA-mapping.txt
26 - info for PCI drivers using DMA portably across all platforms. 28 - info for PCI drivers using DMA portably across all platforms.
27DocBook/ 29DocBook/
@@ -50,6 +52,8 @@ README.cycladesZ
50 - info on Cyclades-Z firmware loading. 52 - info on Cyclades-Z firmware loading.
51SAK.txt 53SAK.txt
52 - info on Secure Attention Keys. 54 - info on Secure Attention Keys.
55SM501.txt
56 - Silicon Motion SM501 multimedia companion chip
53SecurityBugs 57SecurityBugs
54 - procedure for reporting security bugs found in the kernel. 58 - procedure for reporting security bugs found in the kernel.
55SubmitChecklist 59SubmitChecklist
@@ -244,6 +248,8 @@ md.txt
244 - info on boot arguments for the multiple devices driver. 248 - info on boot arguments for the multiple devices driver.
245memory-barriers.txt 249memory-barriers.txt
246 - info on Linux kernel memory barriers. 250 - info on Linux kernel memory barriers.
251memory-hotplug.txt
252 - Hotpluggable memory support, how to use and current status.
247memory.txt 253memory.txt
248 - info on typical Linux memory problems. 254 - info on typical Linux memory problems.
249mips/ 255mips/
@@ -294,6 +300,8 @@ pm.txt
294 - info on Linux power management support. 300 - info on Linux power management support.
295pnp.txt 301pnp.txt
296 - Linux Plug and Play documentation. 302 - Linux Plug and Play documentation.
303power_supply_class.txt
304 - Tells userspace about battery, UPS, AC or DC power supply properties
297power/ 305power/
298 - directory with info on Linux PCI power management. 306 - directory with info on Linux PCI power management.
299powerpc/ 307powerpc/
@@ -330,8 +338,12 @@ sched-coding.txt
330 - reference for various scheduler-related methods in the O(1) scheduler. 338 - reference for various scheduler-related methods in the O(1) scheduler.
331sched-design.txt 339sched-design.txt
332 - goals, design and implementation of the Linux O(1) scheduler. 340 - goals, design and implementation of the Linux O(1) scheduler.
341sched-design-CFS.txt
342 - goals, design and implementation of the Complete Fair Scheduler.
333sched-domains.txt 343sched-domains.txt
334 - information on scheduling domains. 344 - information on scheduling domains.
345sched-nice-design.txt
346 - How and why the scheduler's nice levels are implemented.
335sched-stats.txt 347sched-stats.txt
336 - information on schedstats (Linux Scheduler Statistics). 348 - information on schedstats (Linux Scheduler Statistics).
337scsi/ 349scsi/
@@ -376,6 +388,8 @@ stallion.txt
376 - info on using the Stallion multiport serial driver. 388 - info on using the Stallion multiport serial driver.
377svga.txt 389svga.txt
378 - short guide on selecting video modes at boot via VGA BIOS. 390 - short guide on selecting video modes at boot via VGA BIOS.
391sysfs-rules.txt
392 - How not to use sysfs.
379sx.txt 393sx.txt
380 - info on the Specialix SX/SI multiport serial driver. 394 - info on the Specialix SX/SI multiport serial driver.
381sysctl/ 395sysctl/
@@ -406,6 +420,8 @@ video4linux/
406 - directory with info regarding video/TV/radio cards and linux. 420 - directory with info regarding video/TV/radio cards and linux.
407vm/ 421vm/
408 - directory with info on the Linux vm code. 422 - directory with info on the Linux vm code.
423volatile-considered-harmful.txt
424 - Why the "volatile" type class should not be used
409voyager.txt 425voyager.txt
410 - guide to running Linux on the Voyager architecture. 426 - guide to running Linux on the Voyager architecture.
411w1/ 427w1/
@@ -414,7 +430,5 @@ watchdog/
414 - how to auto-reboot Linux if it has "fallen and can't get up". ;-) 430 - how to auto-reboot Linux if it has "fallen and can't get up". ;-)
415x86_64/ 431x86_64/
416 - directory with info on Linux support for AMD x86-64 (Hammer) machines. 432 - directory with info on Linux support for AMD x86-64 (Hammer) machines.
417xterm-linux.xpm
418 - XPM image of penguin logo (see logo.txt) sitting on an xterm.
419zorro.txt 433zorro.txt
420 - info on writing drivers for Zorro bus devices found on Amigas. 434 - info on writing drivers for Zorro bus devices found on Amigas.
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 7f1730f1a1ae..6caa14615578 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -77,12 +77,15 @@ Get a decent editor and don't leave whitespace at the end of lines.
77Coding style is all about readability and maintainability using commonly 77Coding style is all about readability and maintainability using commonly
78available tools. 78available tools.
79 79
80The limit on the length of lines is 80 columns and this is a hard limit. 80The limit on the length of lines is 80 columns and this is a strongly
81preferred limit.
81 82
82Statements longer than 80 columns will be broken into sensible chunks. 83Statements longer than 80 columns will be broken into sensible chunks.
83Descendants are always substantially shorter than the parent and are placed 84Descendants are always substantially shorter than the parent and are placed
84substantially to the right. The same applies to function headers with a long 85substantially to the right. The same applies to function headers with a long
85argument list. Long strings are as well broken into shorter strings. 86argument list. Long strings are as well broken into shorter strings. The
87only exception to this is where exceeding 80 columns significantly increases
88readability and does not hide information.
86 89
87void fun(int a, int b, int c) 90void fun(int a, int b, int c)
88{ 91{
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index 3c8ae020b6a7..d84f89dbf921 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -189,12 +189,6 @@ smaller mask as pci_set_dma_mask(). However for the rare case that a
189device driver only uses consistent allocations, one would have to 189device driver only uses consistent allocations, one would have to
190check the return value from pci_set_consistent_dma_mask(). 190check the return value from pci_set_consistent_dma_mask().
191 191
192If your 64-bit device is going to be an enormous consumer of DMA
193mappings, this can be problematic since the DMA mappings are a
194finite resource on many platforms. Please see the "DAC Addressing
195for Address Space Hungry Devices" section near the end of this
196document for how to handle this case.
197
198Finally, if your device can only drive the low 24-bits of 192Finally, if your device can only drive the low 24-bits of
199address during PCI bus mastering you might do something like: 193address during PCI bus mastering you might do something like:
200 194
@@ -203,8 +197,6 @@ address during PCI bus mastering you might do something like:
203 "mydev: 24-bit DMA addressing not available.\n"); 197 "mydev: 24-bit DMA addressing not available.\n");
204 goto ignore_this_device; 198 goto ignore_this_device;
205 } 199 }
206[Better use DMA_24BIT_MASK instead of 0x00ffffff.
207See linux/include/dma-mapping.h for reference.]
208 200
209When pci_set_dma_mask() is successful, and returns zero, the PCI layer 201When pci_set_dma_mask() is successful, and returns zero, the PCI layer
210saves away this mask you have provided. The PCI layer will use this 202saves 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
652they are entirely deprecated. Some ports already do not provide these 644they are entirely deprecated. Some ports already do not provide these
653as it is impossible to correctly support them. 645as it is impossible to correctly support them.
654 646
655 64-bit DMA and DAC cycle support
656
657Do you understand all of the text above? Great, then you already
658know how to use 64-bit DMA addressing under Linux. Simply make
659the appropriate pci_set_dma_mask() calls based upon your cards
660capabilities, then use the mapping APIs above.
661
662It is that simple.
663
664Well, not for some odd devices. See the next section for information
665about that.
666
667 Optimizing Unmap State Space Consumption 647 Optimizing Unmap State Space Consumption
668 648
669On many platforms, pci_unmap_{single,page}() is simply a nop. 649On many platforms, pci_unmap_{single,page}() is simply a nop.
diff --git a/Documentation/DocBook/deviceiobook.tmpl b/Documentation/DocBook/deviceiobook.tmpl
index 361c884d860d..9ee6f3cbb414 100644
--- a/Documentation/DocBook/deviceiobook.tmpl
+++ b/Documentation/DocBook/deviceiobook.tmpl
@@ -85,7 +85,7 @@
85 85
86 <chapter id="mmio"> 86 <chapter id="mmio">
87 <title>Memory Mapped IO</title> 87 <title>Memory Mapped IO</title>
88 <sect1> 88 <sect1 id="getting_access_to_the_device">
89 <title>Getting Access to the Device</title> 89 <title>Getting Access to the Device</title>
90 <para> 90 <para>
91 The most widely supported form of IO is memory mapped IO. 91 The most widely supported form of IO is memory mapped IO.
@@ -114,7 +114,7 @@
114 </para> 114 </para>
115 </sect1> 115 </sect1>
116 116
117 <sect1> 117 <sect1 id="accessing_the_device">
118 <title>Accessing the device</title> 118 <title>Accessing the device</title>
119 <para> 119 <para>
120 The part of the interface most used by drivers is reading and 120 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)
272 272
273 </chapter> 273 </chapter>
274 274
275 <chapter> 275 <chapter id="port_space_accesses">
276 <title>Port Space Accesses</title> 276 <title>Port Space Accesses</title>
277 <sect1> 277 <sect1 id="port_space_explained">
278 <title>Port Space Explained</title> 278 <title>Port Space Explained</title>
279 279
280 <para> 280 <para>
@@ -291,7 +291,7 @@ CPU B: spin_unlock_irqrestore(&amp;dev_lock, flags)
291 </para> 291 </para>
292 292
293 </sect1> 293 </sect1>
294 <sect1> 294 <sect1 id="accessing_port_space">
295 <title>Accessing Port Space</title> 295 <title>Accessing Port Space</title>
296 <para> 296 <para>
297 Accesses to this space are provided through a set of functions 297 Accesses to this space are provided through a set of functions
diff --git a/Documentation/DocBook/filesystems.tmpl b/Documentation/DocBook/filesystems.tmpl
index 39fa2aba7f9b..5eaef87e8f1b 100644
--- a/Documentation/DocBook/filesystems.tmpl
+++ b/Documentation/DocBook/filesystems.tmpl
@@ -40,25 +40,25 @@
40 40
41 <chapter id="vfs"> 41 <chapter id="vfs">
42 <title>The Linux VFS</title> 42 <title>The Linux VFS</title>
43 <sect1><title>The Filesystem types</title> 43 <sect1 id="the_filesystem_types"><title>The Filesystem types</title>
44!Iinclude/linux/fs.h 44!Iinclude/linux/fs.h
45 </sect1> 45 </sect1>
46 <sect1><title>The Directory Cache</title> 46 <sect1 id="the_directory_cache"><title>The Directory Cache</title>
47!Efs/dcache.c 47!Efs/dcache.c
48!Iinclude/linux/dcache.h 48!Iinclude/linux/dcache.h
49 </sect1> 49 </sect1>
50 <sect1><title>Inode Handling</title> 50 <sect1 id="inode_handling"><title>Inode Handling</title>
51!Efs/inode.c 51!Efs/inode.c
52!Efs/bad_inode.c 52!Efs/bad_inode.c
53 </sect1> 53 </sect1>
54 <sect1><title>Registration and Superblocks</title> 54 <sect1 id="registration_and_superblocks"><title>Registration and Superblocks</title>
55!Efs/super.c 55!Efs/super.c
56 </sect1> 56 </sect1>
57 <sect1><title>File Locks</title> 57 <sect1 id="file_locks"><title>File Locks</title>
58!Efs/locks.c 58!Efs/locks.c
59!Ifs/locks.c 59!Ifs/locks.c
60 </sect1> 60 </sect1>
61 <sect1><title>Other Functions</title> 61 <sect1 id="other_functions"><title>Other Functions</title>
62!Efs/mpage.c 62!Efs/mpage.c
63!Efs/namei.c 63!Efs/namei.c
64!Efs/buffer.c 64!Efs/buffer.c
@@ -73,11 +73,11 @@
73 <chapter id="proc"> 73 <chapter id="proc">
74 <title>The proc filesystem</title> 74 <title>The proc filesystem</title>
75 75
76 <sect1><title>sysctl interface</title> 76 <sect1 id="sysctl_interface"><title>sysctl interface</title>
77!Ekernel/sysctl.c 77!Ekernel/sysctl.c
78 </sect1> 78 </sect1>
79 79
80 <sect1><title>proc filesystem interface</title> 80 <sect1 id="proc_filesystem_interface"><title>proc filesystem interface</title>
81!Ifs/proc/base.c 81!Ifs/proc/base.c
82 </sect1> 82 </sect1>
83 </chapter> 83 </chapter>
@@ -92,7 +92,7 @@
92 <chapter id="debugfs"> 92 <chapter id="debugfs">
93 <title>The debugfs filesystem</title> 93 <title>The debugfs filesystem</title>
94 94
95 <sect1><title>debugfs interface</title> 95 <sect1 id="debugfs_interface"><title>debugfs interface</title>
96!Efs/debugfs/inode.c 96!Efs/debugfs/inode.c
97!Efs/debugfs/file.c 97!Efs/debugfs/file.c
98 </sect1> 98 </sect1>
@@ -134,9 +134,9 @@
134 134
135 <title>The Linux Journalling API</title> 135 <title>The Linux Journalling API</title>
136 136
137 <sect1> 137 <sect1 id="journaling_overview">
138 <title>Overview</title> 138 <title>Overview</title>
139 <sect2> 139 <sect2 id="journaling_details">
140 <title>Details</title> 140 <title>Details</title>
141<para> 141<para>
142The journalling layer is easy to use. You need to 142The journalling layer is easy to use. You need to
@@ -307,7 +307,7 @@ particular inode.
307 307
308 </sect2> 308 </sect2>
309 309
310 <sect2> 310 <sect2 id="jbd_summary">
311 <title>Summary</title> 311 <title>Summary</title>
312<para> 312<para>
313Using the journal is a matter of wrapping the different context changes, 313Using the journal is a matter of wrapping the different context changes,
@@ -349,7 +349,7 @@ an example.
349 349
350 </sect1> 350 </sect1>
351 351
352 <sect1> 352 <sect1 id="data_types">
353 <title>Data Types</title> 353 <title>Data Types</title>
354 <para> 354 <para>
355 The journalling layer uses typedefs to 'hide' the concrete definitions 355 The journalling layer uses typedefs to 'hide' the concrete definitions
@@ -358,27 +358,27 @@ an example.
358 358
359 Obviously the hiding is not enforced as this is 'C'. 359 Obviously the hiding is not enforced as this is 'C'.
360 </para> 360 </para>
361 <sect2><title>Structures</title> 361 <sect2 id="structures"><title>Structures</title>
362!Iinclude/linux/jbd.h 362!Iinclude/linux/jbd.h
363 </sect2> 363 </sect2>
364 </sect1> 364 </sect1>
365 365
366 <sect1> 366 <sect1 id="functions">
367 <title>Functions</title> 367 <title>Functions</title>
368 <para> 368 <para>
369 The functions here are split into two groups those that 369 The functions here are split into two groups those that
370 affect a journal as a whole, and those which are used to 370 affect a journal as a whole, and those which are used to
371 manage transactions 371 manage transactions
372 </para> 372 </para>
373 <sect2><title>Journal Level</title> 373 <sect2 id="journal_level"><title>Journal Level</title>
374!Efs/jbd/journal.c 374!Efs/jbd/journal.c
375!Ifs/jbd/recovery.c 375!Ifs/jbd/recovery.c
376 </sect2> 376 </sect2>
377 <sect2><title>Transasction Level</title> 377 <sect2 id="transaction_level"><title>Transasction Level</title>
378!Efs/jbd/transaction.c 378!Efs/jbd/transaction.c
379 </sect2> 379 </sect2>
380 </sect1> 380 </sect1>
381 <sect1> 381 <sect1 id="see_also">
382 <title>See also</title> 382 <title>See also</title>
383 <para> 383 <para>
384 <citation> 384 <citation>
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl
index 6996d977bf8f..5a8ffa761e09 100644
--- a/Documentation/DocBook/gadget.tmpl
+++ b/Documentation/DocBook/gadget.tmpl
@@ -144,7 +144,7 @@ with the lowest level (which directly handles hardware).
144 <para>This is the lowest software level. 144 <para>This is the lowest software level.
145 It is the only layer that talks to hardware, 145 It is the only layer that talks to hardware,
146 through registers, fifos, dma, irqs, and the like. 146 through registers, fifos, dma, irqs, and the like.
147 The <filename>&lt;linux/usb_gadget.h&gt;</filename> API abstracts 147 The <filename>&lt;linux/usb/gadget.h&gt;</filename> API abstracts
148 the peripheral controller endpoint hardware. 148 the peripheral controller endpoint hardware.
149 That hardware is exposed through endpoint objects, which accept 149 That hardware is exposed through endpoint objects, which accept
150 streams of IN/OUT buffers, and through callbacks that interact 150 streams of IN/OUT buffers, and through callbacks that interact
@@ -494,7 +494,7 @@ side drivers (and usbcore).
494<sect1 id="core"><title>Core Objects and Methods</title> 494<sect1 id="core"><title>Core Objects and Methods</title>
495 495
496<para>These are declared in 496<para>These are declared in
497<filename>&lt;linux/usb_gadget.h&gt;</filename>, 497<filename>&lt;linux/usb/gadget.h&gt;</filename>,
498and are used by gadget drivers to interact with 498and are used by gadget drivers to interact with
499USB peripheral controller drivers. 499USB peripheral controller drivers.
500</para> 500</para>
@@ -509,7 +509,7 @@ USB peripheral controller drivers.
509 unless the explanations are trivial. 509 unless the explanations are trivial.
510 --> 510 -->
511 511
512!Iinclude/linux/usb_gadget.h 512!Iinclude/linux/usb/gadget.h
513</sect1> 513</sect1>
514 514
515<sect1 id="utils"><title>Optional Utilities</title> 515<sect1 id="utils"><title>Optional Utilities</title>
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 230cbf753782..d3290c46af51 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -340,7 +340,7 @@ X!Earch/x86/kernel/mca_32.c
340 340
341 <chapter id="security"> 341 <chapter id="security">
342 <title>Security Framework</title> 342 <title>Security Framework</title>
343!Esecurity/security.c 343!Isecurity/security.c
344 </chapter> 344 </chapter>
345 345
346 <chapter id="audit"> 346 <chapter id="audit">
@@ -386,8 +386,7 @@ X!Edrivers/base/interface.c
386!Edrivers/base/bus.c 386!Edrivers/base/bus.c
387 </sect1> 387 </sect1>
388 <sect1><title>Device Drivers Power Management</title> 388 <sect1><title>Device Drivers Power Management</title>
389!Edrivers/base/power/resume.c 389!Edrivers/base/power/main.c
390!Edrivers/base/power/suspend.c
391 </sect1> 390 </sect1>
392 <sect1><title>Device Drivers ACPI Support</title> 391 <sect1><title>Device Drivers ACPI Support</title>
393<!-- Internal functions only 392<!-- Internal functions only
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index dceb30921498..54835610b3d6 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -77,7 +77,7 @@ documentation files are also added which explain how to use the feature.
77When a kernel change causes the interface that the kernel exposes to 77When a kernel change causes the interface that the kernel exposes to
78userspace to change, it is recommended that you send the information or 78userspace to change, it is recommended that you send the information or
79a patch to the manual pages explaining the change to the manual pages 79a patch to the manual pages explaining the change to the manual pages
80maintainer at mtk-manpages@gmx.net. 80maintainer at mtk.manpages@gmail.com.
81 81
82Here is a list of files that are in the kernel source tree that are 82Here is a list of files that are in the kernel source tree that are
83required reading: 83required reading:
diff --git a/Documentation/RCU/00-INDEX b/Documentation/RCU/00-INDEX
new file mode 100644
index 000000000000..461481dfb7c3
--- /dev/null
+++ b/Documentation/RCU/00-INDEX
@@ -0,0 +1,22 @@
100-INDEX
2 - This file
3arrayRCU.txt
4 - Using RCU to Protect Read-Mostly Arrays
5checklist.txt
6 - Review Checklist for RCU Patches
7listRCU.txt
8 - Using RCU to Protect Read-Mostly Linked Lists
9NMI-RCU.txt
10 - Using RCU to Protect Dynamic NMI Handlers
11rcuref.txt
12 - Reference-count design for elements of lists/arrays protected by RCU
13rcu.txt
14 - RCU Concepts
15RTFP.txt
16 - List of RCU papers (bibliography) going back to 1980.
17torture.txt
18 - RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST)
19UP.txt
20 - RCU on Uniprocessor Systems
21whatisRCU.txt
22 - What is RCU?
diff --git a/Documentation/SM501.txt b/Documentation/SM501.txt
index 3a1bd95d3767..6fc656035925 100644
--- a/Documentation/SM501.txt
+++ b/Documentation/SM501.txt
@@ -3,6 +3,11 @@
3 3
4Copyright 2006, 2007 Simtec Electronics 4Copyright 2006, 2007 Simtec Electronics
5 5
6The Silicon Motion SM501 multimedia companion chip is a multifunction device
7which may provide numerous interfaces including USB host controller USB gadget,
8Asyncronous Serial ports, Audio functions and a dual display video interface.
9The device may be connected by PCI or local bus with varying functions enabled.
10
6Core 11Core
7---- 12----
8 13
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cbee3a27f768..ab82b7f53312 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -21,7 +21,6 @@
21#include <sys/types.h> 21#include <sys/types.h>
22#include <sys/stat.h> 22#include <sys/stat.h>
23#include <sys/socket.h> 23#include <sys/socket.h>
24#include <sys/types.h>
25#include <signal.h> 24#include <signal.h>
26 25
27#include <linux/genetlink.h> 26#include <linux/genetlink.h>
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index 05851e9982ed..d46306fea230 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -14,8 +14,15 @@ suffice:
14 14
15 typedef struct { volatile int counter; } atomic_t; 15 typedef struct { volatile int counter; } atomic_t;
16 16
17 The first operations to implement for atomic_t's are the 17Historically, counter has been declared volatile. This is now discouraged.
18initializers and plain reads. 18See Documentation/volatile-considered-harmful.txt for the complete rationale.
19
20local_t is very similar to atomic_t. If the counter is per CPU and only
21updated by one CPU, local_t is probably more appropriate. Please see
22Documentation/local_ops.txt for the semantics of local_t.
23
24The first operations to implement for atomic_t's are the initializers and
25plain reads.
19 26
20 #define ATOMIC_INIT(i) { (i) } 27 #define ATOMIC_INIT(i) { (i) }
21 #define atomic_set(v, i) ((v)->counter = (i)) 28 #define atomic_set(v, i) ((v)->counter = (i))
@@ -24,6 +31,12 @@ The first macro is used in definitions, such as:
24 31
25static atomic_t my_counter = ATOMIC_INIT(1); 32static atomic_t my_counter = ATOMIC_INIT(1);
26 33
34The initializer is atomic in that the return values of the atomic operations
35are guaranteed to be correct reflecting the initialized value if the
36initializer is used before runtime. If the initializer is used at runtime, a
37proper implicit or explicit read memory barrier is needed before reading the
38value with atomic_read from another thread.
39
27The second interface can be used at runtime, as in: 40The second interface can be used at runtime, as in:
28 41
29 struct foo { atomic_t counter; }; 42 struct foo { atomic_t counter; };
@@ -36,13 +49,43 @@ The second interface can be used at runtime, as in:
36 return -ENOMEM; 49 return -ENOMEM;
37 atomic_set(&k->counter, 0); 50 atomic_set(&k->counter, 0);
38 51
52The setting is atomic in that the return values of the atomic operations by
53all threads are guaranteed to be correct reflecting either the value that has
54been set with this operation or set with another operation. A proper implicit
55or explicit memory barrier is needed before the value set with the operation
56is guaranteed to be readable with atomic_read from another thread.
57
39Next, we have: 58Next, we have:
40 59
41 #define atomic_read(v) ((v)->counter) 60 #define atomic_read(v) ((v)->counter)
42 61
43which simply reads the current value of the counter. 62which simply reads the counter value currently visible to the calling thread.
44 63The read is atomic in that the return value is guaranteed to be one of the
45Now, we move onto the actual atomic operation interfaces. 64values initialized or modified with the interface operations if a proper
65implicit or explicit memory barrier is used after possible runtime
66initialization by any other thread and the value is modified only with the
67interface operations. atomic_read does not guarantee that the runtime
68initialization by any other thread is visible yet, so the user of the
69interface must take care of that with a proper implicit or explicit memory
70barrier.
71
72*** WARNING: atomic_read() and atomic_set() DO NOT IMPLY BARRIERS! ***
73
74Some architectures may choose to use the volatile keyword, barriers, or inline
75assembly to guarantee some degree of immediacy for atomic_read() and
76atomic_set(). This is not uniformly guaranteed, and may change in the future,
77so all users of atomic_t should treat atomic_read() and atomic_set() as simple
78C statements that may be reordered or optimized away entirely by the compiler
79or processor, and explicitly invoke the appropriate compiler and/or memory
80barrier for each use case. Failure to do so will result in code that may
81suddenly break when used with different architectures or compiler
82optimizations, or even changes in unrelated code which changes how the
83compiler optimizes the section accessing atomic_t variables.
84
85*** YOU HAVE BEEN WARNED! ***
86
87Now, we move onto the atomic operation interfaces typically implemented with
88the help of assembly code.
46 89
47 void atomic_add(int i, atomic_t *v); 90 void atomic_add(int i, atomic_t *v);
48 void atomic_sub(int i, atomic_t *v); 91 void atomic_sub(int i, atomic_t *v);
@@ -117,6 +160,12 @@ operation.
117 160
118Then: 161Then:
119 162
163 int atomic_xchg(atomic_t *v, int new);
164
165This performs an atomic exchange operation on the atomic variable v, setting
166the given new value. It returns the old value that the atomic variable v had
167just before the operation.
168
120 int atomic_cmpxchg(atomic_t *v, int old, int new); 169 int atomic_cmpxchg(atomic_t *v, int old, int new);
121 170
122This performs an atomic compare exchange operation on the atomic value v, 171This performs an atomic compare exchange operation on the atomic value v,
diff --git a/Documentation/dontdiff b/Documentation/dontdiff
index 7b9551fc6fe3..f2d658a6a942 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -42,6 +42,9 @@
42*.9.gz 42*.9.gz
43.* 43.*
44.cscope 44.cscope
45.gitignore
46.mailmap
47.mm
4553c700_d.h 4853c700_d.h
4653c7xx_d.h 4953c7xx_d.h
4753c7xx_u.h 5053c7xx_u.h
@@ -121,7 +124,6 @@ kxgettext
121lkc_defs.h 124lkc_defs.h
122lex.c* 125lex.c*
123lex.*.c 126lex.*.c
124lk201-map.c
125logo_*.c 127logo_*.c
126logo_*_clut224.c 128logo_*_clut224.c
127logo_*_mono.c 129logo_*_mono.c
@@ -176,11 +178,13 @@ times.h*
176tkparse 178tkparse
177trix_boot.h 179trix_boot.h
178utsrelease.h* 180utsrelease.h*
181vdso.lds
179version.h* 182version.h*
180vmlinux 183vmlinux
181vmlinux-* 184vmlinux-*
182vmlinux.aout 185vmlinux.aout
183vmlinux.lds 186vmlinux*.lds*
187vmlinux*.scr
184vsyscall.lds 188vsyscall.lds
185wanxlfw.inc 189wanxlfw.inc
186uImage 190uImage
diff --git a/Documentation/early-userspace/README b/Documentation/early-userspace/README
index cddbac456c29..766d320c8eb6 100644
--- a/Documentation/early-userspace/README
+++ b/Documentation/early-userspace/README
@@ -19,7 +19,7 @@ It consists of several major infrastructure components:
19- klibc, a userspace C library, currently packaged separately, that is 19- klibc, a userspace C library, currently packaged separately, that is
20 optimized for correctness and small size. 20 optimized for correctness and small size.
21 21
22The cpio file format used by initramfs is the "newc" (aka "cpio -c") 22The cpio file format used by initramfs is the "newc" (aka "cpio -H newc")
23format, and is documented in the file "buffer-format.txt". There are 23format, and is documented in the file "buffer-format.txt". There are
24two ways to add an early userspace image: specify an existing cpio 24two ways to add an early userspace image: specify an existing cpio
25archive to be used as the image or have the kernel build process build 25archive 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
44CONFIG_INITRAMFS_SOURCE. Sources can be either directories or files - 44CONFIG_INITRAMFS_SOURCE. Sources can be either directories or files -
45cpio archives are *not* allowed when building from sources. 45cpio archives are *not* allowed when building from sources.
46 46
47A source directory will have it and all of it's contents packaged. The 47A source directory will have it and all of its contents packaged. The
48specified directory name will be mapped to '/'. When packaging a 48specified directory name will be mapped to '/'. When packaging a
49directory, limited user and group ID translation can be performed. 49directory, limited user and group ID translation can be performed.
50INITRAMFS_ROOT_UID can be set to a user ID that needs to be mapped to 50INITRAMFS_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.
144 initrd format, an cpio archive. It must be called "/init". This binary 144 initrd format, an cpio archive. It must be called "/init". This binary
145 is responsible to do all the things prepare_namespace() would do. 145 is responsible to do all the things prepare_namespace() would do.
146 146
147 To remain backwards compatibility, the /init binary will only run if it 147 To maintain backwards compatibility, the /init binary will only run if it
148 comes via an initramfs cpio archive. If this is not the case, 148 comes via an initramfs cpio archive. If this is not the case,
149 init/main.c:init() will run prepare_namespace() to mount the final root 149 init/main.c:init() will run prepare_namespace() to mount the final root
150 and exec one of the predefined init binaries. 150 and exec one of the predefined init binaries.
diff --git a/Documentation/email-clients.txt b/Documentation/email-clients.txt
new file mode 100644
index 000000000000..113165b48305
--- /dev/null
+++ b/Documentation/email-clients.txt
@@ -0,0 +1,217 @@
1Email clients info for Linux
2======================================================================
3
4General Preferences
5----------------------------------------------------------------------
6Patches for the Linux kernel are submitted via email, preferably as
7inline text in the body of the email. Some maintainers accept
8attachments, but then the attachments should have content-type
9"text/plain". However, attachments are generally frowned upon because
10it makes quoting portions of the patch more difficult in the patch
11review process.
12
13Email clients that are used for Linux kernel patches should send the
14patch text untouched. For example, they should not modify or delete tabs
15or spaces, even at the beginning or end of lines.
16
17Don't send patches with "format=flowed". This can cause unexpected
18and unwanted line breaks.
19
20Don't let your email client do automatic word wrapping for you.
21This can also corrupt your patch.
22
23Email clients should not modify the character set encoding of the text.
24Emailed patches should be in ASCII or UTF-8 encoding only.
25If you configure your email client to send emails with UTF-8 encoding,
26you avoid some possible charset problems.
27
28Email clients should generate and maintain References: or In-Reply-To:
29headers so that mail threading is not broken.
30
31Copy-and-paste (or cut-and-paste) usually does not work for patches
32because tabs are converted to spaces. Using xclipboard, xclip, and/or
33xcutsel may work, but it's best to test this for yourself or just avoid
34copy-and-paste.
35
36Don't use PGP/GPG signatures in mail that contains patches.
37This breaks many scripts that read and apply the patches.
38(This should be fixable.)
39
40It's a good idea to send a patch to yourself, save the received message,
41and successfully apply it with 'patch' before sending patches to Linux
42mailing lists.
43
44
45Some email client (MUA) hints
46----------------------------------------------------------------------
47Here are some specific MUA configuration hints for editing and sending
48patches for the Linux kernel. These are not meant to be complete
49software package configuration summaries.
50
51Legend:
52TUI = text-based user interface
53GUI = graphical user interface
54
55~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56Alpine (TUI)
57
58Config options:
59In the "Sending Preferences" section:
60
61- "Do Not Send Flowed Text" must be enabled
62- "Strip Whitespace Before Sending" must be disabled
63
64When composing the message, the cursor should be placed where the patch
65should appear, and then pressing CTRL-R let you specify the patch file
66to insert into the message.
67
68~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69Evolution (GUI)
70
71Some people use this successfully for patches.
72
73When composing mail select: Preformat
74 from Format->Heading->Preformatted (Ctrl-7)
75 or the toolbar
76
77Then use:
78 Insert->Text File... (Alt-n x)
79to insert the patch.
80
81You can also "diff -Nru old.c new.c | xclip", select Preformat, then
82paste with the middle button.
83
84~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85Kmail (GUI)
86
87Some people use Kmail successfully for patches.
88
89The default setting of not composing in HTML is appropriate; do not
90enable it.
91
92When composing an email, under options, uncheck "word wrap". The only
93disadvantage is any text you type in the email will not be word-wrapped
94so you will have to manually word wrap text before the patch. The easiest
95way around this is to compose your email with word wrap enabled, then save
96it as a draft. Once you pull it up again from your drafts it is now hard
97word-wrapped and you can uncheck "word wrap" without losing the existing
98wrapping.
99
100At the bottom of your email, put the commonly-used patch delimiter before
101inserting your patch: three hyphens (---).
102
103Then from the "Message" menu item, select insert file and choose your patch.
104As an added bonus you can customise the message creation toolbar menu
105and put the "insert file" icon there.
106
107You can safely GPG sign attachments, but inlined text is preferred for
108patches so do not GPG sign them. Signing patches that have been inserted
109as inlined text will make them tricky to extract from their 7-bit encoding.
110
111If you absolutely must send patches as attachments instead of inlining
112them as text, right click on the attachment and select properties, and
113highlight "Suggest automatic display" to make the attachment inlined to
114make it more viewable.
115
116When saving patches that are sent as inlined text, select the email that
117contains the patch from the message list pane, right click and select
118"save as". You can use the whole email unmodified as a patch if it was
119properly composed. There is no option currently to save the email when you
120are actually viewing it in its own window -- there has been a request filed
121at kmail's bugzilla and hopefully this will be addressed. Emails are saved
122as read-write for user only so you will have to chmod them to make them
123group and world readable if you copy them elsewhere.
124
125~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126Lotus Notes (GUI)
127
128Run away from it.
129
130~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131Mutt (TUI)
132
133Plenty of Linux developers use mutt, so it must work pretty well.
134
135Mutt doesn't come with an editor, so whatever editor you use should be
136used in a way that there are no automatic linebreaks. Most editors have
137an "insert file" option that inserts the contents of a file unaltered.
138
139To use 'vim' with mutt:
140 set editor="vi"
141
142 If using xclip, type the command
143 :set paste
144 before middle button or shift-insert or use
145 :r filename
146
147if you want to include the patch inline.
148(a)ttach works fine without "set paste".
149
150Config options:
151It should work with default settings.
152However, it's a good idea to set the "send_charset" to:
153 set send_charset="us-ascii:utf-8"
154
155~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156Pine (TUI)
157
158Pine has had some whitespace truncation issues in the past, but these
159should all be fixed now.
160
161Use alpine (pine's successor) if you can.
162
163Config options:
164- quell-flowed-text is needed for recent versions
165- the "no-strip-whitespace-before-send" option is needed
166
167
168~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169Sylpheed (GUI)
170
171- Works well for inlining text (or using attachments).
172- Allows use of an external editor.
173- Not good for IMAP.
174- Is slow on large folders.
175- Won't do TLS SMTP auth over a non-SSL connection.
176- Has a helpful ruler bar in the compose window.
177- Adding addresses to address book doesn't understand the display name
178 properly.
179
180~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181Thunderbird (GUI)
182
183By default, thunderbird likes to mangle text, but there are ways to
184coerce it into being nice.
185
186- Under account settings, composition and addressing, uncheck "Compose
187 messages in HTML format".
188
189- Edit your Thunderbird config settings to tell it not to wrap lines:
190 user_pref("mailnews.wraplength", 0);
191
192- Edit your Thunderbird config settings so that it won't use format=flowed:
193 user_pref("mailnews.send_plaintext_flowed", false);
194
195- You need to get Thunderbird into preformat mode:
196. If you compose HTML messages by default, it's not too hard. Just select
197 "Preformat" from the drop-down box just under the subject line.
198. If you compose in text by default, you have to tell it to compose a new
199 message in HTML (just as a one-off), and then force it from there back to
200 text, else it will wrap lines. To do this, use shift-click on the Write
201 icon to compose to get HTML compose mode, then select "Preformat" from
202 the drop-down box just under the subject line.
203
204- Allows use of an external editor:
205 The easiest thing to do with Thunderbird and patches is to use an
206 "external editor" extension and then just use your favorite $EDITOR
207 for reading/merging patches into the body text. To do this, download
208 and install the extension, then add a button for it using
209 View->Toolbars->Customize... and finally just click on it when in the
210 Compose dialog.
211
212~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213TkRat (GUI)
214
215Works. Use "Insert file..." or external editor.
216
217 ###
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index fb8258ebc577..280ec06573e6 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -82,6 +82,17 @@ Who: Dominik Brodowski <linux@brodo.de>
82 82
83--------------------------- 83---------------------------
84 84
85What: a.out interpreter support for ELF executables
86When: 2.6.25
87Files: fs/binfmt_elf.c
88Why: Using a.out interpreters for ELF executables was a feature for
89 transition from a.out to ELF. But now it is unlikely to be still
90 needed anymore and removing it would simplify the hairy ELF
91 loader code.
92Who: Andi Kleen <ak@suse.de>
93
94---------------------------
95
85What: remove EXPORT_SYMBOL(kernel_thread) 96What: remove EXPORT_SYMBOL(kernel_thread)
86When: August 2006 97When: August 2006
87Files: arch/*/kernel/*_ksyms.c 98Files: arch/*/kernel/*_ksyms.c
diff --git a/Documentation/filesystems/00-INDEX b/Documentation/filesystems/00-INDEX
index 599593a17067..1de155e2dc36 100644
--- a/Documentation/filesystems/00-INDEX
+++ b/Documentation/filesystems/00-INDEX
@@ -44,10 +44,16 @@ files.txt
44 - info on file management in the Linux kernel. 44 - info on file management in the Linux kernel.
45fuse.txt 45fuse.txt
46 - info on the Filesystem in User SpacE including mount options. 46 - info on the Filesystem in User SpacE including mount options.
47gfs2.txt
48 - info on the Global File System 2.
47hfs.txt 49hfs.txt
48 - info on the Macintosh HFS Filesystem for Linux. 50 - info on the Macintosh HFS Filesystem for Linux.
51hfsplus.txt
52 - info on the Macintosh HFSPlus Filesystem for Linux.
49hpfs.txt 53hpfs.txt
50 - info and mount options for the OS/2 HPFS. 54 - info and mount options for the OS/2 HPFS.
55inotify.txt
56 - info on the powerful yet simple file change notification system.
51isofs.txt 57isofs.txt
52 - info and mount options for the ISO 9660 (CDROM) filesystem. 58 - info and mount options for the ISO 9660 (CDROM) filesystem.
53jfs.txt 59jfs.txt
diff --git a/Documentation/filesystems/quota.txt b/Documentation/filesystems/quota.txt
new file mode 100644
index 000000000000..a590c4093eff
--- /dev/null
+++ b/Documentation/filesystems/quota.txt
@@ -0,0 +1,59 @@
1
2Quota subsystem
3===============
4
5Quota subsystem allows system administrator to set limits on used space and
6number of used inodes (inode is a filesystem structure which is associated
7with each file or directory) for users and/or groups. For both used space and
8number of used inodes there are actually two limits. The first one is called
9softlimit and the second one hardlimit. An user can never exceed a hardlimit
10for any resource. User is allowed to exceed softlimit but only for limited
11period of time. This period is called "grace period" or "grace time". When
12grace time is over, user is not able to allocate more space/inodes until he
13frees enough of them to get below softlimit.
14
15Quota limits (and amount of grace time) are set independently for each
16filesystem.
17
18For more details about quota design, see the documentation in quota-tools package
19(http://sourceforge.net/projects/linuxquota).
20
21Quota netlink interface
22=======================
23When user exceeds a softlimit, runs out of grace time or reaches hardlimit,
24quota subsystem traditionally printed a message to the controlling terminal of
25the process which caused the excess. This method has the disadvantage that
26when user is using a graphical desktop he usually cannot see the message.
27Thus quota netlink interface has been designed to pass information about
28the above events to userspace. There they can be captured by an application
29and processed accordingly.
30
31The interface uses generic netlink framework (see
32http://lwn.net/Articles/208755/ and http://people.suug.ch/~tgr/libnl/ for more
33details about this layer). The name of the quota generic netlink interface
34is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>.
35 Currently, the interface supports only one message type QUOTA_NL_C_WARNING.
36This command is used to send a notification about any of the above mentioned
37events. Each message has six attributes. These are (type of the argument is
38in parentheses):
39 QUOTA_NL_A_QTYPE (u32)
40 - type of quota being exceeded (one of USRQUOTA, GRPQUOTA)
41 QUOTA_NL_A_EXCESS_ID (u64)
42 - UID/GID (depends on quota type) of user / group whose limit
43 is being exceeded.
44 QUOTA_NL_A_CAUSED_ID (u64)
45 - UID of a user who caused the event
46 QUOTA_NL_A_WARNING (u32)
47 - what kind of limit is exceeded:
48 QUOTA_NL_IHARDWARN - inode hardlimit
49 QUOTA_NL_ISOFTLONGWARN - inode softlimit is exceeded longer
50 than given grace period
51 QUOTA_NL_ISOFTWARN - inode softlimit
52 QUOTA_NL_BHARDWARN - space (block) hardlimit
53 QUOTA_NL_BSOFTLONGWARN - space (block) softlimit is exceeded
54 longer than given grace period.
55 QUOTA_NL_BSOFTWARN - space (block) softlimit
56 QUOTA_NL_A_DEV_MAJOR (u32)
57 - major number of a device with the affected filesystem
58 QUOTA_NL_A_DEV_MINOR (u32)
59 - minor number of a device with the affected filesystem
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
index 25981e2e51be..339c6a4f220e 100644
--- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt
+++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
@@ -8,7 +8,7 @@ What is ramfs?
8 8
9Ramfs is a very simple filesystem that exports Linux's disk caching 9Ramfs is a very simple filesystem that exports Linux's disk caching
10mechanisms (the page cache and dentry cache) as a dynamically resizable 10mechanisms (the page cache and dentry cache) as a dynamically resizable
11ram-based filesystem. 11RAM-based filesystem.
12 12
13Normally all files are cached in memory by Linux. Pages of data read from 13Normally all files are cached in memory by Linux. Pages of data read from
14backing store (usually the block device the filesystem is mounted on) are kept 14backing store (usually the block device the filesystem is mounted on) are kept
@@ -34,7 +34,7 @@ ramfs and ramdisk:
34------------------ 34------------------
35 35
36The older "ram disk" mechanism created a synthetic block device out of 36The older "ram disk" mechanism created a synthetic block device out of
37an area of ram and used it as backing store for a filesystem. This block 37an area of RAM and used it as backing store for a filesystem. This block
38device was of fixed size, so the filesystem mounted on it was of fixed 38device was of fixed size, so the filesystem mounted on it was of fixed
39size. Using a ram disk also required unnecessarily copying memory from the 39size. Using a ram disk also required unnecessarily copying memory from the
40fake block device into the page cache (and copying changes back out), as well 40fake 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
46to avoid this copying by playing with the page tables, but they're unpleasantly 46to avoid this copying by playing with the page tables, but they're unpleasantly
47complicated and turn out to be about as expensive as the copying anyway.) 47complicated and turn out to be about as expensive as the copying anyway.)
48More to the point, all the work ramfs is doing has to happen _anyway_, 48More to the point, all the work ramfs is doing has to happen _anyway_,
49since all file access goes through the page and dentry caches. The ram 49since all file access goes through the page and dentry caches. The RAM
50disk is simply unnecessary, ramfs is internally much simpler. 50disk is simply unnecessary; ramfs is internally much simpler.
51 51
52Another reason ramdisks are semi-obsolete is that the introduction of 52Another reason ramdisks are semi-obsolete is that the introduction of
53loopback devices offered a more flexible and convenient way to create 53loopback devices offered a more flexible and convenient way to create
@@ -103,7 +103,7 @@ All this differs from the old initrd in several ways:
103 initramfs archive is a gzipped cpio archive (like tar only simpler, 103 initramfs archive is a gzipped cpio archive (like tar only simpler,
104 see cpio(1) and Documentation/early-userspace/buffer-format.txt). The 104 see cpio(1) and Documentation/early-userspace/buffer-format.txt). The
105 kernel's cpio extraction code is not only extremely small, it's also 105 kernel's cpio extraction code is not only extremely small, it's also
106 __init data that can be discarded during the boot process. 106 __init text and data that can be discarded during the boot process.
107 107
108 - The program run by the old initrd (which was called /initrd, not /init) did 108 - The program run by the old initrd (which was called /initrd, not /init) did
109 some setup and then returned to the kernel, while the init program from 109 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
220non-GPL code you'd like to run from initramfs, without conflating it with 220non-GPL code you'd like to run from initramfs, without conflating it with
221the GPL licensed Linux kernel binary). 221the GPL licensed Linux kernel binary).
222 222
223It can also be used to supplement the kernel's built-in initamfs image. The 223It can also be used to supplement the kernel's built-in initramfs image. The
224files in the external archive will overwrite any conflicting files in 224files in the external archive will overwrite any conflicting files in
225the built-in initramfs archive. Some distributors also prefer to customize 225the built-in initramfs archive. Some distributors also prefer to customize
226a single kernel image with task-specific initramfs images, without recompiling. 226a 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
339The move to early userspace is necessary because finding and mounting the real 339The move to early userspace is necessary because finding and mounting the real
340root device is complex. Root partitions can span multiple devices (raid or 340root device is complex. Root partitions can span multiple devices (raid or
341separate journal). They can be out on the network (requiring dhcp, setting a 341separate journal). They can be out on the network (requiring dhcp, setting a
342specific mac address, logging into a server, etc). They can live on removable 342specific MAC address, logging into a server, etc). They can live on removable
343media, with dynamically allocated major/minor numbers and persistent naming 343media, with dynamically allocated major/minor numbers and persistent naming
344issues requiring a full udev implementation to sort out. They can be 344issues requiring a full udev implementation to sort out. They can be
345compressed, encrypted, copy-on-write, loopback mounted, strangely partitioned, 345compressed, encrypted, copy-on-write, loopback mounted, strangely partitioned,
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c
index fba943aacf93..2de62854f0e5 100644
--- a/Documentation/firmware_class/firmware_sample_firmware_class.c
+++ b/Documentation/firmware_class/firmware_sample_firmware_class.c
@@ -109,15 +109,15 @@ static int fw_setup_class_device(struct class_device *class_dev,
109 const char *fw_name, 109 const char *fw_name,
110 struct device *device) 110 struct device *device)
111{ 111{
112 int retval = 0; 112 int retval;
113 struct firmware_priv *fw_priv = kmalloc(sizeof(struct firmware_priv), 113 struct firmware_priv *fw_priv;
114 GFP_KERNEL);
115 114
116 if(!fw_priv){ 115 fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL);
116 if (!fw_priv) {
117 retval = -ENOMEM; 117 retval = -ENOMEM;
118 goto out; 118 goto out;
119 } 119 }
120 memset(fw_priv, 0, sizeof(*fw_priv)); 120
121 memset(class_dev, 0, sizeof(*class_dev)); 121 memset(class_dev, 0, sizeof(*class_dev));
122 122
123 strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX); 123 strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt
index d3dc505104da..74f68b35f7c1 100644
--- a/Documentation/initrd.txt
+++ b/Documentation/initrd.txt
@@ -80,8 +80,8 @@ Compressed cpio images
80---------------------- 80----------------------
81 81
82Recent kernels have support for populating a ramdisk from a compressed cpio 82Recent kernels have support for populating a ramdisk from a compressed cpio
83archive, on such systems, the creation of a ramdisk image doesn't need to 83archive. On such systems, the creation of a ramdisk image doesn't need to
84involve special block devices or loopbacks, you merely create a directory on 84involve special block devices or loopbacks; you merely create a directory on
85disk with the desired initrd content, cd to that directory, and run (as an 85disk with the desired initrd content, cd to that directory, and run (as an
86example): 86example):
87 87
@@ -293,7 +293,7 @@ information as small as possible. In this case, a common initrd could be
293generated with all the necessary modules. Then, only /sbin/init or a file 293generated with all the necessary modules. Then, only /sbin/init or a file
294read by it would have to be different. 294read by it would have to be different.
295 295
296A third scenario are more convenient recovery disks, because information 296A third scenario is more convenient recovery disks, because information
297like the location of the root FS partition doesn't have to be provided at 297like the location of the root FS partition doesn't have to be provided at
298boot time, but the system loaded from initrd can invoke a user-friendly 298boot time, but the system loaded from initrd can invoke a user-friendly
299dialog and it can also perform some sanity checks (or even some form of 299dialog 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".
339Mixed change_root and pivot_root mechanism 339Mixed change_root and pivot_root mechanism
340------------------------------------------ 340------------------------------------------
341 341
342In case you did not want to use root=/dev/ram0 to trig the pivot_root mechanism, 342In case you did not want to use root=/dev/ram0 to trigger the pivot_root
343you may create both /linuxrc and /sbin/init in your initrd image. 343mechanism, you may create both /linuxrc and /sbin/init in your initrd image.
344 344
345/linuxrc would contain only the following: 345/linuxrc would contain only the following:
346 346
@@ -350,7 +350,7 @@ echo 0x0100 >/proc/sys/kernel/real-root-dev
350umount -n /proc 350umount -n /proc
351 351
352Once linuxrc exited, the kernel would mount again your initrd as root, 352Once linuxrc exited, the kernel would mount again your initrd as root,
353this time executing /sbin/init. Again, it would be duty of this init 353this time executing /sbin/init. Again, it would be the duty of this init
354to build the right environment (maybe using the root= device passed on 354to build the right environment (maybe using the root= device passed on
355the cmdline) before the final execution of the real /sbin/init. 355the cmdline) before the final execution of the real /sbin/init.
356 356
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 2fedc081b4c8..1b37b28cc234 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -13,7 +13,7 @@ dump of the system kernel's memory needs to be taken (for example, when
13the system panics). The system kernel's memory image is preserved across 13the system panics). The system kernel's memory image is preserved across
14the reboot and is accessible to the dump-capture kernel. 14the reboot and is accessible to the dump-capture kernel.
15 15
16You can use common Linux commands, such as cp and scp, to copy the 16You can use common commands, such as cp and scp, to copy the
17memory image to a dump file on the local disk, or across the network to 17memory image to a dump file on the local disk, or across the network to
18a remote system. 18a remote system.
19 19
@@ -69,7 +69,7 @@ http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-test
69 69
70This is a symlink to the latest version, which at the time of writing is 70This is a symlink to the latest version, which at the time of writing is
7120061214, the only release of kexec-tools-testing so far. As other versions 7120061214, the only release of kexec-tools-testing so far. As other versions
72are made released, the older onese will remain available at 72are released, the older ones will remain available at
73http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/ 73http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
74 74
75Note: Latest kexec-tools-testing git tree is available at 75Note: Latest kexec-tools-testing git tree is available at
@@ -159,16 +159,17 @@ Dump-capture kernel config options (Arch Independent)
159 CONFIG_PROC_VMCORE=y 159 CONFIG_PROC_VMCORE=y
160 (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.) 160 (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.)
161 161
162Dump-capture kernel config options (Arch Dependent, i386) 162Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
163-------------------------------------------------------- 163--------------------------------------------------------------------
1641) On x86, enable high memory support under "Processor type and 164
1651) On i386, enable high memory support under "Processor type and
165 features": 166 features":
166 167
167 CONFIG_HIGHMEM64G=y 168 CONFIG_HIGHMEM64G=y
168 or 169 or
169 CONFIG_HIGHMEM4G 170 CONFIG_HIGHMEM4G
170 171
1712) On x86 and x86_64, disable symmetric multi-processing support 1722) On i386 and x86_64, disable symmetric multi-processing support
172 under "Processor type and features": 173 under "Processor type and features":
173 174
174 CONFIG_SMP=n 175 CONFIG_SMP=n
@@ -203,28 +204,6 @@ Dump-capture kernel config options (Arch Dependent, i386)
2035) Make and install the kernel and its modules. DO NOT add this kernel 2045) Make and install the kernel and its modules. DO NOT add this kernel
204 to the boot loader configuration files. 205 to the boot loader configuration files.
205 206
206Dump-capture kernel config options (Arch Dependent, x86_64)
207----------------------------------------------------------
2081) On x86 and x86_64, disable symmetric multi-processing support
209 under "Processor type and features":
210
211 CONFIG_SMP=n
212
213 (If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line
214 when loading the dump-capture kernel, see section "Load the Dump-capture
215 Kernel".)
216
2172) Use a suitable value for "Physical address where the kernel is
218 loaded" (under "Processor type and features"). This only appears when
219 "kernel crash dumps" is enabled. By default this value is 0x1000000
220 (16MB). It should be the same as X in the "crashkernel=Y@X" boot
221 parameter.
222
223 For x86_64, normally "CONFIG_PHYSICAL_START=0x1000000".
224
2253) Make and install the kernel and its modules. DO NOT add this kernel
226 to the boot loader configuration files.
227
228Dump-capture kernel config options (Arch Dependent, ppc64) 207Dump-capture kernel config options (Arch Dependent, ppc64)
229---------------------------------------------------------- 208----------------------------------------------------------
230 209
@@ -282,11 +261,9 @@ Based on the architecture and type of image (relocatable or not), one
282can choose to load the uncompressed vmlinux or compressed bzImage/vmlinuz 261can choose to load the uncompressed vmlinux or compressed bzImage/vmlinuz
283of dump-capture kernel. Following is the summary. 262of dump-capture kernel. Following is the summary.
284 263
285For i386: 264For i386 and x86_64:
286 - Use vmlinux if kernel is not relocatable. 265 - Use vmlinux if kernel is not relocatable.
287 - Use bzImage/vmlinuz if kernel is relocatable. 266 - Use bzImage/vmlinuz if kernel is relocatable.
288For x86_64:
289 - Use vmlinux
290For ppc64: 267For ppc64:
291 - Use vmlinux 268 - Use vmlinux
292For ia64: 269For ia64:
@@ -315,20 +292,22 @@ Following are the arch specific command line options to be used while
315loading dump-capture kernel. 292loading dump-capture kernel.
316 293
317For i386, x86_64 and ia64: 294For i386, x86_64 and ia64:
318 "1 irqpoll maxcpus=1" 295 "1 irqpoll maxcpus=1 reset_devices"
319 296
320For ppc64: 297For ppc64:
321 "1 maxcpus=1 noirqdistrib" 298 "1 maxcpus=1 noirqdistrib reset_devices"
322 299
323 300
324Notes on loading the dump-capture kernel: 301Notes on loading the dump-capture kernel:
325 302
326* By default, the ELF headers are stored in ELF64 format to support 303* By default, the ELF headers are stored in ELF64 format to support
327 systems with more than 4GB memory. The --elf32-core-headers option can 304 systems with more than 4GB memory. On i386, kexec automatically checks if
328 be used to force the generation of ELF32 headers. This is necessary 305 the physical RAM size exceeds the 4 GB limit and if not, uses ELF32.
329 because GDB currently cannot open vmcore files with ELF64 headers on 306 So, on non-PAE systems, ELF32 is always used.
330 32-bit systems. ELF32 headers can be used on non-PAE systems (that is, 307
331 less than 4GB of memory). 308 The --elf32-core-headers option can be used to force the generation of ELF32
309 headers. This is necessary because GDB currently cannot open vmcore files
310 with ELF64 headers on 32-bit systems.
332 311
333* The "irqpoll" boot parameter reduces driver initialization failures 312* The "irqpoll" boot parameter reduces driver initialization failures
334 due to shared interrupts in the dump-capture kernel. 313 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()
360is called inside interrupt context or die() is called and panic_on_oops is set, 339is called inside interrupt context or die() is called and panic_on_oops is set,
361the system will boot into the dump-capture kernel. 340the system will boot into the dump-capture kernel.
362 341
363On powererpc systems when a soft-reset is generated, die() is called by all cpus 342On powerpc systems when a soft-reset is generated, die() is called by all cpus
364and the system will boot into the dump-capture kernel. 343and the system will boot into the dump-capture kernel.
365 344
366For testing purposes, you can trigger a crash by using "ALT-SysRq-c", 345For testing purposes, you can trigger a crash by using "ALT-SysRq-c",
@@ -426,9 +405,3 @@ Contact
426Vivek Goyal (vgoyal@in.ibm.com) 405Vivek Goyal (vgoyal@in.ibm.com)
427Maneesh Soni (maneesh@in.ibm.com) 406Maneesh Soni (maneesh@in.ibm.com)
428 407
429
430Trademark
431=========
432
433Linux is a trademark of Linus Torvalds in the United States, other
434countries, or both.
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index eb247997f679..63bda3637085 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -75,10 +75,12 @@ parameter is applicable:
75 PPT Parallel port support is enabled. 75 PPT Parallel port support is enabled.
76 PS2 Appropriate PS/2 support is enabled. 76 PS2 Appropriate PS/2 support is enabled.
77 RAM RAM disk support is enabled. 77 RAM RAM disk support is enabled.
78 ROOTPLUG The example Root Plug LSM is enabled.
78 S390 S390 architecture is enabled. 79 S390 S390 architecture is enabled.
79 SCSI Appropriate SCSI support is enabled. 80 SCSI Appropriate SCSI support is enabled.
80 A lot of drivers has their options described inside of 81 A lot of drivers has their options described inside of
81 Documentation/scsi/. 82 Documentation/scsi/.
83 SECURITY Different security models are enabled.
82 SELINUX SELinux support is enabled. 84 SELINUX SELinux support is enabled.
83 SERIAL Serial support is enabled. 85 SERIAL Serial support is enabled.
84 SH SuperH architecture is enabled. 86 SH SuperH architecture is enabled.
@@ -373,6 +375,12 @@ and is between 256 and 4096 characters. It is defined in the file
373 possible to determine what the correct size should be. 375 possible to determine what the correct size should be.
374 This option provides an override for these situations. 376 This option provides an override for these situations.
375 377
378 capability.disable=
379 [SECURITY] Disable capabilities. This would normally
380 be used only if an alternative security model is to be
381 configured. Potentially dangerous and should only be
382 used if you are entirely sure of the consequences.
383
376 chandev= [HW,NET] Generic channel device initialisation 384 chandev= [HW,NET] Generic channel device initialisation
377 385
378 checkreqprot [SELINUX] Set initial checkreqprot flag value. 386 checkreqprot [SELINUX] Set initial checkreqprot flag value.
@@ -1473,14 +1481,10 @@ and is between 256 and 4096 characters. It is defined in the file
1473 raid= [HW,RAID] 1481 raid= [HW,RAID]
1474 See Documentation/md.txt. 1482 See Documentation/md.txt.
1475 1483
1476 ramdisk= [RAM] Sizes of RAM disks in kilobytes [deprecated]
1477 See Documentation/ramdisk.txt.
1478
1479 ramdisk_blocksize= [RAM] 1484 ramdisk_blocksize= [RAM]
1480 See Documentation/ramdisk.txt. 1485 See Documentation/ramdisk.txt.
1481 1486
1482 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes 1487 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes
1483 New name for the ramdisk parameter.
1484 See Documentation/ramdisk.txt. 1488 See Documentation/ramdisk.txt.
1485 1489
1486 rcu.blimit= [KNL,BOOT] Set maximum number of finished 1490 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
1543 Useful for devices that are detected asynchronously 1547 Useful for devices that are detected asynchronously
1544 (e.g. USB and MMC devices). 1548 (e.g. USB and MMC devices).
1545 1549
1550 root_plug.vendor_id=
1551 [ROOTPLUG] Override the default vendor ID
1552
1553 root_plug.product_id=
1554 [ROOTPLUG] Override the default product ID
1555
1556 root_plug.debug=
1557 [ROOTPLUG] Enable debugging output
1558
1546 rw [KNL] Mount root device read-write on boot 1559 rw [KNL] Mount root device read-write on boot
1547 1560
1548 S [KNL] Run init in single mode 1561 S [KNL] Run init in single mode
diff --git a/Documentation/keys-request-key.txt b/Documentation/keys-request-key.txt
index c1f64fdf84cb..266955d23ee6 100644
--- a/Documentation/keys-request-key.txt
+++ b/Documentation/keys-request-key.txt
@@ -20,6 +20,19 @@ or:
20 const char *callout_string, 20 const char *callout_string,
21 void *aux); 21 void *aux);
22 22
23or:
24
25 struct key *request_key_async(const struct key_type *type,
26 const char *description,
27 const char *callout_string);
28
29or:
30
31 struct key *request_key_async_with_auxdata(const struct key_type *type,
32 const char *description,
33 const char *callout_string,
34 void *aux);
35
23Or by userspace invoking the request_key system call: 36Or by userspace invoking the request_key system call:
24 37
25 key_serial_t request_key(const char *type, 38 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
32destroyed. The kernel interface returns a pointer directly to the key, and 45destroyed. The kernel interface returns a pointer directly to the key, and
33it's up to the caller to destroy the key. 46it's up to the caller to destroy the key.
34 47
35The request_key_with_auxdata() call is like the in-kernel request_key() call, 48The request_key*_with_auxdata() calls are like the in-kernel request_key*()
36except that it permits auxiliary data to be passed to the upcaller (the default 49calls, except that they permit auxiliary data to be passed to the upcaller (the
37is NULL). This is only useful for those key types that define their own upcall 50default is NULL). This is only useful for those key types that define their
38mechanism rather than using /sbin/request-key. 51own upcall mechanism rather than using /sbin/request-key.
52
53The two async in-kernel calls may return keys that are still in the process of
54being constructed. The two non-async ones will wait for construction to
55complete first.
39 56
40The userspace interface links the key to a keyring associated with the process 57The userspace interface links the key to a keyring associated with the process
41to prevent the key from going away, and returns the serial number of the key to 58to prevent the key from going away, and returns the serial number of the key to
diff --git a/Documentation/keys.txt b/Documentation/keys.txt
index 947d57d53453..51652d39e61c 100644
--- a/Documentation/keys.txt
+++ b/Documentation/keys.txt
@@ -4,7 +4,7 @@
4 4
5This service allows cryptographic keys, authentication tokens, cross-domain 5This service allows cryptographic keys, authentication tokens, cross-domain
6user mappings, and similar to be cached in the kernel for the use of 6user mappings, and similar to be cached in the kernel for the use of
7filesystems other kernel services. 7filesystems and other kernel services.
8 8
9Keyrings are permitted; these are a special type of key that can hold links to 9Keyrings are permitted; these are a special type of key that can hold links to
10other keys. Processes each have three standard keyring subscriptions that a 10other 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
726two different users opening the same file is left to the filesystem author to 726two different users opening the same file is left to the filesystem author to
727solve. 727solve.
728 728
729To access the key manager, the following header must be #included:
730
731 <linux/key.h>
732
733Specific key types should have a header file under include/keys/ that should be
734used to access that type. For keys of type "user", for example, that would be:
735
736 <keys/user-type.h>
737
729Note that there are two different types of pointers to keys that may be 738Note that there are two different types of pointers to keys that may be
730encountered: 739encountered:
731 740
@@ -791,6 +800,36 @@ payload contents" for more information.
791 passed to the key_type->request_key() op if it exists. 800 passed to the key_type->request_key() op if it exists.
792 801
793 802
803(*) A key can be requested asynchronously by calling one of:
804
805 struct key *request_key_async(const struct key_type *type,
806 const char *description,
807 const char *callout_string);
808
809 or:
810
811 struct key *request_key_async_with_auxdata(const struct key_type *type,
812 const char *description,
813 const char *callout_string,
814 void *aux);
815
816 which are asynchronous equivalents of request_key() and
817 request_key_with_auxdata() respectively.
818
819 These two functions return with the key potentially still under
820 construction. To wait for contruction completion, the following should be
821 called:
822
823 int wait_for_key_construction(struct key *key, bool intr);
824
825 The function will wait for the key to finish being constructed and then
826 invokes key_validate() to return an appropriate value to indicate the state
827 of the key (0 indicates the key is usable).
828
829 If intr is true, then the wait can be interrupted by a signal, in which
830 case error ERESTARTSYS will be returned.
831
832
794(*) When it is no longer required, the key should be released using: 833(*) When it is no longer required, the key should be released using:
795 834
796 void key_put(struct key *key); 835 void key_put(struct key *key);
@@ -924,7 +963,11 @@ DEFINING A KEY TYPE
924 963
925A kernel service may want to define its own key type. For instance, an AFS 964A kernel service may want to define its own key type. For instance, an AFS
926filesystem might want to define a Kerberos 5 ticket key type. To do this, it 965filesystem might want to define a Kerberos 5 ticket key type. To do this, it
927author fills in a struct key_type and registers it with the system. 966author fills in a key_type struct and registers it with the system.
967
968Source files that implement key types should include the following header file:
969
970 <linux/key-type.h>
928 971
929The structure has a number of fields, some of which are mandatory: 972The structure has a number of fields, some of which are mandatory:
930 973
@@ -1053,22 +1096,44 @@ The structure has a number of fields, some of which are mandatory:
1053 as might happen when the userspace buffer is accessed. 1096 as might happen when the userspace buffer is accessed.
1054 1097
1055 1098
1056 (*) int (*request_key)(struct key *key, struct key *authkey, const char *op, 1099 (*) int (*request_key)(struct key_construction *cons, const char *op,
1057 void *aux); 1100 void *aux);
1058 1101
1059 This method is optional. If provided, request_key() and 1102 This method is optional. If provided, request_key() and friends will
1060 request_key_with_auxdata() will invoke this function rather than 1103 invoke this function rather than upcalling to /sbin/request-key to operate
1061 upcalling to /sbin/request-key to operate upon a key of this type. 1104 upon a key of this type.
1105
1106 The aux parameter is as passed to request_key_async_with_auxdata() and
1107 similar or is NULL otherwise. Also passed are the construction record for
1108 the key to be operated upon and the operation type (currently only
1109 "create").
1110
1111 This method is permitted to return before the upcall is complete, but the
1112 following function must be called under all circumstances to complete the
1113 instantiation process, whether or not it succeeds, whether or not there's
1114 an error:
1115
1116 void complete_request_key(struct key_construction *cons, int error);
1117
1118 The error parameter should be 0 on success, -ve on error. The
1119 construction record is destroyed by this action and the authorisation key
1120 will be revoked. If an error is indicated, the key under construction
1121 will be negatively instantiated if it wasn't already instantiated.
1122
1123 If this method returns an error, that error will be returned to the
1124 caller of request_key*(). complete_request_key() must be called prior to
1125 returning.
1126
1127 The key under construction and the authorisation key can be found in the
1128 key_construction struct pointed to by cons:
1129
1130 (*) struct key *key;
1131
1132 The key under construction.
1062 1133
1063 The aux parameter is as passed to request_key_with_auxdata() or is NULL 1134 (*) struct key *authkey;
1064 otherwise. Also passed are the key to be operated upon, the
1065 authorisation key for this operation and the operation type (currently
1066 only "create").
1067 1135
1068 This function should return only when the upcall is complete. Upon return 1136 The authorisation key.
1069 the authorisation key will be revoked, and the target key will be
1070 negatively instantiated if it is still uninstantiated. The error will be
1071 returned to the caller of request_key*().
1072 1137
1073 1138
1074============================ 1139============================
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt
index b0aca0705d1e..4269a1105b37 100644
--- a/Documentation/local_ops.txt
+++ b/Documentation/local_ops.txt
@@ -27,7 +27,7 @@ CPU which owns the data. Therefore, care must taken to make sure that only one
27CPU writes to the local_t data. This is done by using per cpu data and making 27CPU writes to the local_t data. This is done by using per cpu data and making
28sure that we modify it from within a preemption safe context. It is however 28sure that we modify it from within a preemption safe context. It is however
29permitted to read local_t data from any CPU : it will then appear to be written 29permitted to read local_t data from any CPU : it will then appear to be written
30out of order wrt other memory writes on the owner CPU. 30out of order wrt other memory writes by the owner CPU.
31 31
32 32
33* Implementation for a given architecture 33* Implementation for a given architecture
@@ -45,6 +45,29 @@ long fails. The definition looks like :
45typedef struct { atomic_long_t a; } local_t; 45typedef struct { atomic_long_t a; } local_t;
46 46
47 47
48* Rules to follow when using local atomic operations
49
50- Variables touched by local ops must be per cpu variables.
51- _Only_ the CPU owner of these variables must write to them.
52- This CPU can use local ops from any context (process, irq, softirq, nmi, ...)
53 to update its local_t variables.
54- Preemption (or interrupts) must be disabled when using local ops in
55 process context to make sure the process won't be migrated to a
56 different CPU between getting the per-cpu variable and doing the
57 actual local op.
58- When using local ops in interrupt context, no special care must be
59 taken on a mainline kernel, since they will run on the local CPU with
60 preemption already disabled. I suggest, however, to explicitly
61 disable preemption anyway to make sure it will still work correctly on
62 -rt kernels.
63- Reading the local cpu variable will provide the current copy of the
64 variable.
65- Reads of these variables can be done from any CPU, because updates to
66 "long", aligned, variables are always atomic. Since no memory
67 synchronization is done by the writer CPU, an outdated copy of the
68 variable can be read when reading some _other_ cpu's variables.
69
70
48* How to use local atomic operations 71* How to use local atomic operations
49 72
50#include <linux/percpu.h> 73#include <linux/percpu.h>
diff --git a/Documentation/m68k/kernel-options.txt b/Documentation/m68k/kernel-options.txt
index 59108cebe163..8a523f6af48a 100644
--- a/Documentation/m68k/kernel-options.txt
+++ b/Documentation/m68k/kernel-options.txt
@@ -192,10 +192,10 @@ Devices possible for Atari:
192 seconds. 192 seconds.
193 193
194 194
1952.6) ramdisk= 1952.6) ramdisk_size=
196------------- 196-------------
197 197
198Syntax: ramdisk=<size> 198Syntax: ramdisk_size=<size>
199 199
200 This option instructs the kernel to set up a ramdisk of the given 200 This option instructs the kernel to set up a ramdisk of the given
201size in KBytes. Do not use this option if the ramdisk contents are 201size 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
index 000000000000..f2481cabffcb
--- /dev/null
+++ b/Documentation/make/headers_install.txt
@@ -0,0 +1,46 @@
1Exporting kernel headers for use by userspace
2=============================================
3
4The "make headers_install" command exports the kernel's header files in a
5form suitable for use by userspace programs.
6
7The linux kernel's exported header files describe the API for user space
8programs attempting to use kernel services. These kernel header files are
9used by the system's C library (such as glibc or uClibc) to define available
10system calls, as well as constants and structures to be used with these
11system calls. The C library's header files include the kernel header files
12from the "linux" subdirectory. The system's libc headers are usually
13installed at the default location /usr/include and the kernel headers in
14subdirectories under that (most notably /usr/include/linux and
15/usr/include/asm).
16
17Kernel headers are backwards compatible, but not forwards compatible. This
18means that a program built against a C library using older kernel headers
19should run on a newer kernel (although it may not have access to new
20features), but a program built against newer kernel headers may not work on an
21older kernel.
22
23The "make headers_install" command can be run in the top level directory of the
24kernel source code (or using a standard out-of-tree build). It takes two
25optional arguments:
26
27 make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr/include
28
29ARCH indicates which architecture to produce headers for, and defaults to the
30current architecture. The linux/asm directory of the exported kernel headers
31is platform-specific, to see a complete list of supported architectures use
32the command:
33
34 ls -d include/asm-* | sed 's/.*-//'
35
36INSTALL_HDR_PATH indicates where to install the headers. It defaults to
37"./usr/include".
38
39The command "make headers_install_all" exports headers for all architectures
40simultaneously. (This is mostly of interest to distribution maintainers,
41who create an architecture-independent tarball from the resulting include
42directory.) Remember to provide the appropriate linux/asm directory via "mv"
43or "ln -s" before building a C library with headers exported this way.
44
45The kernel header export infrastructure is maintained by David Woodhouse
46<dwmw2@infradead.org>.
diff --git a/Documentation/mips/00-INDEX b/Documentation/mips/00-INDEX
new file mode 100644
index 000000000000..9df8a2eac7b4
--- /dev/null
+++ b/Documentation/mips/00-INDEX
@@ -0,0 +1,8 @@
100-INDEX
2 - this file.
3AU1xxx_IDE.README
4 - README for MIPS AU1XXX IDE driver.
5GT64120.README
6 - README for dir with info on MIPS boards using GT-64120 or GT-64120A.
7time.README
8 - README for MIPS time services.
diff --git a/Documentation/mutex-design.txt b/Documentation/mutex-design.txt
index cbf79881a41c..51f935191ae5 100644
--- a/Documentation/mutex-design.txt
+++ b/Documentation/mutex-design.txt
@@ -90,7 +90,8 @@ of advantages of mutexes:
90 * - task may not exit with mutex held 90 * - task may not exit with mutex held
91 * - memory areas where held locks reside must not be freed 91 * - memory areas where held locks reside must not be freed
92 * - held mutexes must not be reinitialized 92 * - held mutexes must not be reinitialized
93 * - mutexes may not be used in irq contexts 93 * - mutexes may not be used in hardware or software interrupt
94 * contexts such as tasklets and timers
94 95
95 furthermore, there are also convenience features in the debugging 96 furthermore, there are also convenience features in the debugging
96 code: 97 code:
diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt
index cae231b1c134..c36b64b0020f 100644
--- a/Documentation/networking/rxrpc.txt
+++ b/Documentation/networking/rxrpc.txt
@@ -857,3 +857,10 @@ The kernel interface functions are as follows:
857 857
858 This is used to extract the error number from a message indicating either 858 This is used to extract the error number from a message indicating either
859 a local error occurred or a network error occurred. 859 a local error occurred or a network error occurred.
860
861 (*) Allocate a null key for doing anonymous security.
862
863 struct key *rxrpc_get_null_key(const char *keyname);
864
865 This is used to allocate a null RxRPC key that can be used to indicate
866 anonymous security for a particular domain.
diff --git a/Documentation/power/00-INDEX b/Documentation/power/00-INDEX
new file mode 100644
index 000000000000..8db4e41a052d
--- /dev/null
+++ b/Documentation/power/00-INDEX
@@ -0,0 +1,34 @@
100-INDEX
2 - This file
3basic-pm-debugging.txt
4 - Debugging suspend and resume
5devices.txt
6 - How drivers interact with system-wide power management
7drivers-testing.txt
8 - Testing suspend and resume support in device drivers
9freezing-of-tasks.txt
10 - How processes and controlled during suspend
11interface.txt
12 - Power management user interface in /sys/power
13notifiers.txt
14 - Registering suspend notifiers in device drivers
15pci.txt
16 - How the PCI Subsystem Does Power Management
17s2ram.txt
18 - How to get suspend to ram working (and debug it when it isn't)
19states.txt
20 - System power management states
21swsusp-and-swap-files.txt
22 - Using swap files with software suspend (to disk)
23swsusp-dmcrypt.txt
24 - How to use dm-crypt and software suspend (to disk) together
25swsusp.txt
26 - Goals, implementation, and usage of software suspend (ACPI S3)
27tricks.txt
28 - How to trick software suspend (to disk) into working when it isn't
29userland-swsusp.txt
30 - Experimental implementation of software suspend in userspace
31video_extension.txt
32 - ACPI video extensions
33video.txt
34 - Video issues during resume from suspend
diff --git a/Documentation/power/drivers-testing.txt b/Documentation/power/drivers-testing.txt
index 33016c2f18dd..e4bdcaee24e4 100644
--- a/Documentation/power/drivers-testing.txt
+++ b/Documentation/power/drivers-testing.txt
@@ -14,8 +14,8 @@ the machine's BIOS.
14Of course, for this purpose the test system has to be known to suspend and 14Of course, for this purpose the test system has to be known to suspend and
15resume without the driver being tested. Thus, if possible, you should first 15resume without the driver being tested. Thus, if possible, you should first
16resolve all suspend/resume-related problems in the test system before you start 16resolve all suspend/resume-related problems in the test system before you start
17testing the new driver. Please see Documents/power/basic-pm-debugging.txt for 17testing the new driver. Please see Documentation/power/basic-pm-debugging.txt
18more information about the debugging of suspend/resume functionality. 18for more information about the debugging of suspend/resume functionality.
19 19
202. Testing the driver 202. Testing the driver
21 21
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX
index d6d65b9bcfe3..94a3c577b083 100644
--- a/Documentation/powerpc/00-INDEX
+++ b/Documentation/powerpc/00-INDEX
@@ -5,6 +5,8 @@ please mail me.
5 5
600-INDEX 600-INDEX
7 - this file 7 - this file
8booting-without-of.txt
9 - Booting the Linux/ppc kernel without Open Firmware
8cpu_features.txt 10cpu_features.txt
9 - info on how we support a variety of CPUs with minimal compile-time 11 - info on how we support a variety of CPUs with minimal compile-time
10 options. 12 options.
@@ -14,6 +16,8 @@ hvcs.txt
14 - IBM "Hypervisor Virtual Console Server" Installation Guide 16 - IBM "Hypervisor Virtual Console Server" Installation Guide
15mpc52xx.txt 17mpc52xx.txt
16 - Linux 2.6.x on MPC52xx family 18 - Linux 2.6.x on MPC52xx family
19mpc52xx-device-tree-bindings.txt
20 - MPC5200 Device Tree Bindings
17ppc_htab.txt 21ppc_htab.txt
18 - info about the Linux/PPC /proc/ppc_htab entry 22 - info about the Linux/PPC /proc/ppc_htab entry
19SBC8260_memory_mapping.txt 23SBC8260_memory_mapping.txt
diff --git a/Documentation/ramdisk.txt b/Documentation/ramdisk.txt
index 52f75b7d51c2..6c820baa19a6 100644
--- a/Documentation/ramdisk.txt
+++ b/Documentation/ramdisk.txt
@@ -22,16 +22,14 @@ The RAM disk dynamically grows as more space is required. It does this by using
22RAM from the buffer cache. The driver marks the buffers it is using as dirty 22RAM from the buffer cache. The driver marks the buffers it is using as dirty
23so that the VM subsystem does not try to reclaim them later. 23so that the VM subsystem does not try to reclaim them later.
24 24
25Also, the RAM disk supports up to 16 RAM disks out of the box, and can 25The RAM disk supports up to 16 RAM disks by default, and can be reconfigured
26be reconfigured to support up to 255 RAM disks - change "#define NUM_RAMDISKS" 26to support an unlimited number of RAM disks (at your own risk). Just change
27in drivers/block/rd.c. To use RAM disk support with your system, run 27the configuration symbol BLK_DEV_RAM_COUNT in the Block drivers config menu
28'./MAKEDEV ram' from the /dev directory. RAM disks are all major number 1, and 28and (re)build the kernel.
29start with minor number 0 for /dev/ram0, etc. If used, modern kernels use 29
30/dev/ram0 for an initrd. 30To use RAM disk support with your system, run './MAKEDEV ram' from the /dev
31 31directory. RAM disks are all major number 1, and start with minor number 0
32The old "ramdisk=<ram_size>" has been changed to "ramdisk_size=<ram_size>" to 32for /dev/ram0, etc. If used, modern kernels use /dev/ram0 for an initrd.
33make it clearer. The original "ramdisk=<ram_size>" has been kept around for
34compatibility reasons, but it may be removed in the future.
35 33
36The new RAM disk also has the ability to load compressed RAM disk images, 34The new RAM disk also has the ability to load compressed RAM disk images,
37allowing one to squeeze more programs onto an average installation or 35allowing one to squeeze more programs onto an average installation or
diff --git a/Documentation/scsi/ChangeLog.ncr53c8xx b/Documentation/scsi/ChangeLog.ncr53c8xx
index 7d03e9d5b5f7..a9f721aeb11c 100644
--- a/Documentation/scsi/ChangeLog.ncr53c8xx
+++ b/Documentation/scsi/ChangeLog.ncr53c8xx
@@ -195,9 +195,9 @@ Sun Feb 14:00 1999 Gerard Roudier (groudier@club-internet.fr)
195 Pointed out by Leonard Zubkoff. 195 Pointed out by Leonard Zubkoff.
196 - Allow to tune request_irq() flags from the boot command line using 196 - Allow to tune request_irq() flags from the boot command line using
197 ncr53c8xx=irqm:??, as follows: 197 ncr53c8xx=irqm:??, as follows:
198 a) If bit 0x10 is set in irqm, SA_SHIRQ flag is not used. 198 a) If bit 0x10 is set in irqm, IRQF_SHARED flag is not used.
199 b) If bit 0x20 is set in irqm, SA_INTERRUPT flag is not used. 199 b) If bit 0x20 is set in irqm, IRQF_DISABLED flag is not used.
200 By default the driver uses both SA_SHIRQ and SA_INTERRUPT. 200 By default the driver uses both IRQF_SHARED and IRQF_DISABLED.
201 Option 'ncr53c8xx=irqm:0x20' may be used when an IRQ is shared by 201 Option 'ncr53c8xx=irqm:0x20' may be used when an IRQ is shared by
202 a 53C8XX adapter and a network board. 202 a 53C8XX adapter and a network board.
203 - Tiny mispelling fixed (ABORT instead of ABRT). Was fortunately 203 - Tiny mispelling fixed (ABORT instead of ABRT). Was fortunately
diff --git a/Documentation/scsi/ibmmca.txt b/Documentation/scsi/ibmmca.txt
index 9707941704e3..a08e225653d6 100644
--- a/Documentation/scsi/ibmmca.txt
+++ b/Documentation/scsi/ibmmca.txt
@@ -1188,7 +1188,7 @@
1188 and 15 get ignored by the driver & adapter! 1188 and 15 get ignored by the driver & adapter!
1189 Q: I have a 9595 and I get a NMI during heavy SCSI I/O e.g. during fsck. 1189 Q: I have a 9595 and I get a NMI during heavy SCSI I/O e.g. during fsck.
1190 A COMMAND ERROR is reported and characters on the screen are missing. 1190 A COMMAND ERROR is reported and characters on the screen are missing.
1191 Warm reboot is not possible. Things look like quite weired. 1191 Warm reboot is not possible. Things look like quite weird.
1192 A: Check the processor type of your 9595. If you have an 80486 or 486DX-2 1192 A: Check the processor type of your 9595. If you have an 80486 or 486DX-2
1193 processor complex on your mainboard and you compiled a kernel that 1193 processor complex on your mainboard and you compiled a kernel that
1194 supports 80386 processors, it is possible, that the kernel cannot 1194 supports 80386 processors, it is possible, that the kernel cannot
diff --git a/Documentation/scsi/ncr53c8xx.txt b/Documentation/scsi/ncr53c8xx.txt
index 39d409a8efe5..230e30846ef2 100644
--- a/Documentation/scsi/ncr53c8xx.txt
+++ b/Documentation/scsi/ncr53c8xx.txt
@@ -785,8 +785,8 @@ port address 0x1400.
785 irqm:0 always open drain 785 irqm:0 always open drain
786 irqm:1 same as initial settings (assumed BIOS settings) 786 irqm:1 same as initial settings (assumed BIOS settings)
787 irqm:2 always totem pole 787 irqm:2 always totem pole
788 irqm:0x10 driver will not use SA_SHIRQ flag when requesting irq 788 irqm:0x10 driver will not use IRQF_SHARED flag when requesting irq
789 irqm:0x20 driver will not use SA_INTERRUPT flag when requesting irq 789 irqm:0x20 driver will not use IRQF_DISABLED flag when requesting irq
790 790
791 (Bits 0x10 and 0x20 can be combined with hardware irq mode option) 791 (Bits 0x10 and 0x20 can be combined with hardware irq mode option)
792 792
@@ -1236,15 +1236,15 @@ when the SCSI DATA IN phase is reentered after a phase mismatch.
1236When an IRQ is shared by devices that are handled by different drivers, it 1236When an IRQ is shared by devices that are handled by different drivers, it
1237may happen that one driver complains about the request of the IRQ having 1237may happen that one driver complains about the request of the IRQ having
1238failed. Inder Linux-2.0, this may be due to one driver having requested the 1238failed. Inder Linux-2.0, this may be due to one driver having requested the
1239IRQ using the SA_INTERRUPT flag but some other having requested the same IRQ 1239IRQ using the IRQF_DISABLED flag but some other having requested the same IRQ
1240without this flag. Under both Linux-2.0 and linux-2.2, this may be caused by 1240without this flag. Under both Linux-2.0 and linux-2.2, this may be caused by
1241one driver not having requested the IRQ with the SA_SHIRQ flag. 1241one driver not having requested the IRQ with the IRQF_SHARED flag.
1242 1242
1243By default, the ncr53c8xx and sym53c8xx drivers request IRQs with both the 1243By default, the ncr53c8xx and sym53c8xx drivers request IRQs with both the
1244SA_INTERRUPT and the SA_SHIRQ flag under Linux-2.0 and with only the SA_SHIRQ 1244IRQF_DISABLED and the IRQF_SHARED flag under Linux-2.0 and with only the IRQF_SHARED
1245flag under Linux-2.2. 1245flag under Linux-2.2.
1246 1246
1247Under Linux-2.0, you can disable use of SA_INTERRUPT flag from the boot 1247Under Linux-2.0, you can disable use of IRQF_DISABLED flag from the boot
1248command line by using the following option: 1248command line by using the following option:
1249 1249
1250 ncr53c8xx=irqm:0x20 (for the generic ncr53c8xx driver) 1250 ncr53c8xx=irqm:0x20 (for the generic ncr53c8xx driver)
@@ -1252,7 +1252,7 @@ command line by using the following option:
1252 1252
1253If this does not fix the problem, then you may want to check how all other 1253If this does not fix the problem, then you may want to check how all other
1254drivers are requesting the IRQ and report the problem. Note that if at least 1254drivers are requesting the IRQ and report the problem. Note that if at least
1255a single driver does not request the IRQ with the SA_SHIRQ flag (share IRQ), 1255a single driver does not request the IRQ with the IRQF_SHARED flag (share IRQ),
1256then the request of the IRQ obviously will not succeed for all the drivers. 1256then the request of the IRQ obviously will not succeed for all the drivers.
1257 1257
125815. SCSI problem troubleshooting 125815. SCSI problem troubleshooting
diff --git a/Documentation/sysctl/00-INDEX b/Documentation/sysctl/00-INDEX
new file mode 100644
index 000000000000..a20a9066dc4c
--- /dev/null
+++ b/Documentation/sysctl/00-INDEX
@@ -0,0 +1,16 @@
100-INDEX
2 - this file.
3README
4 - general information about /proc/sys/ sysctl files.
5abi.txt
6 - documentation for /proc/sys/abi/*.
7ctl_unnumbered.txt
8 - explanation of why one should not add new binary sysctl numbers.
9fs.txt
10 - documentation for /proc/sys/fs/*.
11kernel.txt
12 - documentation for /proc/sys/kernel/*.
13sunrpc.txt
14 - documentation for /proc/sys/sunrpc/*.
15vm.txt
16 - documentation for /proc/sys/vm/*.
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 111fd28727ec..8984a5396271 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -320,6 +320,14 @@ kernel. This value defaults to SHMMAX.
320 320
321============================================================== 321==============================================================
322 322
323softlockup_thresh:
324
325This value can be used to lower the softlockup tolerance
326threshold. The default threshold is 10s. If a cpu is locked up
327for 10s, the kernel complains. Valid values are 1-60s.
328
329==============================================================
330
323tainted: 331tainted:
324 332
325Non-zero if the kernel has been tainted. Numeric values, which 333Non-zero if the kernel has been tainted. Numeric values, which
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index a0ccc5b60260..b89570c30434 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -31,6 +31,7 @@ Currently, these files are in /proc/sys/vm:
31- min_unmapped_ratio 31- min_unmapped_ratio
32- min_slab_ratio 32- min_slab_ratio
33- panic_on_oom 33- panic_on_oom
34- oom_kill_allocating_task
34- mmap_min_address 35- mmap_min_address
35- numa_zonelist_order 36- numa_zonelist_order
36 37
@@ -111,6 +112,12 @@ of kilobytes free. The VM uses this number to compute a pages_min
111value for each lowmem zone in the system. Each lowmem zone gets 112value for each lowmem zone in the system. Each lowmem zone gets
112a number of reserved free pages based proportionally on its size. 113a number of reserved free pages based proportionally on its size.
113 114
115Some minimal ammount of memory is needed to satisfy PF_MEMALLOC
116allocations; if you set this to lower than 1024KB, your system will
117become subtly broken, and prone to deadlock under high loads.
118
119Setting this too high will OOM your machine instantly.
120
114============================================================== 121==============================================================
115 122
116percpu_pagelist_fraction 123percpu_pagelist_fraction
@@ -220,6 +227,27 @@ The default value is 0.
2201 and 2 are for failover of clustering. Please select either 2271 and 2 are for failover of clustering. Please select either
221according to your policy of failover. 228according to your policy of failover.
222 229
230=============================================================
231
232oom_kill_allocating_task
233
234This enables or disables killing the OOM-triggering task in
235out-of-memory situations.
236
237If this is set to zero, the OOM killer will scan through the entire
238tasklist and select a task based on heuristics to kill. This normally
239selects a rogue memory-hogging task that frees up a large amount of
240memory when killed.
241
242If this is set to non-zero, the OOM killer simply kills the task that
243triggered the out-of-memory condition. This avoids the expensive
244tasklist scan.
245
246If panic_on_oom is selected, it takes precedence over whatever value
247is used in oom_kill_allocating_task.
248
249The default value is 0.
250
223============================================================== 251==============================================================
224 252
225mmap_min_addr 253mmap_min_addr
diff --git a/Documentation/telephony/00-INDEX b/Documentation/telephony/00-INDEX
new file mode 100644
index 000000000000..4ffe0ed5b6fb
--- /dev/null
+++ b/Documentation/telephony/00-INDEX
@@ -0,0 +1,4 @@
100-INDEX
2 - this file.
3ixj.txt
4 - document describing the Quicknet drivers.
diff --git a/Documentation/vm/00-INDEX b/Documentation/vm/00-INDEX
new file mode 100644
index 000000000000..2131b00b63f6
--- /dev/null
+++ b/Documentation/vm/00-INDEX
@@ -0,0 +1,20 @@
100-INDEX
2 - this file.
3balance
4 - various information on memory balancing.
5hugetlbpage.txt
6 - a brief summary of hugetlbpage support in the Linux kernel.
7locking
8 - info on how locking and synchronization is done in the Linux vm code.
9numa
10 - information about NUMA specific code in the Linux vm.
11numa_memory_policy.txt
12 - documentation of concepts and APIs of the 2.6 memory policy support.
13overcommit-accounting
14 - description of the Linux kernels overcommit handling modes.
15page_migration
16 - description of page migration in NUMA systems.
17slabinfo.c
18 - source code for a tool to get reports about slabs.
19slub.txt
20 - a short users guide for SLUB.
diff --git a/Documentation/vm/slabinfo.c b/Documentation/vm/slabinfo.c
index 1af7bd5a2183..7047696c47a1 100644
--- a/Documentation/vm/slabinfo.c
+++ b/Documentation/vm/slabinfo.c
@@ -11,6 +11,7 @@
11#include <stdlib.h> 11#include <stdlib.h>
12#include <sys/types.h> 12#include <sys/types.h>
13#include <dirent.h> 13#include <dirent.h>
14#include <strings.h>
14#include <string.h> 15#include <string.h>
15#include <unistd.h> 16#include <unistd.h>
16#include <stdarg.h> 17#include <stdarg.h>
@@ -84,7 +85,7 @@ void fatal(const char *x, ...)
84 va_start(ap, x); 85 va_start(ap, x);
85 vfprintf(stderr, x, ap); 86 vfprintf(stderr, x, ap);
86 va_end(ap); 87 va_end(ap);
87 exit(1); 88 exit(EXIT_FAILURE);
88} 89}
89 90
90void usage(void) 91void usage(void)
@@ -119,14 +120,14 @@ void usage(void)
119 ); 120 );
120} 121}
121 122
122unsigned long read_obj(char *name) 123unsigned long read_obj(const char *name)
123{ 124{
124 FILE *f = fopen(name, "r"); 125 FILE *f = fopen(name, "r");
125 126
126 if (!f) 127 if (!f)
127 buffer[0] = 0; 128 buffer[0] = 0;
128 else { 129 else {
129 if (!fgets(buffer,sizeof(buffer), f)) 130 if (!fgets(buffer, sizeof(buffer), f))
130 buffer[0] = 0; 131 buffer[0] = 0;
131 fclose(f); 132 fclose(f);
132 if (buffer[strlen(buffer)] == '\n') 133 if (buffer[strlen(buffer)] == '\n')
@@ -139,7 +140,7 @@ unsigned long read_obj(char *name)
139/* 140/*
140 * Get the contents of an attribute 141 * Get the contents of an attribute
141 */ 142 */
142unsigned long get_obj(char *name) 143unsigned long get_obj(const char *name)
143{ 144{
144 if (!read_obj(name)) 145 if (!read_obj(name))
145 return 0; 146 return 0;
@@ -147,7 +148,7 @@ unsigned long get_obj(char *name)
147 return atol(buffer); 148 return atol(buffer);
148} 149}
149 150
150unsigned long get_obj_and_str(char *name, char **x) 151unsigned long get_obj_and_str(const char *name, char **x)
151{ 152{
152 unsigned long result = 0; 153 unsigned long result = 0;
153 char *p; 154 char *p;
@@ -166,12 +167,12 @@ unsigned long get_obj_and_str(char *name, char **x)
166 return result; 167 return result;
167} 168}
168 169
169void set_obj(struct slabinfo *s, char *name, int n) 170void set_obj(struct slabinfo *s, const char *name, int n)
170{ 171{
171 char x[100]; 172 char x[100];
172 FILE *f; 173 FILE *f;
173 174
174 sprintf(x, "%s/%s", s->name, name); 175 snprintf(x, 100, "%s/%s", s->name, name);
175 f = fopen(x, "w"); 176 f = fopen(x, "w");
176 if (!f) 177 if (!f)
177 fatal("Cannot write to %s\n", x); 178 fatal("Cannot write to %s\n", x);
@@ -180,13 +181,13 @@ void set_obj(struct slabinfo *s, char *name, int n)
180 fclose(f); 181 fclose(f);
181} 182}
182 183
183unsigned long read_slab_obj(struct slabinfo *s, char *name) 184unsigned long read_slab_obj(struct slabinfo *s, const char *name)
184{ 185{
185 char x[100]; 186 char x[100];
186 FILE *f; 187 FILE *f;
187 int l; 188 size_t l;
188 189
189 sprintf(x, "%s/%s", s->name, name); 190 snprintf(x, 100, "%s/%s", s->name, name);
190 f = fopen(x, "r"); 191 f = fopen(x, "r");
191 if (!f) { 192 if (!f) {
192 buffer[0] = 0; 193 buffer[0] = 0;
@@ -453,7 +454,7 @@ void slabcache(struct slabinfo *s)
453 return; 454 return;
454 455
455 store_size(size_str, slab_size(s)); 456 store_size(size_str, slab_size(s));
456 sprintf(dist_str,"%lu/%lu/%d", s->slabs, s->partial, s->cpu_slabs); 457 snprintf(dist_str, 40, "%lu/%lu/%d", s->slabs, s->partial, s->cpu_slabs);
457 458
458 if (!line++) 459 if (!line++)
459 first_line(); 460 first_line();
@@ -1062,6 +1063,7 @@ void read_slab_dir(void)
1062 slab->partial = get_obj("partial"); 1063 slab->partial = get_obj("partial");
1063 slab->partial = get_obj_and_str("partial", &t); 1064 slab->partial = get_obj_and_str("partial", &t);
1064 decode_numa_list(slab->numa_partial, t); 1065 decode_numa_list(slab->numa_partial, t);
1066 free(t);
1065 slab->poison = get_obj("poison"); 1067 slab->poison = get_obj("poison");
1066 slab->reclaim_account = get_obj("reclaim_account"); 1068 slab->reclaim_account = get_obj("reclaim_account");
1067 slab->red_zone = get_obj("red_zone"); 1069 slab->red_zone = get_obj("red_zone");
@@ -1069,6 +1071,7 @@ void read_slab_dir(void)
1069 slab->slab_size = get_obj("slab_size"); 1071 slab->slab_size = get_obj("slab_size");
1070 slab->slabs = get_obj_and_str("slabs", &t); 1072 slab->slabs = get_obj_and_str("slabs", &t);
1071 decode_numa_list(slab->numa, t); 1073 decode_numa_list(slab->numa, t);
1074 free(t);
1072 slab->store_user = get_obj("store_user"); 1075 slab->store_user = get_obj("store_user");
1073 slab->trace = get_obj("trace"); 1076 slab->trace = get_obj("trace");
1074 chdir(".."); 1077 chdir("..");
@@ -1148,7 +1151,7 @@ int main(int argc, char *argv[])
1148 1151
1149 while ((c = getopt_long(argc, argv, "ad::efhil1noprstvzTS", 1152 while ((c = getopt_long(argc, argv, "ad::efhil1noprstvzTS",
1150 opts, NULL)) != -1) 1153 opts, NULL)) != -1)
1151 switch(c) { 1154 switch (c) {
1152 case '1': 1155 case '1':
1153 show_single_ref = 1; 1156 show_single_ref = 1;
1154 break; 1157 break;
diff --git a/Documentation/w1/00-INDEX b/Documentation/w1/00-INDEX
new file mode 100644
index 000000000000..5270cf4cb109
--- /dev/null
+++ b/Documentation/w1/00-INDEX
@@ -0,0 +1,8 @@
100-INDEX
2 - This file
3masters/
4 - Individual chips providing 1-wire busses.
5w1.generic
6 - The 1-wire (w1) bus
7w1.netlink
8 - Userspace communication protocol over connector [1].
diff --git a/Documentation/w1/masters/00-INDEX b/Documentation/w1/masters/00-INDEX
new file mode 100644
index 000000000000..752613c4cea2
--- /dev/null
+++ b/Documentation/w1/masters/00-INDEX
@@ -0,0 +1,6 @@
100-INDEX
2 - This file
3ds2482
4 - The Maxim/Dallas Semiconductor DS2482 provides 1-wire busses.
5ds2490
6 - The Maxim/Dallas Semiconductor DS2490 builds USB <-> W1 bridges.
diff --git a/Documentation/w1/masters/ds2482 b/Documentation/w1/masters/ds2482
index c5d5478d90b2..9210d6fa5024 100644
--- a/Documentation/w1/masters/ds2482
+++ b/Documentation/w1/masters/ds2482
@@ -15,7 +15,7 @@ Author: Ben Gardner <bgardner@wabtec.com>
15Description 15Description
16----------- 16-----------
17 17
18The Maixm/Dallas Semiconductor DS2482 is a I2C device that provides 18The Maxim/Dallas Semiconductor DS2482 is a I2C device that provides
19one (DS2482-100) or eight (DS2482-800) 1-wire busses. 19one (DS2482-100) or eight (DS2482-800) 1-wire busses.
20 20
21 21
diff --git a/Documentation/w1/masters/ds2490 b/Documentation/w1/masters/ds2490
index 44a4918bd7f2..239f9ae01843 100644
--- a/Documentation/w1/masters/ds2490
+++ b/Documentation/w1/masters/ds2490
@@ -10,7 +10,7 @@ Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
10Description 10Description
11----------- 11-----------
12 12
13The Maixm/Dallas Semiconductor DS2490 is a chip 13The Maxim/Dallas Semiconductor DS2490 is a chip
14which allows to build USB <-> W1 bridges. 14which allows to build USB <-> W1 bridges.
15 15
16DS9490(R) is a USB <-> W1 bus master device 16DS9490(R) is a USB <-> W1 bus master device
diff --git a/Documentation/xterm-linux.xpm b/Documentation/xterm-linux.xpm
deleted file mode 100644
index f469c1a18e6e..000000000000
--- a/Documentation/xterm-linux.xpm
+++ /dev/null
@@ -1,61 +0,0 @@
1/* XPM */
2/*****************************************************************************/
3/** This pixmap was made by Torsten Poulin - 1996 - torsten@diku.dk **/
4/** It was made by combining xterm-blank.xpm with **/
5/** the wonderfully cute Linux penguin mascot by Larry Ewing. **/
6/** I had to change Larry's penguin a little to make it fit. **/
7/** xterm-blank.xpm contained the following comment: **/
8/** This pixmap is kindly offered by Ion Cionca - 1992 - **/
9/** Swiss Federal Institute of Technology **/
10/** Central Computing Service **/
11/*****************************************************************************/
12static char * image_name [] = {
13/**/
14"64 38 8 1",
15/**/
16" s mask c none",
17". c gray70",
18"X c gray85",
19"o c gray50",
20"O c yellow",
21"+ c darkolivegreen",
22"@ c white",
23"# c black",
24" ###### ",
25" ######## ",
26" ########## ........................... ",
27" ########### .XXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
28" ########### .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXoo ",
29" #@@@#@@@### .XX+++++++++++++++++++++++XXXXoo ",
30" #@#@#@#@### .XX++++++++++++++++++++++++XXXooo ",
31" #@#####@### .XX++@@+@++@+@@@@++@+++++++XXXooo ",
32" ###OOO######.XX++++++++++++++++++++++++XXXoooo ",
33" ##OOOOOO####.XX++@@@@+@@+@@@+++++++++++XXXoooo ",
34" #O#OOO#O####.XX++++++++++++++++++++++++XXXooooo ",
35" ##O###OO####.XX++@@@@@@@@@@+@@@@@++++++XXXooooo ",
36" ###OOOO@#####XX++++++++++++++++++++++++XXXooooo ",
37" ##@###@@@@####XX++@@@+@@@@+@@++@@@++++++XXXooooo ",
38" #@@@@@@@@@@####X++++++++++++++++++++++++XXXooooo ",
39" ##@@@@@@@@@@#####++@+++++++++++++++++++++XXXooooo ",
40" ###@@@@@@@@@@######+++++++++++++++++++++++XXXooooo ",
41" ####@@@@@@@@@@@#####+@@@@+@+@@@+@++++++++++XXXooooo ",
42" ###@@@@@@@@@@@@######++++++++++++++++++++++XXXooooo ",
43" ##@@@@@@@@@@@@@@#####@+@@@@++++++++++++++++XXXooooo ",
44" ###@@@@@@@@@@@@@@######++++++++++++++++++++XXXXoooo ",
45" ###@@@@@@@@@@@@@@######XXXXXXXXXXXXXXXXXXXXXXXXooo ",
46" ###@@@@@@@@@@@@@@@######XXXXXXXXXXXXXXXXXXXXXXXooo ",
47" ###@@@@@@@@@@@@@@@@#####ooooooooooooooooooooooo...oo ",
48" ###@@@@@@@@@@@@@@@######.........................ooo ",
49" #OO##@@@@@@@@@@@@@#######oooooooooooooooooooooooooooo ",
50" #OOO##@@@@@@@@@@@#OO####O#XXXXXXXXXXXXXXXXXXXXXXXoooo.. .. ",
51" ###OOOOO##@@@@@@@@@@#OOO#OOO#XXXXXXXXXXXXXX#######XXoooo . .",
52" #OOOOOOOO###@@@@@@@@@#OOOOOOO#ooooooooooooooooooooXXXooo . ",
53" #OOOOOOOOO###@@@@@@@@@#OOOOOOO##XXXXXXXXXXXXXXXXXooooo . ",
54" #OOOOOOOOO#@@@@@@@@###OOOOOOOOO#XXXXXXXXXXXXXXXoo oooooo ",
55" #OOOOOOOOO#@@@@@@@####OOOOOOOO#@@@@@@@@@@@XXXXXoo ooooo...o ",
56" #OOOOOOOOOOO###########OOOOOO##XXXXXXXXXXXXXXXXoo ooXXXoo..o ",
57" ##OOOOOOOOO###########OOOO##@@@@@@@@@@@@@XXXXoo oXXXXX..o ",
58" ###OOOO### oXX##OOO#XXXXXXXXXXXXXXXXXXoo o.....oo ",
59" #### oooo####oooooooooooooooooooo ooooooo ",
60" ",
61" "};
diff --git a/MAINTAINERS b/MAINTAINERS
index cc3b233ccaca..10deabeb3929 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1877,10 +1877,8 @@ T: quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
1877S: Maintained 1877S: Maintained
1878 1878
1879IDE/ATAPI CDROM DRIVER 1879IDE/ATAPI CDROM DRIVER
1880P: Alan Cox
1881M: alan@lxorguk.ukuu.org.uk
1882L: linux-ide@vger.kernel.org 1880L: linux-ide@vger.kernel.org
1883S: Maintained 1881S: Unmaintained
1884 1882
1885IDE/ATAPI FLOPPY DRIVERS 1883IDE/ATAPI FLOPPY DRIVERS
1886P: Paul Bristow 1884P: Paul Bristow
@@ -2488,7 +2486,7 @@ S: Supported
2488 2486
2489MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7 2487MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
2490P: Michael Kerrisk 2488P: Michael Kerrisk
2491M: mtk-manpages@gmx.net 2489M: mtk.manpages@gmail.com
2492W: ftp://ftp.kernel.org/pub/linux/docs/manpages 2490W: ftp://ftp.kernel.org/pub/linux/docs/manpages
2493S: Maintained 2491S: Maintained
2494 2492
@@ -3709,7 +3707,7 @@ S: Maintained
3709 3707
3710TI OMAP MMC INTERFACE DRIVER 3708TI OMAP MMC INTERFACE DRIVER
3711P: Carlos Aguiar, Anderson Briglia and Syed Khasim 3709P: Carlos Aguiar, Anderson Briglia and Syed Khasim
3712M: linux-omap-open-source@linux.omap.com 3710M: linux-omap-open-source@linux.omap.com (subscribers only)
3713W: http://linux.omap.com 3711W: http://linux.omap.com
3714W: http://www.muru.com/linux/omap/ 3712W: http://www.muru.com/linux/omap/
3715S: Maintained 3713S: Maintained
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 4d25e49a14f7..9bd1870d980e 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -26,9 +26,9 @@
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/file.h> 27#include <linux/file.h>
28#include <linux/utsname.h> 28#include <linux/utsname.h>
29#include <linux/ipc.h>
29 30
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31#include <asm/ipc.h>
32 32
33extern unsigned long do_mremap(unsigned long addr, unsigned long old_len, 33extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
34 unsigned long new_len, unsigned long flags, 34 unsigned long new_len, unsigned long flags,
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 8e2f9bc3368b..e8b98046895b 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -80,7 +80,7 @@
80#include <linux/sem.h> 80#include <linux/sem.h>
81#include <linux/socket.h> 81#include <linux/socket.h>
82#include <linux/net.h> 82#include <linux/net.h>
83#include <asm/ipc.h> 83#include <linux/ipc.h>
84#include <asm/uaccess.h> 84#include <asm/uaccess.h>
85 85
86struct oldabi_stat64 { 86struct oldabi_stat64 {
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index ef6ccc8993e9..c261472208cb 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -78,9 +78,9 @@ static void __init
78fixup_cats(struct machine_desc *desc, struct tag *tags, 78fixup_cats(struct machine_desc *desc, struct tag *tags,
79 char **cmdline, struct meminfo *mi) 79 char **cmdline, struct meminfo *mi)
80{ 80{
81 ORIG_VIDEO_LINES = 25; 81 screen_info.orig_video_lines = 25;
82 ORIG_VIDEO_POINTS = 16; 82 screen_info.orig_video_points = 16;
83 ORIG_Y = 24; 83 screen_info.orig_y = 24;
84} 84}
85 85
86MACHINE_START(CATS, "Chalice-CATS") 86MACHINE_START(CATS, "Chalice-CATS")
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 992ca435a922..29696e46ed65 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1272,7 +1272,7 @@ struct sysdev_class dma_sysclass = {
1272 1272
1273/* kmem cache implementation */ 1273/* kmem cache implementation */
1274 1274
1275static void s3c2410_dma_cache_ctor(void *p, struct kmem_cache *c, unsigned long f) 1275static void s3c2410_dma_cache_ctor(struct kmem_cache *c, void *p)
1276{ 1276{
1277 memset(p, 0, sizeof(struct s3c2410_dma_buf)); 1277 memset(p, 0, sizeof(struct s3c2410_dma_buf));
1278} 1278}
diff --git a/arch/avr32/mm/dma-coherent.c b/arch/avr32/mm/dma-coherent.c
index 099212d4567c..177fea8f7b71 100644
--- a/arch/avr32/mm/dma-coherent.c
+++ b/arch/avr32/mm/dma-coherent.c
@@ -21,13 +21,13 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, int direction)
21 21
22 switch (direction) { 22 switch (direction) {
23 case DMA_FROM_DEVICE: /* invalidate only */ 23 case DMA_FROM_DEVICE: /* invalidate only */
24 dma_cache_inv(vaddr, size); 24 invalidate_dcache_region(vaddr, size);
25 break; 25 break;
26 case DMA_TO_DEVICE: /* writeback only */ 26 case DMA_TO_DEVICE: /* writeback only */
27 dma_cache_wback(vaddr, size); 27 clean_dcache_region(vaddr, size);
28 break; 28 break;
29 case DMA_BIDIRECTIONAL: /* writeback and invalidate */ 29 case DMA_BIDIRECTIONAL: /* writeback and invalidate */
30 dma_cache_wback_inv(vaddr, size); 30 flush_dcache_region(vaddr, size);
31 break; 31 break;
32 default: 32 default:
33 BUG(); 33 BUG();
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 0aa0e0ebb3a9..514359b8122e 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -21,9 +21,9 @@
21#include <linux/stat.h> 21#include <linux/stat.h>
22#include <linux/mman.h> 22#include <linux/mman.h>
23#include <linux/file.h> 23#include <linux/file.h>
24#include <linux/ipc.h>
24 25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/ipc.h>
27#include <asm/segment.h> 27#include <asm/segment.h>
28 28
29/* 29/*
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 6fbe2665c577..04c6b1677ccf 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -23,10 +23,10 @@
23#include <linux/file.h> 23#include <linux/file.h>
24#include <linux/utsname.h> 24#include <linux/utsname.h>
25#include <linux/syscalls.h> 25#include <linux/syscalls.h>
26#include <linux/ipc.h>
26 27
27#include <asm/setup.h> 28#include <asm/setup.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/ipc.h>
30 30
31/* 31/*
32 * sys_pipe() is the normal C calling standard for creating 32 * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index ddc62727dc9f..00608be6d567 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -19,12 +19,12 @@
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/ipc.h>
22 23
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/cachectl.h> 26#include <asm/cachectl.h>
26#include <asm/traps.h> 27#include <asm/traps.h>
27#include <asm/ipc.h>
28#include <asm/unistd.h> 28#include <asm/unistd.h>
29 29
30/* 30/*
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index bf9aafad4978..7a95c58947e4 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -831,12 +831,13 @@ config CRASH_DUMP
831 depends on HIGHMEM 831 depends on HIGHMEM
832 help 832 help
833 Generate crash dump after being started by kexec. 833 Generate crash dump after being started by kexec.
834 This should be normally only set in special crash dump kernels 834 This should be normally only set in special crash dump kernels
835 which are loaded in the main kernel with kexec-tools into 835 which are loaded in the main kernel with kexec-tools into
836 a specially reserved region and then later executed after 836 a specially reserved region and then later executed after
837 a crash by kdump/kexec. The crash dump kernel must be compiled 837 a crash by kdump/kexec. The crash dump kernel must be compiled
838 to a memory address not used by the main kernel or BIOS using 838 to a memory address not used by the main kernel or BIOS using
839 PHYSICAL_START. 839 PHYSICAL_START, or it must be built as a relocatable image
840 (CONFIG_RELOCATABLE=y).
840 For more details see Documentation/kdump/kdump.txt 841 For more details see Documentation/kdump/kdump.txt
841 842
842config PHYSICAL_START 843config PHYSICAL_START
@@ -882,17 +883,17 @@ config PHYSICAL_START
882 Don't change this unless you know what you are doing. 883 Don't change this unless you know what you are doing.
883 884
884config RELOCATABLE 885config RELOCATABLE
885 bool "Build a relocatable kernel(EXPERIMENTAL)" 886 bool "Build a relocatable kernel (EXPERIMENTAL)"
886 depends on EXPERIMENTAL 887 depends on EXPERIMENTAL
887 help 888 help
888 This builds a kernel image that retains relocation information 889 This builds a kernel image that retains relocation information
889 so it can be loaded someplace besides the default 1MB. 890 so it can be loaded someplace besides the default 1MB.
890 The relocations tend to make the kernel binary about 10% larger, 891 The relocations tend to make the kernel binary about 10% larger,
891 but are discarded at runtime. 892 but are discarded at runtime.
892 893
893 One use is for the kexec on panic case where the recovery kernel 894 One use is for the kexec on panic case where the recovery kernel
894 must live at a different physical address than the primary 895 must live at a different physical address than the primary
895 kernel. 896 kernel.
896 897
897config PHYSICAL_ALIGN 898config PHYSICAL_ALIGN
898 hex "Alignment value to which kernel should be aligned" 899 hex "Alignment value to which kernel should be aligned"
@@ -1256,7 +1257,6 @@ source "fs/Kconfig"
1256 1257
1257menuconfig INSTRUMENTATION 1258menuconfig INSTRUMENTATION
1258 bool "Instrumentation Support" 1259 bool "Instrumentation Support"
1259 depends on EXPERIMENTAL
1260 default y 1260 default y
1261 ---help--- 1261 ---help---
1262 Say Y here to get to see options related to performance measurement, 1262 Say Y here to get to see options related to performance measurement,
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 59b91ac861ac..c60532d93c54 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -593,7 +593,6 @@ config IRQ_PER_CPU
593source "arch/ia64/hp/sim/Kconfig" 593source "arch/ia64/hp/sim/Kconfig"
594 594
595menu "Instrumentation Support" 595menu "Instrumentation Support"
596 depends on EXPERIMENTAL
597 596
598source "arch/ia64/oprofile/Kconfig" 597source "arch/ia64/oprofile/Kconfig"
599 598
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
index 1cfab326fb7e..f6ae3ec93810 100644
--- a/arch/ia64/ia32/binfmt_elf32.c
+++ b/arch/ia64/ia32/binfmt_elf32.c
@@ -240,7 +240,7 @@ static int __init check_elf32_binfmt(void)
240{ 240{
241 if (cpu_uses_ia32el()) { 241 if (cpu_uses_ia32el()) {
242 printk("Please use IA-32 EL for executing IA-32 binaries\n"); 242 printk("Please use IA-32 EL for executing IA-32 binaries\n");
243 return unregister_binfmt(&elf_format); 243 unregister_binfmt(&elf_format);
244 } 244 }
245 return 0; 245 return 0;
246} 246}
diff --git a/arch/ia64/ia32/elfcore32.h b/arch/ia64/ia32/elfcore32.h
index a47f63b204fb..446c9aac924d 100644
--- a/arch/ia64/ia32/elfcore32.h
+++ b/arch/ia64/ia32/elfcore32.h
@@ -117,6 +117,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
117} 117}
118 118
119#define ELF_CORE_COPY_XFPREGS 1 119#define ELF_CORE_COPY_XFPREGS 1
120#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
120static inline int 121static inline int
121elf_core_copy_task_xfpregs(struct task_struct *tsk, elf_fpxregset_t *xfpu) 122elf_core_copy_task_xfpregs(struct task_struct *tsk, elf_fpxregset_t *xfpu)
122{ 123{
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index 58e943a5d95c..0dd3b2394cdd 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -15,10 +15,13 @@
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/efi.h> 17#include <linux/efi.h>
18#include <linux/numa.h>
19#include <linux/mmzone.h>
18#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
19#include <asm/setup.h> 21#include <asm/setup.h>
20#include <asm/delay.h> 22#include <asm/delay.h>
21#include <asm/meminit.h> 23#include <asm/meminit.h>
24#include <asm/processor.h>
22 25
23typedef NORET_TYPE void (*relocate_new_kernel_t)( 26typedef NORET_TYPE void (*relocate_new_kernel_t)(
24 unsigned long indirection_page, 27 unsigned long indirection_page,
@@ -121,3 +124,28 @@ void machine_kexec(struct kimage *image)
121 unw_init_running(ia64_machine_kexec, image); 124 unw_init_running(ia64_machine_kexec, image);
122 for(;;); 125 for(;;);
123} 126}
127
128void arch_crash_save_vmcoreinfo(void)
129{
130#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
131 VMCOREINFO_SYMBOL(pgdat_list);
132 VMCOREINFO_LENGTH(pgdat_list, MAX_NUMNODES);
133
134 VMCOREINFO_SYMBOL(node_memblk);
135 VMCOREINFO_LENGTH(node_memblk, NR_NODE_MEMBLKS);
136 VMCOREINFO_SIZE(node_memblk_s);
137 VMCOREINFO_OFFSET(node_memblk_s, start_paddr);
138 VMCOREINFO_OFFSET(node_memblk_s, size);
139#endif
140#ifdef CONFIG_PGTABLE_3
141 VMCOREINFO_CONFIG(PGTABLE_3);
142#elif CONFIG_PGTABLE_4
143 VMCOREINFO_CONFIG(PGTABLE_4);
144#endif
145}
146
147unsigned long paddr_vmcoreinfo_note(void)
148{
149 return ia64_tpa((unsigned long)(char *)&vmcoreinfo_note);
150}
151
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 5628067a74d2..0b567398f38e 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -48,7 +48,7 @@ struct early_node_data {
48static struct early_node_data mem_data[MAX_NUMNODES] __initdata; 48static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
49static nodemask_t memory_less_mask __initdata; 49static nodemask_t memory_less_mask __initdata;
50 50
51static pg_data_t *pgdat_list[MAX_NUMNODES]; 51pg_data_t *pgdat_list[MAX_NUMNODES];
52 52
53/* 53/*
54 * To prevent cache aliasing effects, align per-node structures so that they 54 * To prevent cache aliasing effects, align per-node structures so that they
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index b13dbbeaeafa..0fc2efec18f6 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -20,11 +20,11 @@
20#include <linux/mman.h> 20#include <linux/mman.h>
21#include <linux/file.h> 21#include <linux/file.h>
22#include <linux/utsname.h> 22#include <linux/utsname.h>
23#include <linux/ipc.h>
23 24
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/cachectl.h> 26#include <asm/cachectl.h>
26#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
27#include <asm/ipc.h>
28#include <asm/syscall.h> 28#include <asm/syscall.h>
29#include <asm/unistd.h> 29#include <asm/unistd.h>
30 30
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 36d78cf1a7bc..e892f17ba3fa 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -21,12 +21,12 @@
21#include <linux/mman.h> 21#include <linux/mman.h>
22#include <linux/file.h> 22#include <linux/file.h>
23#include <linux/utsname.h> 23#include <linux/utsname.h>
24#include <linux/ipc.h>
24 25
25#include <asm/setup.h> 26#include <asm/setup.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/cachectl.h> 28#include <asm/cachectl.h>
28#include <asm/traps.h> 29#include <asm/traps.h>
29#include <asm/ipc.h>
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index 15d62c5279a9..65f7a95f056e 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -18,13 +18,13 @@
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/ipc.h>
21#include <linux/fs.h> 22#include <linux/fs.h>
22 23
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/cachectl.h> 26#include <asm/cachectl.h>
26#include <asm/traps.h> 27#include <asm/traps.h>
27#include <asm/ipc.h>
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd.h> 29#include <asm/unistd.h>
30 30
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 6b663bec4752..14164c2b8791 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -279,7 +279,6 @@ core-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/
279cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec 279cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec
280libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/ 280libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/
281load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000 281load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
282CLEAN_FILES += drivers/tc/lk201-map.c
283 282
284# 283#
285# Wind River PPMC Board (4KC + GT64120) 284# Wind River PPMC Board (4KC + GT64120)
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 8ef5cf4cc423..b997af713eb3 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -44,11 +44,14 @@
44static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs); 44static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs);
45static int load_irix_library(struct file *); 45static int load_irix_library(struct file *);
46static int irix_core_dump(long signr, struct pt_regs * regs, 46static int irix_core_dump(long signr, struct pt_regs * regs,
47 struct file *file); 47 struct file *file, unsigned long limit);
48 48
49static struct linux_binfmt irix_format = { 49static struct linux_binfmt irix_format = {
50 NULL, THIS_MODULE, load_irix_binary, load_irix_library, 50 .module = THIS_MODULE,
51 irix_core_dump, PAGE_SIZE 51 .load_binary = load_irix_binary,
52 .load_shlib = load_irix_library,
53 .core_dump = irix_core_dump,
54 .min_coredump = PAGE_SIZE,
52}; 55};
53 56
54/* Debugging routines. */ 57/* Debugging routines. */
@@ -1088,7 +1091,7 @@ end_coredump:
1088 * and then they are actually written out. If we run out of core limit 1091 * and then they are actually written out. If we run out of core limit
1089 * we just truncate. 1092 * we just truncate.
1090 */ 1093 */
1091static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file) 1094static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
1092{ 1095{
1093 int has_dumped = 0; 1096 int has_dumped = 0;
1094 mm_segment_t fs; 1097 mm_segment_t fs;
@@ -1098,7 +1101,6 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1098 struct vm_area_struct *vma; 1101 struct vm_area_struct *vma;
1099 struct elfhdr elf; 1102 struct elfhdr elf;
1100 off_t offset = 0, dataoff; 1103 off_t offset = 0, dataoff;
1101 int limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1102 int numnote = 3; 1104 int numnote = 3;
1103 struct memelfnote notes[3]; 1105 struct memelfnote notes[3];
1104 struct elf_prstatus prstatus; /* NT_PRSTATUS */ 1106 struct elf_prstatus prstatus; /* NT_PRSTATUS */
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index d6e01215fb2b..2b8ec1102e86 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -35,12 +35,12 @@
35#include <linux/security.h> 35#include <linux/security.h>
36#include <linux/compat.h> 36#include <linux/compat.h>
37#include <linux/vfs.h> 37#include <linux/vfs.h>
38#include <linux/ipc.h>
38 39
39#include <net/sock.h> 40#include <net/sock.h>
40#include <net/scm.h> 41#include <net/scm.h>
41 42
42#include <asm/compat-signal.h> 43#include <asm/compat-signal.h>
43#include <asm/ipc.h>
44#include <asm/sim.h> 44#include <asm/sim.h>
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46#include <asm/mmu_context.h> 46#include <asm/mmu_context.h>
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 17c4374d2209..b95fe93dd646 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -28,11 +28,11 @@
28#include <linux/shm.h> 28#include <linux/shm.h>
29#include <linux/compiler.h> 29#include <linux/compiler.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/ipc.h>
31 32
32#include <asm/branch.h> 33#include <asm/branch.h>
33#include <asm/cachectl.h> 34#include <asm/cachectl.h>
34#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
35#include <asm/ipc.h>
36#include <asm/asm-offsets.h> 36#include <asm/asm-offsets.h>
37#include <asm/signal.h> 37#include <asm/signal.h>
38#include <asm/sim.h> 38#include <asm/sim.h>
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 43dde874f414..81f30ac2bff9 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -47,8 +47,6 @@ void (*_dma_cache_wback)(unsigned long start, unsigned long size);
47void (*_dma_cache_inv)(unsigned long start, unsigned long size); 47void (*_dma_cache_inv)(unsigned long start, unsigned long size);
48 48
49EXPORT_SYMBOL(_dma_cache_wback_inv); 49EXPORT_SYMBOL(_dma_cache_wback_inv);
50EXPORT_SYMBOL(_dma_cache_wback);
51EXPORT_SYMBOL(_dma_cache_inv);
52 50
53#endif /* CONFIG_DMA_NONCOHERENT */ 51#endif /* CONFIG_DMA_NONCOHERENT */
54 52
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index 09fa007c1d1b..059eade96f2e 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -206,7 +206,7 @@ static void pci_proc_init(void)
206} 206}
207#endif /* CONFIG_PROC_FS && PCI_COUNTERS */ 207#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
208 208
209spinlock_t bpci_lock = SPIN_LOCK_UNLOCKED; 209DEFINE_SPINLOCK(bpci_lock);
210 210
211/***************************************************************************** 211/*****************************************************************************
212 * 212 *
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5624fb060d9d..3763f681ce4c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -670,7 +670,6 @@ source "arch/powerpc/sysdev/qe_lib/Kconfig"
670source "lib/Kconfig" 670source "lib/Kconfig"
671 671
672menu "Instrumentation Support" 672menu "Instrumentation Support"
673 depends on EXPERIMENTAL
674 673
675source "arch/powerpc/oprofile/Kconfig" 674source "arch/powerpc/oprofile/Kconfig"
676 675
diff --git a/arch/powerpc/kernel/binfmt_elf32.c b/arch/powerpc/kernel/binfmt_elf32.c
index 5cb58757e1b1..1d45d7782d4e 100644
--- a/arch/powerpc/kernel/binfmt_elf32.c
+++ b/arch/powerpc/kernel/binfmt_elf32.c
@@ -13,49 +13,44 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#define ELF_ARCH EM_PPC
17#define ELF_CLASS ELFCLASS32
18#define ELF_DATA ELFDATA2MSB;
19
20#include <asm/processor.h> 16#include <asm/processor.h>
21#include <linux/module.h> 17#include <linux/module.h>
22#include <linux/elfcore.h>
23#include <linux/compat.h> 18#include <linux/compat.h>
19#include <linux/elfcore-compat.h>
20
21#undef ELF_ARCH
22#undef ELF_CLASS
23#define ELF_CLASS ELFCLASS32
24#define ELF_ARCH EM_PPC
25
26#undef elfhdr
27#undef elf_phdr
28#undef elf_note
29#undef elf_addr_t
30#define elfhdr elf32_hdr
31#define elf_phdr elf32_phdr
32#define elf_note elf32_note
33#define elf_addr_t Elf32_Off
24 34
25#define elf_prstatus elf_prstatus32 35#define elf_prstatus compat_elf_prstatus
26struct elf_prstatus32 36#define elf_prpsinfo compat_elf_prpsinfo
37
38#define elf_core_copy_regs compat_elf_core_copy_regs
39static inline void compat_elf_core_copy_regs(compat_elf_gregset_t *elf_regs,
40 struct pt_regs *regs)
27{ 41{
28 struct elf_siginfo pr_info; /* Info associated with signal */ 42 PPC_ELF_CORE_COPY_REGS((*elf_regs), regs);
29 short pr_cursig; /* Current signal */ 43}
30 unsigned int pr_sigpend; /* Set of pending signals */
31 unsigned int pr_sighold; /* Set of held signals */
32 pid_t pr_pid;
33 pid_t pr_ppid;
34 pid_t pr_pgrp;
35 pid_t pr_sid;
36 struct compat_timeval pr_utime; /* User time */
37 struct compat_timeval pr_stime; /* System time */
38 struct compat_timeval pr_cutime; /* Cumulative user time */
39 struct compat_timeval pr_cstime; /* Cumulative system time */
40 elf_gregset_t pr_reg; /* General purpose registers. */
41 int pr_fpvalid; /* True if math co-processor being used. */
42};
43 44
44#define elf_prpsinfo elf_prpsinfo32 45#define elf_core_copy_task_regs compat_elf_core_copy_task_regs
45struct elf_prpsinfo32 46static int compat_elf_core_copy_task_regs(struct task_struct *tsk,
47 compat_elf_gregset_t *elf_regs)
46{ 48{
47 char pr_state; /* numeric process state */ 49 struct pt_regs *regs = tsk->thread.regs;
48 char pr_sname; /* char for pr_state */ 50 if (regs)
49 char pr_zomb; /* zombie */ 51 compat_elf_core_copy_regs(elf_regs, regs);
50 char pr_nice; /* nice val */ 52 return 1;
51 unsigned int pr_flag; /* flags */ 53}
52 u32 pr_uid;
53 u32 pr_gid;
54 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
55 /* Lots missing */
56 char pr_fname[16]; /* filename of executable */
57 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
58};
59 54
60#include <linux/time.h> 55#include <linux/time.h>
61 56
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 7949c203cb89..ea6ad7a2a7e3 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -149,10 +149,32 @@ void flush_altivec_to_thread(struct task_struct *tsk)
149 } 149 }
150} 150}
151 151
152int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) 152int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
153{ 153{
154 flush_altivec_to_thread(current); 154 /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
155 memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs)); 155 * separately, see below */
156 const int nregs = ELF_NVRREG - 2;
157 elf_vrreg_t *reg;
158 u32 *dest;
159
160 if (tsk == current)
161 flush_altivec_to_thread(tsk);
162
163 reg = (elf_vrreg_t *)vrregs;
164
165 /* copy the 32 vr registers */
166 memcpy(reg, &tsk->thread.vr[0], nregs * sizeof(*reg));
167 reg += nregs;
168
169 /* copy the vscr */
170 memcpy(reg, &tsk->thread.vscr, sizeof(*reg));
171 reg++;
172
173 /* vrsave is stored in the high 32bit slot of the final 128bits */
174 memset(reg, 0, sizeof(*reg));
175 dest = (u32 *)reg;
176 *dest = tsk->thread.vrsave;
177
156 return 1; 178 return 1;
157} 179}
158#endif /* CONFIG_ALTIVEC */ 180#endif /* CONFIG_ALTIVEC */
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 62b7bf2f3eab..f2276593f416 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
286} 286}
287 287
288/* constructor for flash_block_cache */ 288/* constructor for flash_block_cache */
289void rtas_block_ctor(void *ptr, struct kmem_cache *cache, unsigned long flags) 289void rtas_block_ctor(struct kmem_cache *cache, void *ptr)
290{ 290{
291 memset(ptr, 0, RTAS_BLK_SIZE); 291 memset(ptr, 0, RTAS_BLK_SIZE);
292} 292}
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index bd85b5fd08c8..4a4f5c6b560b 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -41,10 +41,10 @@
41#include <linux/compat.h> 41#include <linux/compat.h>
42#include <linux/ptrace.h> 42#include <linux/ptrace.h>
43#include <linux/elf.h> 43#include <linux/elf.h>
44#include <linux/ipc.h>
44 45
45#include <asm/ptrace.h> 46#include <asm/ptrace.h>
46#include <asm/types.h> 47#include <asm/types.h>
47#include <asm/ipc.h>
48#include <asm/uaccess.h> 48#include <asm/uaccess.h>
49#include <asm/unistd.h> 49#include <asm/unistd.h>
50#include <asm/semaphore.h> 50#include <asm/semaphore.h>
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index f85f402ceaef..3b1d5dd65643 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -38,7 +38,6 @@
38#include <linux/personality.h> 38#include <linux/personality.h>
39 39
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/ipc.h>
42#include <asm/semaphore.h> 41#include <asm/semaphore.h>
43#include <asm/syscalls.h> 42#include <asm/syscalls.h>
44#include <asm/time.h> 43#include <asm/time.h>
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 08f0d9ff7712..71efb38d599b 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -526,7 +526,7 @@ repeat:
526 return err; 526 return err;
527} 527}
528 528
529static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags) 529static void zero_ctor(struct kmem_cache *cache, void *addr)
530{ 530{
531 memset(addr, 0, kmem_cache_size(cache)); 531 memset(addr, 0, kmem_cache_size(cache));
532} 532}
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 6720b1c93f18..d9c82d3d6482 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -142,7 +142,7 @@ static int __init setup_kcore(void)
142module_init(setup_kcore); 142module_init(setup_kcore);
143#endif 143#endif
144 144
145static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags) 145static void zero_ctor(struct kmem_cache *cache, void *addr)
146{ 146{
147 memset(addr, 0, kmem_cache_size(cache)); 147 memset(addr, 0, kmem_cache_size(cache));
148} 148}
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 319826ef1645..ad928edafb0a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -34,7 +34,7 @@
34#include <asm/mmu.h> 34#include <asm/mmu.h>
35#include <asm/spu.h> 35#include <asm/spu.h>
36 36
37static spinlock_t slice_convert_lock = SPIN_LOCK_UNLOCKED; 37static DEFINE_SPINLOCK(slice_convert_lock);
38 38
39 39
40#ifdef DEBUG 40#ifdef DEBUG
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 11098747d09b..0966d093db43 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -68,7 +68,7 @@ spufs_destroy_inode(struct inode *inode)
68} 68}
69 69
70static void 70static void
71spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags) 71spufs_init_once(struct kmem_cache *cachep, void *p)
72{ 72{
73 struct spufs_inode_info *ei = p; 73 struct spufs_inode_info *ei = p;
74 74
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 5ddf40a66ae8..3a5d112af5e0 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -37,6 +37,10 @@
37#include <asm/time.h> 37#include <asm/time.h>
38#include <asm/of_platform.h> 38#include <asm/of_platform.h>
39 39
40#include <pcmcia/ss.h>
41#include <pcmcia/cistpl.h>
42#include <pcmcia/ds.h>
43
40#include "pasemi.h" 44#include "pasemi.h"
41 45
42/* SDC reset register, must be pre-mapped at reset time */ 46/* SDC reset register, must be pre-mapped at reset time */
@@ -308,7 +312,57 @@ static void __init pas_init_early(void)
308 iommu_init_early_pasemi(); 312 iommu_init_early_pasemi();
309} 313}
310 314
315#ifdef CONFIG_PCMCIA
316static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
317 void *data)
318{
319 struct device *dev = data;
320 struct device *parent;
321 struct pcmcia_device *pdev = to_pcmcia_dev(dev);
322
323 /* We are only intereted in device addition */
324 if (action != BUS_NOTIFY_ADD_DEVICE)
325 return 0;
326
327 parent = pdev->socket->dev.parent;
328
329 /* We know electra_cf devices will always have of_node set, since
330 * electra_cf is an of_platform driver.
331 */
332 if (!parent->archdata.of_node)
333 return 0;
334
335 if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf"))
336 return 0;
337
338 /* We use the direct ops for localbus */
339 dev->archdata.dma_ops = &dma_direct_ops;
340
341 return 0;
342}
343
344static struct notifier_block pcmcia_notifier = {
345 .notifier_call = pcmcia_notify,
346};
347
348static inline void pasemi_pcmcia_init(void)
349{
350 extern struct bus_type pcmcia_bus_type;
351
352 bus_register_notifier(&pcmcia_bus_type, &pcmcia_notifier);
353}
354
355#else
356
357static inline void pasemi_pcmcia_init(void)
358{
359}
360
361#endif
362
363
311static struct of_device_id pasemi_bus_ids[] = { 364static struct of_device_id pasemi_bus_ids[] = {
365 { .type = "localbus", },
312 { .type = "sdc", }, 366 { .type = "sdc", },
313 {}, 367 {},
314}; 368};
@@ -318,6 +372,8 @@ static int __init pasemi_publish_devices(void)
318 if (!machine_is(pasemi)) 372 if (!machine_is(pasemi))
319 return 0; 373 return 0;
320 374
375 pasemi_pcmcia_init();
376
321 /* Publish OF platform devices for SDC and other non-PCI devices */ 377 /* Publish OF platform devices for SDC and other non-PCI devices */
322 of_platform_bus_probe(NULL, pasemi_bus_ids, NULL); 378 of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
323 379
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 5236fdb17fcb..50b85d07ddd2 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -58,9 +58,9 @@
58#include <linux/vfs.h> 58#include <linux/vfs.h>
59#include <linux/ptrace.h> 59#include <linux/ptrace.h>
60#include <linux/fadvise.h> 60#include <linux/fadvise.h>
61#include <linux/ipc.h>
61 62
62#include <asm/types.h> 63#include <asm/types.h>
63#include <asm/ipc.h>
64#include <asm/uaccess.h> 64#include <asm/uaccess.h>
65#include <asm/semaphore.h> 65#include <asm/semaphore.h>
66 66
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 1eaff84a1eb6..fefee99f28aa 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -28,9 +28,9 @@
28#include <linux/utsname.h> 28#include <linux/utsname.h>
29#include <linux/personality.h> 29#include <linux/personality.h>
30#include <linux/unistd.h> 30#include <linux/unistd.h>
31#include <linux/ipc.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/ipc.h>
34 34
35/* 35/*
36 * sys_pipe() is the normal C calling standard for creating 36 * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index fabc50adc46a..d4ed93dfb9c7 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -17,6 +17,7 @@
17#include <linux/ctype.h> 17#include <linux/ctype.h>
18#include <linux/swap.h> 18#include <linux/swap.h>
19#include <linux/kthread.h> 19#include <linux/kthread.h>
20#include <linux/oom.h>
20 21
21#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
diff --git a/arch/sh/drivers/pci/dma-dreamcast.c b/arch/sh/drivers/pci/dma-dreamcast.c
index 230d6ec0d239..888a34050599 100644
--- a/arch/sh/drivers/pci/dma-dreamcast.c
+++ b/arch/sh/drivers/pci/dma-dreamcast.c
@@ -51,7 +51,7 @@ void *dreamcast_consistent_alloc(struct device *dev, size_t size,
51 buf = P2SEGADDR(buf); 51 buf = P2SEGADDR(buf);
52 52
53 /* Flush the dcache before we hand off the buffer */ 53 /* Flush the dcache before we hand off the buffer */
54 dma_cache_wback_inv((void *)buf, size); 54 __flush_purge_region((void *)buf, size);
55 55
56 return (void *)buf; 56 return (void *)buf;
57} 57}
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 024ce5dedd8c..d545a686a201 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -22,9 +22,9 @@
22#include <linux/utsname.h> 22#include <linux/utsname.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/ipc.h>
25#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/ipc.h>
28#include <asm/unistd.h> 28#include <asm/unistd.h>
29 29
30/* 30/*
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 38c82d890ffd..e220c29a3c00 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -34,7 +34,7 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle)
34 /* 34 /*
35 * We must flush the cache before we pass it on to the device 35 * We must flush the cache before we pass it on to the device
36 */ 36 */
37 dma_cache_wback_inv(ret, size); 37 __flush_purge_region(ret, size);
38 38
39 page = virt_to_page(ret); 39 page = virt_to_page(ret);
40 free = page + (size >> PAGE_SHIFT); 40 free = page + (size >> PAGE_SHIFT);
@@ -68,13 +68,13 @@ void consistent_sync(void *vaddr, size_t size, int direction)
68 68
69 switch (direction) { 69 switch (direction) {
70 case DMA_FROM_DEVICE: /* invalidate only */ 70 case DMA_FROM_DEVICE: /* invalidate only */
71 dma_cache_inv(p1addr, size); 71 __flush_invalidate_region(p1addr, size);
72 break; 72 break;
73 case DMA_TO_DEVICE: /* writeback only */ 73 case DMA_TO_DEVICE: /* writeback only */
74 dma_cache_wback(p1addr, size); 74 __flush_wback_region(p1addr, size);
75 break; 75 break;
76 case DMA_BIDIRECTIONAL: /* writeback and invalidate */ 76 case DMA_BIDIRECTIONAL: /* writeback and invalidate */
77 dma_cache_wback_inv(p1addr, size); 77 __flush_purge_region(p1addr, size);
78 break; 78 break;
79 default: 79 default:
80 BUG(); 80 BUG();
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 7d43758dc244..1d45b82f0a63 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -292,8 +292,7 @@ void pmb_unmap(unsigned long addr)
292 } while (pmbe); 292 } while (pmbe);
293} 293}
294 294
295static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep, 295static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
296 unsigned long flags)
297{ 296{
298 struct pmb_entry *pmbe = pmb; 297 struct pmb_entry *pmbe = pmb;
299 298
diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c
index b7f18e298a20..de0a303ba26f 100644
--- a/arch/sh64/kernel/sys_sh64.c
+++ b/arch/sh64/kernel/sys_sh64.c
@@ -29,8 +29,8 @@
29#include <linux/file.h> 29#include <linux/file.h>
30#include <linux/utsname.h> 30#include <linux/utsname.h>
31#include <linux/syscalls.h> 31#include <linux/syscalls.h>
32#include <linux/ipc.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/ipc.h>
34#include <asm/ptrace.h> 34#include <asm/ptrace.h>
35#include <asm/unistd.h> 35#include <asm/unistd.h>
36 36
diff --git a/arch/sh64/mm/consistent.c b/arch/sh64/mm/consistent.c
index 8875a2a40da7..c439620402cb 100644
--- a/arch/sh64/mm/consistent.c
+++ b/arch/sh64/mm/consistent.c
@@ -11,6 +11,7 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/dma-mapping.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <asm/io.h> 16#include <asm/io.h>
16 17
@@ -32,7 +33,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
32 if (vp != NULL) { 33 if (vp != NULL) {
33 memset(vp, 0, size); 34 memset(vp, 0, size);
34 *dma_handle = virt_to_phys(ret); 35 *dma_handle = virt_to_phys(ret);
35 dma_cache_wback_inv((unsigned long)ret, size); 36 dma_cache_sync(NULL, ret, size, DMA_BIDIRECTIONAL);
36 } 37 }
37 38
38 return vp; 39 return vp;
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9d327ec59759..c0f4ba109daa 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -321,7 +321,6 @@ endmenu
321source "fs/Kconfig" 321source "fs/Kconfig"
322 322
323menu "Instrumentation Support" 323menu "Instrumentation Support"
324 depends on EXPERIMENTAL
325 324
326source "arch/sparc/oprofile/Kconfig" 325source "arch/sparc/oprofile/Kconfig"
327 326
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index a954a0c00000..6c0221e9a9f5 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -21,9 +21,9 @@
21#include <linux/utsname.h> 21#include <linux/utsname.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
24#include <linux/ipc.h>
24 25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/ipc.h>
27#include <asm/unistd.h> 27#include <asm/unistd.h>
28 28
29/* #define DEBUG_UNIMP_SYSCALL */ 29/* #define DEBUG_UNIMP_SYSCALL */
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 2f22fa90461a..59c4d752d286 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -461,7 +461,6 @@ source "drivers/fc4/Kconfig"
461source "fs/Kconfig" 461source "fs/Kconfig"
462 462
463menu "Instrumentation Support" 463menu "Instrumentation Support"
464 depends on EXPERIMENTAL
465 464
466source "arch/sparc64/oprofile/Kconfig" 465source "arch/sparc64/oprofile/Kconfig"
467 466
diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c
index d208cc7804f2..92c1b36a2e16 100644
--- a/arch/sparc64/kernel/binfmt_aout32.c
+++ b/arch/sparc64/kernel/binfmt_aout32.c
@@ -35,11 +35,14 @@
35 35
36static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs); 36static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs);
37static int load_aout32_library(struct file*); 37static int load_aout32_library(struct file*);
38static int aout32_core_dump(long signr, struct pt_regs * regs, struct file *file); 38static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
39 39
40static struct linux_binfmt aout32_format = { 40static struct linux_binfmt aout32_format = {
41 NULL, THIS_MODULE, load_aout32_binary, load_aout32_library, aout32_core_dump, 41 .module = THIS_MODULE,
42 PAGE_SIZE 42 .load_binary = load_aout32_binary,
43 .load_shlib = load_aout32_library,
44 .core_dump = aout32_core_dump,
45 .min_coredump = PAGE_SIZE,
43}; 46};
44 47
45static void set_brk(unsigned long start, unsigned long end) 48static void set_brk(unsigned long start, unsigned long end)
@@ -83,7 +86,7 @@ if (file->f_op->llseek) { \
83 * dumping of the process results in another error.. 86 * dumping of the process results in another error..
84 */ 87 */
85 88
86static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file) 89static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
87{ 90{
88 mm_segment_t fs; 91 mm_segment_t fs;
89 int has_dumped = 0; 92 int has_dumped = 0;
@@ -102,13 +105,11 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
102 105
103/* If the size of the dump file exceeds the rlimit, then see what would happen 106/* If the size of the dump file exceeds the rlimit, then see what would happen
104 if we wrote the stack, but not the data area. */ 107 if we wrote the stack, but not the data area. */
105 if ((dump.u_dsize+dump.u_ssize) > 108 if (dump.u_dsize + dump.u_ssize > limit)
106 current->signal->rlim[RLIMIT_CORE].rlim_cur)
107 dump.u_dsize = 0; 109 dump.u_dsize = 0;
108 110
109/* Make sure we have enough room to write the stack and data areas. */ 111/* Make sure we have enough room to write the stack and data areas. */
110 if ((dump.u_ssize) > 112 if (dump.u_ssize > limit)
111 current->signal->rlim[RLIMIT_CORE].rlim_cur)
112 dump.u_ssize = 0; 113 dump.u_ssize = 0;
113 114
114/* make sure we actually have a data and stack area to dump */ 115/* make sure we actually have a data and stack area to dump */
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 0d5c50264945..560cb1edb1d0 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -26,7 +26,6 @@
26#include <linux/random.h> 26#include <linux/random.h>
27 27
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/ipc.h>
30#include <asm/utrap.h> 29#include <asm/utrap.h>
31#include <asm/perfctr.h> 30#include <asm/perfctr.h>
32#include <asm/a.out.h> 31#include <asm/a.out.h>
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index e8dce90d05d4..78caff926737 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -54,7 +54,6 @@
54#include <linux/highuid.h> 54#include <linux/highuid.h>
55 55
56#include <asm/types.h> 56#include <asm/types.h>
57#include <asm/ipc.h>
58#include <asm/uaccess.h> 57#include <asm/uaccess.h>
59#include <asm/fpumacro.h> 58#include <asm/fpumacro.h>
60#include <asm/semaphore.h> 59#include <asm/semaphore.h>
diff --git a/arch/sparc64/solaris/ipc.c b/arch/sparc64/solaris/ipc.c
index a531a2cdb381..499135fa7060 100644
--- a/arch/sparc64/solaris/ipc.c
+++ b/arch/sparc64/solaris/ipc.c
@@ -11,10 +11,10 @@
11#include <linux/shm.h> 11#include <linux/shm.h>
12#include <linux/sem.h> 12#include <linux/sem.h>
13#include <linux/msg.h> 13#include <linux/msg.h>
14#include <linux/ipc.h>
14 15
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16#include <asm/string.h> 17#include <asm/string.h>
17#include <asm/ipc.h>
18 18
19#include "conv.h" 19#include "conv.h"
20 20
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c
index 710d5fb807e1..e2d142684412 100644
--- a/arch/um/sys-i386/syscalls.c
+++ b/arch/um/sys-i386/syscalls.c
@@ -5,7 +5,7 @@
5 5
6#include "linux/sched.h" 6#include "linux/sched.h"
7#include "linux/shm.h" 7#include "linux/shm.h"
8#include "asm/ipc.h" 8#include "linux/ipc.h"
9#include "asm/mman.h" 9#include "asm/mman.h"
10#include "asm/uaccess.h" 10#include "asm/uaccess.h"
11#include "asm/unistd.h" 11#include "asm/unistd.h"
diff --git a/arch/v850/kernel/syscalls.c b/arch/v850/kernel/syscalls.c
index f9f00ccf5324..0a4df4d6e05f 100644
--- a/arch/v850/kernel/syscalls.c
+++ b/arch/v850/kernel/syscalls.c
@@ -30,7 +30,6 @@
30#include <linux/file.h> 30#include <linux/file.h>
31 31
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <asm/ipc.h>
34#include <asm/semaphore.h> 33#include <asm/semaphore.h>
35#include <asm/unistd.h> 34#include <asm/unistd.h>
36 35
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index e8756e5f6b29..89dbf970e058 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -39,6 +39,7 @@ setup-y += printf.o string.o tty.o video.o version.o voyager.o
39setup-y += video-vga.o 39setup-y += video-vga.o
40setup-y += video-vesa.o 40setup-y += video-vesa.o
41setup-y += video-bios.o 41setup-y += video-bios.o
42
42targets += $(setup-y) 43targets += $(setup-y)
43hostprogs-y := tools/build 44hostprogs-y := tools/build
44 45
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 08781370256d..7cf1c29bf90e 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -40,7 +40,7 @@ static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
40static int load_aout_library(struct file*); 40static int load_aout_library(struct file*);
41 41
42#ifdef CORE_DUMP 42#ifdef CORE_DUMP
43static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 43static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
44 44
45/* 45/*
46 * fill in the user structure for a core dump.. 46 * fill in the user structure for a core dump..
@@ -148,7 +148,7 @@ if (file->f_op->llseek) { \
148 * dumping of the process results in another error.. 148 * dumping of the process results in another error..
149 */ 149 */
150 150
151static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file) 151static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
152{ 152{
153 mm_segment_t fs; 153 mm_segment_t fs;
154 int has_dumped = 0; 154 int has_dumped = 0;
@@ -168,13 +168,11 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
168 168
169/* If the size of the dump file exceeds the rlimit, then see what would happen 169/* If the size of the dump file exceeds the rlimit, then see what would happen
170 if we wrote the stack, but not the data area. */ 170 if we wrote the stack, but not the data area. */
171 if ((dump.u_dsize+dump.u_ssize+1) * PAGE_SIZE > 171 if ((dump.u_dsize + dump.u_ssize + 1) * PAGE_SIZE > limit)
172 current->signal->rlim[RLIMIT_CORE].rlim_cur)
173 dump.u_dsize = 0; 172 dump.u_dsize = 0;
174 173
175/* Make sure we have enough room to write the stack and data areas. */ 174/* Make sure we have enough room to write the stack and data areas. */
176 if ((dump.u_ssize+1) * PAGE_SIZE > 175 if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
177 current->signal->rlim[RLIMIT_CORE].rlim_cur)
178 dump.u_ssize = 0; 176 dump.u_ssize = 0;
179 177
180/* make sure we actually have a data and stack area to dump */ 178/* make sure we actually have a data and stack area to dump */
diff --git a/arch/x86/ia32/ia32_binfmt.c b/arch/x86/ia32/ia32_binfmt.c
index dffd2ac72747..d3c53e8b05c0 100644
--- a/arch/x86/ia32/ia32_binfmt.c
+++ b/arch/x86/ia32/ia32_binfmt.c
@@ -188,6 +188,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
188} 188}
189 189
190#define ELF_CORE_COPY_XFPREGS 1 190#define ELF_CORE_COPY_XFPREGS 1
191#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
191static inline int 192static inline int
192elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) 193elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
193{ 194{
diff --git a/arch/x86/ia32/ipc32.c b/arch/x86/ia32/ipc32.c
index 2e1869ec4db4..7b3342e5aab5 100644
--- a/arch/x86/ia32/ipc32.c
+++ b/arch/x86/ia32/ipc32.c
@@ -9,8 +9,6 @@
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/compat.h> 10#include <linux/compat.h>
11 11
12#include <asm/ipc.h>
13
14asmlinkage long 12asmlinkage long
15sys32_ipc(u32 call, int first, int second, int third, 13sys32_ipc(u32 call, int first, int second, int third,
16 compat_uptr_t ptr, u32 fifth) 14 compat_uptr_t ptr, u32 fifth)
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 0f4d5e209e9b..e422b8159f69 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -24,7 +24,7 @@
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/e820.h> 25#include <asm/e820.h>
26#include <asm/proto.h> 26#include <asm/proto.h>
27#include <asm/bootsetup.h> 27#include <asm/setup.h>
28#include <asm/sections.h> 28#include <asm/sections.h>
29 29
30struct e820map e820; 30struct e820map e820;
@@ -68,10 +68,15 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
68 68
69 /* initrd */ 69 /* initrd */
70#ifdef CONFIG_BLK_DEV_INITRD 70#ifdef CONFIG_BLK_DEV_INITRD
71 if (LOADER_TYPE && INITRD_START && last >= INITRD_START && 71 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
72 addr < INITRD_START+INITRD_SIZE) { 72 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
73 *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); 73 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
74 return 1; 74 unsigned long ramdisk_end = ramdisk_image+ramdisk_size;
75
76 if (last >= ramdisk_image && addr < ramdisk_end) {
77 *addrp = PAGE_ALIGN(ramdisk_end);
78 return 1;
79 }
75 } 80 }
76#endif 81#endif
77 /* kernel code */ 82 /* kernel code */
@@ -594,8 +599,8 @@ void __init setup_memory_region(void)
594 * Otherwise fake a memory map; one section from 0k->640k, 599 * Otherwise fake a memory map; one section from 0k->640k,
595 * the next section from 1mb->appropriate_mem_k 600 * the next section from 1mb->appropriate_mem_k
596 */ 601 */
597 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 602 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
598 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) 603 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
599 early_panic("Cannot find a valid memory map"); 604 early_panic("Cannot find a valid memory map");
600 printk(KERN_INFO "BIOS-provided physical RAM map:\n"); 605 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
601 e820_print_map("BIOS-e820"); 606 e820_print_map("BIOS-e820");
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index fd9aff3f3890..b7d6c23f2871 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -6,15 +6,10 @@
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/fcntl.h> 8#include <asm/fcntl.h>
9#include <asm/setup.h>
9#include <xen/hvc-console.h> 10#include <xen/hvc-console.h>
10 11
11/* Simple VGA output */ 12/* Simple VGA output */
12
13#ifdef __i386__
14#include <asm/setup.h>
15#else
16#include <asm/bootsetup.h>
17#endif
18#define VGABASE (__ISA_IO_base + 0xb8000) 13#define VGABASE (__ISA_IO_base + 0xb8000)
19 14
20static int max_ypos = 25, max_xpos = 80; 15static int max_ypos = 25, max_xpos = 80;
@@ -234,10 +229,10 @@ static int __init setup_early_printk(char *buf)
234 early_serial_init(buf); 229 early_serial_init(buf);
235 early_console = &early_serial_console; 230 early_console = &early_serial_console;
236 } else if (!strncmp(buf, "vga", 3) 231 } else if (!strncmp(buf, "vga", 3)
237 && SCREEN_INFO.orig_video_isVGA == 1) { 232 && boot_params.screen_info.orig_video_isVGA == 1) {
238 max_xpos = SCREEN_INFO.orig_video_cols; 233 max_xpos = boot_params.screen_info.orig_video_cols;
239 max_ypos = SCREEN_INFO.orig_video_lines; 234 max_ypos = boot_params.screen_info.orig_video_lines;
240 current_ypos = SCREEN_INFO.orig_y; 235 current_ypos = boot_params.screen_info.orig_y;
241 early_console = &early_vga_console; 236 early_console = &early_vga_console;
242 } else if (!strncmp(buf, "simnow", 6)) { 237 } else if (!strncmp(buf, "simnow", 6)) {
243 simnow_init(buf + 6); 238 simnow_init(buf + 6);
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index 2452c6fbe992..b42558c48e9d 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -331,11 +331,13 @@ void __init efi_init(void)
331 memset(&efi, 0, sizeof(efi) ); 331 memset(&efi, 0, sizeof(efi) );
332 memset(&efi_phys, 0, sizeof(efi_phys)); 332 memset(&efi_phys, 0, sizeof(efi_phys));
333 333
334 efi_phys.systab = EFI_SYSTAB; 334 efi_phys.systab =
335 memmap.phys_map = EFI_MEMMAP; 335 (efi_system_table_t *)boot_params.efi_info.efi_systab;
336 memmap.nr_map = EFI_MEMMAP_SIZE/EFI_MEMDESC_SIZE; 336 memmap.phys_map = (void *)boot_params.efi_info.efi_memmap;
337 memmap.desc_version = EFI_MEMDESC_VERSION; 337 memmap.nr_map = boot_params.efi_info.efi_memmap_size/
338 memmap.desc_size = EFI_MEMDESC_SIZE; 338 boot_params.efi_info.efi_memdesc_size;
339 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
340 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
339 341
340 efi.systab = (efi_system_table_t *) 342 efi.systab = (efi_system_table_t *)
341 boot_ioremap((unsigned long) efi_phys.systab, 343 boot_ioremap((unsigned long) efi_phys.systab,
@@ -446,7 +448,8 @@ void __init efi_init(void)
446 printk(KERN_ERR PFX "Could not map the runtime service table!\n"); 448 printk(KERN_ERR PFX "Could not map the runtime service table!\n");
447 449
448 /* Map the EFI memory map for use until paging_init() */ 450 /* Map the EFI memory map for use until paging_init() */
449 memmap.map = boot_ioremap((unsigned long) EFI_MEMMAP, EFI_MEMMAP_SIZE); 451 memmap.map = boot_ioremap(boot_params.efi_info.efi_memmap,
452 boot_params.efi_info.efi_memmap_size);
450 if (memmap.map == NULL) 453 if (memmap.map == NULL)
451 printk(KERN_ERR PFX "Could not map the EFI memory map!\n"); 454 printk(KERN_ERR PFX "Could not map the EFI memory map!\n");
452 455
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 8561f626edad..a7eee0a4751d 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -14,7 +14,6 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/proto.h> 15#include <asm/proto.h>
16#include <asm/smp.h> 16#include <asm/smp.h>
17#include <asm/bootsetup.h>
18#include <asm/setup.h> 17#include <asm/setup.h>
19#include <asm/desc.h> 18#include <asm/desc.h>
20#include <asm/pgtable.h> 19#include <asm/pgtable.h>
@@ -36,26 +35,15 @@ static void __init clear_bss(void)
36 (unsigned long) __bss_stop - (unsigned long) __bss_start); 35 (unsigned long) __bss_stop - (unsigned long) __bss_start);
37} 36}
38 37
39#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
40#define OLD_CL_MAGIC_ADDR 0x20
41#define OLD_CL_MAGIC 0xA33F
42#define OLD_CL_OFFSET 0x22
43
44static void __init copy_bootdata(char *real_mode_data) 38static void __init copy_bootdata(char *real_mode_data)
45{ 39{
46 unsigned long new_data;
47 char * command_line; 40 char * command_line;
48 41
49 memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); 42 memcpy(&boot_params, real_mode_data, sizeof boot_params);
50 new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); 43 if (boot_params.hdr.cmd_line_ptr) {
51 if (!new_data) { 44 command_line = __va(boot_params.hdr.cmd_line_ptr);
52 if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { 45 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
53 return;
54 }
55 new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET);
56 } 46 }
57 command_line = __va(new_data);
58 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
59} 47}
60 48
61void __init x86_64_start_kernel(char * real_mode_data) 49void __init x86_64_start_kernel(char * real_mode_data)
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index deda9a221cf2..8459ca64bc2f 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -10,6 +10,7 @@
10#include <linux/kexec.h> 10#include <linux/kexec.h>
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/numa.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
14#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
15#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
@@ -169,3 +170,15 @@ static int __init parse_crashkernel(char *arg)
169 return 0; 170 return 0;
170} 171}
171early_param("crashkernel", parse_crashkernel); 172early_param("crashkernel", parse_crashkernel);
173
174void arch_crash_save_vmcoreinfo(void)
175{
176#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
177 VMCOREINFO_SYMBOL(node_data);
178 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
179#endif
180#ifdef CONFIG_X86_PAE
181 VMCOREINFO_CONFIG(X86_PAE);
182#endif
183}
184
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index cd1899a2f0c5..7450b69710b5 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -10,6 +10,7 @@
10#include <linux/kexec.h> 10#include <linux/kexec.h>
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/reboot.h> 12#include <linux/reboot.h>
13#include <linux/numa.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
14#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
15#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
@@ -257,3 +258,11 @@ static int __init setup_crashkernel(char *arg)
257} 258}
258early_param("crashkernel", setup_crashkernel); 259early_param("crashkernel", setup_crashkernel);
259 260
261void arch_crash_save_vmcoreinfo(void)
262{
263#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
264 VMCOREINFO_SYMBOL(node_data);
265 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
266#endif
267}
268
diff --git a/arch/x86/kernel/mce_64.c b/arch/x86/kernel/mce_64.c
index a66d607f5b92..97d2b757d6bd 100644
--- a/arch/x86/kernel/mce_64.c
+++ b/arch/x86/kernel/mce_64.c
@@ -76,9 +76,6 @@ void mce_log(struct mce *mce)
76 wmb(); 76 wmb();
77 for (;;) { 77 for (;;) {
78 entry = rcu_dereference(mcelog.next); 78 entry = rcu_dereference(mcelog.next);
79 /* The rmb forces the compiler to reload next in each
80 iteration */
81 rmb();
82 for (;;) { 79 for (;;) {
83 /* When the buffer fills up discard new entries. Assume 80 /* When the buffer fills up discard new entries. Assume
84 that the earlier errors are the more interesting. */ 81 that the earlier errors are the more interesting. */
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
index 1200aaac403e..ba9188235057 100644
--- a/arch/x86/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
@@ -11,7 +11,6 @@
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <asm/bootsetup.h>
15#include <asm/pda.h> 14#include <asm/pda.h>
16#include <asm/pgtable.h> 15#include <asm/pgtable.h>
17#include <asm/processor.h> 16#include <asm/processor.h>
@@ -23,8 +22,9 @@
23#include <asm/percpu.h> 22#include <asm/percpu.h>
24#include <asm/proto.h> 23#include <asm/proto.h>
25#include <asm/sections.h> 24#include <asm/sections.h>
25#include <asm/setup.h>
26 26
27char x86_boot_params[BOOT_PARAM_SIZE] __initdata; 27struct boot_params __initdata boot_params;
28 28
29cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 29cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
30 30
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index c8e1bc38d421..b87a6fd5ba48 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -137,10 +137,11 @@ EXPORT_SYMBOL(edd);
137 */ 137 */
138static inline void copy_edd(void) 138static inline void copy_edd(void)
139{ 139{
140 memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); 140 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
141 memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); 141 sizeof(edd.mbr_signature));
142 edd.mbr_signature_nr = EDD_MBR_SIG_NR; 142 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
143 edd.edd_info_nr = EDD_NR; 143 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
144 edd.edd_info_nr = boot_params.eddbuf_entries;
144} 145}
145#else 146#else
146static inline void copy_edd(void) 147static inline void copy_edd(void)
@@ -434,17 +435,20 @@ void __init setup_bootmem_allocator(void)
434#endif 435#endif
435 numa_kva_reserve(); 436 numa_kva_reserve();
436#ifdef CONFIG_BLK_DEV_INITRD 437#ifdef CONFIG_BLK_DEV_INITRD
437 if (LOADER_TYPE && INITRD_START) { 438 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
438 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 439 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
439 reserve_bootmem(INITRD_START, INITRD_SIZE); 440 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
440 initrd_start = INITRD_START + PAGE_OFFSET; 441 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
441 initrd_end = initrd_start+INITRD_SIZE; 442 unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
442 } 443
443 else { 444 if (ramdisk_end <= end_of_lowmem) {
445 reserve_bootmem(ramdisk_image, ramdisk_size);
446 initrd_start = ramdisk_image + PAGE_OFFSET;
447 initrd_end = initrd_start+ramdisk_size;
448 } else {
444 printk(KERN_ERR "initrd extends beyond end of memory " 449 printk(KERN_ERR "initrd extends beyond end of memory "
445 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 450 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
446 INITRD_START + INITRD_SIZE, 451 ramdisk_end, end_of_lowmem);
447 max_low_pfn << PAGE_SHIFT);
448 initrd_start = 0; 452 initrd_start = 0;
449 } 453 }
450 } 454 }
@@ -512,28 +516,29 @@ void __init setup_arch(char **cmdline_p)
512 * the system table is valid. If not, then initialize normally. 516 * the system table is valid. If not, then initialize normally.
513 */ 517 */
514#ifdef CONFIG_EFI 518#ifdef CONFIG_EFI
515 if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) 519 if ((boot_params.hdr.type_of_loader == 0x50) &&
520 boot_params.efi_info.efi_systab)
516 efi_enabled = 1; 521 efi_enabled = 1;
517#endif 522#endif
518 523
519 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 524 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
520 screen_info = SCREEN_INFO; 525 screen_info = boot_params.screen_info;
521 edid_info = EDID_INFO; 526 edid_info = boot_params.edid_info;
522 apm_info.bios = APM_BIOS_INFO; 527 apm_info.bios = boot_params.apm_bios_info;
523 ist_info = IST_INFO; 528 ist_info = boot_params.ist_info;
524 saved_videomode = VIDEO_MODE; 529 saved_videomode = boot_params.hdr.vid_mode;
525 if( SYS_DESC_TABLE.length != 0 ) { 530 if( boot_params.sys_desc_table.length != 0 ) {
526 set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); 531 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
527 machine_id = SYS_DESC_TABLE.table[0]; 532 machine_id = boot_params.sys_desc_table.table[0];
528 machine_submodel_id = SYS_DESC_TABLE.table[1]; 533 machine_submodel_id = boot_params.sys_desc_table.table[1];
529 BIOS_revision = SYS_DESC_TABLE.table[2]; 534 BIOS_revision = boot_params.sys_desc_table.table[2];
530 } 535 }
531 bootloader_type = LOADER_TYPE; 536 bootloader_type = boot_params.hdr.type_of_loader;
532 537
533#ifdef CONFIG_BLK_DEV_RAM 538#ifdef CONFIG_BLK_DEV_RAM
534 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 539 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
535 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 540 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
536 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); 541 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
537#endif 542#endif
538 ARCH_SETUP 543 ARCH_SETUP
539 if (efi_enabled) 544 if (efi_enabled)
@@ -545,7 +550,7 @@ void __init setup_arch(char **cmdline_p)
545 550
546 copy_edd(); 551 copy_edd();
547 552
548 if (!MOUNT_ROOT_RDONLY) 553 if (!boot_params.hdr.root_flags)
549 root_mountflags &= ~MS_RDONLY; 554 root_mountflags &= ~MS_RDONLY;
550 init_mm.start_code = (unsigned long) _text; 555 init_mm.start_code = (unsigned long) _text;
551 init_mm.end_code = (unsigned long) _etext; 556 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 85b5b6310acc..8159bf0be17a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -52,7 +52,6 @@
52#include <asm/dma.h> 52#include <asm/dma.h>
53#include <asm/mpspec.h> 53#include <asm/mpspec.h>
54#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
55#include <asm/bootsetup.h>
56#include <asm/proto.h> 55#include <asm/proto.h>
57#include <asm/setup.h> 56#include <asm/setup.h>
58#include <asm/mach_apic.h> 57#include <asm/mach_apic.h>
@@ -180,10 +179,11 @@ EXPORT_SYMBOL(edd);
180 */ 179 */
181static inline void copy_edd(void) 180static inline void copy_edd(void)
182{ 181{
183 memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); 182 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
184 memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); 183 sizeof(edd.mbr_signature));
185 edd.mbr_signature_nr = EDD_MBR_SIG_NR; 184 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
186 edd.edd_info_nr = EDD_NR; 185 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
186 edd.edd_info_nr = boot_params.eddbuf_entries;
187} 187}
188#else 188#else
189static inline void copy_edd(void) 189static inline void copy_edd(void)
@@ -220,21 +220,21 @@ void __init setup_arch(char **cmdline_p)
220{ 220{
221 printk(KERN_INFO "Command line: %s\n", boot_command_line); 221 printk(KERN_INFO "Command line: %s\n", boot_command_line);
222 222
223 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 223 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
224 screen_info = SCREEN_INFO; 224 screen_info = boot_params.screen_info;
225 edid_info = EDID_INFO; 225 edid_info = boot_params.edid_info;
226 saved_video_mode = SAVED_VIDEO_MODE; 226 saved_video_mode = boot_params.hdr.vid_mode;
227 bootloader_type = LOADER_TYPE; 227 bootloader_type = boot_params.hdr.type_of_loader;
228 228
229#ifdef CONFIG_BLK_DEV_RAM 229#ifdef CONFIG_BLK_DEV_RAM
230 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 230 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
231 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 231 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
232 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); 232 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
233#endif 233#endif
234 setup_memory_region(); 234 setup_memory_region();
235 copy_edd(); 235 copy_edd();
236 236
237 if (!MOUNT_ROOT_RDONLY) 237 if (!boot_params.hdr.root_flags)
238 root_mountflags &= ~MS_RDONLY; 238 root_mountflags &= ~MS_RDONLY;
239 init_mm.start_code = (unsigned long) &_text; 239 init_mm.start_code = (unsigned long) &_text;
240 init_mm.end_code = (unsigned long) &_etext; 240 init_mm.end_code = (unsigned long) &_etext;
@@ -339,17 +339,20 @@ void __init setup_arch(char **cmdline_p)
339 */ 339 */
340 find_smp_config(); 340 find_smp_config();
341#ifdef CONFIG_BLK_DEV_INITRD 341#ifdef CONFIG_BLK_DEV_INITRD
342 if (LOADER_TYPE && INITRD_START) { 342 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
343 if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { 343 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
344 reserve_bootmem_generic(INITRD_START, INITRD_SIZE); 344 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
345 initrd_start = INITRD_START + PAGE_OFFSET; 345 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
346 initrd_end = initrd_start+INITRD_SIZE; 346 unsigned long end_of_mem = end_pfn << PAGE_SHIFT;
347 } 347
348 else { 348 if (ramdisk_end <= end_of_mem) {
349 reserve_bootmem_generic(ramdisk_image, ramdisk_size);
350 initrd_start = ramdisk_image + PAGE_OFFSET;
351 initrd_end = initrd_start+ramdisk_size;
352 } else {
349 printk(KERN_ERR "initrd extends beyond end of memory " 353 printk(KERN_ERR "initrd extends beyond end of memory "
350 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 354 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
351 (unsigned long)(INITRD_START + INITRD_SIZE), 355 ramdisk_end, end_of_mem);
352 (unsigned long)(end_pfn << PAGE_SHIFT));
353 initrd_start = 0; 356 initrd_start = 0;
354 } 357 }
355 } 358 }
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index f8bae9ba0324..a86d26f036e1 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -17,10 +17,10 @@
17#include <linux/mman.h> 17#include <linux/mman.h>
18#include <linux/file.h> 18#include <linux/file.h>
19#include <linux/utsname.h> 19#include <linux/utsname.h>
20#include <linux/ipc.h>
20 21
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22#include <asm/unistd.h> 23#include <asm/unistd.h>
23#include <asm/ipc.h>
24 24
25/* 25/*
26 * sys_pipe() is the normal C calling standard for creating 26 * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index 7f635c7a2381..1bd82983986d 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -159,16 +159,18 @@ char * __init machine_specific_memory_setup(void)
159 * Otherwise fake a memory map; one section from 0k->640k, 159 * Otherwise fake a memory map; one section from 0k->640k,
160 * the next section from 1mb->appropriate_mem_k 160 * the next section from 1mb->appropriate_mem_k
161 */ 161 */
162 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 162 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
163 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 163 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
164 < 0) {
164 unsigned long mem_size; 165 unsigned long mem_size;
165 166
166 /* compare results from other methods and take the greater */ 167 /* compare results from other methods and take the greater */
167 if (ALT_MEM_K < EXT_MEM_K) { 168 if (boot_params.alt_mem_k
168 mem_size = EXT_MEM_K; 169 < boot_params.screen_info.ext_mem_k) {
170 mem_size = boot_params.screen_info.ext_mem_k;
169 who = "BIOS-88"; 171 who = "BIOS-88";
170 } else { 172 } else {
171 mem_size = ALT_MEM_K; 173 mem_size = boot_params.alt_mem_k;
172 who = "BIOS-e801"; 174 who = "BIOS-e801";
173 } 175 }
174 176
diff --git a/arch/x86/mach-visws/setup.c b/arch/x86/mach-visws/setup.c
index 1f81f10e03a0..de4c9dbd086f 100644
--- a/arch/x86/mach-visws/setup.c
+++ b/arch/x86/mach-visws/setup.c
@@ -152,7 +152,7 @@ char * __init machine_specific_memory_setup(void)
152{ 152{
153 long long gfx_mem_size = 8 * MB; 153 long long gfx_mem_size = 8 * MB;
154 154
155 mem_size = ALT_MEM_K; 155 mem_size = boot_params.alt_mem_k;
156 156
157 if (!mem_size) { 157 if (!mem_size) {
158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n"); 158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index 2b55694e6400..a0ab4002abcd 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -83,7 +83,7 @@ char * __init machine_specific_memory_setup(void)
83 83
84 if(inb(catbase) != VOYAGER_DINO) { 84 if(inb(catbase) != VOYAGER_DINO) {
85 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); 85 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
86 tom = (EXT_MEM_K)<<10; 86 tom = (boot_params.screen_info.ext_mem_k)<<10;
87 } 87 }
88 who = "Voyager-TOM"; 88 who = "Voyager-TOM";
89 add_memory_region(0, 0x9f000, E820_RAM); 89 add_memory_region(0, 0x9f000, E820_RAM);
@@ -104,16 +104,18 @@ char * __init machine_specific_memory_setup(void)
104 * Otherwise fake a memory map; one section from 0k->640k, 104 * Otherwise fake a memory map; one section from 0k->640k,
105 * the next section from 1mb->appropriate_mem_k 105 * the next section from 1mb->appropriate_mem_k
106 */ 106 */
107 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 107 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
108 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 108 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
109 < 0) {
109 unsigned long mem_size; 110 unsigned long mem_size;
110 111
111 /* compare results from other methods and take the greater */ 112 /* compare results from other methods and take the greater */
112 if (ALT_MEM_K < EXT_MEM_K) { 113 if (boot_params.alt_mem_k
113 mem_size = EXT_MEM_K; 114 < boot_params.screen_info.ext_mem_k) {
115 mem_size = boot_params.screen_info.ext_mem_k;
114 who = "BIOS-88"; 116 who = "BIOS-88";
115 } else { 117 } else {
116 mem_size = ALT_MEM_K; 118 mem_size = boot_params.alt_mem_k;
117 who = "BIOS-e801"; 119 who = "BIOS-e801";
118 } 120 }
119 121
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 860e912a3fbb..b1e45457d4ef 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -288,8 +288,9 @@ unsigned long __init setup_memory(void)
288 288
289#ifdef CONFIG_BLK_DEV_INITRD 289#ifdef CONFIG_BLK_DEV_INITRD
290 /* Numa kva area is below the initrd */ 290 /* Numa kva area is below the initrd */
291 if (LOADER_TYPE && INITRD_START) 291 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image)
292 kva_start_pfn = PFN_DOWN(INITRD_START) - kva_pages; 292 kva_start_pfn = PFN_DOWN(boot_params.hdr.ramdisk_image)
293 - kva_pages;
293#endif 294#endif
294 kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1); 295 kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1);
295 296
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 01437c46baae..ef1f6cd3ea66 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -193,7 +193,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
193 return pte; 193 return pte;
194} 194}
195 195
196void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags) 196void pmd_ctor(struct kmem_cache *cache, void *pmd)
197{ 197{
198 memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); 198 memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
199} 199}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f01bfcd4bdee..493a083f6886 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1137,9 +1137,10 @@ asmlinkage void __init xen_start_kernel(void)
1137 new_cpu_data.x86_capability[0] = cpuid_edx(1); 1137 new_cpu_data.x86_capability[0] = cpuid_edx(1);
1138 1138
1139 /* Poke various useful things into boot_params */ 1139 /* Poke various useful things into boot_params */
1140 LOADER_TYPE = (9 << 4) | 0; 1140 boot_params.hdr.type_of_loader = (9 << 4) | 0;
1141 INITRD_START = xen_start_info->mod_start ? __pa(xen_start_info->mod_start) : 0; 1141 boot_params.hdr.ramdisk_image = xen_start_info->mod_start
1142 INITRD_SIZE = xen_start_info->mod_len; 1142 ? __pa(xen_start_info->mod_start) : 0;
1143 boot_params.hdr.ramdisk_size = xen_start_info->mod_len;
1143 1144
1144 /* Start the world */ 1145 /* Start the world */
1145 start_kernel(); 1146 start_kernel();
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 8c83dbe4c4d0..d681be88ae5d 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -582,17 +582,18 @@ config CRASH_DUMP
582 bool "kernel crash dumps (EXPERIMENTAL)" 582 bool "kernel crash dumps (EXPERIMENTAL)"
583 depends on EXPERIMENTAL 583 depends on EXPERIMENTAL
584 help 584 help
585 Generate crash dump after being started by kexec. 585 Generate crash dump after being started by kexec.
586 This should be normally only set in special crash dump kernels 586 This should be normally only set in special crash dump kernels
587 which are loaded in the main kernel with kexec-tools into 587 which are loaded in the main kernel with kexec-tools into
588 a specially reserved region and then later executed after 588 a specially reserved region and then later executed after
589 a crash by kdump/kexec. The crash dump kernel must be compiled 589 a crash by kdump/kexec. The crash dump kernel must be compiled
590 to a memory address not used by the main kernel or BIOS using 590 to a memory address not used by the main kernel or BIOS using
591 PHYSICAL_START. 591 PHYSICAL_START, or it must be built as a relocatable image
592 For more details see Documentation/kdump/kdump.txt 592 (CONFIG_RELOCATABLE=y).
593 For more details see Documentation/kdump/kdump.txt
593 594
594config RELOCATABLE 595config RELOCATABLE
595 bool "Build a relocatable kernel(EXPERIMENTAL)" 596 bool "Build a relocatable kernel (EXPERIMENTAL)"
596 depends on EXPERIMENTAL 597 depends on EXPERIMENTAL
597 help 598 help
598 Builds a relocatable kernel. This enables loading and running 599 Builds a relocatable kernel. This enables loading and running
@@ -603,8 +604,8 @@ config RELOCATABLE
603 must live at a different physical address than the primary 604 must live at a different physical address than the primary
604 kernel. 605 kernel.
605 606
606 Note: If CONFIG_RELOCATABLE=y, then kernel run from the address 607 Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
607 it has been loaded at and compile time physical address 608 it has been loaded at and the compile time physical address
608 (CONFIG_PHYSICAL_START) is ignored. 609 (CONFIG_PHYSICAL_START) is ignored.
609 610
610config PHYSICAL_START 611config PHYSICAL_START
@@ -796,7 +797,6 @@ source "drivers/firmware/Kconfig"
796source fs/Kconfig 797source fs/Kconfig
797 798
798menu "Instrumentation Support" 799menu "Instrumentation Support"
799 depends on EXPERIMENTAL
800 800
801source "arch/x86/oprofile/Kconfig" 801source "arch/x86/oprofile/Kconfig"
802 802
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 9eabac95fbe0..524404bd08c1 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1786,6 +1786,7 @@ static void blk_release_queue(struct kobject *kobj)
1786 1786
1787 blk_trace_shutdown(q); 1787 blk_trace_shutdown(q);
1788 1788
1789 bdi_destroy(&q->backing_dev_info);
1789 kmem_cache_free(requestq_cachep, q); 1790 kmem_cache_free(requestq_cachep, q);
1790} 1791}
1791 1792
@@ -1839,21 +1840,27 @@ static struct kobj_type queue_ktype;
1839struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) 1840struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
1840{ 1841{
1841 struct request_queue *q; 1842 struct request_queue *q;
1843 int err;
1842 1844
1843 q = kmem_cache_alloc_node(requestq_cachep, 1845 q = kmem_cache_alloc_node(requestq_cachep,
1844 gfp_mask | __GFP_ZERO, node_id); 1846 gfp_mask | __GFP_ZERO, node_id);
1845 if (!q) 1847 if (!q)
1846 return NULL; 1848 return NULL;
1847 1849
1850 q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
1851 q->backing_dev_info.unplug_io_data = q;
1852 err = bdi_init(&q->backing_dev_info);
1853 if (err) {
1854 kmem_cache_free(requestq_cachep, q);
1855 return NULL;
1856 }
1857
1848 init_timer(&q->unplug_timer); 1858 init_timer(&q->unplug_timer);
1849 1859
1850 kobject_set_name(&q->kobj, "%s", "queue"); 1860 kobject_set_name(&q->kobj, "%s", "queue");
1851 q->kobj.ktype = &queue_ktype; 1861 q->kobj.ktype = &queue_ktype;
1852 kobject_init(&q->kobj); 1862 kobject_init(&q->kobj);
1853 1863
1854 q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
1855 q->backing_dev_info.unplug_io_data = q;
1856
1857 mutex_init(&q->sysfs_lock); 1864 mutex_init(&q->sysfs_lock);
1858 1865
1859 return q; 1866 return q;
diff --git a/drivers/acorn/char/defkeymap-l7200.c b/drivers/acorn/char/defkeymap-l7200.c
index 9e18ce742e38..28a5fbc6aa1a 100644
--- a/drivers/acorn/char/defkeymap-l7200.c
+++ b/drivers/acorn/char/defkeymap-l7200.c
@@ -346,7 +346,7 @@ char *func_table[MAX_NR_FUNC] = {
346 0, 346 0,
347}; 347};
348 348
349struct kbdiacr accent_table[MAX_DIACR] = { 349struct kbdiacruc accent_table[MAX_DIACR] = {
350 {'`', 'A', '\300'}, {'`', 'a', '\340'}, 350 {'`', 'A', '\300'}, {'`', 'a', '\340'},
351 {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, 351 {'\'', 'A', '\301'}, {'\'', 'a', '\341'},
352 {'^', 'A', '\302'}, {'^', 'a', '\342'}, 352 {'^', 'A', '\302'}, {'^', 'a', '\342'},
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index 7647abfe1890..fbae8674e491 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -302,7 +302,7 @@ restart:
302 if (mem_flags & __GFP_WAIT) { 302 if (mem_flags & __GFP_WAIT) {
303 DECLARE_WAITQUEUE (wait, current); 303 DECLARE_WAITQUEUE (wait, current);
304 304
305 current->state = TASK_INTERRUPTIBLE; 305 __set_current_state(TASK_INTERRUPTIBLE);
306 add_wait_queue (&pool->waitq, &wait); 306 add_wait_queue (&pool->waitq, &wait);
307 spin_unlock_irqrestore (&pool->lock, flags); 307 spin_unlock_irqrestore (&pool->lock, flags);
308 308
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index ba07f762c4cb..07f02f855ab5 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -48,15 +48,6 @@ struct aoe_hdr {
48 __be32 tag; 48 __be32 tag;
49}; 49};
50 50
51#ifdef __KERNEL__
52#include <linux/skbuff.h>
53
54static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb)
55{
56 return (struct aoe_hdr *)skb_mac_header(skb);
57}
58#endif
59
60struct aoe_atahdr { 51struct aoe_atahdr {
61 unsigned char aflags; 52 unsigned char aflags;
62 unsigned char errfeat; 53 unsigned char errfeat;
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 99672017ca56..4d59d5057734 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -120,7 +120,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
120 120
121 /* initialize the headers & frame */ 121 /* initialize the headers & frame */
122 skb = f->skb; 122 skb = f->skb;
123 h = aoe_hdr(skb); 123 h = (struct aoe_hdr *) skb_mac_header(skb);
124 ah = (struct aoe_atahdr *) (h+1); 124 ah = (struct aoe_atahdr *) (h+1);
125 skb_put(skb, sizeof *h + sizeof *ah); 125 skb_put(skb, sizeof *h + sizeof *ah);
126 memset(h, 0, skb->len); 126 memset(h, 0, skb->len);
@@ -209,7 +209,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
209 skb->dev = ifp; 209 skb->dev = ifp;
210 if (sl_tail == NULL) 210 if (sl_tail == NULL)
211 sl_tail = skb; 211 sl_tail = skb;
212 h = aoe_hdr(skb); 212 h = (struct aoe_hdr *) skb_mac_header(skb);
213 memset(h, 0, sizeof *h + sizeof *ch); 213 memset(h, 0, sizeof *h + sizeof *ch);
214 214
215 memset(h->dst, 0xff, sizeof h->dst); 215 memset(h->dst, 0xff, sizeof h->dst);
@@ -304,7 +304,7 @@ rexmit(struct aoedev *d, struct frame *f)
304 aoechr_error(buf); 304 aoechr_error(buf);
305 305
306 skb = f->skb; 306 skb = f->skb;
307 h = aoe_hdr(skb); 307 h = (struct aoe_hdr *) skb_mac_header(skb);
308 ah = (struct aoe_atahdr *) (h+1); 308 ah = (struct aoe_atahdr *) (h+1);
309 f->tag = n; 309 f->tag = n;
310 h->tag = cpu_to_be32(n); 310 h->tag = cpu_to_be32(n);
@@ -533,7 +533,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
533 char ebuf[128]; 533 char ebuf[128];
534 u16 aoemajor; 534 u16 aoemajor;
535 535
536 hin = aoe_hdr(skb); 536 hin = (struct aoe_hdr *) skb_mac_header(skb);
537 aoemajor = be16_to_cpu(get_unaligned(&hin->major)); 537 aoemajor = be16_to_cpu(get_unaligned(&hin->major));
538 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 538 d = aoedev_by_aoeaddr(aoemajor, hin->minor);
539 if (d == NULL) { 539 if (d == NULL) {
@@ -565,7 +565,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
565 calc_rttavg(d, tsince(f->tag)); 565 calc_rttavg(d, tsince(f->tag));
566 566
567 ahin = (struct aoe_atahdr *) (hin+1); 567 ahin = (struct aoe_atahdr *) (hin+1);
568 hout = aoe_hdr(f->skb); 568 hout = (struct aoe_hdr *) skb_mac_header(f->skb);
569 ahout = (struct aoe_atahdr *) (hout+1); 569 ahout = (struct aoe_atahdr *) (hout+1);
570 buf = f->buf; 570 buf = f->buf;
571 571
@@ -699,7 +699,7 @@ aoecmd_ata_id(struct aoedev *d)
699 699
700 /* initialize the headers & frame */ 700 /* initialize the headers & frame */
701 skb = f->skb; 701 skb = f->skb;
702 h = aoe_hdr(skb); 702 h = (struct aoe_hdr *) skb_mac_header(skb);
703 ah = (struct aoe_atahdr *) (h+1); 703 ah = (struct aoe_atahdr *) (h+1);
704 skb_put(skb, sizeof *h + sizeof *ah); 704 skb_put(skb, sizeof *h + sizeof *ah);
705 memset(h, 0, skb->len); 705 memset(h, 0, skb->len);
@@ -730,7 +730,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
730 enum { MAXFRAMES = 16 }; 730 enum { MAXFRAMES = 16 };
731 u16 n; 731 u16 n;
732 732
733 h = aoe_hdr(skb); 733 h = (struct aoe_hdr *) skb_mac_header(skb);
734 ch = (struct aoe_cfghdr *) (h+1); 734 ch = (struct aoe_cfghdr *) (h+1);
735 735
736 /* 736 /*
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index 4dc0fb7da94b..4e6deb7f5c24 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -127,7 +127,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
127 goto exit; 127 goto exit;
128 skb_push(skb, ETH_HLEN); /* (1) */ 128 skb_push(skb, ETH_HLEN); /* (1) */
129 129
130 h = aoe_hdr(skb); 130 h = (struct aoe_hdr *) skb_mac_header(skb);
131 n = be32_to_cpu(get_unaligned(&h->tag)); 131 n = be32_to_cpu(get_unaligned(&h->tag));
132 if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) 132 if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
133 goto exit; 133 goto exit;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 3fb7e8bc436d..ca56a0e5cd5e 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1582,38 +1582,36 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
1582 * allows us to delete disk zero but keep the controller registered. 1582 * allows us to delete disk zero but keep the controller registered.
1583 */ 1583 */
1584 if (h->gendisk[0] != disk) { 1584 if (h->gendisk[0] != disk) {
1585 if (disk) { 1585 struct request_queue *q = disk->queue;
1586 struct request_queue *q = disk->queue; 1586 if (disk->flags & GENHD_FL_UP)
1587 if (disk->flags & GENHD_FL_UP) 1587 del_gendisk(disk);
1588 del_gendisk(disk); 1588 if (q) {
1589 if (q) { 1589 blk_cleanup_queue(q);
1590 blk_cleanup_queue(q); 1590 /* Set drv->queue to NULL so that we do not try
1591 /* Set drv->queue to NULL so that we do not try 1591 * to call blk_start_queue on this queue in the
1592 * to call blk_start_queue on this queue in the 1592 * interrupt handler
1593 * interrupt handler 1593 */
1594 */ 1594 drv->queue = NULL;
1595 drv->queue = NULL; 1595 }
1596 } 1596 /* If clear_all is set then we are deleting the logical
1597 /* If clear_all is set then we are deleting the logical 1597 * drive, not just refreshing its info. For drives
1598 * drive, not just refreshing its info. For drives 1598 * other than disk 0 we will call put_disk. We do not
1599 * other than disk 0 we will call put_disk. We do not 1599 * do this for disk 0 as we need it to be able to
1600 * do this for disk 0 as we need it to be able to 1600 * configure the controller.
1601 * configure the controller. 1601 */
1602 if (clear_all){
1603 /* This isn't pretty, but we need to find the
1604 * disk in our array and NULL our the pointer.
1605 * This is so that we will call alloc_disk if
1606 * this index is used again later.
1602 */ 1607 */
1603 if (clear_all){ 1608 for (i=0; i < CISS_MAX_LUN; i++){
1604 /* This isn't pretty, but we need to find the 1609 if(h->gendisk[i] == disk){
1605 * disk in our array and NULL our the pointer. 1610 h->gendisk[i] = NULL;
1606 * This is so that we will call alloc_disk if 1611 break;
1607 * this index is used again later.
1608 */
1609 for (i=0; i < CISS_MAX_LUN; i++){
1610 if(h->gendisk[i] == disk){
1611 h->gendisk[i] = NULL;
1612 break;
1613 }
1614 } 1612 }
1615 put_disk(disk);
1616 } 1613 }
1614 put_disk(disk);
1617 } 1615 }
1618 } else { 1616 } else {
1619 set_capacity(disk, 0); 1617 set_capacity(disk, 0);
@@ -2365,30 +2363,55 @@ static inline void resend_cciss_cmd(ctlr_info_t *h, CommandList_struct *c)
2365 start_io(h); 2363 start_io(h);
2366} 2364}
2367 2365
2366static inline unsigned int make_status_bytes(unsigned int scsi_status_byte,
2367 unsigned int msg_byte, unsigned int host_byte,
2368 unsigned int driver_byte)
2369{
2370 /* inverse of macros in scsi.h */
2371 return (scsi_status_byte & 0xff) |
2372 ((msg_byte & 0xff) << 8) |
2373 ((host_byte & 0xff) << 16) |
2374 ((driver_byte & 0xff) << 24);
2375}
2376
2368static inline int evaluate_target_status(CommandList_struct *cmd) 2377static inline int evaluate_target_status(CommandList_struct *cmd)
2369{ 2378{
2370 unsigned char sense_key; 2379 unsigned char sense_key;
2371 int error_count = 1; 2380 unsigned char status_byte, msg_byte, host_byte, driver_byte;
2381 int error_value;
2382
2383 /* If we get in here, it means we got "target status", that is, scsi status */
2384 status_byte = cmd->err_info->ScsiStatus;
2385 driver_byte = DRIVER_OK;
2386 msg_byte = cmd->err_info->CommandStatus; /* correct? seems too device specific */
2387
2388 if (blk_pc_request(cmd->rq))
2389 host_byte = DID_PASSTHROUGH;
2390 else
2391 host_byte = DID_OK;
2392
2393 error_value = make_status_bytes(status_byte, msg_byte,
2394 host_byte, driver_byte);
2372 2395
2373 if (cmd->err_info->ScsiStatus != 0x02) { /* not check condition? */ 2396 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) {
2374 if (!blk_pc_request(cmd->rq)) 2397 if (!blk_pc_request(cmd->rq))
2375 printk(KERN_WARNING "cciss: cmd %p " 2398 printk(KERN_WARNING "cciss: cmd %p "
2376 "has SCSI Status 0x%x\n", 2399 "has SCSI Status 0x%x\n",
2377 cmd, cmd->err_info->ScsiStatus); 2400 cmd, cmd->err_info->ScsiStatus);
2378 return error_count; 2401 return error_value;
2379 } 2402 }
2380 2403
2381 /* check the sense key */ 2404 /* check the sense key */
2382 sense_key = 0xf & cmd->err_info->SenseInfo[2]; 2405 sense_key = 0xf & cmd->err_info->SenseInfo[2];
2383 /* no status or recovered error */ 2406 /* no status or recovered error */
2384 if ((sense_key == 0x0) || (sense_key == 0x1)) 2407 if (((sense_key == 0x0) || (sense_key == 0x1)) && !blk_pc_request(cmd->rq))
2385 error_count = 0; 2408 error_value = 0;
2386 2409
2387 if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */ 2410 if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */
2388 if (error_count != 0) 2411 if (error_value != 0)
2389 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION" 2412 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION"
2390 " sense key = 0x%x\n", cmd, sense_key); 2413 " sense key = 0x%x\n", cmd, sense_key);
2391 return error_count; 2414 return error_value;
2392 } 2415 }
2393 2416
2394 /* SG_IO or similar, copy sense data back */ 2417 /* SG_IO or similar, copy sense data back */
@@ -2400,7 +2423,7 @@ static inline int evaluate_target_status(CommandList_struct *cmd)
2400 } else 2423 } else
2401 cmd->rq->sense_len = 0; 2424 cmd->rq->sense_len = 0;
2402 2425
2403 return error_count; 2426 return error_value;
2404} 2427}
2405 2428
2406/* checks the status of the job and calls complete buffers to mark all 2429/* 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,
2416 rq->errors = 0; 2439 rq->errors = 0;
2417 2440
2418 if (timeout) 2441 if (timeout)
2419 rq->errors = 1; 2442 rq->errors = make_status_bytes(0, 0, 0, DRIVER_TIMEOUT);
2420 2443
2421 if (cmd->err_info->CommandStatus == 0) /* no error has occurred */ 2444 if (cmd->err_info->CommandStatus == 0) /* no error has occurred */
2422 goto after_error_processing; 2445 goto after_error_processing;
@@ -2442,32 +2465,44 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
2442 case CMD_INVALID: 2465 case CMD_INVALID:
2443 printk(KERN_WARNING "cciss: cmd %p is " 2466 printk(KERN_WARNING "cciss: cmd %p is "
2444 "reported invalid\n", cmd); 2467 "reported invalid\n", cmd);
2445 rq->errors = 1; 2468 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2469 cmd->err_info->CommandStatus, DRIVER_OK,
2470 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2446 break; 2471 break;
2447 case CMD_PROTOCOL_ERR: 2472 case CMD_PROTOCOL_ERR:
2448 printk(KERN_WARNING "cciss: cmd %p has " 2473 printk(KERN_WARNING "cciss: cmd %p has "
2449 "protocol error \n", cmd); 2474 "protocol error \n", cmd);
2450 rq->errors = 1; 2475 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2476 cmd->err_info->CommandStatus, DRIVER_OK,
2477 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2451 break; 2478 break;
2452 case CMD_HARDWARE_ERR: 2479 case CMD_HARDWARE_ERR:
2453 printk(KERN_WARNING "cciss: cmd %p had " 2480 printk(KERN_WARNING "cciss: cmd %p had "
2454 " hardware error\n", cmd); 2481 " hardware error\n", cmd);
2455 rq->errors = 1; 2482 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2483 cmd->err_info->CommandStatus, DRIVER_OK,
2484 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2456 break; 2485 break;
2457 case CMD_CONNECTION_LOST: 2486 case CMD_CONNECTION_LOST:
2458 printk(KERN_WARNING "cciss: cmd %p had " 2487 printk(KERN_WARNING "cciss: cmd %p had "
2459 "connection lost\n", cmd); 2488 "connection lost\n", cmd);
2460 rq->errors = 1; 2489 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2490 cmd->err_info->CommandStatus, DRIVER_OK,
2491 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2461 break; 2492 break;
2462 case CMD_ABORTED: 2493 case CMD_ABORTED:
2463 printk(KERN_WARNING "cciss: cmd %p was " 2494 printk(KERN_WARNING "cciss: cmd %p was "
2464 "aborted\n", cmd); 2495 "aborted\n", cmd);
2465 rq->errors = 1; 2496 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2497 cmd->err_info->CommandStatus, DRIVER_OK,
2498 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT);
2466 break; 2499 break;
2467 case CMD_ABORT_FAILED: 2500 case CMD_ABORT_FAILED:
2468 printk(KERN_WARNING "cciss: cmd %p reports " 2501 printk(KERN_WARNING "cciss: cmd %p reports "
2469 "abort failed\n", cmd); 2502 "abort failed\n", cmd);
2470 rq->errors = 1; 2503 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2504 cmd->err_info->CommandStatus, DRIVER_OK,
2505 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2471 break; 2506 break;
2472 case CMD_UNSOLICITED_ABORT: 2507 case CMD_UNSOLICITED_ABORT:
2473 printk(KERN_WARNING "cciss%d: unsolicited " 2508 printk(KERN_WARNING "cciss%d: unsolicited "
@@ -2481,17 +2516,23 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
2481 printk(KERN_WARNING 2516 printk(KERN_WARNING
2482 "cciss%d: %p retried too " 2517 "cciss%d: %p retried too "
2483 "many times\n", h->ctlr, cmd); 2518 "many times\n", h->ctlr, cmd);
2484 rq->errors = 1; 2519 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2520 cmd->err_info->CommandStatus, DRIVER_OK,
2521 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT);
2485 break; 2522 break;
2486 case CMD_TIMEOUT: 2523 case CMD_TIMEOUT:
2487 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); 2524 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
2488 rq->errors = 1; 2525 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2526 cmd->err_info->CommandStatus, DRIVER_OK,
2527 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2489 break; 2528 break;
2490 default: 2529 default:
2491 printk(KERN_WARNING "cciss: cmd %p returned " 2530 printk(KERN_WARNING "cciss: cmd %p returned "
2492 "unknown status %x\n", cmd, 2531 "unknown status %x\n", cmd,
2493 cmd->err_info->CommandStatus); 2532 cmd->err_info->CommandStatus);
2494 rq->errors = 1; 2533 rq->errors = make_status_bytes(SAM_STAT_GOOD,
2534 cmd->err_info->CommandStatus, DRIVER_OK,
2535 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
2495 } 2536 }
2496 2537
2497after_error_processing: 2538after_error_processing:
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 80483aac4cc9..639ed14bb08d 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -5,6 +5,7 @@
5 * Copyright (C) 1993, 1994 Alain Knaff 5 * Copyright (C) 1993, 1994 Alain Knaff
6 * Copyright (C) 1998 Alan Cox 6 * Copyright (C) 1998 Alan Cox
7 */ 7 */
8
8/* 9/*
9 * 02.12.91 - Changed to static variables to indicate need for reset 10 * 02.12.91 - Changed to static variables to indicate need for reset
10 * and recalibrate. This makes some things easier (output_byte reset 11 * and recalibrate. This makes some things easier (output_byte reset
@@ -149,7 +150,7 @@
149#define REALLY_SLOW_IO 150#define REALLY_SLOW_IO
150 151
151#define DEBUGT 2 152#define DEBUGT 2
152#define DCL_DEBUG /* debug disk change line */ 153#define DCL_DEBUG /* debug disk change line */
153 154
154/* do print messages for unexpected interrupts */ 155/* do print messages for unexpected interrupts */
155static int print_unex = 1; 156static int print_unex = 1;
@@ -161,10 +162,8 @@ static int print_unex = 1;
161#include <linux/workqueue.h> 162#include <linux/workqueue.h>
162#define FDPATCHES 163#define FDPATCHES
163#include <linux/fdreg.h> 164#include <linux/fdreg.h>
164
165#include <linux/fd.h> 165#include <linux/fd.h>
166#include <linux/hdreg.h> 166#include <linux/hdreg.h>
167
168#include <linux/errno.h> 167#include <linux/errno.h>
169#include <linux/slab.h> 168#include <linux/slab.h>
170#include <linux/mm.h> 169#include <linux/mm.h>
@@ -274,8 +273,7 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l)
274 return; /* we have the memory */ 273 return; /* we have the memory */
275 if (can_use_virtual_dma != 2) 274 if (can_use_virtual_dma != 2)
276 return; /* no fallback allowed */ 275 return; /* no fallback allowed */
277 printk 276 printk("DMA memory shortage. Temporarily falling back on virtual DMA\n");
278 ("DMA memory shortage. Temporarily falling back on virtual DMA\n");
279 *addr = (char *)nodma_mem_alloc(l); 277 *addr = (char *)nodma_mem_alloc(l);
280#else 278#else
281 return; 279 return;
@@ -291,8 +289,8 @@ static int initialising = 1;
291#define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) 289#define TOMINOR(x) ((x & 3) | ((x & 4) << 5))
292#define UNIT(x) ((x) & 0x03) /* drive on fdc */ 290#define UNIT(x) ((x) & 0x03) /* drive on fdc */
293#define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ 291#define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */
292 /* reverse mapping from unit and fdc to drive */
294#define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) 293#define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2))
295 /* reverse mapping from unit and fdc to drive */
296#define DP (&drive_params[current_drive]) 294#define DP (&drive_params[current_drive])
297#define DRS (&drive_state[current_drive]) 295#define DRS (&drive_state[current_drive])
298#define DRWE (&write_errors[current_drive]) 296#define DRWE (&write_errors[current_drive])
@@ -356,7 +354,6 @@ static int inr; /* size of reply buffer, when called from interrupt */
356#define R_HEAD (reply_buffer[4]) 354#define R_HEAD (reply_buffer[4])
357#define R_SECTOR (reply_buffer[5]) 355#define R_SECTOR (reply_buffer[5])
358#define R_SIZECODE (reply_buffer[6]) 356#define R_SIZECODE (reply_buffer[6])
359
360#define SEL_DLY (2*HZ/100) 357#define SEL_DLY (2*HZ/100)
361 358
362/* 359/*
@@ -472,8 +469,8 @@ static struct floppy_struct floppy_type[32] = {
472 { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */ 469 { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */
473 { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */ 470 { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */
474 { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */ 471 { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */
475
476 { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */ 472 { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */
473
477 { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */ 474 { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */
478 { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ 475 { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */
479}; 476};
@@ -539,12 +536,12 @@ static char *floppy_track_buffer;
539static int max_buffer_sectors; 536static int max_buffer_sectors;
540 537
541static int *errors; 538static int *errors;
542typedef void (*done_f) (int); 539typedef void (*done_f)(int);
543static struct cont_t { 540static struct cont_t {
544 void (*interrupt) (void); /* this is called after the interrupt of the 541 void (*interrupt)(void); /* this is called after the interrupt of the
545 * main command */ 542 * main command */
546 void (*redo) (void); /* this is called to retry the operation */ 543 void (*redo)(void); /* this is called to retry the operation */
547 void (*error) (void); /* this is called to tally an error */ 544 void (*error)(void); /* this is called to tally an error */
548 done_f done; /* this is called to say if the operation has 545 done_f done; /* this is called to say if the operation has
549 * succeeded/failed */ 546 * succeeded/failed */
550} *cont; 547} *cont;
@@ -694,7 +691,6 @@ static void reschedule_timeout(int drive, const char *message, int marg)
694} 691}
695 692
696#define INFBOUND(a,b) (a)=max_t(int, a, b) 693#define INFBOUND(a,b) (a)=max_t(int, a, b)
697
698#define SUPBOUND(a,b) (a)=min_t(int, a, b) 694#define SUPBOUND(a,b) (a)=min_t(int, a, b)
699 695
700/* 696/*
@@ -733,6 +729,7 @@ static void reschedule_timeout(int drive, const char *message, int marg)
733static int disk_change(int drive) 729static int disk_change(int drive)
734{ 730{
735 int fdc = FDC(drive); 731 int fdc = FDC(drive);
732
736#ifdef FLOPPY_SANITY_CHECK 733#ifdef FLOPPY_SANITY_CHECK
737 if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) 734 if (time_before(jiffies, UDRS->select_date + UDP->select_delay))
738 DPRINT("WARNING disk change called early\n"); 735 DPRINT("WARNING disk change called early\n");
@@ -771,7 +768,6 @@ static int disk_change(int drive)
771 floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1; 768 floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1;
772 } 769 }
773 770
774 /*USETF(FD_DISK_NEWCHANGE); */
775 return 1; 771 return 1;
776 } else { 772 } else {
777 UDRS->last_checked = jiffies; 773 UDRS->last_checked = jiffies;
@@ -787,7 +783,10 @@ static inline int is_selected(int dor, int unit)
787 783
788static int set_dor(int fdc, char mask, char data) 784static int set_dor(int fdc, char mask, char data)
789{ 785{
790 register unsigned char drive, unit, newdor, olddor; 786 unsigned char unit;
787 unsigned char drive;
788 unsigned char newdor;
789 unsigned char olddor;
791 790
792 if (FDCS->address == -1) 791 if (FDCS->address == -1)
793 return -1; 792 return -1;
@@ -892,7 +891,6 @@ static int _lock_fdc(int drive, int interruptible, int line)
892 891
893 set_current_state(TASK_RUNNING); 892 set_current_state(TASK_RUNNING);
894 remove_wait_queue(&fdc_wait, &wait); 893 remove_wait_queue(&fdc_wait, &wait);
895
896 flush_scheduled_work(); 894 flush_scheduled_work();
897 } 895 }
898 command_status = FD_COMMAND_NONE; 896 command_status = FD_COMMAND_NONE;
@@ -942,7 +940,7 @@ static void motor_off_callback(unsigned long nr)
942static void floppy_off(unsigned int drive) 940static void floppy_off(unsigned int drive)
943{ 941{
944 unsigned long volatile delta; 942 unsigned long volatile delta;
945 register int fdc = FDC(drive); 943 int fdc = FDC(drive);
946 944
947 if (!(FDCS->dor & (0x10 << UNIT(drive)))) 945 if (!(FDCS->dor & (0x10 << UNIT(drive))))
948 return; 946 return;
@@ -968,7 +966,9 @@ static void floppy_off(unsigned int drive)
968 */ 966 */
969static void scandrives(void) 967static void scandrives(void)
970{ 968{
971 int i, drive, saved_drive; 969 int i;
970 int drive;
971 int saved_drive;
972 972
973 if (DP->select_delay) 973 if (DP->select_delay)
974 return; 974 return;
@@ -1146,7 +1146,9 @@ static void show_floppy(void);
1146/* waits until the fdc becomes ready */ 1146/* waits until the fdc becomes ready */
1147static int wait_til_ready(void) 1147static int wait_til_ready(void)
1148{ 1148{
1149 int counter, status; 1149 int status;
1150 int counter;
1151
1150 if (FDCS->reset) 1152 if (FDCS->reset)
1151 return -1; 1153 return -1;
1152 for (counter = 0; counter < 10000; counter++) { 1154 for (counter = 0; counter < 10000; counter++) {
@@ -1193,7 +1195,8 @@ static int output_byte(char byte)
1193/* gets the response from the fdc */ 1195/* gets the response from the fdc */
1194static int result(void) 1196static int result(void)
1195{ 1197{
1196 int i, status = 0; 1198 int i;
1199 int status = 0;
1197 1200
1198 for (i = 0; i < MAX_REPLIES; i++) { 1201 for (i = 0; i < MAX_REPLIES; i++) {
1199 if ((status = wait_til_ready()) < 0) 1202 if ((status = wait_til_ready()) < 0)
@@ -1226,6 +1229,7 @@ static int result(void)
1226static int need_more_output(void) 1229static int need_more_output(void)
1227{ 1230{
1228 int status; 1231 int status;
1232
1229 if ((status = wait_til_ready()) < 0) 1233 if ((status = wait_til_ready()) < 0)
1230 return -1; 1234 return -1;
1231 if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) 1235 if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY)
@@ -1309,8 +1313,11 @@ static int fdc_configure(void)
1309 */ 1313 */
1310static void fdc_specify(void) 1314static void fdc_specify(void)
1311{ 1315{
1312 unsigned char spec1, spec2; 1316 unsigned char spec1;
1313 unsigned long srt, hlt, hut; 1317 unsigned char spec2;
1318 unsigned long srt;
1319 unsigned long hlt;
1320 unsigned long hut;
1314 unsigned long dtr = NOMINAL_DTR; 1321 unsigned long dtr = NOMINAL_DTR;
1315 unsigned long scale_dtr = NOMINAL_DTR; 1322 unsigned long scale_dtr = NOMINAL_DTR;
1316 int hlt_max_code = 0x7f; 1323 int hlt_max_code = 0x7f;
@@ -1319,7 +1326,6 @@ static void fdc_specify(void)
1319 if (FDCS->need_configure && FDCS->version >= FDC_82072A) { 1326 if (FDCS->need_configure && FDCS->version >= FDC_82072A) {
1320 fdc_configure(); 1327 fdc_configure();
1321 FDCS->need_configure = 0; 1328 FDCS->need_configure = 0;
1322 /*DPRINT("FIFO enabled\n"); */
1323 } 1329 }
1324 1330
1325 switch (raw_cmd->rate & 0x03) { 1331 switch (raw_cmd->rate & 0x03) {
@@ -1472,7 +1478,6 @@ static int interpret_errors(void)
1472 tell_sector(); 1478 tell_sector();
1473 } 1479 }
1474 printk("\n"); 1480 printk("\n");
1475
1476 } 1481 }
1477 if (ST2 & ST2_WC || ST2 & ST2_BC) 1482 if (ST2 & ST2_WC || ST2 & ST2_BC)
1478 /* wrong cylinder => recal */ 1483 /* wrong cylinder => recal */
@@ -1498,7 +1503,10 @@ static int interpret_errors(void)
1498 */ 1503 */
1499static void setup_rw_floppy(void) 1504static void setup_rw_floppy(void)
1500{ 1505{
1501 int i, r, flags, dflags; 1506 int i;
1507 int r;
1508 int flags;
1509 int dflags;
1502 unsigned long ready_date; 1510 unsigned long ready_date;
1503 timeout_fn function; 1511 timeout_fn function;
1504 1512
@@ -1728,9 +1736,9 @@ static void print_result(char *message, int inr)
1728/* interrupt handler. Note that this can be called externally on the Sparc */ 1736/* interrupt handler. Note that this can be called externally on the Sparc */
1729irqreturn_t floppy_interrupt(int irq, void *dev_id) 1737irqreturn_t floppy_interrupt(int irq, void *dev_id)
1730{ 1738{
1731 void (*handler) (void) = do_floppy;
1732 int do_print; 1739 int do_print;
1733 unsigned long f; 1740 unsigned long f;
1741 void (*handler)(void) = do_floppy;
1734 1742
1735 lasthandler = handler; 1743 lasthandler = handler;
1736 interruptjiffies = jiffies; 1744 interruptjiffies = jiffies;
@@ -1912,12 +1920,11 @@ static void floppy_shutdown(unsigned long data)
1912 is_alive("floppy shutdown"); 1920 is_alive("floppy shutdown");
1913} 1921}
1914 1922
1915/*typedef void (*timeout_fn)(unsigned long);*/
1916
1917/* start motor, check media-changed condition and write protection */ 1923/* start motor, check media-changed condition and write protection */
1918static int start_motor(void (*function) (void)) 1924static int start_motor(void (*function)(void))
1919{ 1925{
1920 int mask, data; 1926 int mask;
1927 int data;
1921 1928
1922 mask = 0xfc; 1929 mask = 0xfc;
1923 data = UNIT(current_drive); 1930 data = UNIT(current_drive);
@@ -2020,17 +2027,17 @@ static struct cont_t wakeup_cont = {
2020 .interrupt = empty, 2027 .interrupt = empty,
2021 .redo = do_wakeup, 2028 .redo = do_wakeup,
2022 .error = empty, 2029 .error = empty,
2023 .done = (done_f) empty 2030 .done = (done_f)empty
2024}; 2031};
2025 2032
2026static struct cont_t intr_cont = { 2033static struct cont_t intr_cont = {
2027 .interrupt = empty, 2034 .interrupt = empty,
2028 .redo = process_fd_request, 2035 .redo = process_fd_request,
2029 .error = empty, 2036 .error = empty,
2030 .done = (done_f) empty 2037 .done = (done_f)empty
2031}; 2038};
2032 2039
2033static int wait_til_done(void (*handler) (void), int interruptible) 2040static int wait_til_done(void (*handler)(void), int interruptible)
2034{ 2041{
2035 int ret; 2042 int ret;
2036 2043
@@ -2049,7 +2056,6 @@ static int wait_til_done(void (*handler) (void), int interruptible)
2049 break; 2056 break;
2050 2057
2051 is_alive("wait_til_done"); 2058 is_alive("wait_til_done");
2052
2053 schedule(); 2059 schedule();
2054 } 2060 }
2055 2061
@@ -2141,6 +2147,7 @@ static void bad_flp_intr(void)
2141static void set_floppy(int drive) 2147static void set_floppy(int drive)
2142{ 2148{
2143 int type = ITYPE(UDRS->fd_device); 2149 int type = ITYPE(UDRS->fd_device);
2150
2144 if (type) 2151 if (type)
2145 _floppy = floppy_type + type; 2152 _floppy = floppy_type + type;
2146 else 2153 else
@@ -2169,11 +2176,14 @@ static void format_interrupt(void)
2169#define CT(x) ((x) | 0xc0) 2176#define CT(x) ((x) | 0xc0)
2170static void setup_format_params(int track) 2177static void setup_format_params(int track)
2171{ 2178{
2179 int n;
2180 int il;
2181 int count;
2182 int head_shift;
2183 int track_shift;
2172 struct fparm { 2184 struct fparm {
2173 unsigned char track, head, sect, size; 2185 unsigned char track, head, sect, size;
2174 } *here = (struct fparm *)floppy_track_buffer; 2186 } *here = (struct fparm *)floppy_track_buffer;
2175 int il, n;
2176 int count, head_shift, track_shift;
2177 2187
2178 raw_cmd = &default_raw_cmd; 2188 raw_cmd = &default_raw_cmd;
2179 raw_cmd->track = track; 2189 raw_cmd->track = track;
@@ -2344,7 +2354,10 @@ static void request_done(int uptodate)
2344/* Interrupt handler evaluating the result of the r/w operation */ 2354/* Interrupt handler evaluating the result of the r/w operation */
2345static void rw_interrupt(void) 2355static void rw_interrupt(void)
2346{ 2356{
2347 int nr_sectors, ssize, eoc, heads; 2357 int eoc;
2358 int ssize;
2359 int heads;
2360 int nr_sectors;
2348 2361
2349 if (R_HEAD >= 2) { 2362 if (R_HEAD >= 2) {
2350 /* some Toshiba floppy controllers occasionnally seem to 2363 /* some Toshiba floppy controllers occasionnally seem to
@@ -2476,7 +2489,8 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
2476{ 2489{
2477 int remaining; /* number of transferred 512-byte sectors */ 2490 int remaining; /* number of transferred 512-byte sectors */
2478 struct bio_vec *bv; 2491 struct bio_vec *bv;
2479 char *buffer, *dma_buffer; 2492 char *buffer;
2493 char *dma_buffer;
2480 int size; 2494 int size;
2481 struct req_iterator iter; 2495 struct req_iterator iter;
2482 2496
@@ -2556,19 +2570,6 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
2556#endif 2570#endif
2557} 2571}
2558 2572
2559#if 0
2560static inline int check_dma_crossing(char *start,
2561 unsigned long length, char *message)
2562{
2563 if (CROSS_64KB(start, length)) {
2564 printk("DMA xfer crosses 64KB boundary in %s %p-%p\n",
2565 message, start, start + length);
2566 return 1;
2567 } else
2568 return 0;
2569}
2570#endif
2571
2572/* work around a bug in pseudo DMA 2573/* work around a bug in pseudo DMA
2573 * (on some FDCs) pseudo DMA does not stop when the CPU stops 2574 * (on some FDCs) pseudo DMA does not stop when the CPU stops
2574 * sending data. Hence we need a different way to signal the 2575 * sending data. Hence we need a different way to signal the
@@ -2578,7 +2579,8 @@ static inline int check_dma_crossing(char *start,
2578 */ 2579 */
2579static void virtualdmabug_workaround(void) 2580static void virtualdmabug_workaround(void)
2580{ 2581{
2581 int hard_sectors, end_sector; 2582 int hard_sectors;
2583 int end_sector;
2582 2584
2583 if (CT(COMMAND) == FD_WRITE) { 2585 if (CT(COMMAND) == FD_WRITE) {
2584 COMMAND &= ~0x80; /* switch off multiple track mode */ 2586 COMMAND &= ~0x80; /* switch off multiple track mode */
@@ -2610,7 +2612,10 @@ static void virtualdmabug_workaround(void)
2610static int make_raw_rw_request(void) 2612static int make_raw_rw_request(void)
2611{ 2613{
2612 int aligned_sector_t; 2614 int aligned_sector_t;
2613 int max_sector, max_size, tracksize, ssize; 2615 int max_sector;
2616 int max_size;
2617 int tracksize;
2618 int ssize;
2614 2619
2615 if (max_buffer_sectors == 0) { 2620 if (max_buffer_sectors == 0) {
2616 printk("VFS: Block I/O scheduled on unopened device\n"); 2621 printk("VFS: Block I/O scheduled on unopened device\n");
@@ -2762,9 +2767,7 @@ static int make_raw_rw_request(void)
2762 */ 2767 */
2763 if (!direct || 2768 if (!direct ||
2764 (indirect * 2 > direct * 3 && 2769 (indirect * 2 > direct * 3 &&
2765 *errors < DP->max_errors.read_track && 2770 *errors < DP->max_errors.read_track && ((!probing
2766 /*!TESTF(FD_NEED_TWADDLE) && */
2767 ((!probing
2768 || (DP->read_track & (1 << DRS->probed_format)))))) { 2771 || (DP->read_track & (1 << DRS->probed_format)))))) {
2769 max_size = current_req->nr_sectors; 2772 max_size = current_req->nr_sectors;
2770 } else { 2773 } else {
@@ -2777,10 +2780,6 @@ static int make_raw_rw_request(void)
2777 indirect, direct, fsector_t); 2780 indirect, direct, fsector_t);
2778 return 0; 2781 return 0;
2779 } 2782 }
2780/* check_dma_crossing(raw_cmd->kernel_data,
2781 raw_cmd->length,
2782 "end of make_raw_request [1]");*/
2783
2784 virtualdmabug_workaround(); 2783 virtualdmabug_workaround();
2785 return 2; 2784 return 2;
2786 } 2785 }
@@ -2830,8 +2829,6 @@ static int make_raw_rw_request(void)
2830 raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1; 2829 raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;
2831 raw_cmd->length <<= 9; 2830 raw_cmd->length <<= 9;
2832#ifdef FLOPPY_SANITY_CHECK 2831#ifdef FLOPPY_SANITY_CHECK
2833 /*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length,
2834 "end of make_raw_request"); */
2835 if ((raw_cmd->length < current_count_sectors << 9) || 2832 if ((raw_cmd->length < current_count_sectors << 9) ||
2836 (raw_cmd->kernel_data != current_req->buffer && 2833 (raw_cmd->kernel_data != current_req->buffer &&
2837 CT(COMMAND) == FD_WRITE && 2834 CT(COMMAND) == FD_WRITE &&
@@ -3011,6 +3008,7 @@ static struct cont_t poll_cont = {
3011static int poll_drive(int interruptible, int flag) 3008static int poll_drive(int interruptible, int flag)
3012{ 3009{
3013 int ret; 3010 int ret;
3011
3014 /* no auto-sense, just clear dcl */ 3012 /* no auto-sense, just clear dcl */
3015 raw_cmd = &default_raw_cmd; 3013 raw_cmd = &default_raw_cmd;
3016 raw_cmd->flags = flag; 3014 raw_cmd->flags = flag;
@@ -3173,7 +3171,8 @@ static inline int raw_cmd_copyout(int cmd, char __user *param,
3173 3171
3174static void raw_cmd_free(struct floppy_raw_cmd **ptr) 3172static void raw_cmd_free(struct floppy_raw_cmd **ptr)
3175{ 3173{
3176 struct floppy_raw_cmd *next, *this; 3174 struct floppy_raw_cmd *next;
3175 struct floppy_raw_cmd *this;
3177 3176
3178 this = *ptr; 3177 this = *ptr;
3179 *ptr = NULL; 3178 *ptr = NULL;
@@ -3245,8 +3244,10 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
3245 3244
3246static int raw_cmd_ioctl(int cmd, void __user *param) 3245static int raw_cmd_ioctl(int cmd, void __user *param)
3247{ 3246{
3248 int drive, ret, ret2;
3249 struct floppy_raw_cmd *my_raw_cmd; 3247 struct floppy_raw_cmd *my_raw_cmd;
3248 int drive;
3249 int ret2;
3250 int ret;
3250 3251
3251 if (FDCS->rawcmd <= 1) 3252 if (FDCS->rawcmd <= 1)
3252 FDCS->rawcmd = 1; 3253 FDCS->rawcmd = 1;
@@ -3453,7 +3454,8 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
3453#define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 3454#define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0
3454 3455
3455 int drive = (long)inode->i_bdev->bd_disk->private_data; 3456 int drive = (long)inode->i_bdev->bd_disk->private_data;
3456 int i, type = ITYPE(UDRS->fd_device); 3457 int type = ITYPE(UDRS->fd_device);
3458 int i;
3457 int ret; 3459 int ret;
3458 int size; 3460 int size;
3459 union inparam { 3461 union inparam {
@@ -3619,8 +3621,7 @@ static void __init config_types(void)
3619 if (!UDP->cmos && FLOPPY1_TYPE) 3621 if (!UDP->cmos && FLOPPY1_TYPE)
3620 UDP->cmos = FLOPPY1_TYPE; 3622 UDP->cmos = FLOPPY1_TYPE;
3621 3623
3622 /* XXX */ 3624 /* FIXME: additional physical CMOS drive detection should go here */
3623 /* additional physical CMOS drive detection should go here */
3624 3625
3625 for (drive = 0; drive < N_DRIVE; drive++) { 3626 for (drive = 0; drive < N_DRIVE; drive++) {
3626 unsigned int type = UDP->cmos; 3627 unsigned int type = UDP->cmos;
@@ -3903,13 +3904,13 @@ static int floppy_revalidate(struct gendisk *disk)
3903} 3904}
3904 3905
3905static struct block_device_operations floppy_fops = { 3906static struct block_device_operations floppy_fops = {
3906 .owner = THIS_MODULE, 3907 .owner = THIS_MODULE,
3907 .open = floppy_open, 3908 .open = floppy_open,
3908 .release = floppy_release, 3909 .release = floppy_release,
3909 .ioctl = fd_ioctl, 3910 .ioctl = fd_ioctl,
3910 .getgeo = fd_getgeo, 3911 .getgeo = fd_getgeo,
3911 .media_changed = check_floppy_change, 3912 .media_changed = check_floppy_change,
3912 .revalidate_disk = floppy_revalidate, 3913 .revalidate_disk = floppy_revalidate,
3913}; 3914};
3914 3915
3915/* 3916/*
@@ -4388,11 +4389,15 @@ static int floppy_grab_irq_and_dma(void)
4388 if (fd_request_dma()) { 4389 if (fd_request_dma()) {
4389 DPRINT("Unable to grab DMA%d for the floppy driver\n", 4390 DPRINT("Unable to grab DMA%d for the floppy driver\n",
4390 FLOPPY_DMA); 4391 FLOPPY_DMA);
4391 fd_free_irq(); 4392 if (can_use_virtual_dma & 2)
4392 spin_lock_irqsave(&floppy_usage_lock, flags); 4393 use_virtual_dma = can_use_virtual_dma = 1;
4393 usage_count--; 4394 if (!(can_use_virtual_dma & 1)) {
4394 spin_unlock_irqrestore(&floppy_usage_lock, flags); 4395 fd_free_irq();
4395 return -1; 4396 spin_lock_irqsave(&floppy_usage_lock, flags);
4397 usage_count--;
4398 spin_unlock_irqrestore(&floppy_usage_lock, flags);
4399 return -1;
4400 }
4396 } 4401 }
4397 4402
4398 for (fdc = 0; fdc < N_FDC; fdc++) { 4403 for (fdc = 0; fdc < N_FDC; fdc++) {
@@ -4424,8 +4429,8 @@ static int floppy_grab_irq_and_dma(void)
4424 if (FDCS->address != -1) 4429 if (FDCS->address != -1)
4425 fd_outb(FDCS->dor, FD_DOR); 4430 fd_outb(FDCS->dor, FD_DOR);
4426 /* 4431 /*
4427 * The driver will try and free resources and relies on us 4432 * The driver will try and free resources and relies on us
4428 * to know if they were allocated or not. 4433 * to know if they were allocated or not.
4429 */ 4434 */
4430 fdc = 0; 4435 fdc = 0;
4431 irqdma_allocated = 1; 4436 irqdma_allocated = 1;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index e5a051577a5e..589cbbd9cd4f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1285,7 +1285,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
1285 struct loop_device *lo = inode->i_bdev->bd_disk->private_data; 1285 struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
1286 int err; 1286 int err;
1287 1287
1288 lock_kernel();
1289 switch(cmd) { 1288 switch(cmd) {
1290 case LOOP_SET_STATUS: 1289 case LOOP_SET_STATUS:
1291 mutex_lock(&lo->lo_ctl_mutex); 1290 mutex_lock(&lo->lo_ctl_mutex);
@@ -1311,7 +1310,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
1311 err = -ENOIOCTLCMD; 1310 err = -ENOIOCTLCMD;
1312 break; 1311 break;
1313 } 1312 }
1314 unlock_kernel();
1315 return err; 1313 return err;
1316} 1314}
1317#endif 1315#endif
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index be5ec3a9b1fc..cb136a919f2a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -113,12 +113,42 @@ static void nbd_end_request(struct request *req)
113 spin_unlock_irqrestore(q->queue_lock, flags); 113 spin_unlock_irqrestore(q->queue_lock, flags);
114} 114}
115 115
116static void sock_shutdown(struct nbd_device *lo, int lock)
117{
118 /* Forcibly shutdown the socket causing all listeners
119 * to error
120 *
121 * FIXME: This code is duplicated from sys_shutdown, but
122 * there should be a more generic interface rather than
123 * calling socket ops directly here */
124 if (lock)
125 mutex_lock(&lo->tx_lock);
126 if (lo->sock) {
127 printk(KERN_WARNING "%s: shutting down socket\n",
128 lo->disk->disk_name);
129 lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN);
130 lo->sock = NULL;
131 }
132 if (lock)
133 mutex_unlock(&lo->tx_lock);
134}
135
136static void nbd_xmit_timeout(unsigned long arg)
137{
138 struct task_struct *task = (struct task_struct *)arg;
139
140 printk(KERN_WARNING "nbd: killing hung xmit (%s, pid: %d)\n",
141 task->comm, task->pid);
142 force_sig(SIGKILL, task);
143}
144
116/* 145/*
117 * Send or receive packet. 146 * Send or receive packet.
118 */ 147 */
119static int sock_xmit(struct socket *sock, int send, void *buf, int size, 148static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
120 int msg_flags) 149 int msg_flags)
121{ 150{
151 struct socket *sock = lo->sock;
122 int result; 152 int result;
123 struct msghdr msg; 153 struct msghdr msg;
124 struct kvec iov; 154 struct kvec iov;
@@ -139,9 +169,20 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size,
139 msg.msg_controllen = 0; 169 msg.msg_controllen = 0;
140 msg.msg_flags = msg_flags | MSG_NOSIGNAL; 170 msg.msg_flags = msg_flags | MSG_NOSIGNAL;
141 171
142 if (send) 172 if (send) {
173 struct timer_list ti;
174
175 if (lo->xmit_timeout) {
176 init_timer(&ti);
177 ti.function = nbd_xmit_timeout;
178 ti.data = (unsigned long)current;
179 ti.expires = jiffies + lo->xmit_timeout;
180 add_timer(&ti);
181 }
143 result = kernel_sendmsg(sock, &msg, &iov, 1, size); 182 result = kernel_sendmsg(sock, &msg, &iov, 1, size);
144 else 183 if (lo->xmit_timeout)
184 del_timer_sync(&ti);
185 } else
145 result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0); 186 result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0);
146 187
147 if (signal_pending(current)) { 188 if (signal_pending(current)) {
@@ -150,6 +191,7 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size,
150 current->pid, current->comm, 191 current->pid, current->comm,
151 dequeue_signal_lock(current, &current->blocked, &info)); 192 dequeue_signal_lock(current, &current->blocked, &info));
152 result = -EINTR; 193 result = -EINTR;
194 sock_shutdown(lo, !send);
153 break; 195 break;
154 } 196 }
155 197
@@ -167,23 +209,22 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size,
167 return result; 209 return result;
168} 210}
169 211
170static inline int sock_send_bvec(struct socket *sock, struct bio_vec *bvec, 212static inline int sock_send_bvec(struct nbd_device *lo, struct bio_vec *bvec,
171 int flags) 213 int flags)
172{ 214{
173 int result; 215 int result;
174 void *kaddr = kmap(bvec->bv_page); 216 void *kaddr = kmap(bvec->bv_page);
175 result = sock_xmit(sock, 1, kaddr + bvec->bv_offset, bvec->bv_len, 217 result = sock_xmit(lo, 1, kaddr + bvec->bv_offset, bvec->bv_len, flags);
176 flags);
177 kunmap(bvec->bv_page); 218 kunmap(bvec->bv_page);
178 return result; 219 return result;
179} 220}
180 221
222/* always call with the tx_lock held */
181static int nbd_send_req(struct nbd_device *lo, struct request *req) 223static int nbd_send_req(struct nbd_device *lo, struct request *req)
182{ 224{
183 int result, flags; 225 int result, flags;
184 struct nbd_request request; 226 struct nbd_request request;
185 unsigned long size = req->nr_sectors << 9; 227 unsigned long size = req->nr_sectors << 9;
186 struct socket *sock = lo->sock;
187 228
188 request.magic = htonl(NBD_REQUEST_MAGIC); 229 request.magic = htonl(NBD_REQUEST_MAGIC);
189 request.type = htonl(nbd_cmd(req)); 230 request.type = htonl(nbd_cmd(req));
@@ -196,8 +237,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
196 nbdcmd_to_ascii(nbd_cmd(req)), 237 nbdcmd_to_ascii(nbd_cmd(req)),
197 (unsigned long long)req->sector << 9, 238 (unsigned long long)req->sector << 9,
198 req->nr_sectors << 9); 239 req->nr_sectors << 9);
199 result = sock_xmit(sock, 1, &request, sizeof(request), 240 result = sock_xmit(lo, 1, &request, sizeof(request),
200 (nbd_cmd(req) == NBD_CMD_WRITE)? MSG_MORE: 0); 241 (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0);
201 if (result <= 0) { 242 if (result <= 0) {
202 printk(KERN_ERR "%s: Send control failed (result %d)\n", 243 printk(KERN_ERR "%s: Send control failed (result %d)\n",
203 lo->disk->disk_name, result); 244 lo->disk->disk_name, result);
@@ -217,7 +258,7 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
217 flags = MSG_MORE; 258 flags = MSG_MORE;
218 dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n", 259 dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
219 lo->disk->disk_name, req, bvec->bv_len); 260 lo->disk->disk_name, req, bvec->bv_len);
220 result = sock_send_bvec(sock, bvec, flags); 261 result = sock_send_bvec(lo, bvec, flags);
221 if (result <= 0) { 262 if (result <= 0) {
222 printk(KERN_ERR "%s: Send data failed (result %d)\n", 263 printk(KERN_ERR "%s: Send data failed (result %d)\n",
223 lo->disk->disk_name, result); 264 lo->disk->disk_name, result);
@@ -231,22 +272,18 @@ error_out:
231 return 1; 272 return 1;
232} 273}
233 274
234static struct request *nbd_find_request(struct nbd_device *lo, char *handle) 275static struct request *nbd_find_request(struct nbd_device *lo,
276 struct request *xreq)
235{ 277{
236 struct request *req; 278 struct request *req, *tmp;
237 struct list_head *tmp;
238 struct request *xreq;
239 int err; 279 int err;
240 280
241 memcpy(&xreq, handle, sizeof(xreq));
242
243 err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq); 281 err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq);
244 if (unlikely(err)) 282 if (unlikely(err))
245 goto out; 283 goto out;
246 284
247 spin_lock(&lo->queue_lock); 285 spin_lock(&lo->queue_lock);
248 list_for_each(tmp, &lo->queue_head) { 286 list_for_each_entry_safe(req, tmp, &lo->queue_head, queuelist) {
249 req = list_entry(tmp, struct request, queuelist);
250 if (req != xreq) 287 if (req != xreq)
251 continue; 288 continue;
252 list_del_init(&req->queuelist); 289 list_del_init(&req->queuelist);
@@ -261,11 +298,11 @@ out:
261 return ERR_PTR(err); 298 return ERR_PTR(err);
262} 299}
263 300
264static inline int sock_recv_bvec(struct socket *sock, struct bio_vec *bvec) 301static inline int sock_recv_bvec(struct nbd_device *lo, struct bio_vec *bvec)
265{ 302{
266 int result; 303 int result;
267 void *kaddr = kmap(bvec->bv_page); 304 void *kaddr = kmap(bvec->bv_page);
268 result = sock_xmit(sock, 0, kaddr + bvec->bv_offset, bvec->bv_len, 305 result = sock_xmit(lo, 0, kaddr + bvec->bv_offset, bvec->bv_len,
269 MSG_WAITALL); 306 MSG_WAITALL);
270 kunmap(bvec->bv_page); 307 kunmap(bvec->bv_page);
271 return result; 308 return result;
@@ -277,10 +314,9 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
277 int result; 314 int result;
278 struct nbd_reply reply; 315 struct nbd_reply reply;
279 struct request *req; 316 struct request *req;
280 struct socket *sock = lo->sock;
281 317
282 reply.magic = 0; 318 reply.magic = 0;
283 result = sock_xmit(sock, 0, &reply, sizeof(reply), MSG_WAITALL); 319 result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL);
284 if (result <= 0) { 320 if (result <= 0) {
285 printk(KERN_ERR "%s: Receive control failed (result %d)\n", 321 printk(KERN_ERR "%s: Receive control failed (result %d)\n",
286 lo->disk->disk_name, result); 322 lo->disk->disk_name, result);
@@ -295,7 +331,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
295 goto harderror; 331 goto harderror;
296 } 332 }
297 333
298 req = nbd_find_request(lo, reply.handle); 334 req = nbd_find_request(lo, *(struct request **)reply.handle);
299 if (unlikely(IS_ERR(req))) { 335 if (unlikely(IS_ERR(req))) {
300 result = PTR_ERR(req); 336 result = PTR_ERR(req);
301 if (result != -ENOENT) 337 if (result != -ENOENT)
@@ -321,7 +357,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
321 struct bio_vec *bvec; 357 struct bio_vec *bvec;
322 358
323 rq_for_each_segment(bvec, req, iter) { 359 rq_for_each_segment(bvec, req, iter) {
324 result = sock_recv_bvec(sock, bvec); 360 result = sock_recv_bvec(lo, bvec);
325 if (result <= 0) { 361 if (result <= 0) {
326 printk(KERN_ERR "%s: Receive data failed (result %d)\n", 362 printk(KERN_ERR "%s: Receive data failed (result %d)\n",
327 lo->disk->disk_name, result); 363 lo->disk->disk_name, result);
@@ -396,6 +432,7 @@ static void nbd_clear_que(struct nbd_device *lo)
396 } 432 }
397} 433}
398 434
435
399/* 436/*
400 * We always wait for result of write, for now. It would be nice to make it optional 437 * We always wait for result of write, for now. It would be nice to make it optional
401 * in future 438 * in future
@@ -504,7 +541,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
504 sreq.nr_sectors = 0; 541 sreq.nr_sectors = 0;
505 if (!lo->sock) 542 if (!lo->sock)
506 return -EINVAL; 543 return -EINVAL;
544 mutex_lock(&lo->tx_lock);
507 nbd_send_req(lo, &sreq); 545 nbd_send_req(lo, &sreq);
546 mutex_unlock(&lo->tx_lock);
508 return 0; 547 return 0;
509 548
510 case NBD_CLEAR_SOCK: 549 case NBD_CLEAR_SOCK:
@@ -548,6 +587,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
548 set_blocksize(inode->i_bdev, lo->blksize); 587 set_blocksize(inode->i_bdev, lo->blksize);
549 set_capacity(lo->disk, lo->bytesize >> 9); 588 set_capacity(lo->disk, lo->bytesize >> 9);
550 return 0; 589 return 0;
590 case NBD_SET_TIMEOUT:
591 lo->xmit_timeout = arg * HZ;
592 return 0;
551 case NBD_SET_SIZE_BLOCKS: 593 case NBD_SET_SIZE_BLOCKS:
552 lo->bytesize = ((u64) arg) * lo->blksize; 594 lo->bytesize = ((u64) arg) * lo->blksize;
553 inode->i_bdev->bd_inode->i_size = lo->bytesize; 595 inode->i_bdev->bd_inode->i_size = lo->bytesize;
@@ -560,28 +602,16 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
560 error = nbd_do_it(lo); 602 error = nbd_do_it(lo);
561 if (error) 603 if (error)
562 return error; 604 return error;
563 /* on return tidy up in case we have a signal */ 605 sock_shutdown(lo, 1);
564 /* Forcibly shutdown the socket causing all listeners
565 * to error
566 *
567 * FIXME: This code is duplicated from sys_shutdown, but
568 * there should be a more generic interface rather than
569 * calling socket ops directly here */
570 mutex_lock(&lo->tx_lock);
571 if (lo->sock) {
572 printk(KERN_WARNING "%s: shutting down socket\n",
573 lo->disk->disk_name);
574 lo->sock->ops->shutdown(lo->sock,
575 SEND_SHUTDOWN|RCV_SHUTDOWN);
576 lo->sock = NULL;
577 }
578 mutex_unlock(&lo->tx_lock);
579 file = lo->file; 606 file = lo->file;
580 lo->file = NULL; 607 lo->file = NULL;
581 nbd_clear_que(lo); 608 nbd_clear_que(lo);
582 printk(KERN_WARNING "%s: queue cleared\n", lo->disk->disk_name); 609 printk(KERN_WARNING "%s: queue cleared\n", lo->disk->disk_name);
583 if (file) 610 if (file)
584 fput(file); 611 fput(file);
612 lo->bytesize = 0;
613 inode->i_bdev->bd_inode->i_size = 0;
614 set_capacity(lo->disk, 0);
585 return lo->harderror; 615 return lo->harderror;
586 case NBD_CLEAR_QUE: 616 case NBD_CLEAR_QUE:
587 /* 617 /*
@@ -659,14 +689,14 @@ static int __init nbd_init(void)
659 mutex_init(&nbd_dev[i].tx_lock); 689 mutex_init(&nbd_dev[i].tx_lock);
660 init_waitqueue_head(&nbd_dev[i].active_wq); 690 init_waitqueue_head(&nbd_dev[i].active_wq);
661 nbd_dev[i].blksize = 1024; 691 nbd_dev[i].blksize = 1024;
662 nbd_dev[i].bytesize = 0x7ffffc00ULL << 10; /* 2TB */ 692 nbd_dev[i].bytesize = 0;
663 disk->major = NBD_MAJOR; 693 disk->major = NBD_MAJOR;
664 disk->first_minor = i; 694 disk->first_minor = i;
665 disk->fops = &nbd_fops; 695 disk->fops = &nbd_fops;
666 disk->private_data = &nbd_dev[i]; 696 disk->private_data = &nbd_dev[i];
667 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; 697 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
668 sprintf(disk->disk_name, "nbd%d", i); 698 sprintf(disk->disk_name, "nbd%d", i);
669 set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */ 699 set_capacity(disk, 0);
670 add_disk(disk); 700 add_disk(disk);
671 } 701 }
672 702
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 701ea77f62e9..08176d23a46c 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void)
411 blk_cleanup_queue(rd_queue[i]); 411 blk_cleanup_queue(rd_queue[i]);
412 } 412 }
413 unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); 413 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
414
415 bdi_destroy(&rd_file_backing_dev_info);
416 bdi_destroy(&rd_backing_dev_info);
414} 417}
415 418
416/* 419/*
@@ -419,7 +422,19 @@ static void __exit rd_cleanup(void)
419static int __init rd_init(void) 422static int __init rd_init(void)
420{ 423{
421 int i; 424 int i;
422 int err = -ENOMEM; 425 int err;
426
427 err = bdi_init(&rd_backing_dev_info);
428 if (err)
429 goto out2;
430
431 err = bdi_init(&rd_file_backing_dev_info);
432 if (err) {
433 bdi_destroy(&rd_backing_dev_info);
434 goto out2;
435 }
436
437 err = -ENOMEM;
423 438
424 if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || 439 if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 ||
425 (rd_blocksize & (rd_blocksize-1))) { 440 (rd_blocksize & (rd_blocksize-1))) {
@@ -473,6 +488,9 @@ out:
473 put_disk(rd_disks[i]); 488 put_disk(rd_disks[i]);
474 blk_cleanup_queue(rd_queue[i]); 489 blk_cleanup_queue(rd_queue[i]);
475 } 490 }
491 bdi_destroy(&rd_backing_dev_info);
492 bdi_destroy(&rd_file_backing_dev_info);
493out2:
476 return err; 494 return err;
477} 495}
478 496
@@ -486,17 +504,12 @@ static int __init ramdisk_size(char *str)
486 rd_size = simple_strtol(str,NULL,0); 504 rd_size = simple_strtol(str,NULL,0);
487 return 1; 505 return 1;
488} 506}
489static int __init ramdisk_size2(char *str) /* kludge */
490{
491 return ramdisk_size(str);
492}
493static int __init ramdisk_blocksize(char *str) 507static int __init ramdisk_blocksize(char *str)
494{ 508{
495 rd_blocksize = simple_strtol(str,NULL,0); 509 rd_blocksize = simple_strtol(str,NULL,0);
496 return 1; 510 return 1;
497} 511}
498__setup("ramdisk=", ramdisk_size); 512__setup("ramdisk_size=", ramdisk_size);
499__setup("ramdisk_size=", ramdisk_size2);
500__setup("ramdisk_blocksize=", ramdisk_blocksize); 513__setup("ramdisk_blocksize=", ramdisk_blocksize);
501#endif 514#endif
502 515
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index f6f8c03047fa..204d53e506de 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -36,6 +36,23 @@ config VT
36 If unsure, say Y, or else you won't be able to do much with your new 36 If unsure, say Y, or else you won't be able to do much with your new
37 shiny Linux system :-) 37 shiny Linux system :-)
38 38
39config VT_UNICODE
40 bool "Virtual console is Unicode by default"
41 depends on VT
42 default n
43 ---help---
44 If you say Y here, the virtual terminal will be in UTF-8 by default,
45 and the keyboard will run in unicode mode.
46
47 If you say N here, the virtual terminal will not be in UTF-8 by
48 default, and the keyboard will run in XLATE mode.
49
50 This can also be changed by passing 'default_utf8=<0|1>' on the
51 kernel command line.
52
53 Historically, the kernel has defaulted to non-UTF8 and XLATE mode.
54 If unsure, say N here.
55
39config VT_CONSOLE 56config VT_CONSOLE
40 bool "Support for console on virtual terminal" if EMBEDDED 57 bool "Support for console on virtual terminal" if EMBEDDED
41 depends on VT 58 depends on VT
@@ -568,8 +585,8 @@ config TIPAR
568config HVC_DRIVER 585config HVC_DRIVER
569 bool 586 bool
570 help 587 help
571 Users of pSeries machines that want to utilize the hvc console front-end 588 Generic "hypervisor virtual console" infrastructure for various
572 module for their backend console driver should select this option. 589 hypervisors (pSeries, iSeries, Xen, lguest).
573 It will automatically be selected if one of the back-end console drivers 590 It will automatically be selected if one of the back-end console drivers
574 is selected. 591 is selected.
575 592
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 313a133a1172..cbb0444467ba 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -14,15 +14,12 @@
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/agp_backend.h> 16#include <linux/agp_backend.h>
17#include <linux/log2.h>
17 18
18#include <asm/acpi-ext.h> 19#include <asm/acpi-ext.h>
19 20
20#include "agp.h" 21#include "agp.h"
21 22
22#ifndef log2
23#define log2(x) ffz(~(x))
24#endif
25
26#define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ 23#define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */
27 24
28/* HP ZX1 IOC registers */ 25/* HP ZX1 IOC registers */
@@ -257,7 +254,7 @@ hp_zx1_configure (void)
257 readl(hp->ioc_regs+HP_ZX1_IMASK); 254 readl(hp->ioc_regs+HP_ZX1_IMASK);
258 writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); 255 writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE);
259 readl(hp->ioc_regs+HP_ZX1_IBASE); 256 readl(hp->ioc_regs+HP_ZX1_IBASE);
260 writel(hp->iova_base|log2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); 257 writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM);
261 readl(hp->ioc_regs+HP_ZX1_PCOM); 258 readl(hp->ioc_regs+HP_ZX1_PCOM);
262 } 259 }
263 260
@@ -285,7 +282,7 @@ hp_zx1_tlbflush (struct agp_memory *mem)
285{ 282{
286 struct _hp_private *hp = &hp_private; 283 struct _hp_private *hp = &hp_private;
287 284
288 writeq(hp->gart_base | log2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); 285 writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM);
289 readq(hp->ioc_regs+HP_ZX1_PCOM); 286 readq(hp->ioc_regs+HP_ZX1_PCOM);
290} 287}
291 288
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index 70117df4d067..e72a83e2bad5 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -13,6 +13,7 @@
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/agp_backend.h> 15#include <linux/agp_backend.h>
16#include <linux/log2.h>
16 17
17#include "agp.h" 18#include "agp.h"
18 19
@@ -59,8 +60,6 @@
59 */ 60 */
60#define WR_FLUSH_GATT(index) RD_GATT(index) 61#define WR_FLUSH_GATT(index) RD_GATT(index)
61 62
62#define log2(x) ffz(~(x))
63
64static struct { 63static struct {
65 void *gatt; /* ioremap'd GATT area */ 64 void *gatt; /* ioremap'd GATT area */
66 65
@@ -148,7 +147,7 @@ static int i460_fetch_size (void)
148 * values[i].size. 147 * values[i].size.
149 */ 148 */
150 values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12); 149 values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12);
151 values[i].page_order = log2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT); 150 values[i].page_order = ilog2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT);
152 } 151 }
153 152
154 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { 153 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index f4562cc22343..2939e3570f9d 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/klist.h> 19#include <linux/klist.h>
20#include <linux/agp_backend.h> 20#include <linux/agp_backend.h>
21#include <linux/log2.h>
21 22
22#include <asm-parisc/parisc-device.h> 23#include <asm-parisc/parisc-device.h>
23#include <asm-parisc/ropes.h> 24#include <asm-parisc/ropes.h>
@@ -27,10 +28,6 @@
27#define DRVNAME "quicksilver" 28#define DRVNAME "quicksilver"
28#define DRVPFX DRVNAME ": " 29#define DRVPFX DRVNAME ": "
29 30
30#ifndef log2
31#define log2(x) ffz(~(x))
32#endif
33
34#define AGP8X_MODE_BIT 3 31#define AGP8X_MODE_BIT 3
35#define AGP8X_MODE (1 << AGP8X_MODE_BIT) 32#define AGP8X_MODE (1 << AGP8X_MODE_BIT)
36 33
@@ -92,7 +89,7 @@ parisc_agp_tlbflush(struct agp_memory *mem)
92{ 89{
93 struct _parisc_agp_info *info = &parisc_agp_info; 90 struct _parisc_agp_info *info = &parisc_agp_info;
94 91
95 writeq(info->gart_base | log2(info->gart_size), info->ioc_regs+IOC_PCOM); 92 writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM);
96 readq(info->ioc_regs+IOC_PCOM); /* flush */ 93 readq(info->ioc_regs+IOC_PCOM); /* flush */
97} 94}
98 95
diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c
index 4b3916f54909..6b104e45a322 100644
--- a/drivers/char/consolemap.c
+++ b/drivers/char/consolemap.c
@@ -494,12 +494,11 @@ int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
494 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 494 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
495 if (p && p->readonly) return -EIO; 495 if (p && p->readonly) return -EIO;
496 if (!p || --p->refcount) { 496 if (!p || --p->refcount) {
497 q = kmalloc(sizeof(*p), GFP_KERNEL); 497 q = kzalloc(sizeof(*p), GFP_KERNEL);
498 if (!q) { 498 if (!q) {
499 if (p) p->refcount++; 499 if (p) p->refcount++;
500 return -ENOMEM; 500 return -ENOMEM;
501 } 501 }
502 memset(q, 0, sizeof(*q));
503 q->refcount=1; 502 q->refcount=1;
504 *vc->vc_uni_pagedir_loc = (unsigned long)q; 503 *vc->vc_uni_pagedir_loc = (unsigned long)q;
505 } else { 504 } else {
@@ -670,19 +669,29 @@ void con_protect_unimap(struct vc_data *vc, int rdonly)
670 p->readonly = rdonly; 669 p->readonly = rdonly;
671} 670}
672 671
672/*
673 * Always use USER_MAP. These functions are used by the keyboard,
674 * which shouldn't be affected by G0/G1 switching, etc.
675 * If the user map still contains default values, i.e. the
676 * direct-to-font mapping, then assume user is using Latin1.
677 */
673/* may be called during an interrupt */ 678/* may be called during an interrupt */
674u32 conv_8bit_to_uni(unsigned char c) 679u32 conv_8bit_to_uni(unsigned char c)
675{ 680{
676 /*
677 * Always use USER_MAP. This function is used by the keyboard,
678 * which shouldn't be affected by G0/G1 switching, etc.
679 * If the user map still contains default values, i.e. the
680 * direct-to-font mapping, then assume user is using Latin1.
681 */
682 unsigned short uni = translations[USER_MAP][c]; 681 unsigned short uni = translations[USER_MAP][c];
683 return uni == (0xf000 | c) ? c : uni; 682 return uni == (0xf000 | c) ? c : uni;
684} 683}
685 684
685int conv_uni_to_8bit(u32 uni)
686{
687 int c;
688 for (c = 0; c < 0x100; c++)
689 if (translations[USER_MAP][c] == uni ||
690 (translations[USER_MAP][c] == (c | 0xf000) && uni == c))
691 return c;
692 return -1;
693}
694
686int 695int
687conv_uni_to_pc(struct vc_data *conp, long ucs) 696conv_uni_to_pc(struct vc_data *conp, long ucs)
688{ 697{
diff --git a/drivers/char/defkeymap.c_shipped b/drivers/char/defkeymap.c_shipped
index 453a2f1ffa15..0aa419a61767 100644
--- a/drivers/char/defkeymap.c_shipped
+++ b/drivers/char/defkeymap.c_shipped
@@ -222,7 +222,7 @@ char *func_table[MAX_NR_FUNC] = {
222 NULL, 222 NULL,
223}; 223};
224 224
225struct kbdiacr accent_table[MAX_DIACR] = { 225struct kbdiacruc accent_table[MAX_DIACR] = {
226 {'`', 'A', '\300'}, {'`', 'a', '\340'}, 226 {'`', 'A', '\300'}, {'`', 'a', '\340'},
227 {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, 227 {'\'', 'A', '\301'}, {'\'', 'a', '\341'},
228 {'^', 'A', '\302'}, {'^', 'a', '\342'}, 228 {'^', 'A', '\302'}, {'^', 'a', '\342'},
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index c6c56fb8ba50..ffcecde9e2a5 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1,34 +1,30 @@
1/* 1/*
2
3
4 Copyright (C) 1996 Digi International. 2 Copyright (C) 1996 Digi International.
5 3
6 For technical support please email digiLinux@dgii.com or 4 For technical support please email digiLinux@dgii.com or
7 call Digi tech support at (612) 912-3456 5 call Digi tech support at (612) 912-3456
8 6
9 ** This driver is no longer supported by Digi ** 7 ** This driver is no longer supported by Digi **
10 8
11 Much of this design and code came from epca.c which was 9 Much of this design and code came from epca.c which was
12 copyright (C) 1994, 1995 Troy De Jongh, and subsquently 10 copyright (C) 1994, 1995 Troy De Jongh, and subsquently
13 modified by David Nugent, Christoph Lameter, Mike McLagan. 11 modified by David Nugent, Christoph Lameter, Mike McLagan.
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 2 of the License, or
18 (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
29--------------------------------------------------------------------------- */
30/* See README.epca for change history --DAT*/
31 12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27/* See README.epca for change history --DAT*/
32 28
33#include <linux/module.h> 29#include <linux/module.h>
34#include <linux/kernel.h> 30#include <linux/kernel.h>
@@ -54,13 +50,10 @@
54#include "epca.h" 50#include "epca.h"
55#include "epcaconfig.h" 51#include "epcaconfig.h"
56 52
57/* ---------------------- Begin defines ------------------------ */
58
59#define VERSION "1.3.0.1-LK2.6" 53#define VERSION "1.3.0.1-LK2.6"
60 54
61/* This major needs to be submitted to Linux to join the majors list */ 55/* This major needs to be submitted to Linux to join the majors list */
62 56#define DIGIINFOMAJOR 35 /* For Digi specific ioctl */
63#define DIGIINFOMAJOR 35 /* For Digi specific ioctl */
64 57
65 58
66#define MAXCARDS 7 59#define MAXCARDS 7
@@ -68,60 +61,48 @@
68 61
69#define PFX "epca: " 62#define PFX "epca: "
70 63
71/* ----------------- Begin global definitions ------------------- */
72
73static int nbdevs, num_cards, liloconfig; 64static int nbdevs, num_cards, liloconfig;
74static int digi_poller_inhibited = 1 ; 65static int digi_poller_inhibited = 1 ;
75 66
76static int setup_error_code; 67static int setup_error_code;
77static int invalid_lilo_config; 68static int invalid_lilo_config;
78 69
79/* The ISA boards do window flipping into the same spaces so its only sane 70/*
80 with a single lock. It's still pretty efficient */ 71 * The ISA boards do window flipping into the same spaces so its only sane with
81 72 * a single lock. It's still pretty efficient.
73 */
82static DEFINE_SPINLOCK(epca_lock); 74static DEFINE_SPINLOCK(epca_lock);
83 75
84/* ----------------------------------------------------------------------- 76/* MAXBOARDS is typically 12, but ISA and EISA cards are restricted to 7 below. */
85 MAXBOARDS is typically 12, but ISA and EISA cards are restricted to
86 7 below.
87--------------------------------------------------------------------------*/
88static struct board_info boards[MAXBOARDS]; 77static struct board_info boards[MAXBOARDS];
89 78
90
91/* ------------- Begin structures used for driver registeration ---------- */
92
93static struct tty_driver *pc_driver; 79static struct tty_driver *pc_driver;
94static struct tty_driver *pc_info; 80static struct tty_driver *pc_info;
95 81
96/* ------------------ Begin Digi specific structures -------------------- */ 82/* ------------------ Begin Digi specific structures -------------------- */
97 83
98/* ------------------------------------------------------------------------ 84/*
99 digi_channels represents an array of structures that keep track of 85 * digi_channels represents an array of structures that keep track of each
100 each channel of the Digi product. Information such as transmit and 86 * channel of the Digi product. Information such as transmit and receive
101 receive pointers, termio data, and signal definitions (DTR, CTS, etc ...) 87 * pointers, termio data, and signal definitions (DTR, CTS, etc ...) are stored
102 are stored here. This structure is NOT used to overlay the cards 88 * here. This structure is NOT used to overlay the cards physical channel
103 physical channel structure. 89 * structure.
104-------------------------------------------------------------------------- */ 90 */
105
106static struct channel digi_channels[MAX_ALLOC]; 91static struct channel digi_channels[MAX_ALLOC];
107 92
108/* ------------------------------------------------------------------------ 93/*
109 card_ptr is an array used to hold the address of the 94 * card_ptr is an array used to hold the address of the first channel structure
110 first channel structure of each card. This array will hold 95 * of each card. This array will hold the addresses of various channels located
111 the addresses of various channels located in digi_channels. 96 * in digi_channels.
112-------------------------------------------------------------------------- */ 97 */
113static struct channel *card_ptr[MAXCARDS]; 98static struct channel *card_ptr[MAXCARDS];
114 99
115static struct timer_list epca_timer; 100static struct timer_list epca_timer;
116 101
117/* ---------------------- Begin function prototypes --------------------- */ 102/*
118 103 * Begin generic memory functions. These functions will be alias (point at)
119/* ---------------------------------------------------------------------- 104 * more specific functions dependent on the board being configured.
120 Begin generic memory functions. These functions will be alias 105 */
121 (point at) more specific functions dependent on the board being
122 configured.
123----------------------------------------------------------------------- */
124
125static void memwinon(struct board_info *b, unsigned int win); 106static void memwinon(struct board_info *b, unsigned int win);
126static void memwinoff(struct board_info *b, unsigned int win); 107static void memwinoff(struct board_info *b, unsigned int win);
127static void globalwinon(struct channel *ch); 108static void globalwinon(struct channel *ch);
@@ -170,8 +151,6 @@ static void dummy_memoff(struct channel *ch);
170static void dummy_assertgwinon(struct channel *ch); 151static void dummy_assertgwinon(struct channel *ch);
171static void dummy_assertmemoff(struct channel *ch); 152static void dummy_assertmemoff(struct channel *ch);
172 153
173/* ------------------- Begin declare functions ----------------------- */
174
175static struct channel *verifyChannel(struct tty_struct *); 154static struct channel *verifyChannel(struct tty_struct *);
176static void pc_sched_event(struct channel *, int); 155static void pc_sched_event(struct channel *, int);
177static void epca_error(int, char *); 156static void epca_error(int, char *);
@@ -213,62 +192,55 @@ static int pc_write(struct tty_struct *, const unsigned char *, int);
213static int pc_init(void); 192static int pc_init(void);
214static int init_PCI(void); 193static int init_PCI(void);
215 194
216 195/*
217/* ------------------------------------------------------------------ 196 * Table of functions for each board to handle memory. Mantaining parallelism
218 Table of functions for each board to handle memory. Mantaining 197 * is a *very* good idea here. The idea is for the runtime code to blindly call
219 parallelism is a *very* good idea here. The idea is for the 198 * these functions, not knowing/caring about the underlying hardware. This
220 runtime code to blindly call these functions, not knowing/caring 199 * stuff should contain no conditionals; if more functionality is needed a
221 about the underlying hardware. This stuff should contain no 200 * different entry should be established. These calls are the interface calls
222 conditionals; if more functionality is needed a different entry 201 * and are the only functions that should be accessed. Anyone caught making
223 should be established. These calls are the interface calls and 202 * direct calls deserves what they get.
224 are the only functions that should be accessed. Anyone caught 203 */
225 making direct calls deserves what they get.
226-------------------------------------------------------------------- */
227
228static void memwinon(struct board_info *b, unsigned int win) 204static void memwinon(struct board_info *b, unsigned int win)
229{ 205{
230 (b->memwinon)(b, win); 206 b->memwinon(b, win);
231} 207}
232 208
233static void memwinoff(struct board_info *b, unsigned int win) 209static void memwinoff(struct board_info *b, unsigned int win)
234{ 210{
235 (b->memwinoff)(b, win); 211 b->memwinoff(b, win);
236} 212}
237 213
238static void globalwinon(struct channel *ch) 214static void globalwinon(struct channel *ch)
239{ 215{
240 (ch->board->globalwinon)(ch); 216 ch->board->globalwinon(ch);
241} 217}
242 218
243static void rxwinon(struct channel *ch) 219static void rxwinon(struct channel *ch)
244{ 220{
245 (ch->board->rxwinon)(ch); 221 ch->board->rxwinon(ch);
246} 222}
247 223
248static void txwinon(struct channel *ch) 224static void txwinon(struct channel *ch)
249{ 225{
250 (ch->board->txwinon)(ch); 226 ch->board->txwinon(ch);
251} 227}
252 228
253static void memoff(struct channel *ch) 229static void memoff(struct channel *ch)
254{ 230{
255 (ch->board->memoff)(ch); 231 ch->board->memoff(ch);
256} 232}
257static void assertgwinon(struct channel *ch) 233static void assertgwinon(struct channel *ch)
258{ 234{
259 (ch->board->assertgwinon)(ch); 235 ch->board->assertgwinon(ch);
260} 236}
261 237
262static void assertmemoff(struct channel *ch) 238static void assertmemoff(struct channel *ch)
263{ 239{
264 (ch->board->assertmemoff)(ch); 240 ch->board->assertmemoff(ch);
265} 241}
266 242
267/* --------------------------------------------------------- 243/* PCXEM windowing is the same as that used in the PCXR and CX series cards. */
268 PCXEM windowing is the same as that used in the PCXR
269 and CX series cards.
270------------------------------------------------------------ */
271
272static void pcxem_memwinon(struct board_info *b, unsigned int win) 244static void pcxem_memwinon(struct board_info *b, unsigned int win)
273{ 245{
274 outb_p(FEPWIN|win, b->port + 1); 246 outb_p(FEPWIN|win, b->port + 1);
@@ -300,32 +272,30 @@ static void pcxem_memoff(struct channel *ch)
300} 272}
301 273
302/* ----------------- Begin pcxe memory window stuff ------------------ */ 274/* ----------------- Begin pcxe memory window stuff ------------------ */
303
304static void pcxe_memwinon(struct board_info *b, unsigned int win) 275static void pcxe_memwinon(struct board_info *b, unsigned int win)
305{ 276{
306 outb_p(FEPWIN | win, b->port + 1); 277 outb_p(FEPWIN | win, b->port + 1);
307} 278}
308 279
309static void pcxe_memwinoff(struct board_info *b, unsigned int win) 280static void pcxe_memwinoff(struct board_info *b, unsigned int win)
310{ 281{
311 outb_p(inb(b->port) & ~FEPMEM, 282 outb_p(inb(b->port) & ~FEPMEM, b->port + 1);
312 b->port + 1);
313 outb_p(0, b->port + 1); 283 outb_p(0, b->port + 1);
314} 284}
315 285
316static void pcxe_globalwinon(struct channel *ch) 286static void pcxe_globalwinon(struct channel *ch)
317{ 287{
318 outb_p( FEPWIN, (int)ch->board->port + 1); 288 outb_p(FEPWIN, (int)ch->board->port + 1);
319} 289}
320 290
321static void pcxe_rxwinon(struct channel *ch) 291static void pcxe_rxwinon(struct channel *ch)
322{ 292{
323 outb_p(ch->rxwin, (int)ch->board->port + 1); 293 outb_p(ch->rxwin, (int)ch->board->port + 1);
324} 294}
325 295
326static void pcxe_txwinon(struct channel *ch) 296static void pcxe_txwinon(struct channel *ch)
327{ 297{
328 outb_p(ch->txwin, (int)ch->board->port + 1); 298 outb_p(ch->txwin, (int)ch->board->port + 1);
329} 299}
330 300
331static void pcxe_memoff(struct channel *ch) 301static void pcxe_memoff(struct channel *ch)
@@ -335,10 +305,9 @@ static void pcxe_memoff(struct channel *ch)
335} 305}
336 306
337/* ------------- Begin pc64xe and pcxi memory window stuff -------------- */ 307/* ------------- Begin pc64xe and pcxi memory window stuff -------------- */
338
339static void pcxi_memwinon(struct board_info *b, unsigned int win) 308static void pcxi_memwinon(struct board_info *b, unsigned int win)
340{ 309{
341 outb_p(inb(b->port) | FEPMEM, b->port); 310 outb_p(inb(b->port) | FEPMEM, b->port);
342} 311}
343 312
344static void pcxi_memwinoff(struct board_info *b, unsigned int win) 313static void pcxi_memwinoff(struct board_info *b, unsigned int win)
@@ -353,12 +322,12 @@ static void pcxi_globalwinon(struct channel *ch)
353 322
354static void pcxi_rxwinon(struct channel *ch) 323static void pcxi_rxwinon(struct channel *ch)
355{ 324{
356 outb_p(FEPMEM, ch->board->port); 325 outb_p(FEPMEM, ch->board->port);
357} 326}
358 327
359static void pcxi_txwinon(struct channel *ch) 328static void pcxi_txwinon(struct channel *ch)
360{ 329{
361 outb_p(FEPMEM, ch->board->port); 330 outb_p(FEPMEM, ch->board->port);
362} 331}
363 332
364static void pcxi_memoff(struct channel *ch) 333static void pcxi_memoff(struct channel *ch)
@@ -376,16 +345,13 @@ static void pcxi_assertmemoff(struct channel *ch)
376 epcaassert(!(inb(ch->board->port) & FEPMEM), "Memory on"); 345 epcaassert(!(inb(ch->board->port) & FEPMEM), "Memory on");
377} 346}
378 347
379 348/*
380/* ---------------------------------------------------------------------- 349 * Not all of the cards need specific memory windowing routines. Some cards
381 Not all of the cards need specific memory windowing routines. Some 350 * (Such as PCI) needs no windowing routines at all. We provide these do
382 cards (Such as PCI) needs no windowing routines at all. We provide 351 * nothing routines so that the same code base can be used. The driver will
383 these do nothing routines so that the same code base can be used. 352 * ALWAYS call a windowing routine if it thinks it needs to; regardless of the
384 The driver will ALWAYS call a windowing routine if it thinks it needs 353 * card. However, dependent on the card the routine may or may not do anything.
385 to; regardless of the card. However, dependent on the card the routine 354 */
386 may or may not do anything.
387---------------------------------------------------------------------------*/
388
389static void dummy_memwinon(struct board_info *b, unsigned int win) 355static void dummy_memwinon(struct board_info *b, unsigned int win)
390{ 356{
391} 357}
@@ -418,15 +384,14 @@ static void dummy_assertmemoff(struct channel *ch)
418{ 384{
419} 385}
420 386
421/* ----------------- Begin verifyChannel function ----------------------- */
422static struct channel *verifyChannel(struct tty_struct *tty) 387static struct channel *verifyChannel(struct tty_struct *tty)
423{ /* Begin verifyChannel */ 388{
424 /* -------------------------------------------------------------------- 389 /*
425 This routine basically provides a sanity check. It insures that 390 * This routine basically provides a sanity check. It insures that the
426 the channel returned is within the proper range of addresses as 391 * channel returned is within the proper range of addresses as well as
427 well as properly initialized. If some bogus info gets passed in 392 * properly initialized. If some bogus info gets passed in
428 through tty->driver_data this should catch it. 393 * through tty->driver_data this should catch it.
429 --------------------------------------------------------------------- */ 394 */
430 if (tty) { 395 if (tty) {
431 struct channel *ch = (struct channel *)tty->driver_data; 396 struct channel *ch = (struct channel *)tty->driver_data;
432 if ((ch >= &digi_channels[0]) && (ch < &digi_channels[nbdevs])) { 397 if ((ch >= &digi_channels[0]) && (ch < &digi_channels[nbdevs])) {
@@ -435,62 +400,55 @@ static struct channel *verifyChannel(struct tty_struct *tty)
435 } 400 }
436 } 401 }
437 return NULL; 402 return NULL;
438 403}
439} /* End verifyChannel */
440
441/* ------------------ Begin pc_sched_event ------------------------- */
442 404
443static void pc_sched_event(struct channel *ch, int event) 405static void pc_sched_event(struct channel *ch, int event)
444{ 406{
445 /* ---------------------------------------------------------------------- 407 /*
446 We call this to schedule interrupt processing on some event. The 408 * We call this to schedule interrupt processing on some event. The
447 kernel sees our request and calls the related routine in OUR driver. 409 * kernel sees our request and calls the related routine in OUR driver.
448 -------------------------------------------------------------------------*/ 410 */
449 ch->event |= 1 << event; 411 ch->event |= 1 << event;
450 schedule_work(&ch->tqueue); 412 schedule_work(&ch->tqueue);
451} /* End pc_sched_event */ 413}
452
453/* ------------------ Begin epca_error ------------------------- */
454 414
455static void epca_error(int line, char *msg) 415static void epca_error(int line, char *msg)
456{ 416{
457 printk(KERN_ERR "epca_error (Digi): line = %d %s\n",line,msg); 417 printk(KERN_ERR "epca_error (Digi): line = %d %s\n",line,msg);
458} 418}
459 419
460/* ------------------ Begin pc_close ------------------------- */ 420static void pc_close(struct tty_struct *tty, struct file *filp)
461static void pc_close(struct tty_struct * tty, struct file * filp)
462{ 421{
463 struct channel *ch; 422 struct channel *ch;
464 unsigned long flags; 423 unsigned long flags;
465 /* --------------------------------------------------------- 424 /*
466 verifyChannel returns the channel from the tty struct 425 * verifyChannel returns the channel from the tty struct if it is
467 if it is valid. This serves as a sanity check. 426 * valid. This serves as a sanity check.
468 ------------------------------------------------------------- */ 427 */
469 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if ch != NULL */ 428 if ((ch = verifyChannel(tty)) != NULL) {
470 spin_lock_irqsave(&epca_lock, flags); 429 spin_lock_irqsave(&epca_lock, flags);
471 if (tty_hung_up_p(filp)) { 430 if (tty_hung_up_p(filp)) {
472 spin_unlock_irqrestore(&epca_lock, flags); 431 spin_unlock_irqrestore(&epca_lock, flags);
473 return; 432 return;
474 } 433 }
475 /* Check to see if the channel is open more than once */
476 if (ch->count-- > 1) { 434 if (ch->count-- > 1) {
477 /* Begin channel is open more than once */ 435 /* Begin channel is open more than once */
478 /* ------------------------------------------------------------- 436 /*
479 Return without doing anything. Someone might still be using 437 * Return without doing anything. Someone might still
480 the channel. 438 * be using the channel.
481 ---------------------------------------------------------------- */ 439 */
482 spin_unlock_irqrestore(&epca_lock, flags); 440 spin_unlock_irqrestore(&epca_lock, flags);
483 return; 441 return;
484 } /* End channel is open more than once */ 442 }
485 443
486 /* Port open only once go ahead with shutdown & reset */ 444 /* Port open only once go ahead with shutdown & reset */
487 BUG_ON(ch->count < 0); 445 BUG_ON(ch->count < 0);
488 446
489 /* --------------------------------------------------------------- 447 /*
490 Let the rest of the driver know the channel is being closed. 448 * Let the rest of the driver know the channel is being closed.
491 This becomes important if an open is attempted before close 449 * This becomes important if an open is attempted before close
492 is finished. 450 * is finished.
493 ------------------------------------------------------------------ */ 451 */
494 ch->asyncflags |= ASYNC_CLOSING; 452 ch->asyncflags |= ASYNC_CLOSING;
495 tty->closing = 1; 453 tty->closing = 1;
496 454
@@ -498,7 +456,7 @@ static void pc_close(struct tty_struct * tty, struct file * filp)
498 456
499 if (ch->asyncflags & ASYNC_INITIALIZED) { 457 if (ch->asyncflags & ASYNC_INITIALIZED) {
500 /* Setup an event to indicate when the transmit buffer empties */ 458 /* Setup an event to indicate when the transmit buffer empties */
501 setup_empty_event(tty, ch); 459 setup_empty_event(tty, ch);
502 tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */ 460 tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */
503 } 461 }
504 if (tty->driver->flush_buffer) 462 if (tty->driver->flush_buffer)
@@ -513,27 +471,24 @@ static void pc_close(struct tty_struct * tty, struct file * filp)
513 ch->tty = NULL; 471 ch->tty = NULL;
514 spin_unlock_irqrestore(&epca_lock, flags); 472 spin_unlock_irqrestore(&epca_lock, flags);
515 473
516 if (ch->blocked_open) { /* Begin if blocked_open */ 474 if (ch->blocked_open) {
517 if (ch->close_delay) 475 if (ch->close_delay)
518 msleep_interruptible(jiffies_to_msecs(ch->close_delay)); 476 msleep_interruptible(jiffies_to_msecs(ch->close_delay));
519 wake_up_interruptible(&ch->open_wait); 477 wake_up_interruptible(&ch->open_wait);
520 } /* End if blocked_open */ 478 }
521 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | 479 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED |
522 ASYNC_CLOSING); 480 ASYNC_CLOSING);
523 wake_up_interruptible(&ch->close_wait); 481 wake_up_interruptible(&ch->close_wait);
524 } /* End if ch != NULL */ 482 }
525} /* End pc_close */ 483}
526
527/* ------------------ Begin shutdown ------------------------- */
528 484
529static void shutdown(struct channel *ch) 485static void shutdown(struct channel *ch)
530{ /* Begin shutdown */ 486{
531
532 unsigned long flags; 487 unsigned long flags;
533 struct tty_struct *tty; 488 struct tty_struct *tty;
534 struct board_chan __iomem *bc; 489 struct board_chan __iomem *bc;
535 490
536 if (!(ch->asyncflags & ASYNC_INITIALIZED)) 491 if (!(ch->asyncflags & ASYNC_INITIALIZED))
537 return; 492 return;
538 493
539 spin_lock_irqsave(&epca_lock, flags); 494 spin_lock_irqsave(&epca_lock, flags);
@@ -541,50 +496,40 @@ static void shutdown(struct channel *ch)
541 globalwinon(ch); 496 globalwinon(ch);
542 bc = ch->brdchan; 497 bc = ch->brdchan;
543 498
544 /* ------------------------------------------------------------------ 499 /*
545 In order for an event to be generated on the receipt of data the 500 * In order for an event to be generated on the receipt of data the
546 idata flag must be set. Since we are shutting down, this is not 501 * idata flag must be set. Since we are shutting down, this is not
547 necessary clear this flag. 502 * necessary clear this flag.
548 --------------------------------------------------------------------- */ 503 */
549
550 if (bc) 504 if (bc)
551 writeb(0, &bc->idata); 505 writeb(0, &bc->idata);
552 tty = ch->tty; 506 tty = ch->tty;
553 507
554 /* ---------------------------------------------------------------- 508 /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */
555 If we're a modem control device and HUPCL is on, drop RTS & DTR.
556 ------------------------------------------------------------------ */
557
558 if (tty->termios->c_cflag & HUPCL) { 509 if (tty->termios->c_cflag & HUPCL) {
559 ch->omodem &= ~(ch->m_rts | ch->m_dtr); 510 ch->omodem &= ~(ch->m_rts | ch->m_dtr);
560 fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1); 511 fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1);
561 } 512 }
562 memoff(ch); 513 memoff(ch);
563 514
564 /* ------------------------------------------------------------------ 515 /*
565 The channel has officialy been closed. The next time it is opened 516 * The channel has officialy been closed. The next time it is opened it
566 it will have to reinitialized. Set a flag to indicate this. 517 * will have to reinitialized. Set a flag to indicate this.
567 ---------------------------------------------------------------------- */ 518 */
568
569 /* Prevent future Digi programmed interrupts from coming active */ 519 /* Prevent future Digi programmed interrupts from coming active */
570
571 ch->asyncflags &= ~ASYNC_INITIALIZED; 520 ch->asyncflags &= ~ASYNC_INITIALIZED;
572 spin_unlock_irqrestore(&epca_lock, flags); 521 spin_unlock_irqrestore(&epca_lock, flags);
573 522}
574} /* End shutdown */
575
576/* ------------------ Begin pc_hangup ------------------------- */
577 523
578static void pc_hangup(struct tty_struct *tty) 524static void pc_hangup(struct tty_struct *tty)
579{ /* Begin pc_hangup */ 525{
580 struct channel *ch; 526 struct channel *ch;
581
582 /* ---------------------------------------------------------
583 verifyChannel returns the channel from the tty struct
584 if it is valid. This serves as a sanity check.
585 ------------------------------------------------------------- */
586 527
587 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if ch != NULL */ 528 /*
529 * verifyChannel returns the channel from the tty struct if it is
530 * valid. This serves as a sanity check.
531 */
532 if ((ch = verifyChannel(tty)) != NULL) {
588 unsigned long flags; 533 unsigned long flags;
589 534
590 if (tty->driver->flush_buffer) 535 if (tty->driver->flush_buffer)
@@ -599,15 +544,12 @@ static void pc_hangup(struct tty_struct *tty)
599 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED); 544 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED);
600 spin_unlock_irqrestore(&epca_lock, flags); 545 spin_unlock_irqrestore(&epca_lock, flags);
601 wake_up_interruptible(&ch->open_wait); 546 wake_up_interruptible(&ch->open_wait);
602 } /* End if ch != NULL */ 547 }
603 548}
604} /* End pc_hangup */
605
606/* ------------------ Begin pc_write ------------------------- */
607 549
608static int pc_write(struct tty_struct * tty, 550static int pc_write(struct tty_struct *tty,
609 const unsigned char *buf, int bytesAvailable) 551 const unsigned char *buf, int bytesAvailable)
610{ /* Begin pc_write */ 552{
611 unsigned int head, tail; 553 unsigned int head, tail;
612 int dataLen; 554 int dataLen;
613 int size; 555 int size;
@@ -617,25 +559,23 @@ static int pc_write(struct tty_struct * tty,
617 int remain; 559 int remain;
618 struct board_chan __iomem *bc; 560 struct board_chan __iomem *bc;
619 561
620 /* ---------------------------------------------------------------- 562 /*
621 pc_write is primarily called directly by the kernel routine 563 * pc_write is primarily called directly by the kernel routine
622 tty_write (Though it can also be called by put_char) found in 564 * tty_write (Though it can also be called by put_char) found in
623 tty_io.c. pc_write is passed a line discipline buffer where 565 * tty_io.c. pc_write is passed a line discipline buffer where the data
624 the data to be written out is stored. The line discipline 566 * to be written out is stored. The line discipline implementation
625 implementation itself is done at the kernel level and is not 567 * itself is done at the kernel level and is not brought into the
626 brought into the driver. 568 * driver.
627 ------------------------------------------------------------------- */ 569 */
628
629 /* ---------------------------------------------------------
630 verifyChannel returns the channel from the tty struct
631 if it is valid. This serves as a sanity check.
632 ------------------------------------------------------------- */
633 570
571 /*
572 * verifyChannel returns the channel from the tty struct if it is
573 * valid. This serves as a sanity check.
574 */
634 if ((ch = verifyChannel(tty)) == NULL) 575 if ((ch = verifyChannel(tty)) == NULL)
635 return 0; 576 return 0;
636 577
637 /* Make a pointer to the channel data structure found on the board. */ 578 /* Make a pointer to the channel data structure found on the board. */
638
639 bc = ch->brdchan; 579 bc = ch->brdchan;
640 size = ch->txbufsize; 580 size = ch->txbufsize;
641 amountCopied = 0; 581 amountCopied = 0;
@@ -650,37 +590,36 @@ static int pc_write(struct tty_struct * tty,
650 tail = readw(&bc->tout); 590 tail = readw(&bc->tout);
651 tail &= (size - 1); 591 tail &= (size - 1);
652 592
653 /* If head >= tail, head has not wrapped around. */ 593 if (head >= tail) {
654 if (head >= tail) { /* Begin head has not wrapped */ 594 /* head has not wrapped */
655 /* --------------------------------------------------------------- 595 /*
656 remain (much like dataLen above) represents the total amount of 596 * remain (much like dataLen above) represents the total amount
657 space available on the card for data. Here dataLen represents 597 * of space available on the card for data. Here dataLen
658 the space existing between the head pointer and the end of 598 * represents the space existing between the head pointer and
659 buffer. This is important because a memcpy cannot be told to 599 * the end of buffer. This is important because a memcpy cannot
660 automatically wrap around when it hits the buffer end. 600 * be told to automatically wrap around when it hits the buffer
661 ------------------------------------------------------------------ */ 601 * end.
602 */
662 dataLen = size - head; 603 dataLen = size - head;
663 remain = size - (head - tail) - 1; 604 remain = size - (head - tail) - 1;
664 } else { /* Begin head has wrapped around */ 605 } else {
665 606 /* head has wrapped around */
666 remain = tail - head - 1; 607 remain = tail - head - 1;
667 dataLen = remain; 608 dataLen = remain;
668 609 }
669 } /* End head has wrapped around */ 610 /*
670 /* ------------------------------------------------------------------- 611 * Check the space on the card. If we have more data than space; reduce
671 Check the space on the card. If we have more data than 612 * the amount of data to fit the space.
672 space; reduce the amount of data to fit the space. 613 */
673 ---------------------------------------------------------------------- */
674 bytesAvailable = min(remain, bytesAvailable); 614 bytesAvailable = min(remain, bytesAvailable);
675 txwinon(ch); 615 txwinon(ch);
676 while (bytesAvailable > 0) 616 while (bytesAvailable > 0) {
677 { /* Begin while there is data to copy onto card */ 617 /* there is data to copy onto card */
678
679 /* -----------------------------------------------------------------
680 If head is not wrapped, the below will make sure the first
681 data copy fills to the end of card buffer.
682 ------------------------------------------------------------------- */
683 618
619 /*
620 * If head is not wrapped, the below will make sure the first
621 * data copy fills to the end of card buffer.
622 */
684 dataLen = min(bytesAvailable, dataLen); 623 dataLen = min(bytesAvailable, dataLen);
685 memcpy_toio(ch->txptr + head, buf, dataLen); 624 memcpy_toio(ch->txptr + head, buf, dataLen);
686 buf += dataLen; 625 buf += dataLen;
@@ -692,7 +631,7 @@ static int pc_write(struct tty_struct * tty,
692 head = 0; 631 head = 0;
693 dataLen = tail; 632 dataLen = tail;
694 } 633 }
695 } /* End while there is data to copy onto card */ 634 }
696 ch->statusflags |= TXBUSY; 635 ch->statusflags |= TXBUSY;
697 globalwinon(ch); 636 globalwinon(ch);
698 writew(head, &bc->tin); 637 writew(head, &bc->tin);
@@ -703,22 +642,16 @@ static int pc_write(struct tty_struct * tty,
703 } 642 }
704 memoff(ch); 643 memoff(ch);
705 spin_unlock_irqrestore(&epca_lock, flags); 644 spin_unlock_irqrestore(&epca_lock, flags);
706 return(amountCopied); 645 return amountCopied;
707 646}
708} /* End pc_write */
709
710/* ------------------ Begin pc_put_char ------------------------- */
711 647
712static void pc_put_char(struct tty_struct *tty, unsigned char c) 648static void pc_put_char(struct tty_struct *tty, unsigned char c)
713{ /* Begin pc_put_char */ 649{
714 pc_write(tty, &c, 1); 650 pc_write(tty, &c, 1);
715} /* End pc_put_char */ 651}
716
717/* ------------------ Begin pc_write_room ------------------------- */
718 652
719static int pc_write_room(struct tty_struct *tty) 653static int pc_write_room(struct tty_struct *tty)
720{ /* Begin pc_write_room */ 654{
721
722 int remain; 655 int remain;
723 struct channel *ch; 656 struct channel *ch;
724 unsigned long flags; 657 unsigned long flags;
@@ -727,11 +660,10 @@ static int pc_write_room(struct tty_struct *tty)
727 660
728 remain = 0; 661 remain = 0;
729 662
730 /* --------------------------------------------------------- 663 /*
731 verifyChannel returns the channel from the tty struct 664 * verifyChannel returns the channel from the tty struct if it is
732 if it is valid. This serves as a sanity check. 665 * valid. This serves as a sanity check.
733 ------------------------------------------------------------- */ 666 */
734
735 if ((ch = verifyChannel(tty)) != NULL) { 667 if ((ch = verifyChannel(tty)) != NULL) {
736 spin_lock_irqsave(&epca_lock, flags); 668 spin_lock_irqsave(&epca_lock, flags);
737 globalwinon(ch); 669 globalwinon(ch);
@@ -757,14 +689,10 @@ static int pc_write_room(struct tty_struct *tty)
757 } 689 }
758 /* Return how much room is left on card */ 690 /* Return how much room is left on card */
759 return remain; 691 return remain;
760 692}
761} /* End pc_write_room */
762
763/* ------------------ Begin pc_chars_in_buffer ---------------------- */
764 693
765static int pc_chars_in_buffer(struct tty_struct *tty) 694static int pc_chars_in_buffer(struct tty_struct *tty)
766{ /* Begin pc_chars_in_buffer */ 695{
767
768 int chars; 696 int chars;
769 unsigned int ctail, head, tail; 697 unsigned int ctail, head, tail;
770 int remain; 698 int remain;
@@ -772,13 +700,12 @@ static int pc_chars_in_buffer(struct tty_struct *tty)
772 struct channel *ch; 700 struct channel *ch;
773 struct board_chan __iomem *bc; 701 struct board_chan __iomem *bc;
774 702
775 /* --------------------------------------------------------- 703 /*
776 verifyChannel returns the channel from the tty struct 704 * verifyChannel returns the channel from the tty struct if it is
777 if it is valid. This serves as a sanity check. 705 * valid. This serves as a sanity check.
778 ------------------------------------------------------------- */ 706 */
779
780 if ((ch = verifyChannel(tty)) == NULL) 707 if ((ch = verifyChannel(tty)) == NULL)
781 return(0); 708 return 0;
782 709
783 spin_lock_irqsave(&epca_lock, flags); 710 spin_lock_irqsave(&epca_lock, flags);
784 globalwinon(ch); 711 globalwinon(ch);
@@ -793,45 +720,40 @@ static int pc_chars_in_buffer(struct tty_struct *tty)
793 else { /* Begin if some space on the card has been used */ 720 else { /* Begin if some space on the card has been used */
794 head = readw(&bc->tin) & (ch->txbufsize - 1); 721 head = readw(&bc->tin) & (ch->txbufsize - 1);
795 tail &= (ch->txbufsize - 1); 722 tail &= (ch->txbufsize - 1);
796 /* -------------------------------------------------------------- 723 /*
797 The logic here is basically opposite of the above pc_write_room 724 * The logic here is basically opposite of the above
798 here we are finding the amount of bytes in the buffer filled. 725 * pc_write_room here we are finding the amount of bytes in the
799 Not the amount of bytes empty. 726 * buffer filled. Not the amount of bytes empty.
800 ------------------------------------------------------------------- */ 727 */
801 if ((remain = tail - head - 1) < 0 ) 728 if ((remain = tail - head - 1) < 0 )
802 remain += ch->txbufsize; 729 remain += ch->txbufsize;
803 chars = (int)(ch->txbufsize - remain); 730 chars = (int)(ch->txbufsize - remain);
804 /* ------------------------------------------------------------- 731 /*
805 Make it possible to wakeup anything waiting for output 732 * Make it possible to wakeup anything waiting for output in
806 in tty_ioctl.c, etc. 733 * tty_ioctl.c, etc.
807 734 *
808 If not already set. Setup an event to indicate when the 735 * If not already set. Setup an event to indicate when the
809 transmit buffer empties 736 * transmit buffer empties.
810 ----------------------------------------------------------------- */ 737 */
811 if (!(ch->statusflags & EMPTYWAIT)) 738 if (!(ch->statusflags & EMPTYWAIT))
812 setup_empty_event(tty,ch); 739 setup_empty_event(tty,ch);
813
814 } /* End if some space on the card has been used */ 740 } /* End if some space on the card has been used */
815 memoff(ch); 741 memoff(ch);
816 spin_unlock_irqrestore(&epca_lock, flags); 742 spin_unlock_irqrestore(&epca_lock, flags);
817 /* Return number of characters residing on card. */ 743 /* Return number of characters residing on card. */
818 return(chars); 744 return chars;
819 745}
820} /* End pc_chars_in_buffer */
821
822/* ------------------ Begin pc_flush_buffer ---------------------- */
823 746
824static void pc_flush_buffer(struct tty_struct *tty) 747static void pc_flush_buffer(struct tty_struct *tty)
825{ /* Begin pc_flush_buffer */ 748{
826
827 unsigned int tail; 749 unsigned int tail;
828 unsigned long flags; 750 unsigned long flags;
829 struct channel *ch; 751 struct channel *ch;
830 struct board_chan __iomem *bc; 752 struct board_chan __iomem *bc;
831 /* --------------------------------------------------------- 753 /*
832 verifyChannel returns the channel from the tty struct 754 * verifyChannel returns the channel from the tty struct if it is
833 if it is valid. This serves as a sanity check. 755 * valid. This serves as a sanity check.
834 ------------------------------------------------------------- */ 756 */
835 if ((ch = verifyChannel(tty)) == NULL) 757 if ((ch = verifyChannel(tty)) == NULL)
836 return; 758 return;
837 759
@@ -844,51 +766,47 @@ static void pc_flush_buffer(struct tty_struct *tty)
844 memoff(ch); 766 memoff(ch);
845 spin_unlock_irqrestore(&epca_lock, flags); 767 spin_unlock_irqrestore(&epca_lock, flags);
846 tty_wakeup(tty); 768 tty_wakeup(tty);
847} /* End pc_flush_buffer */ 769}
848
849/* ------------------ Begin pc_flush_chars ---------------------- */
850 770
851static void pc_flush_chars(struct tty_struct *tty) 771static void pc_flush_chars(struct tty_struct *tty)
852{ /* Begin pc_flush_chars */ 772{
853 struct channel * ch; 773 struct channel *ch;
854 /* --------------------------------------------------------- 774 /*
855 verifyChannel returns the channel from the tty struct 775 * verifyChannel returns the channel from the tty struct if it is
856 if it is valid. This serves as a sanity check. 776 * valid. This serves as a sanity check.
857 ------------------------------------------------------------- */ 777 */
858 if ((ch = verifyChannel(tty)) != NULL) { 778 if ((ch = verifyChannel(tty)) != NULL) {
859 unsigned long flags; 779 unsigned long flags;
860 spin_lock_irqsave(&epca_lock, flags); 780 spin_lock_irqsave(&epca_lock, flags);
861 /* ---------------------------------------------------------------- 781 /*
862 If not already set and the transmitter is busy setup an event 782 * If not already set and the transmitter is busy setup an
863 to indicate when the transmit empties. 783 * event to indicate when the transmit empties.
864 ------------------------------------------------------------------- */ 784 */
865 if ((ch->statusflags & TXBUSY) && !(ch->statusflags & EMPTYWAIT)) 785 if ((ch->statusflags & TXBUSY) && !(ch->statusflags & EMPTYWAIT))
866 setup_empty_event(tty,ch); 786 setup_empty_event(tty,ch);
867 spin_unlock_irqrestore(&epca_lock, flags); 787 spin_unlock_irqrestore(&epca_lock, flags);
868 } 788 }
869} /* End pc_flush_chars */ 789}
870
871/* ------------------ Begin block_til_ready ---------------------- */
872 790
873static int block_til_ready(struct tty_struct *tty, 791static int block_til_ready(struct tty_struct *tty,
874 struct file *filp, struct channel *ch) 792 struct file *filp, struct channel *ch)
875{ /* Begin block_til_ready */ 793{
876 DECLARE_WAITQUEUE(wait,current); 794 DECLARE_WAITQUEUE(wait,current);
877 int retval, do_clocal = 0; 795 int retval, do_clocal = 0;
878 unsigned long flags; 796 unsigned long flags;
879 797
880 if (tty_hung_up_p(filp)) { 798 if (tty_hung_up_p(filp)) {
881 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 799 if (ch->asyncflags & ASYNC_HUP_NOTIFY)
882 retval = -EAGAIN; 800 retval = -EAGAIN;
883 else 801 else
884 retval = -ERESTARTSYS; 802 retval = -ERESTARTSYS;
885 return(retval); 803 return retval;
886 } 804 }
887 805
888 /* ----------------------------------------------------------------- 806 /*
889 If the device is in the middle of being closed, then block 807 * If the device is in the middle of being closed, then block until
890 until it's done, and then try again. 808 * it's done, and then try again.
891 -------------------------------------------------------------------- */ 809 */
892 if (ch->asyncflags & ASYNC_CLOSING) { 810 if (ch->asyncflags & ASYNC_CLOSING) {
893 interruptible_sleep_on(&ch->close_wait); 811 interruptible_sleep_on(&ch->close_wait);
894 812
@@ -899,17 +817,17 @@ static int block_til_ready(struct tty_struct *tty,
899 } 817 }
900 818
901 if (filp->f_flags & O_NONBLOCK) { 819 if (filp->f_flags & O_NONBLOCK) {
902 /* ----------------------------------------------------------------- 820 /*
903 If non-blocking mode is set, then make the check up front 821 * If non-blocking mode is set, then make the check up front
904 and then exit. 822 * and then exit.
905 -------------------------------------------------------------------- */ 823 */
906 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; 824 ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
907 return 0; 825 return 0;
908 } 826 }
909 if (tty->termios->c_cflag & CLOCAL) 827 if (tty->termios->c_cflag & CLOCAL)
910 do_clocal = 1; 828 do_clocal = 1;
911 /* Block waiting for the carrier detect and the line to become free */ 829 /* Block waiting for the carrier detect and the line to become free */
912 830
913 retval = 0; 831 retval = 0;
914 add_wait_queue(&ch->open_wait, &wait); 832 add_wait_queue(&ch->open_wait, &wait);
915 833
@@ -918,19 +836,18 @@ static int block_til_ready(struct tty_struct *tty,
918 if (!tty_hung_up_p(filp)) 836 if (!tty_hung_up_p(filp))
919 ch->count--; 837 ch->count--;
920 ch->blocked_open++; 838 ch->blocked_open++;
921 while(1) 839 while (1) {
922 { /* Begin forever while */
923 set_current_state(TASK_INTERRUPTIBLE); 840 set_current_state(TASK_INTERRUPTIBLE);
924 if (tty_hung_up_p(filp) || 841 if (tty_hung_up_p(filp) ||
925 !(ch->asyncflags & ASYNC_INITIALIZED)) 842 !(ch->asyncflags & ASYNC_INITIALIZED))
926 { 843 {
927 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 844 if (ch->asyncflags & ASYNC_HUP_NOTIFY)
928 retval = -EAGAIN; 845 retval = -EAGAIN;
929 else 846 else
930 retval = -ERESTARTSYS; 847 retval = -ERESTARTSYS;
931 break; 848 break;
932 } 849 }
933 if (!(ch->asyncflags & ASYNC_CLOSING) && 850 if (!(ch->asyncflags & ASYNC_CLOSING) &&
934 (do_clocal || (ch->imodem & ch->dcd))) 851 (do_clocal || (ch->imodem & ch->dcd)))
935 break; 852 break;
936 if (signal_pending(current)) { 853 if (signal_pending(current)) {
@@ -938,16 +855,15 @@ static int block_til_ready(struct tty_struct *tty,
938 break; 855 break;
939 } 856 }
940 spin_unlock_irqrestore(&epca_lock, flags); 857 spin_unlock_irqrestore(&epca_lock, flags);
941 /* --------------------------------------------------------------- 858 /*
942 Allow someone else to be scheduled. We will occasionally go 859 * Allow someone else to be scheduled. We will occasionally go
943 through this loop until one of the above conditions change. 860 * through this loop until one of the above conditions change.
944 The below schedule call will allow other processes to enter and 861 * The below schedule call will allow other processes to enter
945 prevent this loop from hogging the cpu. 862 * and prevent this loop from hogging the cpu.
946 ------------------------------------------------------------------ */ 863 */
947 schedule(); 864 schedule();
948 spin_lock_irqsave(&epca_lock, flags); 865 spin_lock_irqsave(&epca_lock, flags);
949 866 }
950 } /* End forever while */
951 867
952 __set_current_state(TASK_RUNNING); 868 __set_current_state(TASK_RUNNING);
953 remove_wait_queue(&ch->open_wait, &wait); 869 remove_wait_queue(&ch->open_wait, &wait);
@@ -962,13 +878,10 @@ static int block_til_ready(struct tty_struct *tty,
962 878
963 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; 879 ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
964 return 0; 880 return 0;
965} /* End block_til_ready */ 881}
966
967/* ------------------ Begin pc_open ---------------------- */
968 882
969static int pc_open(struct tty_struct *tty, struct file * filp) 883static int pc_open(struct tty_struct *tty, struct file * filp)
970{ /* Begin pc_open */ 884{
971
972 struct channel *ch; 885 struct channel *ch;
973 unsigned long flags; 886 unsigned long flags;
974 int line, retval, boardnum; 887 int line, retval, boardnum;
@@ -984,12 +897,11 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
984 897
985 /* Check status of board configured in system. */ 898 /* Check status of board configured in system. */
986 899
987 /* ----------------------------------------------------------------- 900 /*
988 I check to see if the epca_setup routine detected an user error. 901 * I check to see if the epca_setup routine detected an user error. It
989 It might be better to put this in pc_init, but for the moment it 902 * might be better to put this in pc_init, but for the moment it goes
990 goes here. 903 * here.
991 ---------------------------------------------------------------------- */ 904 */
992
993 if (invalid_lilo_config) { 905 if (invalid_lilo_config) {
994 if (setup_error_code & INVALID_BOARD_TYPE) 906 if (setup_error_code & INVALID_BOARD_TYPE)
995 printk(KERN_ERR "epca: pc_open: Invalid board type specified in kernel options.\n"); 907 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)
1010 tty->driver_data = NULL; /* Mark this device as 'down' */ 922 tty->driver_data = NULL; /* Mark this device as 'down' */
1011 return(-ENODEV); 923 return(-ENODEV);
1012 } 924 }
1013 925
1014 if ((bc = ch->brdchan) == 0) { 926 if ((bc = ch->brdchan) == 0) {
1015 tty->driver_data = NULL; 927 tty->driver_data = NULL;
1016 return -ENODEV; 928 return -ENODEV;
1017 } 929 }
1018 930
1019 spin_lock_irqsave(&epca_lock, flags); 931 spin_lock_irqsave(&epca_lock, flags);
1020 /* ------------------------------------------------------------------ 932 /*
1021 Every time a channel is opened, increment a counter. This is 933 * Every time a channel is opened, increment a counter. This is
1022 necessary because we do not wish to flush and shutdown the channel 934 * necessary because we do not wish to flush and shutdown the channel
1023 until the last app holding the channel open, closes it. 935 * until the last app holding the channel open, closes it.
1024 --------------------------------------------------------------------- */ 936 */
1025 ch->count++; 937 ch->count++;
1026 /* ---------------------------------------------------------------- 938 /*
1027 Set a kernel structures pointer to our local channel 939 * Set a kernel structures pointer to our local channel structure. This
1028 structure. This way we can get to it when passed only 940 * way we can get to it when passed only a tty struct.
1029 a tty struct. 941 */
1030 ------------------------------------------------------------------ */
1031 tty->driver_data = ch; 942 tty->driver_data = ch;
1032 /* ---------------------------------------------------------------- 943 /*
1033 If this is the first time the channel has been opened, initialize 944 * If this is the first time the channel has been opened, initialize
1034 the tty->termios struct otherwise let pc_close handle it. 945 * the tty->termios struct otherwise let pc_close handle it.
1035 -------------------------------------------------------------------- */ 946 */
1036 globalwinon(ch); 947 globalwinon(ch);
1037 ch->statusflags = 0; 948 ch->statusflags = 0;
1038 949
1039 /* Save boards current modem status */ 950 /* Save boards current modem status */
1040 ch->imodem = readb(&bc->mstat); 951 ch->imodem = readb(&bc->mstat);
1041 952
1042 /* ---------------------------------------------------------------- 953 /*
1043 Set receive head and tail ptrs to each other. This indicates 954 * Set receive head and tail ptrs to each other. This indicates no data
1044 no data available to read. 955 * available to read.
1045 ----------------------------------------------------------------- */ 956 */
1046 head = readw(&bc->rin); 957 head = readw(&bc->rin);
1047 writew(head, &bc->rout); 958 writew(head, &bc->rout);
1048 959
1049 /* Set the channels associated tty structure */ 960 /* Set the channels associated tty structure */
1050 ch->tty = tty; 961 ch->tty = tty;
1051 962
1052 /* ----------------------------------------------------------------- 963 /*
1053 The below routine generally sets up parity, baud, flow control 964 * The below routine generally sets up parity, baud, flow control
1054 issues, etc.... It effect both control flags and input flags. 965 * issues, etc.... It effect both control flags and input flags.
1055 -------------------------------------------------------------------- */ 966 */
1056 epcaparam(tty,ch); 967 epcaparam(tty,ch);
1057 ch->asyncflags |= ASYNC_INITIALIZED; 968 ch->asyncflags |= ASYNC_INITIALIZED;
1058 memoff(ch); 969 memoff(ch);
@@ -1061,10 +972,10 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
1061 retval = block_til_ready(tty, filp, ch); 972 retval = block_til_ready(tty, filp, ch);
1062 if (retval) 973 if (retval)
1063 return retval; 974 return retval;
1064 /* ------------------------------------------------------------- 975 /*
1065 Set this again in case a hangup set it to zero while this 976 * Set this again in case a hangup set it to zero while this open() was
1066 open() was waiting for the line... 977 * waiting for the line...
1067 --------------------------------------------------------------- */ 978 */
1068 spin_lock_irqsave(&epca_lock, flags); 979 spin_lock_irqsave(&epca_lock, flags);
1069 ch->tty = tty; 980 ch->tty = tty;
1070 globalwinon(ch); 981 globalwinon(ch);
@@ -1073,13 +984,12 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
1073 memoff(ch); 984 memoff(ch);
1074 spin_unlock_irqrestore(&epca_lock, flags); 985 spin_unlock_irqrestore(&epca_lock, flags);
1075 return 0; 986 return 0;
1076} /* End pc_open */ 987}
1077 988
1078static int __init epca_module_init(void) 989static int __init epca_module_init(void)
1079{ /* Begin init_module */ 990{
1080 return pc_init(); 991 return pc_init();
1081} 992}
1082
1083module_init(epca_module_init); 993module_init(epca_module_init);
1084 994
1085static struct pci_driver epca_driver; 995static struct pci_driver epca_driver;
@@ -1092,8 +1002,7 @@ static void __exit epca_module_exit(void)
1092 1002
1093 del_timer_sync(&epca_timer); 1003 del_timer_sync(&epca_timer);
1094 1004
1095 if ((tty_unregister_driver(pc_driver)) || 1005 if (tty_unregister_driver(pc_driver) || tty_unregister_driver(pc_info))
1096 (tty_unregister_driver(pc_info)))
1097 { 1006 {
1098 printk(KERN_WARNING "epca: cleanup_module failed to un-register tty driver\n"); 1007 printk(KERN_WARNING "epca: cleanup_module failed to un-register tty driver\n");
1099 return; 1008 return;
@@ -1101,23 +1010,20 @@ static void __exit epca_module_exit(void)
1101 put_tty_driver(pc_driver); 1010 put_tty_driver(pc_driver);
1102 put_tty_driver(pc_info); 1011 put_tty_driver(pc_info);
1103 1012
1104 for (crd = 0; crd < num_cards; crd++) { /* Begin for each card */ 1013 for (crd = 0; crd < num_cards; crd++) {
1105 bd = &boards[crd]; 1014 bd = &boards[crd];
1106 if (!bd) 1015 if (!bd) { /* sanity check */
1107 { /* Begin sanity check */
1108 printk(KERN_ERR "<Error> - Digi : cleanup_module failed\n"); 1016 printk(KERN_ERR "<Error> - Digi : cleanup_module failed\n");
1109 return; 1017 return;
1110 } /* End sanity check */ 1018 }
1111 ch = card_ptr[crd]; 1019 ch = card_ptr[crd];
1112 for (count = 0; count < bd->numports; count++, ch++) 1020 for (count = 0; count < bd->numports; count++, ch++) {
1113 { /* Begin for each port */
1114 if (ch && ch->tty) 1021 if (ch && ch->tty)
1115 tty_hangup(ch->tty); 1022 tty_hangup(ch->tty);
1116 } /* End for each port */ 1023 }
1117 } /* End for each card */ 1024 }
1118 pci_unregister_driver (&epca_driver); 1025 pci_unregister_driver(&epca_driver);
1119} 1026}
1120
1121module_exit(epca_module_exit); 1027module_exit(epca_module_exit);
1122 1028
1123static const struct tty_operations pc_ops = { 1029static const struct tty_operations pc_ops = {
@@ -1148,10 +1054,8 @@ static struct tty_operations info_ops = {
1148 .ioctl = info_ioctl, 1054 .ioctl = info_ioctl,
1149}; 1055};
1150 1056
1151/* ------------------ Begin pc_init ---------------------- */
1152
1153static int __init pc_init(void) 1057static int __init pc_init(void)
1154{ /* Begin pc_init */ 1058{
1155 int crd; 1059 int crd;
1156 struct board_info *bd; 1060 struct board_info *bd;
1157 unsigned char board_id = 0; 1061 unsigned char board_id = 0;
@@ -1169,63 +1073,57 @@ static int __init pc_init(void)
1169 if (!pc_info) 1073 if (!pc_info)
1170 goto out2; 1074 goto out2;
1171 1075
1172 /* ----------------------------------------------------------------------- 1076 /*
1173 If epca_setup has not been ran by LILO set num_cards to defaults; copy 1077 * If epca_setup has not been ran by LILO set num_cards to defaults;
1174 board structure defined by digiConfig into drivers board structure. 1078 * copy board structure defined by digiConfig into drivers board
1175 Note : If LILO has ran epca_setup then epca_setup will handle defining 1079 * structure. Note : If LILO has ran epca_setup then epca_setup will
1176 num_cards as well as copying the data into the board structure. 1080 * handle defining num_cards as well as copying the data into the board
1177 -------------------------------------------------------------------------- */ 1081 * structure.
1178 if (!liloconfig) { /* Begin driver has been configured via. epcaconfig */ 1082 */
1179 1083 if (!liloconfig) {
1084 /* driver has been configured via. epcaconfig */
1180 nbdevs = NBDEVS; 1085 nbdevs = NBDEVS;
1181 num_cards = NUMCARDS; 1086 num_cards = NUMCARDS;
1182 memcpy((void *)&boards, (void *)&static_boards, 1087 memcpy(&boards, &static_boards,
1183 (sizeof(struct board_info) * NUMCARDS)); 1088 sizeof(struct board_info) * NUMCARDS);
1184 } /* End driver has been configured via. epcaconfig */ 1089 }
1185
1186 /* -----------------------------------------------------------------
1187 Note : If lilo was used to configure the driver and the
1188 ignore epcaconfig option was choosen (digiepca=2) then
1189 nbdevs and num_cards will equal 0 at this point. This is
1190 okay; PCI cards will still be picked up if detected.
1191 --------------------------------------------------------------------- */
1192
1193 /* -----------------------------------------------------------
1194 Set up interrupt, we will worry about memory allocation in
1195 post_fep_init.
1196 --------------------------------------------------------------- */
1197 1090
1091 /*
1092 * Note : If lilo was used to configure the driver and the ignore
1093 * epcaconfig option was choosen (digiepca=2) then nbdevs and num_cards
1094 * will equal 0 at this point. This is okay; PCI cards will still be
1095 * picked up if detected.
1096 */
1198 1097
1098 /*
1099 * Set up interrupt, we will worry about memory allocation in
1100 * post_fep_init.
1101 */
1199 printk(KERN_INFO "DIGI epca driver version %s loaded.\n",VERSION); 1102 printk(KERN_INFO "DIGI epca driver version %s loaded.\n",VERSION);
1200 1103
1201 /* ------------------------------------------------------------------ 1104 /*
1202 NOTE : This code assumes that the number of ports found in 1105 * NOTE : This code assumes that the number of ports found in the
1203 the boards array is correct. This could be wrong if 1106 * boards array is correct. This could be wrong if the card in question
1204 the card in question is PCI (And therefore has no ports 1107 * is PCI (And therefore has no ports entry in the boards structure.)
1205 entry in the boards structure.) The rest of the 1108 * The rest of the information will be valid for PCI because the
1206 information will be valid for PCI because the beginning 1109 * beginning of pc_init scans for PCI and determines i/o and base
1207 of pc_init scans for PCI and determines i/o and base 1110 * memory addresses. I am not sure if it is possible to read the number
1208 memory addresses. I am not sure if it is possible to 1111 * of ports supported by the card prior to it being booted (Since that
1209 read the number of ports supported by the card prior to 1112 * is the state it is in when pc_init is run). Because it is not
1210 it being booted (Since that is the state it is in when 1113 * possible to query the number of supported ports until after the card
1211 pc_init is run). Because it is not possible to query the 1114 * has booted; we are required to calculate the card_ptrs as the card
1212 number of supported ports until after the card has booted; 1115 * is initialized (Inside post_fep_init). The negative thing about this
1213 we are required to calculate the card_ptrs as the card is 1116 * approach is that digiDload's call to GET_INFO will have a bad port
1214 is initialized (Inside post_fep_init). The negative thing 1117 * value. (Since this is called prior to post_fep_init.)
1215 about this approach is that digiDload's call to GET_INFO 1118 */
1216 will have a bad port value. (Since this is called prior
1217 to post_fep_init.)
1218
1219 --------------------------------------------------------------------- */
1220
1221 pci_boards_found = 0; 1119 pci_boards_found = 0;
1222 if(num_cards < MAXBOARDS) 1120 if (num_cards < MAXBOARDS)
1223 pci_boards_found += init_PCI(); 1121 pci_boards_found += init_PCI();
1224 num_cards += pci_boards_found; 1122 num_cards += pci_boards_found;
1225 1123
1226 pc_driver->owner = THIS_MODULE; 1124 pc_driver->owner = THIS_MODULE;
1227 pc_driver->name = "ttyD"; 1125 pc_driver->name = "ttyD";
1228 pc_driver->major = DIGI_MAJOR; 1126 pc_driver->major = DIGI_MAJOR;
1229 pc_driver->minor_start = 0; 1127 pc_driver->minor_start = 0;
1230 pc_driver->type = TTY_DRIVER_TYPE_SERIAL; 1128 pc_driver->type = TTY_DRIVER_TYPE_SERIAL;
1231 pc_driver->subtype = SERIAL_TYPE_NORMAL; 1129 pc_driver->subtype = SERIAL_TYPE_NORMAL;
@@ -1256,120 +1154,108 @@ static int __init pc_init(void)
1256 tty_set_operations(pc_info, &info_ops); 1154 tty_set_operations(pc_info, &info_ops);
1257 1155
1258 1156
1259 for (crd = 0; crd < num_cards; crd++) 1157 for (crd = 0; crd < num_cards; crd++) {
1260 { /* Begin for each card */ 1158 /*
1261 1159 * This is where the appropriate memory handlers for the
1262 /* ------------------------------------------------------------------ 1160 * hardware is set. Everything at runtime blindly jumps through
1263 This is where the appropriate memory handlers for the hardware is 1161 * these vectors.
1264 set. Everything at runtime blindly jumps through these vectors. 1162 */
1265 ---------------------------------------------------------------------- */
1266 1163
1267 /* defined in epcaconfig.h */ 1164 /* defined in epcaconfig.h */
1268 bd = &boards[crd]; 1165 bd = &boards[crd];
1269 1166
1270 switch (bd->type) 1167 switch (bd->type) {
1271 { /* Begin switch on bd->type {board type} */ 1168 case PCXEM:
1272 case PCXEM: 1169 case EISAXEM:
1273 case EISAXEM: 1170 bd->memwinon = pcxem_memwinon;
1274 bd->memwinon = pcxem_memwinon ; 1171 bd->memwinoff = pcxem_memwinoff;
1275 bd->memwinoff = pcxem_memwinoff ; 1172 bd->globalwinon = pcxem_globalwinon;
1276 bd->globalwinon = pcxem_globalwinon ; 1173 bd->txwinon = pcxem_txwinon;
1277 bd->txwinon = pcxem_txwinon ; 1174 bd->rxwinon = pcxem_rxwinon;
1278 bd->rxwinon = pcxem_rxwinon ; 1175 bd->memoff = pcxem_memoff;
1279 bd->memoff = pcxem_memoff ; 1176 bd->assertgwinon = dummy_assertgwinon;
1280 bd->assertgwinon = dummy_assertgwinon; 1177 bd->assertmemoff = dummy_assertmemoff;
1281 bd->assertmemoff = dummy_assertmemoff;
1282 break;
1283
1284 case PCIXEM:
1285 case PCIXRJ:
1286 case PCIXR:
1287 bd->memwinon = dummy_memwinon;
1288 bd->memwinoff = dummy_memwinoff;
1289 bd->globalwinon = dummy_globalwinon;
1290 bd->txwinon = dummy_txwinon;
1291 bd->rxwinon = dummy_rxwinon;
1292 bd->memoff = dummy_memoff;
1293 bd->assertgwinon = dummy_assertgwinon;
1294 bd->assertmemoff = dummy_assertmemoff;
1295 break;
1296
1297 case PCXE:
1298 case PCXEVE:
1299
1300 bd->memwinon = pcxe_memwinon;
1301 bd->memwinoff = pcxe_memwinoff;
1302 bd->globalwinon = pcxe_globalwinon;
1303 bd->txwinon = pcxe_txwinon;
1304 bd->rxwinon = pcxe_rxwinon;
1305 bd->memoff = pcxe_memoff;
1306 bd->assertgwinon = dummy_assertgwinon;
1307 bd->assertmemoff = dummy_assertmemoff;
1308 break;
1309
1310 case PCXI:
1311 case PC64XE:
1312
1313 bd->memwinon = pcxi_memwinon;
1314 bd->memwinoff = pcxi_memwinoff;
1315 bd->globalwinon = pcxi_globalwinon;
1316 bd->txwinon = pcxi_txwinon;
1317 bd->rxwinon = pcxi_rxwinon;
1318 bd->memoff = pcxi_memoff;
1319 bd->assertgwinon = pcxi_assertgwinon;
1320 bd->assertmemoff = pcxi_assertmemoff;
1321 break;
1322
1323 default:
1324 break;
1325
1326 } /* End switch on bd->type */
1327
1328 /* ---------------------------------------------------------------
1329 Some cards need a memory segment to be defined for use in
1330 transmit and receive windowing operations. These boards
1331 are listed in the below switch. In the case of the XI the
1332 amount of memory on the board is variable so the memory_seg
1333 is also variable. This code determines what they segment
1334 should be.
1335 ----------------------------------------------------------------- */
1336
1337 switch (bd->type)
1338 { /* Begin switch on bd->type {board type} */
1339
1340 case PCXE:
1341 case PCXEVE:
1342 case PC64XE:
1343 bd->memory_seg = 0xf000;
1344 break; 1178 break;
1345 1179
1346 case PCXI: 1180 case PCIXEM:
1347 board_id = inb((int)bd->port); 1181 case PCIXRJ:
1348 if ((board_id & 0x1) == 0x1) 1182 case PCIXR:
1349 { /* Begin it's an XI card */ 1183 bd->memwinon = dummy_memwinon;
1350 1184 bd->memwinoff = dummy_memwinoff;
1351 /* Is it a 64K board */ 1185 bd->globalwinon = dummy_globalwinon;
1352 if ((board_id & 0x30) == 0) 1186 bd->txwinon = dummy_txwinon;
1353 bd->memory_seg = 0xf000; 1187 bd->rxwinon = dummy_rxwinon;
1354 1188 bd->memoff = dummy_memoff;
1355 /* Is it a 128K board */ 1189 bd->assertgwinon = dummy_assertgwinon;
1356 if ((board_id & 0x30) == 0x10) 1190 bd->assertmemoff = dummy_assertmemoff;
1357 bd->memory_seg = 0xe000; 1191 break;
1358 1192
1359 /* Is is a 256K board */ 1193 case PCXE:
1360 if ((board_id & 0x30) == 0x20) 1194 case PCXEVE:
1361 bd->memory_seg = 0xc000; 1195 bd->memwinon = pcxe_memwinon;
1196 bd->memwinoff = pcxe_memwinoff;
1197 bd->globalwinon = pcxe_globalwinon;
1198 bd->txwinon = pcxe_txwinon;
1199 bd->rxwinon = pcxe_rxwinon;
1200 bd->memoff = pcxe_memoff;
1201 bd->assertgwinon = dummy_assertgwinon;
1202 bd->assertmemoff = dummy_assertmemoff;
1203 break;
1362 1204
1363 /* Is it a 512K board */ 1205 case PCXI:
1364 if ((board_id & 0x30) == 0x30) 1206 case PC64XE:
1365 bd->memory_seg = 0x8000; 1207 bd->memwinon = pcxi_memwinon;
1208 bd->memwinoff = pcxi_memwinoff;
1209 bd->globalwinon = pcxi_globalwinon;
1210 bd->txwinon = pcxi_txwinon;
1211 bd->rxwinon = pcxi_rxwinon;
1212 bd->memoff = pcxi_memoff;
1213 bd->assertgwinon = pcxi_assertgwinon;
1214 bd->assertmemoff = pcxi_assertmemoff;
1215 break;
1366 1216
1367 } else printk(KERN_ERR "epca: Board at 0x%x doesn't appear to be an XI\n",(int)bd->port); 1217 default:
1368 break; 1218 break;
1219 }
1369 1220
1370 } /* End switch on bd->type */ 1221 /*
1222 * Some cards need a memory segment to be defined for use in
1223 * transmit and receive windowing operations. These boards are
1224 * listed in the below switch. In the case of the XI the amount
1225 * of memory on the board is variable so the memory_seg is also
1226 * variable. This code determines what they segment should be.
1227 */
1228 switch (bd->type) {
1229 case PCXE:
1230 case PCXEVE:
1231 case PC64XE:
1232 bd->memory_seg = 0xf000;
1233 break;
1371 1234
1372 } /* End for each card */ 1235 case PCXI:
1236 board_id = inb((int)bd->port);
1237 if ((board_id & 0x1) == 0x1) {
1238 /* it's an XI card */
1239 /* Is it a 64K board */
1240 if ((board_id & 0x30) == 0)
1241 bd->memory_seg = 0xf000;
1242
1243 /* Is it a 128K board */
1244 if ((board_id & 0x30) == 0x10)
1245 bd->memory_seg = 0xe000;
1246
1247 /* Is is a 256K board */
1248 if ((board_id & 0x30) == 0x20)
1249 bd->memory_seg = 0xc000;
1250
1251 /* Is it a 512K board */
1252 if ((board_id & 0x30) == 0x30)
1253 bd->memory_seg = 0x8000;
1254 } else
1255 printk(KERN_ERR "epca: Board at 0x%x doesn't appear to be an XI\n",(int)bd->port);
1256 break;
1257 }
1258 }
1373 1259
1374 err = tty_register_driver(pc_driver); 1260 err = tty_register_driver(pc_driver);
1375 if (err) { 1261 if (err) {
@@ -1383,10 +1269,7 @@ static int __init pc_init(void)
1383 goto out4; 1269 goto out4;
1384 } 1270 }
1385 1271
1386 /* ------------------------------------------------------------------- 1272 /* Start up the poller to check for events on all enabled boards */
1387 Start up the poller to check for events on all enabled boards
1388 ---------------------------------------------------------------------- */
1389
1390 init_timer(&epca_timer); 1273 init_timer(&epca_timer);
1391 epca_timer.function = epcapoll; 1274 epca_timer.function = epcapoll;
1392 mod_timer(&epca_timer, jiffies + HZ/25); 1275 mod_timer(&epca_timer, jiffies + HZ/25);
@@ -1400,51 +1283,47 @@ out2:
1400 put_tty_driver(pc_driver); 1283 put_tty_driver(pc_driver);
1401out1: 1284out1:
1402 return err; 1285 return err;
1403 1286}
1404} /* End pc_init */
1405
1406/* ------------------ Begin post_fep_init ---------------------- */
1407 1287
1408static void post_fep_init(unsigned int crd) 1288static void post_fep_init(unsigned int crd)
1409{ /* Begin post_fep_init */ 1289{
1410
1411 int i; 1290 int i;
1412 void __iomem *memaddr; 1291 void __iomem *memaddr;
1413 struct global_data __iomem *gd; 1292 struct global_data __iomem *gd;
1414 struct board_info *bd; 1293 struct board_info *bd;
1415 struct board_chan __iomem *bc; 1294 struct board_chan __iomem *bc;
1416 struct channel *ch; 1295 struct channel *ch;
1417 int shrinkmem = 0, lowwater ; 1296 int shrinkmem = 0, lowwater;
1418
1419 /* -------------------------------------------------------------
1420 This call is made by the user via. the ioctl call DIGI_INIT.
1421 It is responsible for setting up all the card specific stuff.
1422 ---------------------------------------------------------------- */
1423 bd = &boards[crd];
1424 1297
1425 /* ----------------------------------------------------------------- 1298 /*
1426 If this is a PCI board, get the port info. Remember PCI cards 1299 * This call is made by the user via. the ioctl call DIGI_INIT. It is
1427 do not have entries into the epcaconfig.h file, so we can't get 1300 * responsible for setting up all the card specific stuff.
1428 the number of ports from it. Unfortunetly, this means that anyone 1301 */
1429 doing a DIGI_GETINFO before the board has booted will get an invalid 1302 bd = &boards[crd];
1430 number of ports returned (It should return 0). Calls to DIGI_GETINFO
1431 after DIGI_INIT has been called will return the proper values.
1432 ------------------------------------------------------------------- */
1433 1303
1304 /*
1305 * If this is a PCI board, get the port info. Remember PCI cards do not
1306 * have entries into the epcaconfig.h file, so we can't get the number
1307 * of ports from it. Unfortunetly, this means that anyone doing a
1308 * DIGI_GETINFO before the board has booted will get an invalid number
1309 * of ports returned (It should return 0). Calls to DIGI_GETINFO after
1310 * DIGI_INIT has been called will return the proper values.
1311 */
1434 if (bd->type >= PCIXEM) { /* Begin get PCI number of ports */ 1312 if (bd->type >= PCIXEM) { /* Begin get PCI number of ports */
1435 /* -------------------------------------------------------------------- 1313 /*
1436 Below we use XEMPORTS as a memory offset regardless of which PCI 1314 * Below we use XEMPORTS as a memory offset regardless of which
1437 card it is. This is because all of the supported PCI cards have 1315 * PCI card it is. This is because all of the supported PCI
1438 the same memory offset for the channel data. This will have to be 1316 * cards have the same memory offset for the channel data. This
1439 changed if we ever develop a PCI/XE card. NOTE : The FEP manual 1317 * will have to be changed if we ever develop a PCI/XE card.
1440 states that the port offset is 0xC22 as opposed to 0xC02. This is 1318 * NOTE : The FEP manual states that the port offset is 0xC22
1441 only true for PC/XE, and PC/XI cards; not for the XEM, or CX series. 1319 * as opposed to 0xC02. This is only true for PC/XE, and PC/XI
1442 On the PCI cards the number of ports is determined by reading a 1320 * cards; not for the XEM, or CX series. On the PCI cards the
1443 ID PROM located in the box attached to the card. The card can then 1321 * number of ports is determined by reading a ID PROM located
1444 determine the index the id to determine the number of ports available. 1322 * in the box attached to the card. The card can then determine
1445 (FYI - The id should be located at 0x1ac (And may use up to 4 bytes 1323 * the index the id to determine the number of ports available.
1446 if the box in question is a XEM or CX)). 1324 * (FYI - The id should be located at 0x1ac (And may use up to
1447 ------------------------------------------------------------------------ */ 1325 * 4 bytes if the box in question is a XEM or CX)).
1326 */
1448 /* PCI cards are already remapped at this point ISA are not */ 1327 /* PCI cards are already remapped at this point ISA are not */
1449 bd->numports = readw(bd->re_map_membase + XEMPORTS); 1328 bd->numports = readw(bd->re_map_membase + XEMPORTS);
1450 epcaassert(bd->numports <= 64,"PCI returned a invalid number of ports"); 1329 epcaassert(bd->numports <= 64,"PCI returned a invalid number of ports");
@@ -1465,95 +1344,87 @@ static void post_fep_init(unsigned int crd)
1465 1344
1466 memaddr = bd->re_map_membase; 1345 memaddr = bd->re_map_membase;
1467 1346
1468 /* ----------------------------------------------------------------- 1347 /*
1469 The below assignment will set bc to point at the BEGINING of 1348 * The below assignment will set bc to point at the BEGINING of the
1470 the cards channel structures. For 1 card there will be between 1349 * cards channel structures. For 1 card there will be between 8 and 64
1471 8 and 64 of these structures. 1350 * of these structures.
1472 -------------------------------------------------------------------- */ 1351 */
1473
1474 bc = memaddr + CHANSTRUCT; 1352 bc = memaddr + CHANSTRUCT;
1475 1353
1476 /* ------------------------------------------------------------------- 1354 /*
1477 The below assignment will set gd to point at the BEGINING of 1355 * The below assignment will set gd to point at the BEGINING of global
1478 global memory address 0xc00. The first data in that global 1356 * memory address 0xc00. The first data in that global memory actually
1479 memory actually starts at address 0xc1a. The command in 1357 * starts at address 0xc1a. The command in pointer begins at 0xd10.
1480 pointer begins at 0xd10. 1358 */
1481 ---------------------------------------------------------------------- */
1482
1483 gd = memaddr + GLOBAL; 1359 gd = memaddr + GLOBAL;
1484 1360
1485 /* -------------------------------------------------------------------- 1361 /*
1486 XEPORTS (address 0xc22) points at the number of channels the 1362 * XEPORTS (address 0xc22) points at the number of channels the card
1487 card supports. (For 64XE, XI, XEM, and XR use 0xc02) 1363 * supports. (For 64XE, XI, XEM, and XR use 0xc02)
1488 ----------------------------------------------------------------------- */ 1364 */
1489
1490 if ((bd->type == PCXEVE || bd->type == PCXE) && (readw(memaddr + XEPORTS) < 3)) 1365 if ((bd->type == PCXEVE || bd->type == PCXE) && (readw(memaddr + XEPORTS) < 3))
1491 shrinkmem = 1; 1366 shrinkmem = 1;
1492 if (bd->type < PCIXEM) 1367 if (bd->type < PCIXEM)
1493 if (!request_region((int)bd->port, 4, board_desc[bd->type])) 1368 if (!request_region((int)bd->port, 4, board_desc[bd->type]))
1494 return; 1369 return;
1495 memwinon(bd, 0); 1370 memwinon(bd, 0);
1496 1371
1497 /* -------------------------------------------------------------------- 1372 /*
1498 Remember ch is the main drivers channels structure, while bc is 1373 * Remember ch is the main drivers channels structure, while bc is the
1499 the cards channel structure. 1374 * cards channel structure.
1500 ------------------------------------------------------------------------ */ 1375 */
1501 1376 for (i = 0; i < bd->numports; i++, ch++, bc++) {
1502 /* For every port on the card do ..... */
1503
1504 for (i = 0; i < bd->numports; i++, ch++, bc++) { /* Begin for each port */
1505 unsigned long flags; 1377 unsigned long flags;
1506 u16 tseg, rseg; 1378 u16 tseg, rseg;
1507 1379
1508 ch->brdchan = bc; 1380 ch->brdchan = bc;
1509 ch->mailbox = gd; 1381 ch->mailbox = gd;
1510 INIT_WORK(&ch->tqueue, do_softint); 1382 INIT_WORK(&ch->tqueue, do_softint);
1511 ch->board = &boards[crd]; 1383 ch->board = &boards[crd];
1512 1384
1513 spin_lock_irqsave(&epca_lock, flags); 1385 spin_lock_irqsave(&epca_lock, flags);
1514 switch (bd->type) { 1386 switch (bd->type) {
1515 /* ---------------------------------------------------------------- 1387 /*
1516 Since some of the boards use different bitmaps for their 1388 * Since some of the boards use different bitmaps for
1517 control signals we cannot hard code these values and retain 1389 * their control signals we cannot hard code these
1518 portability. We virtualize this data here. 1390 * values and retain portability. We virtualize this
1519 ------------------------------------------------------------------- */ 1391 * data here.
1520 case EISAXEM: 1392 */
1521 case PCXEM: 1393 case EISAXEM:
1522 case PCIXEM: 1394 case PCXEM:
1523 case PCIXRJ: 1395 case PCIXEM:
1524 case PCIXR: 1396 case PCIXRJ:
1525 ch->m_rts = 0x02 ; 1397 case PCIXR:
1526 ch->m_dcd = 0x80 ; 1398 ch->m_rts = 0x02;
1527 ch->m_dsr = 0x20 ; 1399 ch->m_dcd = 0x80;
1528 ch->m_cts = 0x10 ; 1400 ch->m_dsr = 0x20;
1529 ch->m_ri = 0x40 ; 1401 ch->m_cts = 0x10;
1530 ch->m_dtr = 0x01 ; 1402 ch->m_ri = 0x40;
1531 break; 1403 ch->m_dtr = 0x01;
1532 1404 break;
1533 case PCXE: 1405
1534 case PCXEVE: 1406 case PCXE:
1535 case PCXI: 1407 case PCXEVE:
1536 case PC64XE: 1408 case PCXI:
1537 ch->m_rts = 0x02 ; 1409 case PC64XE:
1538 ch->m_dcd = 0x08 ; 1410 ch->m_rts = 0x02;
1539 ch->m_dsr = 0x10 ; 1411 ch->m_dcd = 0x08;
1540 ch->m_cts = 0x20 ; 1412 ch->m_dsr = 0x10;
1541 ch->m_ri = 0x40 ; 1413 ch->m_cts = 0x20;
1542 ch->m_dtr = 0x80 ; 1414 ch->m_ri = 0x40;
1543 break; 1415 ch->m_dtr = 0x80;
1544 1416 break;
1545 } /* End switch bd->type */ 1417 }
1546 1418
1547 if (boards[crd].altpin) { 1419 if (boards[crd].altpin) {
1548 ch->dsr = ch->m_dcd; 1420 ch->dsr = ch->m_dcd;
1549 ch->dcd = ch->m_dsr; 1421 ch->dcd = ch->m_dsr;
1550 ch->digiext.digi_flags |= DIGI_ALTPIN; 1422 ch->digiext.digi_flags |= DIGI_ALTPIN;
1551 } 1423 } else {
1552 else {
1553 ch->dcd = ch->m_dcd; 1424 ch->dcd = ch->m_dcd;
1554 ch->dsr = ch->m_dsr; 1425 ch->dsr = ch->m_dsr;
1555 } 1426 }
1556 1427
1557 ch->boardnum = crd; 1428 ch->boardnum = crd;
1558 ch->channelnum = i; 1429 ch->channelnum = i;
1559 ch->magic = EPCA_MAGIC; 1430 ch->magic = EPCA_MAGIC;
@@ -1568,71 +1439,67 @@ static void post_fep_init(unsigned int crd)
1568 rseg = readw(&bc->rseg); 1439 rseg = readw(&bc->rseg);
1569 1440
1570 switch (bd->type) { 1441 switch (bd->type) {
1442 case PCIXEM:
1443 case PCIXRJ:
1444 case PCIXR:
1445 /* Cover all the 2MEG cards */
1446 ch->txptr = memaddr + ((tseg << 4) & 0x1fffff);
1447 ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff);
1448 ch->txwin = FEPWIN | (tseg >> 11);
1449 ch->rxwin = FEPWIN | (rseg >> 11);
1450 break;
1571 1451
1572 case PCIXEM: 1452 case PCXEM:
1573 case PCIXRJ: 1453 case EISAXEM:
1574 case PCIXR: 1454 /* Cover all the 32K windowed cards */
1575 /* Cover all the 2MEG cards */ 1455 /* Mask equal to window size - 1 */
1576 ch->txptr = memaddr + ((tseg << 4) & 0x1fffff); 1456 ch->txptr = memaddr + ((tseg << 4) & 0x7fff);
1577 ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff); 1457 ch->rxptr = memaddr + ((rseg << 4) & 0x7fff);
1578 ch->txwin = FEPWIN | (tseg >> 11); 1458 ch->txwin = FEPWIN | (tseg >> 11);
1579 ch->rxwin = FEPWIN | (rseg >> 11); 1459 ch->rxwin = FEPWIN | (rseg >> 11);
1580 break; 1460 break;
1581 1461
1582 case PCXEM: 1462 case PCXEVE:
1583 case EISAXEM: 1463 case PCXE:
1584 /* Cover all the 32K windowed cards */ 1464 ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff);
1585 /* Mask equal to window size - 1 */ 1465 ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9);
1586 ch->txptr = memaddr + ((tseg << 4) & 0x7fff); 1466 ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff);
1587 ch->rxptr = memaddr + ((rseg << 4) & 0x7fff); 1467 ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 );
1588 ch->txwin = FEPWIN | (tseg >> 11); 1468 break;
1589 ch->rxwin = FEPWIN | (rseg >> 11); 1469
1590 break; 1470 case PCXI:
1591 1471 case PC64XE:
1592 case PCXEVE: 1472 ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4);
1593 case PCXE: 1473 ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4);
1594 ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff); 1474 ch->txwin = ch->rxwin = 0;
1595 ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9); 1475 break;
1596 ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff); 1476 }
1597 ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 );
1598 break;
1599
1600 case PCXI:
1601 case PC64XE:
1602 ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4);
1603 ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4);
1604 ch->txwin = ch->rxwin = 0;
1605 break;
1606
1607 } /* End switch bd->type */
1608 1477
1609 ch->txbufhead = 0; 1478 ch->txbufhead = 0;
1610 ch->txbufsize = readw(&bc->tmax) + 1; 1479 ch->txbufsize = readw(&bc->tmax) + 1;
1611 1480
1612 ch->rxbufhead = 0; 1481 ch->rxbufhead = 0;
1613 ch->rxbufsize = readw(&bc->rmax) + 1; 1482 ch->rxbufsize = readw(&bc->rmax) + 1;
1614 1483
1615 lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2); 1484 lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2);
1616 1485
1617 /* Set transmitter low water mark */ 1486 /* Set transmitter low water mark */
1618 fepcmd(ch, STXLWATER, lowwater, 0, 10, 0); 1487 fepcmd(ch, STXLWATER, lowwater, 0, 10, 0);
1619 1488
1620 /* Set receiver low water mark */ 1489 /* Set receiver low water mark */
1621
1622 fepcmd(ch, SRXLWATER, (ch->rxbufsize / 4), 0, 10, 0); 1490 fepcmd(ch, SRXLWATER, (ch->rxbufsize / 4), 0, 10, 0);
1623 1491
1624 /* Set receiver high water mark */ 1492 /* Set receiver high water mark */
1625
1626 fepcmd(ch, SRXHWATER, (3 * ch->rxbufsize / 4), 0, 10, 0); 1493 fepcmd(ch, SRXHWATER, (3 * ch->rxbufsize / 4), 0, 10, 0);
1627 1494
1628 writew(100, &bc->edelay); 1495 writew(100, &bc->edelay);
1629 writeb(1, &bc->idata); 1496 writeb(1, &bc->idata);
1630 1497
1631 ch->startc = readb(&bc->startc); 1498 ch->startc = readb(&bc->startc);
1632 ch->stopc = readb(&bc->stopc); 1499 ch->stopc = readb(&bc->stopc);
1633 ch->startca = readb(&bc->startca); 1500 ch->startca = readb(&bc->startca);
1634 ch->stopca = readb(&bc->stopca); 1501 ch->stopca = readb(&bc->stopca);
1635 1502
1636 ch->fepcflag = 0; 1503 ch->fepcflag = 0;
1637 ch->fepiflag = 0; 1504 ch->fepiflag = 0;
1638 ch->fepoflag = 0; 1505 ch->fepoflag = 0;
@@ -1640,7 +1507,7 @@ static void post_fep_init(unsigned int crd)
1640 ch->fepstopc = 0; 1507 ch->fepstopc = 0;
1641 ch->fepstartca = 0; 1508 ch->fepstartca = 0;
1642 ch->fepstopca = 0; 1509 ch->fepstopca = 0;
1643 1510
1644 ch->close_delay = 50; 1511 ch->close_delay = 50;
1645 ch->count = 0; 1512 ch->count = 0;
1646 ch->blocked_open = 0; 1513 ch->blocked_open = 0;
@@ -1648,80 +1515,66 @@ static void post_fep_init(unsigned int crd)
1648 init_waitqueue_head(&ch->close_wait); 1515 init_waitqueue_head(&ch->close_wait);
1649 1516
1650 spin_unlock_irqrestore(&epca_lock, flags); 1517 spin_unlock_irqrestore(&epca_lock, flags);
1651 } /* End for each port */ 1518 }
1652 1519
1653 printk(KERN_INFO 1520 printk(KERN_INFO
1654 "Digi PC/Xx Driver V%s: %s I/O = 0x%lx Mem = 0x%lx Ports = %d\n", 1521 "Digi PC/Xx Driver V%s: %s I/O = 0x%lx Mem = 0x%lx Ports = %d\n",
1655 VERSION, board_desc[bd->type], (long)bd->port, (long)bd->membase, bd->numports); 1522 VERSION, board_desc[bd->type], (long)bd->port, (long)bd->membase, bd->numports);
1656 memwinoff(bd, 0); 1523 memwinoff(bd, 0);
1657 1524}
1658} /* End post_fep_init */
1659
1660/* --------------------- Begin epcapoll ------------------------ */
1661 1525
1662static void epcapoll(unsigned long ignored) 1526static void epcapoll(unsigned long ignored)
1663{ /* Begin epcapoll */ 1527{
1664
1665 unsigned long flags; 1528 unsigned long flags;
1666 int crd; 1529 int crd;
1667 volatile unsigned int head, tail; 1530 volatile unsigned int head, tail;
1668 struct channel *ch; 1531 struct channel *ch;
1669 struct board_info *bd; 1532 struct board_info *bd;
1670 1533
1671 /* ------------------------------------------------------------------- 1534 /*
1672 This routine is called upon every timer interrupt. Even though 1535 * This routine is called upon every timer interrupt. Even though the
1673 the Digi series cards are capable of generating interrupts this 1536 * Digi series cards are capable of generating interrupts this method
1674 method of non-looping polling is more efficient. This routine 1537 * of non-looping polling is more efficient. This routine checks for
1675 checks for card generated events (Such as receive data, are transmit 1538 * card generated events (Such as receive data, are transmit buffer
1676 buffer empty) and acts on those events. 1539 * empty) and acts on those events.
1677 ----------------------------------------------------------------------- */ 1540 */
1678 1541 for (crd = 0; crd < num_cards; crd++) {
1679 for (crd = 0; crd < num_cards; crd++)
1680 { /* Begin for each card */
1681
1682 bd = &boards[crd]; 1542 bd = &boards[crd];
1683 ch = card_ptr[crd]; 1543 ch = card_ptr[crd];
1684 1544
1685 if ((bd->status == DISABLED) || digi_poller_inhibited) 1545 if ((bd->status == DISABLED) || digi_poller_inhibited)
1686 continue; /* Begin loop next interation */ 1546 continue;
1687
1688 /* -----------------------------------------------------------
1689 assertmemoff is not needed here; indeed it is an empty subroutine.
1690 It is being kept because future boards may need this as well as
1691 some legacy boards.
1692 ---------------------------------------------------------------- */
1693 1547
1548 /*
1549 * assertmemoff is not needed here; indeed it is an empty
1550 * subroutine. It is being kept because future boards may need
1551 * this as well as some legacy boards.
1552 */
1694 spin_lock_irqsave(&epca_lock, flags); 1553 spin_lock_irqsave(&epca_lock, flags);
1695 1554
1696 assertmemoff(ch); 1555 assertmemoff(ch);
1697 1556
1698 globalwinon(ch); 1557 globalwinon(ch);
1699 1558
1700 /* --------------------------------------------------------------- 1559 /*
1701 In this case head and tail actually refer to the event queue not 1560 * In this case head and tail actually refer to the event queue
1702 the transmit or receive queue. 1561 * not the transmit or receive queue.
1703 ------------------------------------------------------------------- */ 1562 */
1704
1705 head = readw(&ch->mailbox->ein); 1563 head = readw(&ch->mailbox->ein);
1706 tail = readw(&ch->mailbox->eout); 1564 tail = readw(&ch->mailbox->eout);
1707
1708 /* If head isn't equal to tail we have an event */
1709 1565
1566 /* If head isn't equal to tail we have an event */
1710 if (head != tail) 1567 if (head != tail)
1711 doevent(crd); 1568 doevent(crd);
1712 memoff(ch); 1569 memoff(ch);
1713 1570
1714 spin_unlock_irqrestore(&epca_lock, flags); 1571 spin_unlock_irqrestore(&epca_lock, flags);
1715
1716 } /* End for each card */ 1572 } /* End for each card */
1717 mod_timer(&epca_timer, jiffies + (HZ / 25)); 1573 mod_timer(&epca_timer, jiffies + (HZ / 25));
1718} /* End epcapoll */ 1574}
1719
1720/* --------------------- Begin doevent ------------------------ */
1721 1575
1722static void doevent(int crd) 1576static void doevent(int crd)
1723{ /* Begin doevent */ 1577{
1724
1725 void __iomem *eventbuf; 1578 void __iomem *eventbuf;
1726 struct channel *ch, *chan0; 1579 struct channel *ch, *chan0;
1727 static struct tty_struct *tty; 1580 static struct tty_struct *tty;
@@ -1731,28 +1584,28 @@ static void doevent(int crd)
1731 int event, channel; 1584 int event, channel;
1732 int mstat, lstat; 1585 int mstat, lstat;
1733 1586
1734 /* ------------------------------------------------------------------- 1587 /*
1735 This subroutine is called by epcapoll when an event is detected 1588 * This subroutine is called by epcapoll when an event is detected
1736 in the event queue. This routine responds to those events. 1589 * in the event queue. This routine responds to those events.
1737 --------------------------------------------------------------------- */ 1590 */
1738 bd = &boards[crd]; 1591 bd = &boards[crd];
1739 1592
1740 chan0 = card_ptr[crd]; 1593 chan0 = card_ptr[crd];
1741 epcaassert(chan0 <= &digi_channels[nbdevs - 1], "ch out of range"); 1594 epcaassert(chan0 <= &digi_channels[nbdevs - 1], "ch out of range");
1742 assertgwinon(chan0); 1595 assertgwinon(chan0);
1743 while ((tail = readw(&chan0->mailbox->eout)) != (head = readw(&chan0->mailbox->ein))) 1596 while ((tail = readw(&chan0->mailbox->eout)) != (head = readw(&chan0->mailbox->ein))) { /* Begin while something in event queue */
1744 { /* Begin while something in event queue */
1745 assertgwinon(chan0); 1597 assertgwinon(chan0);
1746 eventbuf = bd->re_map_membase + tail + ISTART; 1598 eventbuf = bd->re_map_membase + tail + ISTART;
1747 /* Get the channel the event occurred on */ 1599 /* Get the channel the event occurred on */
1748 channel = readb(eventbuf); 1600 channel = readb(eventbuf);
1749 /* Get the actual event code that occurred */ 1601 /* Get the actual event code that occurred */
1750 event = readb(eventbuf + 1); 1602 event = readb(eventbuf + 1);
1751 /* ---------------------------------------------------------------- 1603 /*
1752 The two assignments below get the current modem status (mstat) 1604 * The two assignments below get the current modem status
1753 and the previous modem status (lstat). These are useful becuase 1605 * (mstat) and the previous modem status (lstat). These are
1754 an event could signal a change in modem signals itself. 1606 * useful becuase an event could signal a change in modem
1755 ------------------------------------------------------------------- */ 1607 * signals itself.
1608 */
1756 mstat = readb(eventbuf + 2); 1609 mstat = readb(eventbuf + 2);
1757 lstat = readb(eventbuf + 3); 1610 lstat = readb(eventbuf + 3);
1758 1611
@@ -1772,37 +1625,36 @@ static void doevent(int crd)
1772 assertgwinon(ch); 1625 assertgwinon(ch);
1773 } /* End DATA_IND */ 1626 } /* End DATA_IND */
1774 /* else *//* Fix for DCD transition missed bug */ 1627 /* else *//* Fix for DCD transition missed bug */
1775 if (event & MODEMCHG_IND) { /* Begin MODEMCHG_IND */ 1628 if (event & MODEMCHG_IND) {
1776 /* A modem signal change has been indicated */ 1629 /* A modem signal change has been indicated */
1777 ch->imodem = mstat; 1630 ch->imodem = mstat;
1778 if (ch->asyncflags & ASYNC_CHECK_CD) { 1631 if (ch->asyncflags & ASYNC_CHECK_CD) {
1779 if (mstat & ch->dcd) /* We are now receiving dcd */ 1632 if (mstat & ch->dcd) /* We are now receiving dcd */
1780 wake_up_interruptible(&ch->open_wait); 1633 wake_up_interruptible(&ch->open_wait);
1781 else 1634 else
1782 pc_sched_event(ch, EPCA_EVENT_HANGUP); /* No dcd; hangup */ 1635 pc_sched_event(ch, EPCA_EVENT_HANGUP); /* No dcd; hangup */
1783 } 1636 }
1784 } /* End MODEMCHG_IND */ 1637 }
1785 tty = ch->tty; 1638 tty = ch->tty;
1786 if (tty) { /* Begin if valid tty */ 1639 if (tty) {
1787 if (event & BREAK_IND) { /* Begin if BREAK_IND */ 1640 if (event & BREAK_IND) {
1788 /* A break has been indicated */ 1641 /* A break has been indicated */
1789 tty_insert_flip_char(tty, 0, TTY_BREAK); 1642 tty_insert_flip_char(tty, 0, TTY_BREAK);
1790 tty_schedule_flip(tty); 1643 tty_schedule_flip(tty);
1791 } else if (event & LOWTX_IND) { /* Begin LOWTX_IND */ 1644 } else if (event & LOWTX_IND) {
1792 if (ch->statusflags & LOWWAIT) 1645 if (ch->statusflags & LOWWAIT) {
1793 { /* Begin if LOWWAIT */
1794 ch->statusflags &= ~LOWWAIT; 1646 ch->statusflags &= ~LOWWAIT;
1795 tty_wakeup(tty); 1647 tty_wakeup(tty);
1796 } /* End if LOWWAIT */ 1648 }
1797 } else if (event & EMPTYTX_IND) { /* Begin EMPTYTX_IND */ 1649 } else if (event & EMPTYTX_IND) {
1798 /* This event is generated by setup_empty_event */ 1650 /* This event is generated by setup_empty_event */
1799 ch->statusflags &= ~TXBUSY; 1651 ch->statusflags &= ~TXBUSY;
1800 if (ch->statusflags & EMPTYWAIT) { /* Begin if EMPTYWAIT */ 1652 if (ch->statusflags & EMPTYWAIT) {
1801 ch->statusflags &= ~EMPTYWAIT; 1653 ch->statusflags &= ~EMPTYWAIT;
1802 tty_wakeup(tty); 1654 tty_wakeup(tty);
1803 } /* End if EMPTYWAIT */ 1655 }
1804 } /* End EMPTYTX_IND */ 1656 }
1805 } /* End if valid tty */ 1657 }
1806 next: 1658 next:
1807 globalwinon(ch); 1659 globalwinon(ch);
1808 BUG_ON(!bc); 1660 BUG_ON(!bc);
@@ -1810,13 +1662,11 @@ static void doevent(int crd)
1810 writew((tail + 4) & (IMAX - ISTART - 4), &chan0->mailbox->eout); 1662 writew((tail + 4) & (IMAX - ISTART - 4), &chan0->mailbox->eout);
1811 globalwinon(chan0); 1663 globalwinon(chan0);
1812 } /* End while something in event queue */ 1664 } /* End while something in event queue */
1813} /* End doevent */ 1665}
1814
1815/* --------------------- Begin fepcmd ------------------------ */
1816 1666
1817static void fepcmd(struct channel *ch, int cmd, int word_or_byte, 1667static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
1818 int byte2, int ncmds, int bytecmd) 1668 int byte2, int ncmds, int bytecmd)
1819{ /* Begin fepcmd */ 1669{
1820 unchar __iomem *memaddr; 1670 unchar __iomem *memaddr;
1821 unsigned int head, cmdTail, cmdStart, cmdMax; 1671 unsigned int head, cmdTail, cmdStart, cmdMax;
1822 long count; 1672 long count;
@@ -1831,11 +1681,11 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
1831 head = readw(&ch->mailbox->cin); 1681 head = readw(&ch->mailbox->cin);
1832 /* cmdStart is a base address */ 1682 /* cmdStart is a base address */
1833 cmdStart = readw(&ch->mailbox->cstart); 1683 cmdStart = readw(&ch->mailbox->cstart);
1834 /* ------------------------------------------------------------------ 1684 /*
1835 We do the addition below because we do not want a max pointer 1685 * We do the addition below because we do not want a max pointer
1836 relative to cmdStart. We want a max pointer that points at the 1686 * relative to cmdStart. We want a max pointer that points at the
1837 physical end of the command queue. 1687 * physical end of the command queue.
1838 -------------------------------------------------------------------- */ 1688 */
1839 cmdMax = (cmdStart + 4 + readw(&ch->mailbox->cmax)); 1689 cmdMax = (cmdStart + 4 + readw(&ch->mailbox->cmax));
1840 memaddr = ch->board->re_map_membase; 1690 memaddr = ch->board->re_map_membase;
1841 1691
@@ -1860,7 +1710,7 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
1860 writew(head, &ch->mailbox->cin); 1710 writew(head, &ch->mailbox->cin);
1861 count = FEPTIMEOUT; 1711 count = FEPTIMEOUT;
1862 1712
1863 for (;;) { /* Begin forever loop */ 1713 for (;;) {
1864 count--; 1714 count--;
1865 if (count == 0) { 1715 if (count == 0) {
1866 printk(KERN_ERR "<Error> - Fep not responding in fepcmd()\n"); 1716 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,
1869 head = readw(&ch->mailbox->cin); 1719 head = readw(&ch->mailbox->cin);
1870 cmdTail = readw(&ch->mailbox->cout); 1720 cmdTail = readw(&ch->mailbox->cout);
1871 n = (head - cmdTail) & (cmdMax - cmdStart - 4); 1721 n = (head - cmdTail) & (cmdMax - cmdStart - 4);
1872 /* ---------------------------------------------------------- 1722 /*
1873 Basically this will break when the FEP acknowledges the 1723 * Basically this will break when the FEP acknowledges the
1874 command by incrementing cmdTail (Making it equal to head). 1724 * command by incrementing cmdTail (Making it equal to head).
1875 ------------------------------------------------------------- */ 1725 */
1876 if (n <= ncmds * (sizeof(short) * 4)) 1726 if (n <= ncmds * (sizeof(short) * 4))
1877 break; /* Well nearly forever :-) */ 1727 break;
1878 } /* End forever loop */ 1728 }
1879} /* End fepcmd */ 1729}
1880
1881/* ---------------------------------------------------------------------
1882 Digi products use fields in their channels structures that are very
1883 similar to the c_cflag and c_iflag fields typically found in UNIX
1884 termios structures. The below three routines allow mappings
1885 between these hardware "flags" and their respective Linux flags.
1886------------------------------------------------------------------------- */
1887
1888/* --------------------- Begin termios2digi_h -------------------- */
1889 1730
1731/*
1732 * Digi products use fields in their channels structures that are very similar
1733 * to the c_cflag and c_iflag fields typically found in UNIX termios
1734 * structures. The below three routines allow mappings between these hardware
1735 * "flags" and their respective Linux flags.
1736 */
1890static unsigned termios2digi_h(struct channel *ch, unsigned cflag) 1737static unsigned termios2digi_h(struct channel *ch, unsigned cflag)
1891{ /* Begin termios2digi_h */ 1738{
1892 unsigned res = 0; 1739 unsigned res = 0;
1893 1740
1894 if (cflag & CRTSCTS) { 1741 if (cflag & CRTSCTS) {
@@ -1918,86 +1765,73 @@ static unsigned termios2digi_h(struct channel *ch, unsigned cflag)
1918 ch->digiext.digi_flags |= CTSPACE; 1765 ch->digiext.digi_flags |= CTSPACE;
1919 1766
1920 return res; 1767 return res;
1768}
1921 1769
1922} /* End termios2digi_h */
1923
1924/* --------------------- Begin termios2digi_i -------------------- */
1925static unsigned termios2digi_i(struct channel *ch, unsigned iflag) 1770static unsigned termios2digi_i(struct channel *ch, unsigned iflag)
1926{ /* Begin termios2digi_i */ 1771{
1927 1772 unsigned res = iflag & (IGNBRK | BRKINT | IGNPAR | PARMRK |
1928 unsigned res = iflag & (IGNBRK | BRKINT | IGNPAR | PARMRK |
1929 INPCK | ISTRIP|IXON|IXANY|IXOFF); 1773 INPCK | ISTRIP|IXON|IXANY|IXOFF);
1930 if (ch->digiext.digi_flags & DIGI_AIXON) 1774 if (ch->digiext.digi_flags & DIGI_AIXON)
1931 res |= IAIXON; 1775 res |= IAIXON;
1932 return res; 1776 return res;
1933 1777}
1934} /* End termios2digi_i */
1935
1936/* --------------------- Begin termios2digi_c -------------------- */
1937 1778
1938static unsigned termios2digi_c(struct channel *ch, unsigned cflag) 1779static unsigned termios2digi_c(struct channel *ch, unsigned cflag)
1939{ /* Begin termios2digi_c */ 1780{
1940
1941 unsigned res = 0; 1781 unsigned res = 0;
1942 if (cflag & CBAUDEX) { /* Begin detected CBAUDEX */ 1782 if (cflag & CBAUDEX) {
1943 ch->digiext.digi_flags |= DIGI_FAST; 1783 ch->digiext.digi_flags |= DIGI_FAST;
1944 /* ------------------------------------------------------------- 1784 /*
1945 HUPCL bit is used by FEP to indicate fast baud 1785 * HUPCL bit is used by FEP to indicate fast baud table is to
1946 table is to be used. 1786 * be used.
1947 ----------------------------------------------------------------- */ 1787 */
1948 res |= FEP_HUPCL; 1788 res |= FEP_HUPCL;
1949 } /* End detected CBAUDEX */ 1789 } else
1950 else ch->digiext.digi_flags &= ~DIGI_FAST; 1790 ch->digiext.digi_flags &= ~DIGI_FAST;
1951 /* ------------------------------------------------------------------- 1791 /*
1952 CBAUD has bit position 0x1000 set these days to indicate Linux 1792 * CBAUD has bit position 0x1000 set these days to indicate Linux
1953 baud rate remap. Digi hardware can't handle the bit assignment. 1793 * baud rate remap. Digi hardware can't handle the bit assignment.
1954 (We use a different bit assignment for high speed.). Clear this 1794 * (We use a different bit assignment for high speed.). Clear this
1955 bit out. 1795 * bit out.
1956 ---------------------------------------------------------------------- */ 1796 */
1957 res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE); 1797 res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE);
1958 /* ------------------------------------------------------------- 1798 /*
1959 This gets a little confusing. The Digi cards have their own 1799 * This gets a little confusing. The Digi cards have their own
1960 representation of c_cflags controling baud rate. For the most 1800 * representation of c_cflags controling baud rate. For the most part
1961 part this is identical to the Linux implementation. However; 1801 * this is identical to the Linux implementation. However; Digi
1962 Digi supports one rate (76800) that Linux doesn't. This means 1802 * supports one rate (76800) that Linux doesn't. This means that the
1963 that the c_cflag entry that would normally mean 76800 for Digi 1803 * c_cflag entry that would normally mean 76800 for Digi actually means
1964 actually means 115200 under Linux. Without the below mapping, 1804 * 115200 under Linux. Without the below mapping, a stty 115200 would
1965 a stty 115200 would only drive the board at 76800. Since 1805 * only drive the board at 76800. Since the rate 230400 is also found
1966 the rate 230400 is also found after 76800, the same problem afflicts 1806 * after 76800, the same problem afflicts us when we choose a rate of
1967 us when we choose a rate of 230400. Without the below modificiation 1807 * 230400. Without the below modificiation stty 230400 would actually
1968 stty 230400 would actually give us 115200. 1808 * give us 115200.
1969 1809 *
1970 There are two additional differences. The Linux value for CLOCAL 1810 * There are two additional differences. The Linux value for CLOCAL
1971 (0x800; 0004000) has no meaning to the Digi hardware. Also in 1811 * (0x800; 0004000) has no meaning to the Digi hardware. Also in later
1972 later releases of Linux; the CBAUD define has CBAUDEX (0x1000; 1812 * releases of Linux; the CBAUD define has CBAUDEX (0x1000; 0010000)
1973 0010000) ored into it (CBAUD = 0x100f as opposed to 0xf). CBAUDEX 1813 * ored into it (CBAUD = 0x100f as opposed to 0xf). CBAUDEX should be
1974 should be checked for a screened out prior to termios2digi_c 1814 * checked for a screened out prior to termios2digi_c returning. Since
1975 returning. Since CLOCAL isn't used by the board this can be 1815 * CLOCAL isn't used by the board this can be ignored as long as the
1976 ignored as long as the returned value is used only by Digi hardware. 1816 * returned value is used only by Digi hardware.
1977 ----------------------------------------------------------------- */ 1817 */
1978 if (cflag & CBAUDEX) { 1818 if (cflag & CBAUDEX) {
1979 /* ------------------------------------------------------------- 1819 /*
1980 The below code is trying to guarantee that only baud rates 1820 * The below code is trying to guarantee that only baud rates
1981 115200 and 230400 are remapped. We use exclusive or because 1821 * 115200 and 230400 are remapped. We use exclusive or because
1982 the various baud rates share common bit positions and therefore 1822 * the various baud rates share common bit positions and
1983 can't be tested for easily. 1823 * therefore can't be tested for easily.
1984 ----------------------------------------------------------------- */ 1824 */
1985 1825 if ((!((cflag & 0x7) ^ (B115200 & ~CBAUDEX))) ||
1986
1987 if ((!((cflag & 0x7) ^ (B115200 & ~CBAUDEX))) ||
1988 (!((cflag & 0x7) ^ (B230400 & ~CBAUDEX)))) 1826 (!((cflag & 0x7) ^ (B230400 & ~CBAUDEX))))
1989 res += 1; 1827 res += 1;
1990 } 1828 }
1991 return res; 1829 return res;
1992 1830}
1993} /* End termios2digi_c */
1994
1995/* --------------------- Begin epcaparam ----------------------- */
1996 1831
1997/* Caller must hold the locks */ 1832/* Caller must hold the locks */
1998static void epcaparam(struct tty_struct *tty, struct channel *ch) 1833static void epcaparam(struct tty_struct *tty, struct channel *ch)
1999{ /* Begin epcaparam */ 1834{
2000
2001 unsigned int cmdHead; 1835 unsigned int cmdHead;
2002 struct ktermios *ts; 1836 struct ktermios *ts;
2003 struct board_chan __iomem *bc; 1837 struct board_chan __iomem *bc;
@@ -2013,28 +1847,29 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
2013 writew(cmdHead, &bc->rout); 1847 writew(cmdHead, &bc->rout);
2014 cmdHead = readw(&bc->tin); 1848 cmdHead = readw(&bc->tin);
2015 /* Changing baud in mid-stream transmission can be wonderful */ 1849 /* Changing baud in mid-stream transmission can be wonderful */
2016 /* --------------------------------------------------------------- 1850 /*
2017 Flush current transmit buffer by setting cmdTail pointer (tout) 1851 * Flush current transmit buffer by setting cmdTail pointer
2018 to cmdHead pointer (tin). Hopefully the transmit buffer is empty. 1852 * (tout) to cmdHead pointer (tin). Hopefully the transmit
2019 ----------------------------------------------------------------- */ 1853 * buffer is empty.
1854 */
2020 fepcmd(ch, STOUT, (unsigned) cmdHead, 0, 0, 0); 1855 fepcmd(ch, STOUT, (unsigned) cmdHead, 0, 0, 0);
2021 mval = 0; 1856 mval = 0;
2022 } else { /* Begin CBAUD not detected */ 1857 } else { /* Begin CBAUD not detected */
2023 /* ------------------------------------------------------------------- 1858 /*
2024 c_cflags have changed but that change had nothing to do with BAUD. 1859 * c_cflags have changed but that change had nothing to do with
2025 Propagate the change to the card. 1860 * BAUD. Propagate the change to the card.
2026 ---------------------------------------------------------------------- */ 1861 */
2027 cflag = termios2digi_c(ch, ts->c_cflag); 1862 cflag = termios2digi_c(ch, ts->c_cflag);
2028 if (cflag != ch->fepcflag) { 1863 if (cflag != ch->fepcflag) {
2029 ch->fepcflag = cflag; 1864 ch->fepcflag = cflag;
2030 /* Set baud rate, char size, stop bits, parity */ 1865 /* Set baud rate, char size, stop bits, parity */
2031 fepcmd(ch, SETCTRLFLAGS, (unsigned) cflag, 0, 0, 0); 1866 fepcmd(ch, SETCTRLFLAGS, (unsigned) cflag, 0, 0, 0);
2032 } 1867 }
2033 /* ---------------------------------------------------------------- 1868 /*
2034 If the user has not forced CLOCAL and if the device is not a 1869 * If the user has not forced CLOCAL and if the device is not a
2035 CALLOUT device (Which is always CLOCAL) we set flags such that 1870 * CALLOUT device (Which is always CLOCAL) we set flags such
2036 the driver will wait on carrier detect. 1871 * that the driver will wait on carrier detect.
2037 ------------------------------------------------------------------- */ 1872 */
2038 if (ts->c_cflag & CLOCAL) 1873 if (ts->c_cflag & CLOCAL)
2039 ch->asyncflags &= ~ASYNC_CHECK_CD; 1874 ch->asyncflags &= ~ASYNC_CHECK_CD;
2040 else 1875 else
@@ -2045,19 +1880,19 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
2045 /* Check input mode flags */ 1880 /* Check input mode flags */
2046 if (iflag != ch->fepiflag) { 1881 if (iflag != ch->fepiflag) {
2047 ch->fepiflag = iflag; 1882 ch->fepiflag = iflag;
2048 /* --------------------------------------------------------------- 1883 /*
2049 Command sets channels iflag structure on the board. Such things 1884 * Command sets channels iflag structure on the board. Such
2050 as input soft flow control, handling of parity errors, and 1885 * things as input soft flow control, handling of parity
2051 break handling are all set here. 1886 * errors, and break handling are all set here.
2052 ------------------------------------------------------------------- */ 1887 */
2053 /* break handling, parity handling, input stripping, flow control chars */ 1888 /* break handling, parity handling, input stripping, flow control chars */
2054 fepcmd(ch, SETIFLAGS, (unsigned int) ch->fepiflag, 0, 0, 0); 1889 fepcmd(ch, SETIFLAGS, (unsigned int) ch->fepiflag, 0, 0, 0);
2055 } 1890 }
2056 /* --------------------------------------------------------------- 1891 /*
2057 Set the board mint value for this channel. This will cause hardware 1892 * Set the board mint value for this channel. This will cause hardware
2058 events to be generated each time the DCD signal (Described in mint) 1893 * events to be generated each time the DCD signal (Described in mint)
2059 changes. 1894 * changes.
2060 ------------------------------------------------------------------- */ 1895 */
2061 writeb(ch->dcd, &bc->mint); 1896 writeb(ch->dcd, &bc->mint);
2062 if ((ts->c_cflag & CLOCAL) || (ch->digiext.digi_flags & DIGI_FORCEDCD)) 1897 if ((ts->c_cflag & CLOCAL) || (ch->digiext.digi_flags & DIGI_FORCEDCD))
2063 if (ch->digiext.digi_flags & DIGI_FORCEDCD) 1898 if (ch->digiext.digi_flags & DIGI_FORCEDCD)
@@ -2066,23 +1901,23 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
2066 hflow = termios2digi_h(ch, ts->c_cflag); 1901 hflow = termios2digi_h(ch, ts->c_cflag);
2067 if (hflow != ch->hflow) { 1902 if (hflow != ch->hflow) {
2068 ch->hflow = hflow; 1903 ch->hflow = hflow;
2069 /* -------------------------------------------------------------- 1904 /*
2070 Hard flow control has been selected but the board is not 1905 * Hard flow control has been selected but the board is not
2071 using it. Activate hard flow control now. 1906 * using it. Activate hard flow control now.
2072 ----------------------------------------------------------------- */ 1907 */
2073 fepcmd(ch, SETHFLOW, hflow, 0xff, 0, 1); 1908 fepcmd(ch, SETHFLOW, hflow, 0xff, 0, 1);
2074 } 1909 }
2075 mval ^= ch->modemfake & (mval ^ ch->modem); 1910 mval ^= ch->modemfake & (mval ^ ch->modem);
2076 1911
2077 if (ch->omodem ^ mval) { 1912 if (ch->omodem ^ mval) {
2078 ch->omodem = mval; 1913 ch->omodem = mval;
2079 /* -------------------------------------------------------------- 1914 /*
2080 The below command sets the DTR and RTS mstat structure. If 1915 * The below command sets the DTR and RTS mstat structure. If
2081 hard flow control is NOT active these changes will drive the 1916 * hard flow control is NOT active these changes will drive the
2082 output of the actual DTR and RTS lines. If hard flow control 1917 * output of the actual DTR and RTS lines. If hard flow control
2083 is active, the changes will be saved in the mstat structure and 1918 * is active, the changes will be saved in the mstat structure
2084 only asserted when hard flow control is turned off. 1919 * and only asserted when hard flow control is turned off.
2085 ----------------------------------------------------------------- */ 1920 */
2086 1921
2087 /* First reset DTR & RTS; then set them */ 1922 /* First reset DTR & RTS; then set them */
2088 fepcmd(ch, SETMODEM, 0, ((ch->m_dtr)|(ch->m_rts)), 0, 1); 1923 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)
2091 if (ch->startc != ch->fepstartc || ch->stopc != ch->fepstopc) { 1926 if (ch->startc != ch->fepstartc || ch->stopc != ch->fepstopc) {
2092 ch->fepstartc = ch->startc; 1927 ch->fepstartc = ch->startc;
2093 ch->fepstopc = ch->stopc; 1928 ch->fepstopc = ch->stopc;
2094 /* ------------------------------------------------------------ 1929 /*
2095 The XON / XOFF characters have changed; propagate these 1930 * The XON / XOFF characters have changed; propagate these
2096 changes to the card. 1931 * changes to the card.
2097 --------------------------------------------------------------- */ 1932 */
2098 fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); 1933 fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1);
2099 } 1934 }
2100 if (ch->startca != ch->fepstartca || ch->stopca != ch->fepstopca) { 1935 if (ch->startca != ch->fepstartca || ch->stopca != ch->fepstopca) {
2101 ch->fepstartca = ch->startca; 1936 ch->fepstartca = ch->startca;
2102 ch->fepstopca = ch->stopca; 1937 ch->fepstopca = ch->stopca;
2103 /* --------------------------------------------------------------- 1938 /*
2104 Similar to the above, this time the auxilarly XON / XOFF 1939 * Similar to the above, this time the auxilarly XON / XOFF
2105 characters have changed; propagate these changes to the card. 1940 * characters have changed; propagate these changes to the card.
2106 ------------------------------------------------------------------ */ 1941 */
2107 fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); 1942 fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
2108 } 1943 }
2109} /* End epcaparam */ 1944}
2110 1945
2111/* --------------------- Begin receive_data ----------------------- */
2112/* Caller holds lock */ 1946/* Caller holds lock */
2113static void receive_data(struct channel *ch) 1947static void receive_data(struct channel *ch)
2114{ /* Begin receive_data */ 1948{
2115
2116 unchar *rptr; 1949 unchar *rptr;
2117 struct ktermios *ts = NULL; 1950 struct ktermios *ts = NULL;
2118 struct tty_struct *tty; 1951 struct tty_struct *tty;
@@ -2121,11 +1954,10 @@ static void receive_data(struct channel *ch)
2121 unsigned int tail, head; 1954 unsigned int tail, head;
2122 unsigned int wrapmask; 1955 unsigned int wrapmask;
2123 1956
2124 /* --------------------------------------------------------------- 1957 /*
2125 This routine is called by doint when a receive data event 1958 * This routine is called by doint when a receive data event has taken
2126 has taken place. 1959 * place.
2127 ------------------------------------------------------------------- */ 1960 */
2128
2129 globalwinon(ch); 1961 globalwinon(ch);
2130 if (ch->statusflags & RXSTOPPED) 1962 if (ch->statusflags & RXSTOPPED)
2131 return; 1963 return;
@@ -2136,10 +1968,10 @@ static void receive_data(struct channel *ch)
2136 BUG_ON(!bc); 1968 BUG_ON(!bc);
2137 wrapmask = ch->rxbufsize - 1; 1969 wrapmask = ch->rxbufsize - 1;
2138 1970
2139 /* --------------------------------------------------------------------- 1971 /*
2140 Get the head and tail pointers to the receiver queue. Wrap the 1972 * Get the head and tail pointers to the receiver queue. Wrap the head
2141 head pointer if it has reached the end of the buffer. 1973 * pointer if it has reached the end of the buffer.
2142 ------------------------------------------------------------------------ */ 1974 */
2143 head = readw(&bc->rin); 1975 head = readw(&bc->rin);
2144 head &= wrapmask; 1976 head &= wrapmask;
2145 tail = readw(&bc->rout) & wrapmask; 1977 tail = readw(&bc->rout) & wrapmask;
@@ -2148,10 +1980,7 @@ static void receive_data(struct channel *ch)
2148 if (bytesAvailable == 0) 1980 if (bytesAvailable == 0)
2149 return; 1981 return;
2150 1982
2151 /* ------------------------------------------------------------------ 1983 /* If CREAD bit is off or device not open, set TX tail to head */
2152 If CREAD bit is off or device not open, set TX tail to head
2153 --------------------------------------------------------------------- */
2154
2155 if (!tty || !ts || !(ts->c_cflag & CREAD)) { 1984 if (!tty || !ts || !(ts->c_cflag & CREAD)) {
2156 writew(head, &bc->rout); 1985 writew(head, &bc->rout);
2157 return; 1986 return;
@@ -2168,22 +1997,20 @@ static void receive_data(struct channel *ch)
2168 rxwinon(ch); 1997 rxwinon(ch);
2169 while (bytesAvailable > 0) { /* Begin while there is data on the card */ 1998 while (bytesAvailable > 0) { /* Begin while there is data on the card */
2170 wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; 1999 wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail;
2171 /* --------------------------------------------------------------- 2000 /*
2172 Even if head has wrapped around only report the amount of 2001 * Even if head has wrapped around only report the amount of
2173 data to be equal to the size - tail. Remember memcpy can't 2002 * data to be equal to the size - tail. Remember memcpy can't
2174 automaticly wrap around the receive buffer. 2003 * automaticly wrap around the receive buffer.
2175 ----------------------------------------------------------------- */ 2004 */
2176 dataToRead = (wrapgap < bytesAvailable) ? wrapgap : bytesAvailable; 2005 dataToRead = (wrapgap < bytesAvailable) ? wrapgap : bytesAvailable;
2177 /* -------------------------------------------------------------- 2006 /* Make sure we don't overflow the buffer */
2178 Make sure we don't overflow the buffer
2179 ----------------------------------------------------------------- */
2180 dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead); 2007 dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead);
2181 if (dataToRead == 0) 2008 if (dataToRead == 0)
2182 break; 2009 break;
2183 /* --------------------------------------------------------------- 2010 /*
2184 Move data read from our card into the line disciplines buffer 2011 * Move data read from our card into the line disciplines
2185 for translation if necessary. 2012 * buffer for translation if necessary.
2186 ------------------------------------------------------------------ */ 2013 */
2187 memcpy_fromio(rptr, ch->rxptr + tail, dataToRead); 2014 memcpy_fromio(rptr, ch->rxptr + tail, dataToRead);
2188 tail = (tail + dataToRead) & wrapmask; 2015 tail = (tail + dataToRead) & wrapmask;
2189 bytesAvailable -= dataToRead; 2016 bytesAvailable -= dataToRead;
@@ -2191,28 +2018,26 @@ static void receive_data(struct channel *ch)
2191 globalwinon(ch); 2018 globalwinon(ch);
2192 writew(tail, &bc->rout); 2019 writew(tail, &bc->rout);
2193 /* Must be called with global data */ 2020 /* Must be called with global data */
2194 tty_schedule_flip(ch->tty); 2021 tty_schedule_flip(ch->tty);
2195 return; 2022}
2196} /* End receive_data */
2197 2023
2198static int info_ioctl(struct tty_struct *tty, struct file * file, 2024static int info_ioctl(struct tty_struct *tty, struct file *file,
2199 unsigned int cmd, unsigned long arg) 2025 unsigned int cmd, unsigned long arg)
2200{ 2026{
2201 switch (cmd) 2027 switch (cmd) {
2202 { /* Begin switch cmd */ 2028 case DIGI_GETINFO:
2203 case DIGI_GETINFO: 2029 {
2204 { /* Begin case DIGI_GETINFO */ 2030 struct digi_info di;
2205 struct digi_info di ;
2206 int brd; 2031 int brd;
2207 2032
2208 if(get_user(brd, (unsigned int __user *)arg)) 2033 if (get_user(brd, (unsigned int __user *)arg))
2209 return -EFAULT; 2034 return -EFAULT;
2210 if (brd < 0 || brd >= num_cards || num_cards == 0) 2035 if (brd < 0 || brd >= num_cards || num_cards == 0)
2211 return -ENODEV; 2036 return -ENODEV;
2212 2037
2213 memset(&di, 0, sizeof(di)); 2038 memset(&di, 0, sizeof(di));
2214 2039
2215 di.board = brd ; 2040 di.board = brd;
2216 di.status = boards[brd].status; 2041 di.status = boards[brd].status;
2217 di.type = boards[brd].type ; 2042 di.type = boards[brd].type ;
2218 di.numports = boards[brd].numports ; 2043 di.numports = boards[brd].numports ;
@@ -2220,45 +2045,44 @@ static int info_ioctl(struct tty_struct *tty, struct file * file,
2220 di.port = (unsigned char *)boards[brd].port ; 2045 di.port = (unsigned char *)boards[brd].port ;
2221 di.membase = (unsigned char *)boards[brd].membase ; 2046 di.membase = (unsigned char *)boards[brd].membase ;
2222 2047
2223 if (copy_to_user((void __user *)arg, &di, sizeof (di))) 2048 if (copy_to_user((void __user *)arg, &di, sizeof(di)))
2224 return -EFAULT; 2049 return -EFAULT;
2225 break; 2050 break;
2226 2051
2227 } /* End case DIGI_GETINFO */ 2052 }
2228
2229 case DIGI_POLLER:
2230 { /* Begin case DIGI_POLLER */
2231 2053
2232 int brd = arg & 0xff000000 >> 16 ; 2054 case DIGI_POLLER:
2233 unsigned char state = arg & 0xff ; 2055 {
2056 int brd = arg & 0xff000000 >> 16;
2057 unsigned char state = arg & 0xff;
2234 2058
2235 if (brd < 0 || brd >= num_cards) { 2059 if (brd < 0 || brd >= num_cards) {
2236 printk(KERN_ERR "epca: DIGI POLLER : brd not valid!\n"); 2060 printk(KERN_ERR "epca: DIGI POLLER : brd not valid!\n");
2237 return (-ENODEV); 2061 return -ENODEV;
2238 } 2062 }
2239 digi_poller_inhibited = state ; 2063 digi_poller_inhibited = state;
2240 break ; 2064 break;
2241 } /* End case DIGI_POLLER */ 2065 }
2242 2066
2243 case DIGI_INIT: 2067 case DIGI_INIT:
2244 { /* Begin case DIGI_INIT */ 2068 {
2245 /* ------------------------------------------------------------ 2069 /*
2246 This call is made by the apps to complete the initilization 2070 * This call is made by the apps to complete the
2247 of the board(s). This routine is responsible for setting 2071 * initilization of the board(s). This routine is
2248 the card to its initial state and setting the drivers control 2072 * responsible for setting the card to its initial
2249 fields to the sutianle settings for the card in question. 2073 * state and setting the drivers control fields to the
2250 ---------------------------------------------------------------- */ 2074 * sutianle settings for the card in question.
2251 int crd ; 2075 */
2252 for (crd = 0; crd < num_cards; crd++) 2076 int crd;
2253 post_fep_init (crd); 2077 for (crd = 0; crd < num_cards; crd++)
2254 break ; 2078 post_fep_init(crd);
2255 } /* End case DIGI_INIT */ 2079 break;
2256 default: 2080 }
2257 return -ENOTTY; 2081 default:
2258 } /* End switch cmd */ 2082 return -ENOTTY;
2259 return (0) ; 2083 }
2084 return 0;
2260} 2085}
2261/* --------------------- Begin pc_ioctl ----------------------- */
2262 2086
2263static int pc_tiocmget(struct tty_struct *tty, struct file *file) 2087static int pc_tiocmget(struct tty_struct *tty, struct file *file)
2264{ 2088{
@@ -2304,9 +2128,9 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
2304 2128
2305 spin_lock_irqsave(&epca_lock, flags); 2129 spin_lock_irqsave(&epca_lock, flags);
2306 /* 2130 /*
2307 * I think this modemfake stuff is broken. It doesn't 2131 * I think this modemfake stuff is broken. It doesn't correctly reflect
2308 * correctly reflect the behaviour desired by the TIOCM* 2132 * the behaviour desired by the TIOCM* ioctls. Therefore this is
2309 * ioctls. Therefore this is probably broken. 2133 * probably broken.
2310 */ 2134 */
2311 if (set & TIOCM_RTS) { 2135 if (set & TIOCM_RTS) {
2312 ch->modemfake |= ch->m_rts; 2136 ch->modemfake |= ch->m_rts;
@@ -2325,10 +2149,10 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
2325 ch->modem &= ~ch->m_dtr; 2149 ch->modem &= ~ch->m_dtr;
2326 } 2150 }
2327 globalwinon(ch); 2151 globalwinon(ch);
2328 /* -------------------------------------------------------------- 2152 /*
2329 The below routine generally sets up parity, baud, flow control 2153 * The below routine generally sets up parity, baud, flow control
2330 issues, etc.... It effect both control flags and input flags. 2154 * issues, etc.... It effect both control flags and input flags.
2331 ------------------------------------------------------------------ */ 2155 */
2332 epcaparam(tty,ch); 2156 epcaparam(tty,ch);
2333 memoff(ch); 2157 memoff(ch);
2334 spin_unlock_irqrestore(&epca_lock, flags); 2158 spin_unlock_irqrestore(&epca_lock, flags);
@@ -2337,8 +2161,7 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
2337 2161
2338static int pc_ioctl(struct tty_struct *tty, struct file * file, 2162static int pc_ioctl(struct tty_struct *tty, struct file * file,
2339 unsigned int cmd, unsigned long arg) 2163 unsigned int cmd, unsigned long arg)
2340{ /* Begin pc_ioctl */ 2164{
2341
2342 digiflow_t dflow; 2165 digiflow_t dflow;
2343 int retval; 2166 int retval;
2344 unsigned long flags; 2167 unsigned long flags;
@@ -2347,49 +2170,47 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
2347 struct board_chan __iomem *bc; 2170 struct board_chan __iomem *bc;
2348 struct channel *ch = (struct channel *) tty->driver_data; 2171 struct channel *ch = (struct channel *) tty->driver_data;
2349 void __user *argp = (void __user *)arg; 2172 void __user *argp = (void __user *)arg;
2350 2173
2351 if (ch) 2174 if (ch)
2352 bc = ch->brdchan; 2175 bc = ch->brdchan;
2353 else 2176 else
2354 return -EINVAL; 2177 return -EINVAL;
2355 2178
2356 /* ------------------------------------------------------------------- 2179 /*
2357 For POSIX compliance we need to add more ioctls. See tty_ioctl.c 2180 * For POSIX compliance we need to add more ioctls. See tty_ioctl.c in
2358 in /usr/src/linux/drivers/char for a good example. In particular 2181 * /usr/src/linux/drivers/char for a good example. In particular think
2359 think about adding TCSETAF, TCSETAW, TCSETA, TCSETSF, TCSETSW, TCSETS. 2182 * about adding TCSETAF, TCSETAW, TCSETA, TCSETSF, TCSETSW, TCSETS.
2360 ---------------------------------------------------------------------- */ 2183 */
2361 2184 switch (cmd) {
2362 switch (cmd) 2185 case TCSBRK: /* SVID version: non-zero arg --> no break */
2363 { /* Begin switch cmd */ 2186 retval = tty_check_change(tty);
2364 case TCSBRK: /* SVID version: non-zero arg --> no break */ 2187 if (retval)
2365 retval = tty_check_change(tty); 2188 return retval;
2366 if (retval) 2189 /* Setup an event to indicate when the transmit buffer empties */
2367 return retval; 2190 spin_lock_irqsave(&epca_lock, flags);
2368 /* Setup an event to indicate when the transmit buffer empties */ 2191 setup_empty_event(tty,ch);
2369 spin_lock_irqsave(&epca_lock, flags); 2192 spin_unlock_irqrestore(&epca_lock, flags);
2370 setup_empty_event(tty,ch); 2193 tty_wait_until_sent(tty, 0);
2371 spin_unlock_irqrestore(&epca_lock, flags); 2194 if (!arg)
2372 tty_wait_until_sent(tty, 0); 2195 digi_send_break(ch, HZ / 4); /* 1/4 second */
2373 if (!arg) 2196 return 0;
2374 digi_send_break(ch, HZ/4); /* 1/4 second */ 2197 case TCSBRKP: /* support for POSIX tcsendbreak() */
2375 return 0; 2198 retval = tty_check_change(tty);
2376 case TCSBRKP: /* support for POSIX tcsendbreak() */ 2199 if (retval)
2377 retval = tty_check_change(tty); 2200 return retval;
2378 if (retval)
2379 return retval;
2380 2201
2381 /* Setup an event to indicate when the transmit buffer empties */ 2202 /* Setup an event to indicate when the transmit buffer empties */
2382 spin_lock_irqsave(&epca_lock, flags); 2203 spin_lock_irqsave(&epca_lock, flags);
2383 setup_empty_event(tty,ch); 2204 setup_empty_event(tty,ch);
2384 spin_unlock_irqrestore(&epca_lock, flags); 2205 spin_unlock_irqrestore(&epca_lock, flags);
2385 tty_wait_until_sent(tty, 0); 2206 tty_wait_until_sent(tty, 0);
2386 digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4); 2207 digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4);
2387 return 0; 2208 return 0;
2388 case TIOCGSOFTCAR: 2209 case TIOCGSOFTCAR:
2389 if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg)) 2210 if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg))
2390 return -EFAULT; 2211 return -EFAULT;
2391 return 0; 2212 return 0;
2392 case TIOCSSOFTCAR: 2213 case TIOCSSOFTCAR:
2393 { 2214 {
2394 unsigned int value; 2215 unsigned int value;
2395 2216
@@ -2400,144 +2221,141 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
2400 (value ? CLOCAL : 0)); 2221 (value ? CLOCAL : 0));
2401 return 0; 2222 return 0;
2402 } 2223 }
2403 case TIOCMODG: 2224 case TIOCMODG:
2404 mflag = pc_tiocmget(tty, file); 2225 mflag = pc_tiocmget(tty, file);
2405 if (put_user(mflag, (unsigned long __user *)argp)) 2226 if (put_user(mflag, (unsigned long __user *)argp))
2406 return -EFAULT; 2227 return -EFAULT;
2407 break; 2228 break;
2408 case TIOCMODS: 2229 case TIOCMODS:
2409 if (get_user(mstat, (unsigned __user *)argp)) 2230 if (get_user(mstat, (unsigned __user *)argp))
2410 return -EFAULT; 2231 return -EFAULT;
2411 return pc_tiocmset(tty, file, mstat, ~mstat); 2232 return pc_tiocmset(tty, file, mstat, ~mstat);
2412 case TIOCSDTR: 2233 case TIOCSDTR:
2413 spin_lock_irqsave(&epca_lock, flags); 2234 spin_lock_irqsave(&epca_lock, flags);
2414 ch->omodem |= ch->m_dtr; 2235 ch->omodem |= ch->m_dtr;
2415 globalwinon(ch); 2236 globalwinon(ch);
2416 fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1); 2237 fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1);
2417 memoff(ch); 2238 memoff(ch);
2418 spin_unlock_irqrestore(&epca_lock, flags); 2239 spin_unlock_irqrestore(&epca_lock, flags);
2419 break; 2240 break;
2420 2241
2421 case TIOCCDTR: 2242 case TIOCCDTR:
2243 spin_lock_irqsave(&epca_lock, flags);
2244 ch->omodem &= ~ch->m_dtr;
2245 globalwinon(ch);
2246 fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1);
2247 memoff(ch);
2248 spin_unlock_irqrestore(&epca_lock, flags);
2249 break;
2250 case DIGI_GETA:
2251 if (copy_to_user(argp, &ch->digiext, sizeof(digi_t)))
2252 return -EFAULT;
2253 break;
2254 case DIGI_SETAW:
2255 case DIGI_SETAF:
2256 if (cmd == DIGI_SETAW) {
2257 /* Setup an event to indicate when the transmit buffer empties */
2422 spin_lock_irqsave(&epca_lock, flags); 2258 spin_lock_irqsave(&epca_lock, flags);
2423 ch->omodem &= ~ch->m_dtr; 2259 setup_empty_event(tty,ch);
2424 globalwinon(ch);
2425 fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1);
2426 memoff(ch);
2427 spin_unlock_irqrestore(&epca_lock, flags); 2260 spin_unlock_irqrestore(&epca_lock, flags);
2428 break; 2261 tty_wait_until_sent(tty, 0);
2429 case DIGI_GETA: 2262 } else {
2430 if (copy_to_user(argp, &ch->digiext, sizeof(digi_t))) 2263 /* ldisc lock already held in ioctl */
2431 return -EFAULT; 2264 if (tty->ldisc.flush_buffer)
2432 break; 2265 tty->ldisc.flush_buffer(tty);
2433 case DIGI_SETAW: 2266 }
2434 case DIGI_SETAF: 2267 /* Fall Thru */
2435 if (cmd == DIGI_SETAW) { 2268 case DIGI_SETA:
2436 /* Setup an event to indicate when the transmit buffer empties */ 2269 if (copy_from_user(&ch->digiext, argp, sizeof(digi_t)))
2437 spin_lock_irqsave(&epca_lock, flags); 2270 return -EFAULT;
2438 setup_empty_event(tty,ch); 2271
2439 spin_unlock_irqrestore(&epca_lock, flags); 2272 if (ch->digiext.digi_flags & DIGI_ALTPIN) {
2440 tty_wait_until_sent(tty, 0); 2273 ch->dcd = ch->m_dsr;
2441 } else { 2274 ch->dsr = ch->m_dcd;
2442 /* ldisc lock already held in ioctl */ 2275 } else {
2443 if (tty->ldisc.flush_buffer) 2276 ch->dcd = ch->m_dcd;
2444 tty->ldisc.flush_buffer(tty); 2277 ch->dsr = ch->m_dsr;
2445 }
2446 /* Fall Thru */
2447 case DIGI_SETA:
2448 if (copy_from_user(&ch->digiext, argp, sizeof(digi_t)))
2449 return -EFAULT;
2450
2451 if (ch->digiext.digi_flags & DIGI_ALTPIN) {
2452 ch->dcd = ch->m_dsr;
2453 ch->dsr = ch->m_dcd;
2454 } else {
2455 ch->dcd = ch->m_dcd;
2456 ch->dsr = ch->m_dsr;
2457 } 2278 }
2458
2459 spin_lock_irqsave(&epca_lock, flags);
2460 globalwinon(ch);
2461 2279
2462 /* ----------------------------------------------------------------- 2280 spin_lock_irqsave(&epca_lock, flags);
2463 The below routine generally sets up parity, baud, flow control 2281 globalwinon(ch);
2464 issues, etc.... It effect both control flags and input flags.
2465 ------------------------------------------------------------------- */
2466 2282
2467 epcaparam(tty,ch); 2283 /*
2468 memoff(ch); 2284 * The below routine generally sets up parity, baud, flow
2469 spin_unlock_irqrestore(&epca_lock, flags); 2285 * control issues, etc.... It effect both control flags and
2470 break; 2286 * input flags.
2287 */
2288 epcaparam(tty,ch);
2289 memoff(ch);
2290 spin_unlock_irqrestore(&epca_lock, flags);
2291 break;
2292
2293 case DIGI_GETFLOW:
2294 case DIGI_GETAFLOW:
2295 spin_lock_irqsave(&epca_lock, flags);
2296 globalwinon(ch);
2297 if (cmd == DIGI_GETFLOW) {
2298 dflow.startc = readb(&bc->startc);
2299 dflow.stopc = readb(&bc->stopc);
2300 } else {
2301 dflow.startc = readb(&bc->startca);
2302 dflow.stopc = readb(&bc->stopca);
2303 }
2304 memoff(ch);
2305 spin_unlock_irqrestore(&epca_lock, flags);
2306
2307 if (copy_to_user(argp, &dflow, sizeof(dflow)))
2308 return -EFAULT;
2309 break;
2310
2311 case DIGI_SETAFLOW:
2312 case DIGI_SETFLOW:
2313 if (cmd == DIGI_SETFLOW) {
2314 startc = ch->startc;
2315 stopc = ch->stopc;
2316 } else {
2317 startc = ch->startca;
2318 stopc = ch->stopca;
2319 }
2320
2321 if (copy_from_user(&dflow, argp, sizeof(dflow)))
2322 return -EFAULT;
2471 2323
2472 case DIGI_GETFLOW: 2324 if (dflow.startc != startc || dflow.stopc != stopc) { /* Begin if setflow toggled */
2473 case DIGI_GETAFLOW:
2474 spin_lock_irqsave(&epca_lock, flags); 2325 spin_lock_irqsave(&epca_lock, flags);
2475 globalwinon(ch); 2326 globalwinon(ch);
2476 if (cmd == DIGI_GETFLOW) {
2477 dflow.startc = readb(&bc->startc);
2478 dflow.stopc = readb(&bc->stopc);
2479 } else {
2480 dflow.startc = readb(&bc->startca);
2481 dflow.stopc = readb(&bc->stopca);
2482 }
2483 memoff(ch);
2484 spin_unlock_irqrestore(&epca_lock, flags);
2485 2327
2486 if (copy_to_user(argp, &dflow, sizeof(dflow)))
2487 return -EFAULT;
2488 break;
2489
2490 case DIGI_SETAFLOW:
2491 case DIGI_SETFLOW:
2492 if (cmd == DIGI_SETFLOW) { 2328 if (cmd == DIGI_SETFLOW) {
2493 startc = ch->startc; 2329 ch->fepstartc = ch->startc = dflow.startc;
2494 stopc = ch->stopc; 2330 ch->fepstopc = ch->stopc = dflow.stopc;
2331 fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1);
2495 } else { 2332 } else {
2496 startc = ch->startca; 2333 ch->fepstartca = ch->startca = dflow.startc;
2497 stopc = ch->stopca; 2334 ch->fepstopca = ch->stopca = dflow.stopc;
2335 fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
2498 } 2336 }
2499 2337
2500 if (copy_from_user(&dflow, argp, sizeof(dflow))) 2338 if (ch->statusflags & TXSTOPPED)
2501 return -EFAULT; 2339 pc_start(tty);
2502 2340
2503 if (dflow.startc != startc || dflow.stopc != stopc) { /* Begin if setflow toggled */ 2341 memoff(ch);
2504 spin_lock_irqsave(&epca_lock, flags); 2342 spin_unlock_irqrestore(&epca_lock, flags);
2505 globalwinon(ch); 2343 } /* End if setflow toggled */
2506 2344 break;
2507 if (cmd == DIGI_SETFLOW) { 2345 default:
2508 ch->fepstartc = ch->startc = dflow.startc; 2346 return -ENOIOCTLCMD;
2509 ch->fepstopc = ch->stopc = dflow.stopc; 2347 }
2510 fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1);
2511 } else {
2512 ch->fepstartca = ch->startca = dflow.startc;
2513 ch->fepstopca = ch->stopca = dflow.stopc;
2514 fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
2515 }
2516
2517 if (ch->statusflags & TXSTOPPED)
2518 pc_start(tty);
2519
2520 memoff(ch);
2521 spin_unlock_irqrestore(&epca_lock, flags);
2522 } /* End if setflow toggled */
2523 break;
2524 default:
2525 return -ENOIOCTLCMD;
2526 } /* End switch cmd */
2527 return 0; 2348 return 0;
2528} /* End pc_ioctl */ 2349}
2529
2530/* --------------------- Begin pc_set_termios ----------------------- */
2531 2350
2532static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) 2351static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2533{ /* Begin pc_set_termios */ 2352{
2534
2535 struct channel *ch; 2353 struct channel *ch;
2536 unsigned long flags; 2354 unsigned long flags;
2537 /* --------------------------------------------------------- 2355 /*
2538 verifyChannel returns the channel from the tty struct 2356 * verifyChannel returns the channel from the tty struct if it is
2539 if it is valid. This serves as a sanity check. 2357 * valid. This serves as a sanity check.
2540 ------------------------------------------------------------- */ 2358 */
2541 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ 2359 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */
2542 spin_lock_irqsave(&epca_lock, flags); 2360 spin_lock_irqsave(&epca_lock, flags);
2543 globalwinon(ch); 2361 globalwinon(ch);
@@ -2554,47 +2372,40 @@ static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2554 wake_up_interruptible(&ch->open_wait); 2372 wake_up_interruptible(&ch->open_wait);
2555 2373
2556 } /* End if channel valid */ 2374 } /* End if channel valid */
2557 2375}
2558} /* End pc_set_termios */
2559
2560/* --------------------- Begin do_softint ----------------------- */
2561 2376
2562static void do_softint(struct work_struct *work) 2377static void do_softint(struct work_struct *work)
2563{ /* Begin do_softint */ 2378{
2564 struct channel *ch = container_of(work, struct channel, tqueue); 2379 struct channel *ch = container_of(work, struct channel, tqueue);
2565 /* Called in response to a modem change event */ 2380 /* Called in response to a modem change event */
2566 if (ch && ch->magic == EPCA_MAGIC) { /* Begin EPCA_MAGIC */ 2381 if (ch && ch->magic == EPCA_MAGIC) {
2567 struct tty_struct *tty = ch->tty; 2382 struct tty_struct *tty = ch->tty;
2568 2383
2569 if (tty && tty->driver_data) { 2384 if (tty && tty->driver_data) {
2570 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { /* Begin if clear_bit */ 2385 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
2571 tty_hangup(tty); /* FIXME: module removal race here - AKPM */ 2386 tty_hangup(tty); /* FIXME: module removal race here - AKPM */
2572 wake_up_interruptible(&ch->open_wait); 2387 wake_up_interruptible(&ch->open_wait);
2573 ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; 2388 ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE;
2574 } /* End if clear_bit */ 2389 }
2575 } 2390 }
2576 } /* End EPCA_MAGIC */ 2391 }
2577} /* End do_softint */ 2392}
2578
2579/* ------------------------------------------------------------
2580 pc_stop and pc_start provide software flow control to the
2581 routine and the pc_ioctl routine.
2582---------------------------------------------------------------- */
2583
2584/* --------------------- Begin pc_stop ----------------------- */
2585 2393
2394/*
2395 * pc_stop and pc_start provide software flow control to the routine and the
2396 * pc_ioctl routine.
2397 */
2586static void pc_stop(struct tty_struct *tty) 2398static void pc_stop(struct tty_struct *tty)
2587{ /* Begin pc_stop */ 2399{
2588
2589 struct channel *ch; 2400 struct channel *ch;
2590 unsigned long flags; 2401 unsigned long flags;
2591 /* --------------------------------------------------------- 2402 /*
2592 verifyChannel returns the channel from the tty struct 2403 * verifyChannel returns the channel from the tty struct if it is
2593 if it is valid. This serves as a sanity check. 2404 * valid. This serves as a sanity check.
2594 ------------------------------------------------------------- */ 2405 */
2595 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if valid channel */ 2406 if ((ch = verifyChannel(tty)) != NULL) {
2596 spin_lock_irqsave(&epca_lock, flags); 2407 spin_lock_irqsave(&epca_lock, flags);
2597 if ((ch->statusflags & TXSTOPPED) == 0) { /* Begin if transmit stop requested */ 2408 if ((ch->statusflags & TXSTOPPED) == 0) { /* Begin if transmit stop requested */
2598 globalwinon(ch); 2409 globalwinon(ch);
2599 /* STOP transmitting now !! */ 2410 /* STOP transmitting now !! */
2600 fepcmd(ch, PAUSETX, 0, 0, 0, 0); 2411 fepcmd(ch, PAUSETX, 0, 0, 0, 0);
@@ -2602,19 +2413,17 @@ static void pc_stop(struct tty_struct *tty)
2602 memoff(ch); 2413 memoff(ch);
2603 } /* End if transmit stop requested */ 2414 } /* End if transmit stop requested */
2604 spin_unlock_irqrestore(&epca_lock, flags); 2415 spin_unlock_irqrestore(&epca_lock, flags);
2605 } /* End if valid channel */ 2416 }
2606} /* End pc_stop */ 2417}
2607
2608/* --------------------- Begin pc_start ----------------------- */
2609 2418
2610static void pc_start(struct tty_struct *tty) 2419static void pc_start(struct tty_struct *tty)
2611{ /* Begin pc_start */ 2420{
2612 struct channel *ch; 2421 struct channel *ch;
2613 /* --------------------------------------------------------- 2422 /*
2614 verifyChannel returns the channel from the tty struct 2423 * verifyChannel returns the channel from the tty struct if it is
2615 if it is valid. This serves as a sanity check. 2424 * valid. This serves as a sanity check.
2616 ------------------------------------------------------------- */ 2425 */
2617 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ 2426 if ((ch = verifyChannel(tty)) != NULL) {
2618 unsigned long flags; 2427 unsigned long flags;
2619 spin_lock_irqsave(&epca_lock, flags); 2428 spin_lock_irqsave(&epca_lock, flags);
2620 /* Just in case output was resumed because of a change in Digi-flow */ 2429 /* 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)
2630 memoff(ch); 2439 memoff(ch);
2631 } /* End transmit resume requested */ 2440 } /* End transmit resume requested */
2632 spin_unlock_irqrestore(&epca_lock, flags); 2441 spin_unlock_irqrestore(&epca_lock, flags);
2633 } /* End if channel valid */ 2442 }
2634} /* End pc_start */ 2443}
2635 2444
2636/* ------------------------------------------------------------------ 2445/*
2637 The below routines pc_throttle and pc_unthrottle are used 2446 * The below routines pc_throttle and pc_unthrottle are used to slow (And
2638 to slow (And resume) the receipt of data into the kernels 2447 * resume) the receipt of data into the kernels receive buffers. The exact
2639 receive buffers. The exact occurrence of this depends on the 2448 * occurrence of this depends on the size of the kernels receive buffer and
2640 size of the kernels receive buffer and what the 'watermarks' 2449 * what the 'watermarks' are set to for that buffer. See the n_ttys.c file for
2641 are set to for that buffer. See the n_ttys.c file for more 2450 * more details.
2642 details. 2451 */
2643______________________________________________________________________ */ 2452static void pc_throttle(struct tty_struct *tty)
2644/* --------------------- Begin throttle ----------------------- */ 2453{
2645
2646static void pc_throttle(struct tty_struct * tty)
2647{ /* Begin pc_throttle */
2648 struct channel *ch; 2454 struct channel *ch;
2649 unsigned long flags; 2455 unsigned long flags;
2650 /* --------------------------------------------------------- 2456 /*
2651 verifyChannel returns the channel from the tty struct 2457 * verifyChannel returns the channel from the tty struct if it is
2652 if it is valid. This serves as a sanity check. 2458 * valid. This serves as a sanity check.
2653 ------------------------------------------------------------- */ 2459 */
2654 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ 2460 if ((ch = verifyChannel(tty)) != NULL) {
2655 spin_lock_irqsave(&epca_lock, flags); 2461 spin_lock_irqsave(&epca_lock, flags);
2656 if ((ch->statusflags & RXSTOPPED) == 0) { 2462 if ((ch->statusflags & RXSTOPPED) == 0) {
2657 globalwinon(ch); 2463 globalwinon(ch);
@@ -2660,20 +2466,18 @@ static void pc_throttle(struct tty_struct * tty)
2660 memoff(ch); 2466 memoff(ch);
2661 } 2467 }
2662 spin_unlock_irqrestore(&epca_lock, flags); 2468 spin_unlock_irqrestore(&epca_lock, flags);
2663 } /* End if channel valid */ 2469 }
2664} /* End pc_throttle */ 2470}
2665
2666/* --------------------- Begin unthrottle ----------------------- */
2667 2471
2668static void pc_unthrottle(struct tty_struct *tty) 2472static void pc_unthrottle(struct tty_struct *tty)
2669{ /* Begin pc_unthrottle */ 2473{
2670 struct channel *ch; 2474 struct channel *ch;
2671 unsigned long flags; 2475 unsigned long flags;
2672 /* --------------------------------------------------------- 2476 /*
2673 verifyChannel returns the channel from the tty struct 2477 * verifyChannel returns the channel from the tty struct if it is
2674 if it is valid. This serves as a sanity check. 2478 * valid. This serves as a sanity check.
2675 ------------------------------------------------------------- */ 2479 */
2676 if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ 2480 if ((ch = verifyChannel(tty)) != NULL) {
2677 /* Just in case output was resumed because of a change in Digi-flow */ 2481 /* Just in case output was resumed because of a change in Digi-flow */
2678 spin_lock_irqsave(&epca_lock, flags); 2482 spin_lock_irqsave(&epca_lock, flags);
2679 if (ch->statusflags & RXSTOPPED) { 2483 if (ch->statusflags & RXSTOPPED) {
@@ -2683,151 +2487,143 @@ static void pc_unthrottle(struct tty_struct *tty)
2683 memoff(ch); 2487 memoff(ch);
2684 } 2488 }
2685 spin_unlock_irqrestore(&epca_lock, flags); 2489 spin_unlock_irqrestore(&epca_lock, flags);
2686 } /* End if channel valid */ 2490 }
2687} /* End pc_unthrottle */ 2491}
2688
2689/* --------------------- Begin digi_send_break ----------------------- */
2690 2492
2691void digi_send_break(struct channel *ch, int msec) 2493void digi_send_break(struct channel *ch, int msec)
2692{ /* Begin digi_send_break */ 2494{
2693 unsigned long flags; 2495 unsigned long flags;
2694 2496
2695 spin_lock_irqsave(&epca_lock, flags); 2497 spin_lock_irqsave(&epca_lock, flags);
2696 globalwinon(ch); 2498 globalwinon(ch);
2697 /* -------------------------------------------------------------------- 2499 /*
2698 Maybe I should send an infinite break here, schedule() for 2500 * Maybe I should send an infinite break here, schedule() for msec
2699 msec amount of time, and then stop the break. This way, 2501 * amount of time, and then stop the break. This way, the user can't
2700 the user can't screw up the FEP by causing digi_send_break() 2502 * screw up the FEP by causing digi_send_break() to be called (i.e. via
2701 to be called (i.e. via an ioctl()) more than once in msec amount 2503 * an ioctl()) more than once in msec amount of time.
2702 of time. Try this for now... 2504 * Try this for now...
2703 ------------------------------------------------------------------------ */ 2505 */
2704 fepcmd(ch, SENDBREAK, msec, 0, 10, 0); 2506 fepcmd(ch, SENDBREAK, msec, 0, 10, 0);
2705 memoff(ch); 2507 memoff(ch);
2706 spin_unlock_irqrestore(&epca_lock, flags); 2508 spin_unlock_irqrestore(&epca_lock, flags);
2707} /* End digi_send_break */ 2509}
2708
2709/* --------------------- Begin setup_empty_event ----------------------- */
2710 2510
2711/* Caller MUST hold the lock */ 2511/* Caller MUST hold the lock */
2712
2713static void setup_empty_event(struct tty_struct *tty, struct channel *ch) 2512static void setup_empty_event(struct tty_struct *tty, struct channel *ch)
2714{ /* Begin setup_empty_event */ 2513{
2715
2716 struct board_chan __iomem *bc = ch->brdchan; 2514 struct board_chan __iomem *bc = ch->brdchan;
2717 2515
2718 globalwinon(ch); 2516 globalwinon(ch);
2719 ch->statusflags |= EMPTYWAIT; 2517 ch->statusflags |= EMPTYWAIT;
2720 /* ------------------------------------------------------------------ 2518 /*
2721 When set the iempty flag request a event to be generated when the 2519 * When set the iempty flag request a event to be generated when the
2722 transmit buffer is empty (If there is no BREAK in progress). 2520 * transmit buffer is empty (If there is no BREAK in progress).
2723 --------------------------------------------------------------------- */ 2521 */
2724 writeb(1, &bc->iempty); 2522 writeb(1, &bc->iempty);
2725 memoff(ch); 2523 memoff(ch);
2726} /* End setup_empty_event */ 2524}
2727 2525
2728/* ---------------------- Begin epca_setup -------------------------- */
2729void epca_setup(char *str, int *ints) 2526void epca_setup(char *str, int *ints)
2730{ /* Begin epca_setup */ 2527{
2731 struct board_info board; 2528 struct board_info board;
2732 int index, loop, last; 2529 int index, loop, last;
2733 char *temp, *t2; 2530 char *temp, *t2;
2734 unsigned len; 2531 unsigned len;
2735 2532
2736 /* ---------------------------------------------------------------------- 2533 /*
2737 If this routine looks a little strange it is because it is only called 2534 * If this routine looks a little strange it is because it is only
2738 if a LILO append command is given to boot the kernel with parameters. 2535 * called if a LILO append command is given to boot the kernel with
2739 In this way, we can provide the user a method of changing his board 2536 * parameters. In this way, we can provide the user a method of
2740 configuration without rebuilding the kernel. 2537 * changing his board configuration without rebuilding the kernel.
2741 ----------------------------------------------------------------------- */ 2538 */
2742 if (!liloconfig) 2539 if (!liloconfig)
2743 liloconfig = 1; 2540 liloconfig = 1;
2744 2541
2745 memset(&board, 0, sizeof(board)); 2542 memset(&board, 0, sizeof(board));
2746 2543
2747 /* Assume the data is int first, later we can change it */ 2544 /* Assume the data is int first, later we can change it */
2748 /* I think that array position 0 of ints holds the number of args */ 2545 /* I think that array position 0 of ints holds the number of args */
2749 for (last = 0, index = 1; index <= ints[0]; index++) 2546 for (last = 0, index = 1; index <= ints[0]; index++)
2750 switch(index) 2547 switch (index) { /* Begin parse switch */
2751 { /* Begin parse switch */ 2548 case 1:
2752 case 1: 2549 board.status = ints[index];
2753 board.status = ints[index]; 2550 /*
2754 /* --------------------------------------------------------- 2551 * We check for 2 (As opposed to 1; because 2 is a flag
2755 We check for 2 (As opposed to 1; because 2 is a flag 2552 * instructing the driver to ignore epcaconfig.) For
2756 instructing the driver to ignore epcaconfig.) For this 2553 * this reason we check for 2.
2757 reason we check for 2. 2554 */
2758 ------------------------------------------------------------ */ 2555 if (board.status == 2) { /* Begin ignore epcaconfig as well as lilo cmd line */
2759 if (board.status == 2) { /* Begin ignore epcaconfig as well as lilo cmd line */ 2556 nbdevs = 0;
2760 nbdevs = 0; 2557 num_cards = 0;
2761 num_cards = 0; 2558 return;
2762 return; 2559 } /* End ignore epcaconfig as well as lilo cmd line */
2763 } /* End ignore epcaconfig as well as lilo cmd line */ 2560
2764 2561 if (board.status > 2) {
2765 if (board.status > 2) { 2562 printk(KERN_ERR "epca_setup: Invalid board status 0x%x\n", board.status);
2766 printk(KERN_ERR "epca_setup: Invalid board status 0x%x\n", board.status); 2563 invalid_lilo_config = 1;
2767 invalid_lilo_config = 1; 2564 setup_error_code |= INVALID_BOARD_STATUS;
2768 setup_error_code |= INVALID_BOARD_STATUS; 2565 return;
2769 return; 2566 }
2770 } 2567 last = index;
2771 last = index; 2568 break;
2772 break; 2569 case 2:
2773 case 2: 2570 board.type = ints[index];
2774 board.type = ints[index]; 2571 if (board.type >= PCIXEM) {
2775 if (board.type >= PCIXEM) { 2572 printk(KERN_ERR "epca_setup: Invalid board type 0x%x\n", board.type);
2776 printk(KERN_ERR "epca_setup: Invalid board type 0x%x\n", board.type); 2573 invalid_lilo_config = 1;
2777 invalid_lilo_config = 1; 2574 setup_error_code |= INVALID_BOARD_TYPE;
2778 setup_error_code |= INVALID_BOARD_TYPE; 2575 return;
2779 return; 2576 }
2780 } 2577 last = index;
2781 last = index; 2578 break;
2782 break; 2579 case 3:
2783 case 3: 2580 board.altpin = ints[index];
2784 board.altpin = ints[index]; 2581 if (board.altpin > 1) {
2785 if (board.altpin > 1) { 2582 printk(KERN_ERR "epca_setup: Invalid board altpin 0x%x\n", board.altpin);
2786 printk(KERN_ERR "epca_setup: Invalid board altpin 0x%x\n", board.altpin); 2583 invalid_lilo_config = 1;
2787 invalid_lilo_config = 1; 2584 setup_error_code |= INVALID_ALTPIN;
2788 setup_error_code |= INVALID_ALTPIN; 2585 return;
2789 return; 2586 }
2790 } 2587 last = index;
2791 last = index; 2588 break;
2792 break; 2589
2793 2590 case 4:
2794 case 4: 2591 board.numports = ints[index];
2795 board.numports = ints[index]; 2592 if (board.numports < 2 || board.numports > 256) {
2796 if (board.numports < 2 || board.numports > 256) { 2593 printk(KERN_ERR "epca_setup: Invalid board numports 0x%x\n", board.numports);
2797 printk(KERN_ERR "epca_setup: Invalid board numports 0x%x\n", board.numports); 2594 invalid_lilo_config = 1;
2798 invalid_lilo_config = 1; 2595 setup_error_code |= INVALID_NUM_PORTS;
2799 setup_error_code |= INVALID_NUM_PORTS; 2596 return;
2800 return; 2597 }
2801 } 2598 nbdevs += board.numports;
2802 nbdevs += board.numports; 2599 last = index;
2803 last = index; 2600 break;
2804 break;
2805
2806 case 5:
2807 board.port = ints[index];
2808 if (ints[index] <= 0) {
2809 printk(KERN_ERR "epca_setup: Invalid io port 0x%x\n", (unsigned int)board.port);
2810 invalid_lilo_config = 1;
2811 setup_error_code |= INVALID_PORT_BASE;
2812 return;
2813 }
2814 last = index;
2815 break;
2816
2817 case 6:
2818 board.membase = ints[index];
2819 if (ints[index] <= 0) {
2820 printk(KERN_ERR "epca_setup: Invalid memory base 0x%x\n",(unsigned int)board.membase);
2821 invalid_lilo_config = 1;
2822 setup_error_code |= INVALID_MEM_BASE;
2823 return;
2824 }
2825 last = index;
2826 break;
2827 2601
2828 default: 2602 case 5:
2829 printk(KERN_ERR "<Error> - epca_setup: Too many integer parms\n"); 2603 board.port = ints[index];
2604 if (ints[index] <= 0) {
2605 printk(KERN_ERR "epca_setup: Invalid io port 0x%x\n", (unsigned int)board.port);
2606 invalid_lilo_config = 1;
2607 setup_error_code |= INVALID_PORT_BASE;
2830 return; 2608 return;
2609 }
2610 last = index;
2611 break;
2612
2613 case 6:
2614 board.membase = ints[index];
2615 if (ints[index] <= 0) {
2616 printk(KERN_ERR "epca_setup: Invalid memory base 0x%x\n",(unsigned int)board.membase);
2617 invalid_lilo_config = 1;
2618 setup_error_code |= INVALID_MEM_BASE;
2619 return;
2620 }
2621 last = index;
2622 break;
2623
2624 default:
2625 printk(KERN_ERR "<Error> - epca_setup: Too many integer parms\n");
2626 return;
2831 2627
2832 } /* End parse switch */ 2628 } /* End parse switch */
2833 2629
@@ -2844,120 +2640,121 @@ void epca_setup(char *str, int *ints)
2844 /* Set index to the number of args + 1 */ 2640 /* Set index to the number of args + 1 */
2845 index = last + 1; 2641 index = last + 1;
2846 2642
2847 switch(index) 2643 switch (index) {
2848 { 2644 case 1:
2849 case 1: 2645 len = strlen(str);
2850 len = strlen(str); 2646 if (strncmp("Disable", str, len) == 0)
2851 if (strncmp("Disable", str, len) == 0) 2647 board.status = 0;
2852 board.status = 0; 2648 else if (strncmp("Enable", str, len) == 0)
2853 else if (strncmp("Enable", str, len) == 0) 2649 board.status = 1;
2854 board.status = 1; 2650 else {
2855 else { 2651 printk(KERN_ERR "epca_setup: Invalid status %s\n", str);
2856 printk(KERN_ERR "epca_setup: Invalid status %s\n", str); 2652 invalid_lilo_config = 1;
2857 invalid_lilo_config = 1; 2653 setup_error_code |= INVALID_BOARD_STATUS;
2858 setup_error_code |= INVALID_BOARD_STATUS; 2654 return;
2859 return; 2655 }
2860 } 2656 last = index;
2861 last = index; 2657 break;
2862 break;
2863
2864 case 2:
2865 for(loop = 0; loop < EPCA_NUM_TYPES; loop++)
2866 if (strcmp(board_desc[loop], str) == 0)
2867 break;
2868 /* ---------------------------------------------------------------
2869 If the index incremented above refers to a legitamate board
2870 type set it here.
2871 ------------------------------------------------------------------*/
2872 if (index < EPCA_NUM_TYPES)
2873 board.type = loop;
2874 else {
2875 printk(KERN_ERR "epca_setup: Invalid board type: %s\n", str);
2876 invalid_lilo_config = 1;
2877 setup_error_code |= INVALID_BOARD_TYPE;
2878 return;
2879 }
2880 last = index;
2881 break;
2882
2883 case 3:
2884 len = strlen(str);
2885 if (strncmp("Disable", str, len) == 0)
2886 board.altpin = 0;
2887 else if (strncmp("Enable", str, len) == 0)
2888 board.altpin = 1;
2889 else {
2890 printk(KERN_ERR "epca_setup: Invalid altpin %s\n", str);
2891 invalid_lilo_config = 1;
2892 setup_error_code |= INVALID_ALTPIN;
2893 return;
2894 }
2895 last = index;
2896 break;
2897
2898 case 4:
2899 t2 = str;
2900 while (isdigit(*t2))
2901 t2++;
2902
2903 if (*t2) {
2904 printk(KERN_ERR "epca_setup: Invalid port count %s\n", str);
2905 invalid_lilo_config = 1;
2906 setup_error_code |= INVALID_NUM_PORTS;
2907 return;
2908 }
2909 2658
2910 /* ------------------------------------------------------------ 2659 case 2:
2911 There is not a man page for simple_strtoul but the code can be 2660 for (loop = 0; loop < EPCA_NUM_TYPES; loop++)
2912 found in vsprintf.c. The first argument is the string to 2661 if (strcmp(board_desc[loop], str) == 0)
2913 translate (To an unsigned long obviously), the second argument 2662 break;
2914 can be the address of any character variable or a NULL. If a 2663 /*
2915 variable is given, the end pointer of the string will be stored 2664 * If the index incremented above refers to a
2916 in that variable; if a NULL is given the end pointer will 2665 * legitamate board type set it here.
2917 not be returned. The last argument is the base to use. If 2666 */
2918 a 0 is indicated, the routine will attempt to determine the 2667 if (index < EPCA_NUM_TYPES)
2919 proper base by looking at the values prefix (A '0' for octal, 2668 board.type = loop;
2920 a 'x' for hex, etc ... If a value is given it will use that 2669 else {
2921 value as the base. 2670 printk(KERN_ERR "epca_setup: Invalid board type: %s\n", str);
2922 ---------------------------------------------------------------- */ 2671 invalid_lilo_config = 1;
2923 board.numports = simple_strtoul(str, NULL, 0); 2672 setup_error_code |= INVALID_BOARD_TYPE;
2924 nbdevs += board.numports; 2673 return;
2925 last = index; 2674 }
2926 break; 2675 last = index;
2927 2676 break;
2928 case 5:
2929 t2 = str;
2930 while (isxdigit(*t2))
2931 t2++;
2932
2933 if (*t2) {
2934 printk(KERN_ERR "epca_setup: Invalid i/o address %s\n", str);
2935 invalid_lilo_config = 1;
2936 setup_error_code |= INVALID_PORT_BASE;
2937 return;
2938 }
2939 2677
2940 board.port = simple_strtoul(str, NULL, 16); 2678 case 3:
2941 last = index; 2679 len = strlen(str);
2942 break; 2680 if (strncmp("Disable", str, len) == 0)
2681 board.altpin = 0;
2682 else if (strncmp("Enable", str, len) == 0)
2683 board.altpin = 1;
2684 else {
2685 printk(KERN_ERR "epca_setup: Invalid altpin %s\n", str);
2686 invalid_lilo_config = 1;
2687 setup_error_code |= INVALID_ALTPIN;
2688 return;
2689 }
2690 last = index;
2691 break;
2943 2692
2944 case 6: 2693 case 4:
2945 t2 = str; 2694 t2 = str;
2946 while (isxdigit(*t2)) 2695 while (isdigit(*t2))
2947 t2++; 2696 t2++;
2948 2697
2949 if (*t2) { 2698 if (*t2) {
2950 printk(KERN_ERR "epca_setup: Invalid memory base %s\n",str); 2699 printk(KERN_ERR "epca_setup: Invalid port count %s\n", str);
2951 invalid_lilo_config = 1; 2700 invalid_lilo_config = 1;
2952 setup_error_code |= INVALID_MEM_BASE; 2701 setup_error_code |= INVALID_NUM_PORTS;
2953 return; 2702 return;
2954 } 2703 }
2955 board.membase = simple_strtoul(str, NULL, 16); 2704
2956 last = index; 2705 /*
2957 break; 2706 * There is not a man page for simple_strtoul but the
2958 default: 2707 * code can be found in vsprintf.c. The first argument
2959 printk(KERN_ERR "epca: Too many string parms\n"); 2708 * is the string to translate (To an unsigned long
2709 * obviously), the second argument can be the address
2710 * of any character variable or a NULL. If a variable
2711 * is given, the end pointer of the string will be
2712 * stored in that variable; if a NULL is given the end
2713 * pointer will not be returned. The last argument is
2714 * the base to use. If a 0 is indicated, the routine
2715 * will attempt to determine the proper base by looking
2716 * at the values prefix (A '0' for octal, a 'x' for
2717 * hex, etc ... If a value is given it will use that
2718 * value as the base.
2719 */
2720 board.numports = simple_strtoul(str, NULL, 0);
2721 nbdevs += board.numports;
2722 last = index;
2723 break;
2724
2725 case 5:
2726 t2 = str;
2727 while (isxdigit(*t2))
2728 t2++;
2729
2730 if (*t2) {
2731 printk(KERN_ERR "epca_setup: Invalid i/o address %s\n", str);
2732 invalid_lilo_config = 1;
2733 setup_error_code |= INVALID_PORT_BASE;
2734 return;
2735 }
2736
2737 board.port = simple_strtoul(str, NULL, 16);
2738 last = index;
2739 break;
2740
2741 case 6:
2742 t2 = str;
2743 while (isxdigit(*t2))
2744 t2++;
2745
2746 if (*t2) {
2747 printk(KERN_ERR "epca_setup: Invalid memory base %s\n",str);
2748 invalid_lilo_config = 1;
2749 setup_error_code |= INVALID_MEM_BASE;
2960 return; 2750 return;
2751 }
2752 board.membase = simple_strtoul(str, NULL, 16);
2753 last = index;
2754 break;
2755 default:
2756 printk(KERN_ERR "epca: Too many string parms\n");
2757 return;
2961 } 2758 }
2962 str = temp; 2759 str = temp;
2963 } /* End while there is a string arg */ 2760 } /* End while there is a string arg */
@@ -2966,19 +2763,16 @@ void epca_setup(char *str, int *ints)
2966 printk(KERN_ERR "epca: Insufficient parms specified\n"); 2763 printk(KERN_ERR "epca: Insufficient parms specified\n");
2967 return; 2764 return;
2968 } 2765 }
2969 2766
2970 /* I should REALLY validate the stuff here */ 2767 /* I should REALLY validate the stuff here */
2971 /* Copies our local copy of board into boards */ 2768 /* Copies our local copy of board into boards */
2972 memcpy((void *)&boards[num_cards],(void *)&board, sizeof(board)); 2769 memcpy((void *)&boards[num_cards],(void *)&board, sizeof(board));
2973 /* Does this get called once per lilo arg are what ? */ 2770 /* Does this get called once per lilo arg are what ? */
2974 printk(KERN_INFO "PC/Xx: Added board %i, %s %i ports at 0x%4.4X base 0x%6.6X\n", 2771 printk(KERN_INFO "PC/Xx: Added board %i, %s %i ports at 0x%4.4X base 0x%6.6X\n",
2975 num_cards, board_desc[board.type], 2772 num_cards, board_desc[board.type],
2976 board.numports, (int)board.port, (unsigned int) board.membase); 2773 board.numports, (int)board.port, (unsigned int) board.membase);
2977 num_cards++; 2774 num_cards++;
2978} /* End epca_setup */ 2775}
2979
2980
2981/* ------------------------ Begin init_PCI --------------------------- */
2982 2776
2983enum epic_board_types { 2777enum epic_board_types {
2984 brd_xr = 0, 2778 brd_xr = 0,
@@ -2987,7 +2781,6 @@ enum epic_board_types {
2987 brd_xrj, 2781 brd_xrj,
2988}; 2782};
2989 2783
2990
2991/* indexed directly by epic_board_types enum */ 2784/* indexed directly by epic_board_types enum */
2992static struct { 2785static struct {
2993 unsigned char board_type; 2786 unsigned char board_type;
@@ -2999,7 +2792,7 @@ static struct {
2999 { PCIXRJ, 2, }, 2792 { PCIXRJ, 2, },
3000}; 2793};
3001 2794
3002static int __devinit epca_init_one (struct pci_dev *pdev, 2795static int __devinit epca_init_one(struct pci_dev *pdev,
3003 const struct pci_device_id *ent) 2796 const struct pci_device_id *ent)
3004{ 2797{
3005 static int board_num = -1; 2798 static int board_num = -1;
@@ -3013,7 +2806,7 @@ static int __devinit epca_init_one (struct pci_dev *pdev,
3013 board_idx = board_num + num_cards; 2806 board_idx = board_num + num_cards;
3014 if (board_idx >= MAXBOARDS) 2807 if (board_idx >= MAXBOARDS)
3015 goto err_out; 2808 goto err_out;
3016 2809
3017 addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx); 2810 addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx);
3018 if (!addr) { 2811 if (!addr) {
3019 printk (KERN_ERR PFX "PCI region #%d not available (size 0)\n", 2812 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,
3053 goto err_out_free_memregion; 2846 goto err_out_free_memregion;
3054 } 2847 }
3055 2848
3056 /* -------------------------------------------------------------- 2849 /*
3057 I don't know what the below does, but the hardware guys say 2850 * I don't know what the below does, but the hardware guys say its
3058 its required on everything except PLX (In this case XRJ). 2851 * required on everything except PLX (In this case XRJ).
3059 ---------------------------------------------------------------- */ 2852 */
3060 if (info_idx != brd_xrj) { 2853 if (info_idx != brd_xrj) {
3061 pci_write_config_byte(pdev, 0x40, 0); 2854 pci_write_config_byte(pdev, 0x40, 0);
3062 pci_write_config_byte(pdev, 0x46, 0); 2855 pci_write_config_byte(pdev, 0x46, 0);
3063 } 2856 }
3064 2857
3065 return 0; 2858 return 0;
3066 2859
3067err_out_free_memregion: 2860err_out_free_memregion:
@@ -3086,7 +2879,7 @@ static struct pci_device_id epca_pci_tbl[] = {
3086MODULE_DEVICE_TABLE(pci, epca_pci_tbl); 2879MODULE_DEVICE_TABLE(pci, epca_pci_tbl);
3087 2880
3088int __init init_PCI (void) 2881int __init init_PCI (void)
3089{ /* Begin init_PCI */ 2882{
3090 memset (&epca_driver, 0, sizeof (epca_driver)); 2883 memset (&epca_driver, 0, sizeof (epca_driver));
3091 epca_driver.name = "epca"; 2884 epca_driver.name = "epca";
3092 epca_driver.id_table = epca_pci_tbl; 2885 epca_driver.id_table = epca_pci_tbl;
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 83c1151ec7a2..8252f8668538 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -69,6 +69,8 @@ static struct task_struct *hvc_task;
69/* Picks up late kicks after list walk but before schedule() */ 69/* Picks up late kicks after list walk but before schedule() */
70static int hvc_kicked; 70static int hvc_kicked;
71 71
72static int hvc_init(void);
73
72#ifdef CONFIG_MAGIC_SYSRQ 74#ifdef CONFIG_MAGIC_SYSRQ
73static int sysrq_pressed; 75static int sysrq_pressed;
74#endif 76#endif
@@ -754,6 +756,13 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq,
754 struct hvc_struct *hp; 756 struct hvc_struct *hp;
755 int i; 757 int i;
756 758
759 /* We wait until a driver actually comes along */
760 if (!hvc_driver) {
761 int err = hvc_init();
762 if (err)
763 return ERR_PTR(err);
764 }
765
757 hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, 766 hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
758 GFP_KERNEL); 767 GFP_KERNEL);
759 if (!hp) 768 if (!hp)
@@ -829,16 +838,18 @@ int __devexit hvc_remove(struct hvc_struct *hp)
829 return 0; 838 return 0;
830} 839}
831 840
832/* Driver initialization. Follow console initialization. This is where the TTY 841/* Driver initialization: called as soon as someone uses hvc_alloc(). */
833 * interfaces start to become available. */ 842static int hvc_init(void)
834static int __init hvc_init(void)
835{ 843{
836 struct tty_driver *drv; 844 struct tty_driver *drv;
845 int err;
837 846
838 /* We need more than hvc_count adapters due to hotplug additions. */ 847 /* We need more than hvc_count adapters due to hotplug additions. */
839 drv = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS); 848 drv = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS);
840 if (!drv) 849 if (!drv) {
841 return -ENOMEM; 850 err = -ENOMEM;
851 goto out;
852 }
842 853
843 drv->owner = THIS_MODULE; 854 drv->owner = THIS_MODULE;
844 drv->driver_name = "hvc"; 855 drv->driver_name = "hvc";
@@ -854,30 +865,43 @@ static int __init hvc_init(void)
854 * added later. */ 865 * added later. */
855 hvc_task = kthread_run(khvcd, NULL, "khvcd"); 866 hvc_task = kthread_run(khvcd, NULL, "khvcd");
856 if (IS_ERR(hvc_task)) { 867 if (IS_ERR(hvc_task)) {
857 panic("Couldn't create kthread for console.\n"); 868 printk(KERN_ERR "Couldn't create kthread for console.\n");
858 put_tty_driver(drv); 869 err = PTR_ERR(hvc_task);
859 return -EIO; 870 goto put_tty;
860 } 871 }
861 872
862 if (tty_register_driver(drv)) 873 err = tty_register_driver(drv);
863 panic("Couldn't register hvc console driver\n"); 874 if (err) {
875 printk(KERN_ERR "Couldn't register hvc console driver\n");
876 goto stop_thread;
877 }
864 878
879 /* FIXME: This mb() seems completely random. Remove it. */
865 mb(); 880 mb();
866 hvc_driver = drv; 881 hvc_driver = drv;
867 return 0; 882 return 0;
883
884put_tty:
885 put_tty_driver(hvc_driver);
886stop_thread:
887 kthread_stop(hvc_task);
888 hvc_task = NULL;
889out:
890 return err;
868} 891}
869module_init(hvc_init);
870 892
871/* This isn't particularly necessary due to this being a console driver 893/* This isn't particularly necessary due to this being a console driver
872 * but it is nice to be thorough. 894 * but it is nice to be thorough.
873 */ 895 */
874static void __exit hvc_exit(void) 896static void __exit hvc_exit(void)
875{ 897{
876 kthread_stop(hvc_task); 898 if (hvc_driver) {
899 kthread_stop(hvc_task);
877 900
878 tty_unregister_driver(hvc_driver); 901 tty_unregister_driver(hvc_driver);
879 /* return tty_struct instances allocated in hvc_init(). */ 902 /* return tty_struct instances allocated in hvc_init(). */
880 put_tty_driver(hvc_driver); 903 put_tty_driver(hvc_driver);
881 unregister_console(&hvc_con_driver); 904 unregister_console(&hvc_con_driver);
905 }
882} 906}
883module_exit(hvc_exit); 907module_exit(hvc_exit);
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index bd94d5f9e62b..2124dce38f2b 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -619,11 +619,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
619 ip2config.irq[i] = pci_dev_i->irq; 619 ip2config.irq[i] = pci_dev_i->irq;
620 } else { // ann error 620 } else { // ann error
621 ip2config.addr[i] = 0; 621 ip2config.addr[i] = 0;
622 if (status == PCIBIOS_DEVICE_NOT_FOUND) { 622 printk(KERN_ERR "IP2: PCI board %d not found\n", i);
623 printk( KERN_ERR "IP2: PCI board %d not found\n", i );
624 } else {
625 printk( KERN_ERR "IP2: PCI error 0x%x \n", status );
626 }
627 } 623 }
628 } 624 }
629#else 625#else
@@ -646,10 +642,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
646 642
647 for ( i = 0; i < IP2_MAX_BOARDS; ++i ) { 643 for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
648 if ( ip2config.addr[i] ) { 644 if ( ip2config.addr[i] ) {
649 pB = kmalloc( sizeof(i2eBordStr), GFP_KERNEL); 645 pB = kzalloc(sizeof(i2eBordStr), GFP_KERNEL);
650 if ( pB != NULL ) { 646 if (pB) {
651 i2BoardPtrTable[i] = pB; 647 i2BoardPtrTable[i] = pB;
652 memset( pB, 0, sizeof(i2eBordStr) );
653 iiSetAddress( pB, ip2config.addr[i], ii2DelayTimer ); 648 iiSetAddress( pB, ip2config.addr[i], ii2DelayTimer );
654 iiReset( pB ); 649 iiReset( pB );
655 } else { 650 } else {
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 6a01dd9e43f8..8435fba73daf 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -4136,7 +4136,7 @@ static __exit void cleanup_ipmi(void)
4136 del_timer_sync(&ipmi_timer); 4136 del_timer_sync(&ipmi_timer);
4137 4137
4138#ifdef CONFIG_PROC_FS 4138#ifdef CONFIG_PROC_FS
4139 remove_proc_entry(proc_ipmi_root->name, &proc_root); 4139 remove_proc_entry(proc_ipmi_root->name, NULL);
4140#endif /* CONFIG_PROC_FS */ 4140#endif /* CONFIG_PROC_FS */
4141 4141
4142 driver_unregister(&ipmidriver); 4142 driver_unregister(&ipmidriver);
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index d95f316afb5a..212276affa1f 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -38,6 +38,7 @@
38#include <linux/kbd_kern.h> 38#include <linux/kbd_kern.h>
39#include <linux/kbd_diacr.h> 39#include <linux/kbd_diacr.h>
40#include <linux/vt_kern.h> 40#include <linux/vt_kern.h>
41#include <linux/consolemap.h>
41#include <linux/sysrq.h> 42#include <linux/sysrq.h>
42#include <linux/input.h> 43#include <linux/input.h>
43#include <linux/reboot.h> 44#include <linux/reboot.h>
@@ -403,9 +404,12 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch)
403 return d; 404 return d;
404 405
405 if (kbd->kbdmode == VC_UNICODE) 406 if (kbd->kbdmode == VC_UNICODE)
406 to_utf8(vc, conv_8bit_to_uni(d)); 407 to_utf8(vc, d);
407 else if (d < 0x100) 408 else {
408 put_queue(vc, d); 409 int c = conv_uni_to_8bit(d);
410 if (c != -1)
411 put_queue(vc, c);
412 }
409 413
410 return ch; 414 return ch;
411} 415}
@@ -417,9 +421,12 @@ static void fn_enter(struct vc_data *vc)
417{ 421{
418 if (diacr) { 422 if (diacr) {
419 if (kbd->kbdmode == VC_UNICODE) 423 if (kbd->kbdmode == VC_UNICODE)
420 to_utf8(vc, conv_8bit_to_uni(diacr)); 424 to_utf8(vc, diacr);
421 else if (diacr < 0x100) 425 else {
422 put_queue(vc, diacr); 426 int c = conv_uni_to_8bit(diacr);
427 if (c != -1)
428 put_queue(vc, c);
429 }
423 diacr = 0; 430 diacr = 0;
424 } 431 }
425 put_queue(vc, 13); 432 put_queue(vc, 13);
@@ -627,9 +634,12 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag)
627 return; 634 return;
628 } 635 }
629 if (kbd->kbdmode == VC_UNICODE) 636 if (kbd->kbdmode == VC_UNICODE)
630 to_utf8(vc, conv_8bit_to_uni(value)); 637 to_utf8(vc, value);
631 else if (value < 0x100) 638 else {
632 put_queue(vc, value); 639 int c = conv_uni_to_8bit(value);
640 if (c != -1)
641 put_queue(vc, c);
642 }
633} 643}
634 644
635/* 645/*
@@ -646,7 +656,12 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
646 656
647static void k_self(struct vc_data *vc, unsigned char value, char up_flag) 657static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
648{ 658{
649 k_unicode(vc, value, up_flag); 659 unsigned int uni;
660 if (kbd->kbdmode == VC_UNICODE)
661 uni = value;
662 else
663 uni = conv_8bit_to_uni(value);
664 k_unicode(vc, uni, up_flag);
650} 665}
651 666
652static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) 667static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag)
@@ -1366,7 +1381,7 @@ int __init kbd_init(void)
1366 kbd_table[i].lockstate = KBD_DEFLOCK; 1381 kbd_table[i].lockstate = KBD_DEFLOCK;
1367 kbd_table[i].slockstate = 0; 1382 kbd_table[i].slockstate = 0;
1368 kbd_table[i].modeflags = KBD_DEFMODE; 1383 kbd_table[i].modeflags = KBD_DEFMODE;
1369 kbd_table[i].kbdmode = VC_XLATE; 1384 kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
1370 } 1385 }
1371 1386
1372 error = input_register_handler(&kbd_handler); 1387 error = input_register_handler(&kbd_handler);
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index c59e2a0996cc..81674d7c56c7 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -144,7 +144,7 @@ static unsigned int lp_count = 0;
144static struct class *lp_class; 144static struct class *lp_class;
145 145
146#ifdef CONFIG_LP_CONSOLE 146#ifdef CONFIG_LP_CONSOLE
147static struct parport *console_registered; // initially NULL 147static struct parport *console_registered;
148#endif /* CONFIG_LP_CONSOLE */ 148#endif /* CONFIG_LP_CONSOLE */
149 149
150#undef LP_DEBUG 150#undef LP_DEBUG
@@ -749,8 +749,8 @@ static struct console lpcons = {
749/* --- initialisation code ------------------------------------- */ 749/* --- initialisation code ------------------------------------- */
750 750
751static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC }; 751static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC };
752static char *parport[LP_NO] = { NULL, }; 752static char *parport[LP_NO];
753static int reset = 0; 753static int reset;
754 754
755module_param_array(parport, charp, NULL, 0); 755module_param_array(parport, charp, NULL, 0);
756module_param(reset, bool, 0); 756module_param(reset, bool, 0);
@@ -758,10 +758,10 @@ module_param(reset, bool, 0);
758#ifndef MODULE 758#ifndef MODULE
759static int __init lp_setup (char *str) 759static int __init lp_setup (char *str)
760{ 760{
761 static int parport_ptr; // initially zero 761 static int parport_ptr;
762 int x; 762 int x;
763 763
764 if (get_option (&str, &x)) { 764 if (get_option(&str, &x)) {
765 if (x == 0) { 765 if (x == 0) {
766 /* disable driver on "lp=" or "lp=0" */ 766 /* disable driver on "lp=" or "lp=0" */
767 parport_nr[0] = LP_PARPORT_OFF; 767 parport_nr[0] = LP_PARPORT_OFF;
@@ -807,7 +807,7 @@ static int lp_register(int nr, struct parport *port)
807#ifdef CONFIG_LP_CONSOLE 807#ifdef CONFIG_LP_CONSOLE
808 if (!nr) { 808 if (!nr) {
809 if (port->modes & PARPORT_MODE_SAFEININT) { 809 if (port->modes & PARPORT_MODE_SAFEININT) {
810 register_console (&lpcons); 810 register_console(&lpcons);
811 console_registered = port; 811 console_registered = port;
812 printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP); 812 printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP);
813 } else 813 } else
@@ -823,8 +823,7 @@ static void lp_attach (struct parport *port)
823{ 823{
824 unsigned int i; 824 unsigned int i;
825 825
826 switch (parport_nr[0]) 826 switch (parport_nr[0]) {
827 {
828 case LP_PARPORT_UNSPEC: 827 case LP_PARPORT_UNSPEC:
829 case LP_PARPORT_AUTO: 828 case LP_PARPORT_AUTO:
830 if (parport_nr[0] == LP_PARPORT_AUTO && 829 if (parport_nr[0] == LP_PARPORT_AUTO &&
@@ -855,7 +854,7 @@ static void lp_detach (struct parport *port)
855 /* Write this some day. */ 854 /* Write this some day. */
856#ifdef CONFIG_LP_CONSOLE 855#ifdef CONFIG_LP_CONSOLE
857 if (console_registered == port) { 856 if (console_registered == port) {
858 unregister_console (&lpcons); 857 unregister_console(&lpcons);
859 console_registered = NULL; 858 console_registered = NULL;
860 } 859 }
861#endif /* CONFIG_LP_CONSOLE */ 860#endif /* CONFIG_LP_CONSOLE */
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c
index 7ee5d9444926..3c5802ae1716 100644
--- a/drivers/char/mbcs.c
+++ b/drivers/char/mbcs.c
@@ -22,7 +22,6 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/fs.h>
26#include <linux/uio.h> 25#include <linux/uio.h>
27#include <asm/io.h> 26#include <asm/io.h>
28#include <asm/uaccess.h> 27#include <asm/uaccess.h>
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 64551ab6be03..0e937f64a789 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -893,6 +893,11 @@ static struct class *mem_class;
893static int __init chr_dev_init(void) 893static int __init chr_dev_init(void)
894{ 894{
895 int i; 895 int i;
896 int err;
897
898 err = bdi_init(&zero_bdi);
899 if (err)
900 return err;
896 901
897 if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) 902 if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
898 printk("unable to get major %d for memory devs\n", MEM_MAJOR); 903 printk("unable to get major %d for memory devs\n", MEM_MAJOR);
diff --git a/drivers/char/mxser.h b/drivers/char/mxser.h
index 9fe28497eae9..1f4aa45ec004 100644
--- a/drivers/char/mxser.h
+++ b/drivers/char/mxser.h
@@ -30,8 +30,7 @@
30 30
31#define TTY_THRESHOLD_THROTTLE 128 31#define TTY_THRESHOLD_THROTTLE 128
32 32
33#define LO_WATER (TTY_FLIPBUF_SIZE) 33#define HI_WATER 768
34#define HI_WATER (TTY_FLIPBUF_SIZE*2*3/4)
35 34
36// added by James. 03-11-2004. 35// added by James. 03-11-2004.
37#define MOXA_SDS_GETICOUNTER (MOXA + 68) 36#define MOXA_SDS_GETICOUNTER (MOXA + 68)
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index e8332f305d72..82bcfb9c839a 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -229,7 +229,7 @@ static void n_hdlc_release(struct n_hdlc *n_hdlc)
229 wake_up_interruptible (&tty->read_wait); 229 wake_up_interruptible (&tty->read_wait);
230 wake_up_interruptible (&tty->write_wait); 230 wake_up_interruptible (&tty->write_wait);
231 231
232 if (tty != NULL && tty->disc_data == n_hdlc) 232 if (tty->disc_data == n_hdlc)
233 tty->disc_data = NULL; /* Break the tty->n_hdlc link */ 233 tty->disc_data = NULL; /* Break the tty->n_hdlc link */
234 234
235 /* Release transmit and receive buffers */ 235 /* Release transmit and receive buffers */
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 84ac64fc48a1..efe2f5c55b91 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -66,7 +66,6 @@
66#include <linux/poll.h> 66#include <linux/poll.h>
67#include <linux/major.h> 67#include <linux/major.h>
68#include <linux/ppdev.h> 68#include <linux/ppdev.h>
69#include <linux/device.h>
70#include <asm/uaccess.h> 69#include <asm/uaccess.h>
71 70
72#define PP_VERSION "ppdev: user-space parallel port driver" 71#define PP_VERSION "ppdev: user-space parallel port driver"
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index fdc256b380b8..905d1f51a7bf 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -81,13 +81,9 @@
81#include <linux/mm.h> 81#include <linux/mm.h>
82#include <linux/slab.h> 82#include <linux/slab.h>
83#include <linux/delay.h> 83#include <linux/delay.h>
84
85#include <linux/netdevice.h> 84#include <linux/netdevice.h>
86
87#include <linux/vmalloc.h> 85#include <linux/vmalloc.h>
88#include <linux/init.h> 86#include <linux/init.h>
89
90#include <linux/delay.h>
91#include <linux/ioctl.h> 87#include <linux/ioctl.h>
92 88
93#include <asm/system.h> 89#include <asm/system.h>
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 39cc318011ea..78d14935f2b8 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -36,6 +36,7 @@
36#include <linux/kexec.h> 36#include <linux/kexec.h>
37#include <linux/irq.h> 37#include <linux/irq.h>
38#include <linux/hrtimer.h> 38#include <linux/hrtimer.h>
39#include <linux/oom.h>
39 40
40#include <asm/ptrace.h> 41#include <asm/ptrace.h>
41#include <asm/irq_regs.h> 42#include <asm/irq_regs.h>
@@ -107,12 +108,12 @@ static void sysrq_handle_unraw(int key, struct tty_struct *tty)
107 struct kbd_struct *kbd = &kbd_table[fg_console]; 108 struct kbd_struct *kbd = &kbd_table[fg_console];
108 109
109 if (kbd) 110 if (kbd)
110 kbd->kbdmode = VC_XLATE; 111 kbd->kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
111} 112}
112static struct sysrq_key_op sysrq_unraw_op = { 113static struct sysrq_key_op sysrq_unraw_op = {
113 .handler = sysrq_handle_unraw, 114 .handler = sysrq_handle_unraw,
114 .help_msg = "unRaw", 115 .help_msg = "unRaw",
115 .action_msg = "Keyboard mode set to XLATE", 116 .action_msg = "Keyboard mode set to system default",
116 .enable_mask = SYSRQ_ENABLE_KEYBOARD, 117 .enable_mask = SYSRQ_ENABLE_KEYBOARD,
117}; 118};
118#else 119#else
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 23fa18a6654c..a8e808461377 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -435,17 +435,12 @@ module_param(interrupts, bool, 0444);
435MODULE_PARM_DESC(interrupts, "Enable interrupts"); 435MODULE_PARM_DESC(interrupts, "Enable interrupts");
436 436
437static int tpm_tis_init(struct device *dev, resource_size_t start, 437static int tpm_tis_init(struct device *dev, resource_size_t start,
438 resource_size_t len) 438 resource_size_t len, unsigned int irq)
439{ 439{
440 u32 vendor, intfcaps, intmask; 440 u32 vendor, intfcaps, intmask;
441 int rc, i; 441 int rc, i;
442 struct tpm_chip *chip; 442 struct tpm_chip *chip;
443 443
444 if (!start)
445 start = TIS_MEM_BASE;
446 if (!len)
447 len = TIS_MEM_LEN;
448
449 if (!(chip = tpm_register_hardware(dev, &tpm_tis))) 444 if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
450 return -ENODEV; 445 return -ENODEV;
451 446
@@ -512,7 +507,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
512 iowrite32(intmask, 507 iowrite32(intmask,
513 chip->vendor.iobase + 508 chip->vendor.iobase +
514 TPM_INT_ENABLE(chip->vendor.locality)); 509 TPM_INT_ENABLE(chip->vendor.locality));
515 if (interrupts) { 510 if (interrupts)
511 chip->vendor.irq = irq;
512 if (interrupts && !chip->vendor.irq) {
516 chip->vendor.irq = 513 chip->vendor.irq =
517 ioread8(chip->vendor.iobase + 514 ioread8(chip->vendor.iobase +
518 TPM_INT_VECTOR(chip->vendor.locality)); 515 TPM_INT_VECTOR(chip->vendor.locality));
@@ -597,10 +594,17 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
597 const struct pnp_device_id *pnp_id) 594 const struct pnp_device_id *pnp_id)
598{ 595{
599 resource_size_t start, len; 596 resource_size_t start, len;
597 unsigned int irq = 0;
598
600 start = pnp_mem_start(pnp_dev, 0); 599 start = pnp_mem_start(pnp_dev, 0);
601 len = pnp_mem_len(pnp_dev, 0); 600 len = pnp_mem_len(pnp_dev, 0);
602 601
603 return tpm_tis_init(&pnp_dev->dev, start, len); 602 if (pnp_irq_valid(pnp_dev, 0))
603 irq = pnp_irq(pnp_dev, 0);
604 else
605 interrupts = 0;
606
607 return tpm_tis_init(&pnp_dev->dev, start, len, irq);
604} 608}
605 609
606static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) 610static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
@@ -660,7 +664,7 @@ static int __init init_tis(void)
660 return rc; 664 return rc;
661 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) 665 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
662 return PTR_ERR(pdev); 666 return PTR_ERR(pdev);
663 if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) { 667 if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
664 platform_device_unregister(pdev); 668 platform_device_unregister(pdev);
665 driver_unregister(&tis_drv); 669 driver_unregister(&tis_drv);
666 } 670 }
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 3ee73cf64bd2..745d552620bf 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -206,8 +206,6 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
206 206
207EXPORT_SYMBOL(tty_termios_input_baud_rate); 207EXPORT_SYMBOL(tty_termios_input_baud_rate);
208 208
209#ifdef BOTHER
210
211/** 209/**
212 * tty_termios_encode_baud_rate 210 * tty_termios_encode_baud_rate
213 * @termios: ktermios structure holding user requested state 211 * @termios: ktermios structure holding user requested state
@@ -225,6 +223,9 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate);
225 * 223 *
226 * Locking: Caller should hold termios lock. This is already held 224 * Locking: Caller should hold termios lock. This is already held
227 * when calling this function from the driver termios handler. 225 * when calling this function from the driver termios handler.
226 *
227 * The ifdefs deal with platforms whose owners have yet to update them
228 * and will all go away once this is done.
228 */ 229 */
229 230
230void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) 231void 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
234 int iclose = ibaud/50, oclose = obaud/50; 235 int iclose = ibaud/50, oclose = obaud/50;
235 int ibinput = 0; 236 int ibinput = 0;
236 237
238 if (obaud == 0) /* CD dropped */
239 ibaud = 0; /* Clear ibaud to be sure */
240
237 termios->c_ispeed = ibaud; 241 termios->c_ispeed = ibaud;
238 termios->c_ospeed = obaud; 242 termios->c_ospeed = obaud;
239 243
244#ifdef BOTHER
240 /* If the user asked for a precise weird speed give a precise weird 245 /* If the user asked for a precise weird speed give a precise weird
241 answer. If they asked for a Bfoo speed they many have problems 246 answer. If they asked for a Bfoo speed they many have problems
242 digesting non-exact replies so fuzz a bit */ 247 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
247 iclose = 0; 252 iclose = 0;
248 if ((termios->c_cflag >> IBSHIFT) & CBAUD) 253 if ((termios->c_cflag >> IBSHIFT) & CBAUD)
249 ibinput = 1; /* An input speed was specified */ 254 ibinput = 1; /* An input speed was specified */
250 255#endif
251 termios->c_cflag &= ~CBAUD; 256 termios->c_cflag &= ~CBAUD;
252 257
258 /*
259 * Our goal is to find a close match to the standard baud rate
260 * returned. Walk the baud rate table and if we get a very close
261 * match then report back the speed as a POSIX Bxxxx value by
262 * preference
263 */
264
253 do { 265 do {
254 if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { 266 if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) {
255 termios->c_cflag |= baud_bits[i]; 267 termios->c_cflag |= baud_bits[i];
256 ofound = i; 268 ofound = i;
257 } 269 }
258 if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { 270 if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) {
259 /* For the case input == output don't set IBAUD bits if the user didn't do so */ 271 if (ofound == i && !ibinput)
260 if (ofound != i || ibinput) 272 ifound = i;
273#ifdef IBSHIFT
274 else {
275 ifound = i;
261 termios->c_cflag |= (baud_bits[i] << IBSHIFT); 276 termios->c_cflag |= (baud_bits[i] << IBSHIFT);
262 ifound = i; 277 }
278#endif
263 } 279 }
264 } while (++i < n_baud_table); 280 } while (++i < n_baud_table);
281
282 /*
283 * If we found no match then use BOTHER if provided or warn
284 * the user their platform maintainer needs to wake up if not.
285 */
286#ifdef BOTHER
265 if (ofound == -1) 287 if (ofound == -1)
266 termios->c_cflag |= BOTHER; 288 termios->c_cflag |= BOTHER;
267 /* Set exact input bits only if the input and output differ or the 289 /* Set exact input bits only if the input and output differ or the
268 user already did */ 290 user already did */
269 if (ifound == -1 && (ibaud != obaud || ibinput)) 291 if (ifound == -1 && (ibaud != obaud || ibinput))
270 termios->c_cflag |= (BOTHER << IBSHIFT); 292 termios->c_cflag |= (BOTHER << IBSHIFT);
293#else
294 if (ifound == -1 || ofound == -1) {
295 static int warned;
296 if (!warned++)
297 printk(KERN_WARNING "tty: Unable to return correct "
298 "speed data as your architecture needs updating.\n");
299 }
300#endif
271} 301}
272
273EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); 302EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate);
274 303
275#endif 304void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud)
305{
306 tty_termios_encode_baud_rate(tty->termios, ibaud, obaud);
307}
308EXPORT_SYMBOL_GPL(tty_encode_baud_rate);
276 309
277/** 310/**
278 * tty_get_baud_rate - get tty bit rates 311 * tty_get_baud_rate - get tty bit rates
@@ -304,6 +337,29 @@ speed_t tty_get_baud_rate(struct tty_struct *tty)
304EXPORT_SYMBOL(tty_get_baud_rate); 337EXPORT_SYMBOL(tty_get_baud_rate);
305 338
306/** 339/**
340 * tty_termios_copy_hw - copy hardware settings
341 * @new: New termios
342 * @old: Old termios
343 *
344 * Propogate the hardware specific terminal setting bits from
345 * the old termios structure to the new one. This is used in cases
346 * where the hardware does not support reconfiguration or as a helper
347 * in some cases where only minimal reconfiguration is supported
348 */
349
350void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old)
351{
352 /* The bits a dumb device handles in software. Smart devices need
353 to always provide a set_termios method */
354 new->c_cflag &= HUPCL | CREAD | CLOCAL;
355 new->c_cflag |= old->c_cflag & ~(HUPCL | CREAD | CLOCAL);
356 new->c_ispeed = old->c_ispeed;
357 new->c_ospeed = old->c_ospeed;
358}
359
360EXPORT_SYMBOL(tty_termios_copy_hw);
361
362/**
307 * change_termios - update termios values 363 * change_termios - update termios values
308 * @tty: tty to update 364 * @tty: tty to update
309 * @new_termios: desired new value 365 * @new_termios: desired new value
@@ -340,13 +396,12 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio
340 tty->erasing = 0; 396 tty->erasing = 0;
341 } 397 }
342 398
343 399 /* This bit should be in the ldisc code */
344 if (canon_change && !L_ICANON(tty) && tty->read_cnt) 400 if (canon_change && !L_ICANON(tty) && tty->read_cnt)
345 /* Get characters left over from canonical mode. */ 401 /* Get characters left over from canonical mode. */
346 wake_up_interruptible(&tty->read_wait); 402 wake_up_interruptible(&tty->read_wait);
347 403
348 /* See if packet mode change of state. */ 404 /* See if packet mode change of state. */
349
350 if (tty->link && tty->link->packet) { 405 if (tty->link && tty->link->packet) {
351 int old_flow = ((old_termios.c_iflag & IXON) && 406 int old_flow = ((old_termios.c_iflag & IXON) &&
352 (old_termios.c_cc[VSTOP] == '\023') && 407 (old_termios.c_cc[VSTOP] == '\023') &&
@@ -366,6 +421,8 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio
366 421
367 if (tty->driver->set_termios) 422 if (tty->driver->set_termios)
368 (*tty->driver->set_termios)(tty, &old_termios); 423 (*tty->driver->set_termios)(tty, &old_termios);
424 else
425 tty_termios_copy_hw(tty->termios, &old_termios);
369 426
370 ld = tty_ldisc_ref(tty); 427 ld = tty_ldisc_ref(tty);
371 if (ld != NULL) { 428 if (ld != NULL) {
@@ -440,6 +497,11 @@ static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
440 } 497 }
441 498
442 change_termios(tty, &tmp_termios); 499 change_termios(tty, &tmp_termios);
500
501 /* FIXME: Arguably if tmp_termios == tty->termios AND the
502 actual requested termios was not tmp_termios then we may
503 want to return an error as no user requested change has
504 succeeded */
443 return 0; 505 return 0;
444} 506}
445 507
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0d56f8fc105c..645ad9808982 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -158,7 +158,11 @@ static void blank_screen_t(unsigned long dummy);
158static void set_palette(struct vc_data *vc); 158static void set_palette(struct vc_data *vc);
159 159
160static int printable; /* Is console ready for printing? */ 160static int printable; /* Is console ready for printing? */
161static int default_utf8; 161#ifdef CONFIG_VT_UNICODE
162int default_utf8 = 1;
163#else
164int default_utf8;
165#endif
162module_param(default_utf8, int, S_IRUGO | S_IWUSR); 166module_param(default_utf8, int, S_IRUGO | S_IWUSR);
163 167
164/* 168/*
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index f69a8258095c..e6f89e8b9258 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -23,6 +23,7 @@
23#include <linux/major.h> 23#include <linux/major.h>
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/consolemap.h>
26#include <linux/signal.h> 27#include <linux/signal.h>
27#include <linux/timex.h> 28#include <linux/timex.h>
28 29
@@ -582,10 +583,27 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
582 case KDGKBDIACR: 583 case KDGKBDIACR:
583 { 584 {
584 struct kbdiacrs __user *a = up; 585 struct kbdiacrs __user *a = up;
586 struct kbdiacr diacr;
587 int i;
585 588
586 if (put_user(accent_table_size, &a->kb_cnt)) 589 if (put_user(accent_table_size, &a->kb_cnt))
587 return -EFAULT; 590 return -EFAULT;
588 if (copy_to_user(a->kbdiacr, accent_table, accent_table_size*sizeof(struct kbdiacr))) 591 for (i = 0; i < accent_table_size; i++) {
592 diacr.diacr = conv_uni_to_8bit(accent_table[i].diacr);
593 diacr.base = conv_uni_to_8bit(accent_table[i].base);
594 diacr.result = conv_uni_to_8bit(accent_table[i].result);
595 if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
596 return -EFAULT;
597 }
598 return 0;
599 }
600 case KDGKBDIACRUC:
601 {
602 struct kbdiacrsuc __user *a = up;
603
604 if (put_user(accent_table_size, &a->kb_cnt))
605 return -EFAULT;
606 if (copy_to_user(a->kbdiacruc, accent_table, accent_table_size*sizeof(struct kbdiacruc)))
589 return -EFAULT; 607 return -EFAULT;
590 return 0; 608 return 0;
591 } 609 }
@@ -593,6 +611,30 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
593 case KDSKBDIACR: 611 case KDSKBDIACR:
594 { 612 {
595 struct kbdiacrs __user *a = up; 613 struct kbdiacrs __user *a = up;
614 struct kbdiacr diacr;
615 unsigned int ct;
616 int i;
617
618 if (!perm)
619 return -EPERM;
620 if (get_user(ct,&a->kb_cnt))
621 return -EFAULT;
622 if (ct >= MAX_DIACR)
623 return -EINVAL;
624 accent_table_size = ct;
625 for (i = 0; i < ct; i++) {
626 if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr)))
627 return -EFAULT;
628 accent_table[i].diacr = conv_8bit_to_uni(diacr.diacr);
629 accent_table[i].base = conv_8bit_to_uni(diacr.base);
630 accent_table[i].result = conv_8bit_to_uni(diacr.result);
631 }
632 return 0;
633 }
634
635 case KDSKBDIACRUC:
636 {
637 struct kbdiacrsuc __user *a = up;
596 unsigned int ct; 638 unsigned int ct;
597 639
598 if (!perm) 640 if (!perm)
@@ -602,7 +644,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
602 if (ct >= MAX_DIACR) 644 if (ct >= MAX_DIACR)
603 return -EINVAL; 645 return -EINVAL;
604 accent_table_size = ct; 646 accent_table_size = ct;
605 if (copy_from_user(accent_table, a->kbdiacr, ct*sizeof(struct kbdiacr))) 647 if (copy_from_user(accent_table, a->kbdiacruc, ct*sizeof(struct kbdiacruc)))
606 return -EFAULT; 648 return -EFAULT;
607 return 0; 649 return 0;
608 } 650 }
@@ -1083,7 +1125,7 @@ int vt_waitactive(int vt)
1083void reset_vc(struct vc_data *vc) 1125void reset_vc(struct vc_data *vc)
1084{ 1126{
1085 vc->vc_mode = KD_TEXT; 1127 vc->vc_mode = KD_TEXT;
1086 kbd_table[vc->vc_num].kbdmode = VC_XLATE; 1128 kbd_table[vc->vc_num].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
1087 vc->vt_mode.mode = VT_AUTO; 1129 vc->vt_mode.mode = VT_AUTO;
1088 vc->vt_mode.waitv = 0; 1130 vc->vt_mode.waitv = 0;
1089 vc->vt_mode.relsig = 0; 1131 vc->vt_mode.relsig = 0;
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 5a1d426744d6..e5c62b75f36f 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -1446,21 +1446,20 @@ static struct platform_driver iop_adma_driver = {
1446 1446
1447static int __init iop_adma_init (void) 1447static int __init iop_adma_init (void)
1448{ 1448{
1449 /* it's currently unsafe to unload this module */
1450 /* if forced, worst case is that rmmod hangs */
1451 __unsafe(THIS_MODULE);
1452
1453 return platform_driver_register(&iop_adma_driver); 1449 return platform_driver_register(&iop_adma_driver);
1454} 1450}
1455 1451
1452/* it's currently unsafe to unload this module */
1453#if 0
1456static void __exit iop_adma_exit (void) 1454static void __exit iop_adma_exit (void)
1457{ 1455{
1458 platform_driver_unregister(&iop_adma_driver); 1456 platform_driver_unregister(&iop_adma_driver);
1459 return; 1457 return;
1460} 1458}
1459module_exit(iop_adma_exit);
1460#endif
1461 1461
1462module_init(iop_adma_init); 1462module_init(iop_adma_init);
1463module_exit(iop_adma_exit);
1464 1463
1465MODULE_AUTHOR("Intel Corporation"); 1464MODULE_AUTHOR("Intel Corporation");
1466MODULE_DESCRIPTION("IOP ADMA Engine Driver"); 1465MODULE_DESCRIPTION("IOP ADMA Engine Driver");
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index d9c92c5e0077..66436bae11ac 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/i2c/chips/menelaus.c
@@ -49,8 +49,6 @@
49 49
50#define DRIVER_NAME "menelaus" 50#define DRIVER_NAME "menelaus"
51 51
52#define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ": ", ## arg);
53
54#define MENELAUS_I2C_ADDRESS 0x72 52#define MENELAUS_I2C_ADDRESS 0x72
55 53
56#define MENELAUS_REV 0x01 54#define MENELAUS_REV 0x01
@@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value)
155 int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value); 153 int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
156 154
157 if (val < 0) { 155 if (val < 0) {
158 pr_err("write error"); 156 pr_err(DRIVER_NAME ": write error");
159 return val; 157 return val;
160 } 158 }
161 159
@@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg)
167 int val = i2c_smbus_read_byte_data(the_menelaus->client, reg); 165 int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
168 166
169 if (val < 0) 167 if (val < 0)
170 pr_err("read error"); 168 pr_err(DRIVER_NAME ": read error");
171 169
172 return val; 170 return val;
173} 171}
@@ -1177,7 +1175,7 @@ static int menelaus_probe(struct i2c_client *client)
1177 /* If a true probe check the device */ 1175 /* If a true probe check the device */
1178 rev = menelaus_read_reg(MENELAUS_REV); 1176 rev = menelaus_read_reg(MENELAUS_REV);
1179 if (rev < 0) { 1177 if (rev < 0) {
1180 pr_err("device not found"); 1178 pr_err(DRIVER_NAME ": device not found");
1181 err = -ENODEV; 1179 err = -ENODEV;
1182 goto fail1; 1180 goto fail1;
1183 } 1181 }
@@ -1258,7 +1256,7 @@ static int __init menelaus_init(void)
1258 1256
1259 res = i2c_add_driver(&menelaus_i2c_driver); 1257 res = i2c_add_driver(&menelaus_i2c_driver);
1260 if (res < 0) { 1258 if (res < 0) {
1261 pr_err("driver registration failed\n"); 1259 pr_err(DRIVER_NAME ": driver registration failed\n");
1262 return res; 1260 return res;
1263 } 1261 }
1264 1262
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index ee1c6d05c3d3..4a579c840301 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -893,7 +893,9 @@ static __init char *lguest_memory_setup(void)
893 893
894 /* The Linux bootloader header contains an "e820" memory map: the 894 /* The Linux bootloader header contains an "e820" memory map: the
895 * Launcher populated the first entry with our memory limit. */ 895 * Launcher populated the first entry with our memory limit. */
896 add_memory_region(E820_MAP->addr, E820_MAP->size, E820_MAP->type); 896 add_memory_region(boot_params.e820_map[0].addr,
897 boot_params.e820_map[0].size,
898 boot_params.e820_map[0].type);
897 899
898 /* This string is for the boot messages. */ 900 /* This string is for the boot messages. */
899 return "LGUEST"; 901 return "LGUEST";
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0dc563d76b39..c059ae6f37e5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page)
2714{ 2714{
2715 char *type = "idle"; 2715 char *type = "idle";
2716 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || 2716 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
2717 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) { 2717 (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) {
2718 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) 2718 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
2719 type = "reshape"; 2719 type = "reshape";
2720 else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { 2720 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)
2833static struct md_sysfs_entry md_sync_max = 2833static struct md_sysfs_entry md_sync_max =
2834__ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); 2834__ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
2835 2835
2836static ssize_t
2837degraded_show(mddev_t *mddev, char *page)
2838{
2839 return sprintf(page, "%d\n", mddev->degraded);
2840}
2841static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
2836 2842
2837static ssize_t 2843static ssize_t
2838sync_speed_show(mddev_t *mddev, char *page) 2844sync_speed_show(mddev_t *mddev, char *page)
@@ -2976,6 +2982,7 @@ static struct attribute *md_redundancy_attrs[] = {
2976 &md_suspend_lo.attr, 2982 &md_suspend_lo.attr,
2977 &md_suspend_hi.attr, 2983 &md_suspend_hi.attr,
2978 &md_bitmap.attr, 2984 &md_bitmap.attr,
2985 &md_degraded.attr,
2979 NULL, 2986 NULL,
2980}; 2987};
2981static struct attribute_group md_redundancy_group = { 2988static struct attribute_group md_redundancy_group = {
@@ -5770,26 +5777,47 @@ static int __init md_init(void)
5770 * Searches all registered partitions for autorun RAID arrays 5777 * Searches all registered partitions for autorun RAID arrays
5771 * at boot time. 5778 * at boot time.
5772 */ 5779 */
5773static dev_t detected_devices[128]; 5780
5774static int dev_cnt; 5781static LIST_HEAD(all_detected_devices);
5782struct detected_devices_node {
5783 struct list_head list;
5784 dev_t dev;
5785};
5775 5786
5776void md_autodetect_dev(dev_t dev) 5787void md_autodetect_dev(dev_t dev)
5777{ 5788{
5778 if (dev_cnt >= 0 && dev_cnt < 127) 5789 struct detected_devices_node *node_detected_dev;
5779 detected_devices[dev_cnt++] = dev; 5790
5791 node_detected_dev = kzalloc(sizeof(*node_detected_dev), GFP_KERNEL);
5792 if (node_detected_dev) {
5793 node_detected_dev->dev = dev;
5794 list_add_tail(&node_detected_dev->list, &all_detected_devices);
5795 } else {
5796 printk(KERN_CRIT "md: md_autodetect_dev: kzalloc failed"
5797 ", skipping dev(%d,%d)\n", MAJOR(dev), MINOR(dev));
5798 }
5780} 5799}
5781 5800
5782 5801
5783static void autostart_arrays(int part) 5802static void autostart_arrays(int part)
5784{ 5803{
5785 mdk_rdev_t *rdev; 5804 mdk_rdev_t *rdev;
5786 int i; 5805 struct detected_devices_node *node_detected_dev;
5806 dev_t dev;
5807 int i_scanned, i_passed;
5787 5808
5788 printk(KERN_INFO "md: Autodetecting RAID arrays.\n"); 5809 i_scanned = 0;
5810 i_passed = 0;
5789 5811
5790 for (i = 0; i < dev_cnt; i++) { 5812 printk(KERN_INFO "md: Autodetecting RAID arrays.\n");
5791 dev_t dev = detected_devices[i];
5792 5813
5814 while (!list_empty(&all_detected_devices) && i_scanned < INT_MAX) {
5815 i_scanned++;
5816 node_detected_dev = list_entry(all_detected_devices.next,
5817 struct detected_devices_node, list);
5818 list_del(&node_detected_dev->list);
5819 dev = node_detected_dev->dev;
5820 kfree(node_detected_dev);
5793 rdev = md_import_device(dev,0, 90); 5821 rdev = md_import_device(dev,0, 90);
5794 if (IS_ERR(rdev)) 5822 if (IS_ERR(rdev))
5795 continue; 5823 continue;
@@ -5799,8 +5827,11 @@ static void autostart_arrays(int part)
5799 continue; 5827 continue;
5800 } 5828 }
5801 list_add(&rdev->same_set, &pending_raid_disks); 5829 list_add(&rdev->same_set, &pending_raid_disks);
5830 i_passed++;
5802 } 5831 }
5803 dev_cnt = 0; 5832
5833 printk(KERN_INFO "md: Scanned %d and added %d devices.\n",
5834 i_scanned, i_passed);
5804 5835
5805 autorun_devices(part); 5836 autorun_devices(part);
5806} 5837}
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index e79e1a538d44..c111105fc2dc 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -472,7 +472,7 @@ bad_map:
472 bio_io_error(bio); 472 bio_io_error(bio);
473 return 0; 473 return 0;
474} 474}
475 475
476static void raid0_status (struct seq_file *seq, mddev_t *mddev) 476static void raid0_status (struct seq_file *seq, mddev_t *mddev)
477{ 477{
478#undef MD_DEBUG 478#undef MD_DEBUG
@@ -480,18 +480,18 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
480 int j, k, h; 480 int j, k, h;
481 char b[BDEVNAME_SIZE]; 481 char b[BDEVNAME_SIZE];
482 raid0_conf_t *conf = mddev_to_conf(mddev); 482 raid0_conf_t *conf = mddev_to_conf(mddev);
483 483
484 h = 0; 484 h = 0;
485 for (j = 0; j < conf->nr_strip_zones; j++) { 485 for (j = 0; j < conf->nr_strip_zones; j++) {
486 seq_printf(seq, " z%d", j); 486 seq_printf(seq, " z%d", j);
487 if (conf->hash_table[h] == conf->strip_zone+j) 487 if (conf->hash_table[h] == conf->strip_zone+j)
488 seq_printf("(h%d)", h++); 488 seq_printf(seq, "(h%d)", h++);
489 seq_printf(seq, "=["); 489 seq_printf(seq, "=[");
490 for (k = 0; k < conf->strip_zone[j].nb_dev; k++) 490 for (k = 0; k < conf->strip_zone[j].nb_dev; k++)
491 seq_printf (seq, "%s/", bdevname( 491 seq_printf(seq, "%s/", bdevname(
492 conf->strip_zone[j].dev[k]->bdev,b)); 492 conf->strip_zone[j].dev[k]->bdev,b));
493 493
494 seq_printf (seq, "] zo=%d do=%d s=%d\n", 494 seq_printf(seq, "] zo=%d do=%d s=%d\n",
495 conf->strip_zone[j].zone_offset, 495 conf->strip_zone[j].zone_offset,
496 conf->strip_zone[j].dev_offset, 496 conf->strip_zone[j].dev_offset,
497 conf->strip_zone[j].size); 497 conf->strip_zone[j].size);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 0bcefad82413..16775a0df7f6 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1214,7 +1214,8 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1214 j = 0; 1214 j = 0;
1215 if (j >= 0) 1215 if (j >= 0)
1216 mddev->resync_mismatches += r1_bio->sectors; 1216 mddev->resync_mismatches += r1_bio->sectors;
1217 if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { 1217 if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
1218 && test_bit(BIO_UPTODATE, &sbio->bi_flags))) {
1218 sbio->bi_end_io = NULL; 1219 sbio->bi_end_io = NULL;
1219 rdev_dec_pending(conf->mirrors[i].rdev, mddev); 1220 rdev_dec_pending(conf->mirrors[i].rdev, mddev);
1220 } else { 1221 } else {
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 8c83ee3b0920..ce8f1a34ed21 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -41,8 +41,6 @@
41 41
42struct i2o_driver i2o_exec_driver; 42struct i2o_driver i2o_exec_driver;
43 43
44static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind);
45
46/* global wait list for POST WAIT */ 44/* global wait list for POST WAIT */
47static LIST_HEAD(i2o_exec_wait_list); 45static LIST_HEAD(i2o_exec_wait_list);
48 46
@@ -369,6 +367,53 @@ static int i2o_exec_remove(struct device *dev)
369 return 0; 367 return 0;
370}; 368};
371 369
370#ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES
371/**
372 * i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request
373 * @c: I2O controller to which the request should be send
374 * @change_ind: change indicator
375 *
376 * This function sends a LCT NOTIFY request to the I2O controller with
377 * the change indicator change_ind. If the change_ind == 0 the controller
378 * replies immediately after the request. If change_ind > 0 the reply is
379 * send after change indicator of the LCT is > change_ind.
380 */
381static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
382{
383 i2o_status_block *sb = c->status_block.virt;
384 struct device *dev;
385 struct i2o_message *msg;
386
387 mutex_lock(&c->lct_lock);
388
389 dev = &c->pdev->dev;
390
391 if (i2o_dma_realloc
392 (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL))
393 return -ENOMEM;
394
395 msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
396 if (IS_ERR(msg))
397 return PTR_ERR(msg);
398
399 msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
400 msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
401 ADAPTER_TID);
402 msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
403 msg->u.s.tcntxt = cpu_to_le32(0x00000000);
404 msg->body[0] = cpu_to_le32(0xffffffff);
405 msg->body[1] = cpu_to_le32(change_ind);
406 msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len);
407 msg->body[3] = cpu_to_le32(c->dlct.phys);
408
409 i2o_msg_post(c, msg);
410
411 mutex_unlock(&c->lct_lock);
412
413 return 0;
414}
415#endif
416
372/** 417/**
373 * i2o_exec_lct_modified - Called on LCT NOTIFY reply 418 * i2o_exec_lct_modified - Called on LCT NOTIFY reply
374 * @_work: work struct for a specific controller 419 * @_work: work struct for a specific controller
@@ -525,51 +570,6 @@ int i2o_exec_lct_get(struct i2o_controller *c)
525 return rc; 570 return rc;
526} 571}
527 572
528/**
529 * i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request
530 * @c: I2O controller to which the request should be send
531 * @change_ind: change indicator
532 *
533 * This function sends a LCT NOTIFY request to the I2O controller with
534 * the change indicator change_ind. If the change_ind == 0 the controller
535 * replies immediately after the request. If change_ind > 0 the reply is
536 * send after change indicator of the LCT is > change_ind.
537 */
538static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
539{
540 i2o_status_block *sb = c->status_block.virt;
541 struct device *dev;
542 struct i2o_message *msg;
543
544 mutex_lock(&c->lct_lock);
545
546 dev = &c->pdev->dev;
547
548 if (i2o_dma_realloc
549 (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL))
550 return -ENOMEM;
551
552 msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
553 if (IS_ERR(msg))
554 return PTR_ERR(msg);
555
556 msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
557 msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
558 ADAPTER_TID);
559 msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
560 msg->u.s.tcntxt = cpu_to_le32(0x00000000);
561 msg->body[0] = cpu_to_le32(0xffffffff);
562 msg->body[1] = cpu_to_le32(change_ind);
563 msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len);
564 msg->body[3] = cpu_to_le32(c->dlct.phys);
565
566 i2o_msg_post(c, msg);
567
568 mutex_unlock(&c->lct_lock);
569
570 return 0;
571};
572
573/* Exec OSM driver struct */ 573/* Exec OSM driver struct */
574struct i2o_driver i2o_exec_driver = { 574struct i2o_driver i2o_exec_driver = {
575 .name = OSM_NAME, 575 .name = OSM_NAME,
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 73e248fb2ff1..346c44eff95e 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -203,4 +203,16 @@ config THINKPAD_ACPI_BAY
203 If you are not sure, say Y here. 203 If you are not sure, say Y here.
204 204
205 205
206config ATMEL_SSC
207 tristate "Device driver for Atmel SSC peripheral"
208 depends on AVR32 || ARCH_AT91
209 ---help---
210 This option enables device driver support for Atmel Syncronized
211 Serial Communication peripheral (SSC).
212
213 The SSC peripheral supports a wide variety of serial frame based
214 communications, i.e. I2S, SPI, etc.
215
216 If unsure, say N.
217
206endif # MISC_DEVICES 218endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b5ce0e3dba86..a24c61475c2f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/
7obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ 7obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/
8obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 8obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
9obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o 9obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
10obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
10obj-$(CONFIG_LKDTM) += lkdtm.o 11obj-$(CONFIG_LKDTM) += lkdtm.o
11obj-$(CONFIG_TIFM_CORE) += tifm_core.o 12obj-$(CONFIG_TIFM_CORE) += tifm_core.o
12obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o 13obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
new file mode 100644
index 000000000000..058ccac700d0
--- /dev/null
+++ b/drivers/misc/atmel-ssc.c
@@ -0,0 +1,174 @@
1/*
2 * Atmel SSC driver
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/list.h>
13#include <linux/clk.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/list.h>
17#include <linux/spinlock.h>
18#include <linux/atmel-ssc.h>
19
20/* Serialize access to ssc_list and user count */
21static DEFINE_SPINLOCK(user_lock);
22static LIST_HEAD(ssc_list);
23
24struct ssc_device *ssc_request(unsigned int ssc_num)
25{
26 int ssc_valid = 0;
27 struct ssc_device *ssc;
28
29 spin_lock(&user_lock);
30 list_for_each_entry(ssc, &ssc_list, list) {
31 if (ssc->pdev->id == ssc_num) {
32 ssc_valid = 1;
33 break;
34 }
35 }
36
37 if (!ssc_valid) {
38 spin_unlock(&user_lock);
39 dev_dbg(&ssc->pdev->dev, "could not find requested device\n");
40 return ERR_PTR(-ENODEV);
41 }
42
43 if (ssc->user) {
44 spin_unlock(&user_lock);
45 dev_dbg(&ssc->pdev->dev, "module busy\n");
46 return ERR_PTR(-EBUSY);
47 }
48 ssc->user++;
49 spin_unlock(&user_lock);
50
51 clk_enable(ssc->clk);
52
53 return ssc;
54}
55EXPORT_SYMBOL(ssc_request);
56
57void ssc_free(struct ssc_device *ssc)
58{
59 spin_lock(&user_lock);
60 if (ssc->user) {
61 ssc->user--;
62 clk_disable(ssc->clk);
63 } else {
64 dev_dbg(&ssc->pdev->dev, "device already free\n");
65 }
66 spin_unlock(&user_lock);
67}
68EXPORT_SYMBOL(ssc_free);
69
70static int __init ssc_probe(struct platform_device *pdev)
71{
72 int retval = 0;
73 struct resource *regs;
74 struct ssc_device *ssc;
75
76 ssc = kzalloc(sizeof(struct ssc_device), GFP_KERNEL);
77 if (!ssc) {
78 dev_dbg(&pdev->dev, "out of memory\n");
79 retval = -ENOMEM;
80 goto out;
81 }
82
83 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
84 if (!regs) {
85 dev_dbg(&pdev->dev, "no mmio resource defined\n");
86 retval = -ENXIO;
87 goto out_free;
88 }
89
90 ssc->clk = clk_get(&pdev->dev, "pclk");
91 if (IS_ERR(ssc->clk)) {
92 dev_dbg(&pdev->dev, "no pclk clock defined\n");
93 retval = -ENXIO;
94 goto out_free;
95 }
96
97 ssc->pdev = pdev;
98 ssc->regs = ioremap(regs->start, regs->end - regs->start + 1);
99 if (!ssc->regs) {
100 dev_dbg(&pdev->dev, "ioremap failed\n");
101 retval = -EINVAL;
102 goto out_clk;
103 }
104
105 /* disable all interrupts */
106 clk_enable(ssc->clk);
107 ssc_writel(ssc->regs, IDR, ~0UL);
108 ssc_readl(ssc->regs, SR);
109 clk_disable(ssc->clk);
110
111 ssc->irq = platform_get_irq(pdev, 0);
112 if (!ssc->irq) {
113 dev_dbg(&pdev->dev, "could not get irq\n");
114 retval = -ENXIO;
115 goto out_unmap;
116 }
117
118 spin_lock(&user_lock);
119 list_add_tail(&ssc->list, &ssc_list);
120 spin_unlock(&user_lock);
121
122 platform_set_drvdata(pdev, ssc);
123
124 dev_info(&pdev->dev, "Atmel SSC device at 0x%p (irq %d)\n",
125 ssc->regs, ssc->irq);
126
127 goto out;
128
129out_unmap:
130 iounmap(ssc->regs);
131out_clk:
132 clk_put(ssc->clk);
133out_free:
134 kfree(ssc);
135out:
136 return retval;
137}
138
139static int __devexit ssc_remove(struct platform_device *pdev)
140{
141 struct ssc_device *ssc = platform_get_drvdata(pdev);
142
143 spin_lock(&user_lock);
144 iounmap(ssc->regs);
145 clk_put(ssc->clk);
146 list_del(&ssc->list);
147 kfree(ssc);
148 spin_unlock(&user_lock);
149
150 return 0;
151}
152
153static struct platform_driver ssc_driver = {
154 .remove = __devexit_p(ssc_remove),
155 .driver = {
156 .name = "ssc",
157 },
158};
159
160static int __init ssc_init(void)
161{
162 return platform_driver_probe(&ssc_driver, ssc_probe);
163}
164module_init(ssc_init);
165
166static void __exit ssc_exit(void)
167{
168 platform_driver_unregister(&ssc_driver);
169}
170module_exit(ssc_exit);
171
172MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>");
173MODULE_DESCRIPTION("SSC driver for Atmel AVR32 and AT91");
174MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 1297732f4db9..880fa3690352 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -933,8 +933,7 @@ write_error:
933 * @cache: the lock tree entry slab cache 933 * @cache: the lock tree entry slab cache
934 * @flags: constructor flags 934 * @flags: constructor flags
935 */ 935 */
936static void ltree_entry_ctor(void *obj, struct kmem_cache *cache, 936static void ltree_entry_ctor(struct kmem_cache *cache, void *obj)
937 unsigned long flags)
938{ 937{
939 struct ltree_entry *le = obj; 938 struct ltree_entry *le = obj;
940 939
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h
index a897beee7d5d..e1d05c0f47eb 100644
--- a/drivers/net/spider_net.h
+++ b/drivers/net/spider_net.h
@@ -494,7 +494,4 @@ struct spider_net_card {
494 struct spider_net_descr darray[0]; 494 struct spider_net_descr darray[0];
495}; 495};
496 496
497#define pr_err(fmt,arg...) \
498 printk(KERN_ERR fmt ,##arg)
499
500#endif 497#endif
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index f201bd673137..519b4ff79f7f 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -269,6 +269,13 @@ config AT91_CF
269 Say Y here to support the CompactFlash controller on AT91 chips. 269 Say Y here to support the CompactFlash controller on AT91 chips.
270 Or choose M to compile the driver as a module named "at91_cf". 270 Or choose M to compile the driver as a module named "at91_cf".
271 271
272config ELECTRA_CF
273 tristate "Electra CompactFlash Controller"
274 depends on PCMCIA && PPC_PASEMI
275 help
276 Say Y here to support the CompactFlash controller on the
277 PA Semi Electra eval board.
278
272config PCCARD_NONSTATIC 279config PCCARD_NONSTATIC
273 tristate 280 tristate
274 281
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index dc7a4cb5d270..6f6478ba7174 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o
37obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o 37obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o
38obj-$(CONFIG_OMAP_CF) += omap_cf.o 38obj-$(CONFIG_OMAP_CF) += omap_cf.o
39obj-$(CONFIG_AT91_CF) += at91_cf.o 39obj-$(CONFIG_AT91_CF) += at91_cf.o
40obj-$(CONFIG_ELECTRA_CF) += electra_cf.o
40 41
41sa11xx_core-y += soc_common.o sa11xx_base.o 42sa11xx_core-y += soc_common.o sa11xx_base.o
42pxa2xx_core-y += soc_common.o pxa2xx_base.o 43pxa2xx_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
index 000000000000..0a6cea1316b4
--- /dev/null
+++ b/drivers/pcmcia/electra_cf.c
@@ -0,0 +1,377 @@
1/*
2 * Copyright (C) 2007 PA Semi, Inc
3 *
4 * Maintained by: Olof Johansson <olof@lixom.net>
5 *
6 * Based on drivers/pcmcia/omap_cf.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/module.h>
24#include <linux/kernel.h>
25#include <linux/sched.h>
26#include <linux/platform_device.h>
27#include <linux/errno.h>
28#include <linux/init.h>
29#include <linux/delay.h>
30#include <linux/interrupt.h>
31#include <linux/vmalloc.h>
32
33#include <pcmcia/ss.h>
34#include <asm/of_platform.h>
35
36static const char driver_name[] = "electra-cf";
37
38struct electra_cf_socket {
39 struct pcmcia_socket socket;
40
41 struct timer_list timer;
42 unsigned present:1;
43 unsigned active:1;
44
45 struct of_device *ofdev;
46 unsigned long mem_phys;
47 void __iomem * mem_base;
48 unsigned long mem_size;
49 void __iomem * io_virt;
50 unsigned int io_base;
51 unsigned int io_size;
52 u_int irq;
53 struct resource iomem;
54 void __iomem * gpio_base;
55 int gpio_detect;
56 int gpio_vsense;
57 int gpio_3v;
58 int gpio_5v;
59};
60
61#define POLL_INTERVAL (2 * HZ)
62
63
64static int electra_cf_present(struct electra_cf_socket *cf)
65{
66 unsigned int gpio;
67
68 gpio = in_le32(cf->gpio_base+0x40);
69 return !(gpio & (1 << cf->gpio_detect));
70}
71
72static int electra_cf_ss_init(struct pcmcia_socket *s)
73{
74 return 0;
75}
76
77/* the timer is primarily to kick this socket's pccardd */
78static void electra_cf_timer(unsigned long _cf)
79{
80 struct electra_cf_socket *cf = (void *) _cf;
81 int present = electra_cf_present(cf);
82
83 if (present != cf->present) {
84 cf->present = present;
85 pcmcia_parse_events(&cf->socket, SS_DETECT);
86 }
87
88 if (cf->active)
89 mod_timer(&cf->timer, jiffies + POLL_INTERVAL);
90}
91
92static irqreturn_t electra_cf_irq(int irq, void *_cf)
93{
94 electra_cf_timer((unsigned long)_cf);
95 return IRQ_HANDLED;
96}
97
98static int electra_cf_get_status(struct pcmcia_socket *s, u_int *sp)
99{
100 struct electra_cf_socket *cf;
101
102 if (!sp)
103 return -EINVAL;
104
105 cf = container_of(s, struct electra_cf_socket, socket);
106
107 /* NOTE CF is always 3VCARD */
108 if (electra_cf_present(cf)) {
109 *sp = SS_READY | SS_DETECT | SS_POWERON | SS_3VCARD;
110
111 s->pci_irq = cf->irq;
112 } else
113 *sp = 0;
114 return 0;
115}
116
117static int electra_cf_set_socket(struct pcmcia_socket *sock,
118 struct socket_state_t *s)
119{
120 unsigned int gpio;
121 unsigned int vcc;
122 struct electra_cf_socket *cf;
123
124 cf = container_of(sock, struct electra_cf_socket, socket);
125
126 /* "reset" means no power in our case */
127 vcc = (s->flags & SS_RESET) ? 0 : s->Vcc;
128
129 switch (vcc) {
130 case 0:
131 gpio = 0;
132 break;
133 case 33:
134 gpio = (1 << cf->gpio_3v);
135 break;
136 case 5:
137 gpio = (1 << cf->gpio_5v);
138 break;
139 default:
140 return -EINVAL;
141 }
142
143 gpio |= 1 << (cf->gpio_3v + 16); /* enwr */
144 gpio |= 1 << (cf->gpio_5v + 16); /* enwr */
145 out_le32(cf->gpio_base+0x90, gpio);
146
147 pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n",
148 driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask);
149
150 return 0;
151}
152
153static int electra_cf_set_io_map(struct pcmcia_socket *s,
154 struct pccard_io_map *io)
155{
156 return 0;
157}
158
159static int electra_cf_set_mem_map(struct pcmcia_socket *s,
160 struct pccard_mem_map *map)
161{
162 struct electra_cf_socket *cf;
163
164 if (map->card_start)
165 return -EINVAL;
166 cf = container_of(s, struct electra_cf_socket, socket);
167 map->static_start = cf->mem_phys;
168 map->flags &= MAP_ACTIVE|MAP_ATTRIB;
169 if (!(map->flags & MAP_ATTRIB))
170 map->static_start += 0x800;
171 return 0;
172}
173
174static struct pccard_operations electra_cf_ops = {
175 .init = electra_cf_ss_init,
176 .get_status = electra_cf_get_status,
177 .set_socket = electra_cf_set_socket,
178 .set_io_map = electra_cf_set_io_map,
179 .set_mem_map = electra_cf_set_mem_map,
180};
181
182static int __devinit electra_cf_probe(struct of_device *ofdev,
183 const struct of_device_id *match)
184{
185 struct device *device = &ofdev->dev;
186 struct device_node *np = ofdev->node;
187 struct electra_cf_socket *cf;
188 struct resource mem, io;
189 int status;
190 const unsigned int *prop;
191 int err;
192 struct vm_struct *area;
193
194 err = of_address_to_resource(np, 0, &mem);
195 if (err)
196 return -EINVAL;
197
198 err = of_address_to_resource(np, 1, &io);
199 if (err)
200 return -EINVAL;
201
202 cf = kzalloc(sizeof *cf, GFP_KERNEL);
203 if (!cf)
204 return -ENOMEM;
205
206 setup_timer(&cf->timer, electra_cf_timer, (unsigned long)cf);
207 cf->irq = NO_IRQ;
208
209 cf->ofdev = ofdev;
210 cf->mem_phys = mem.start;
211 cf->mem_size = PAGE_ALIGN(mem.end - mem.start);
212 cf->mem_base = ioremap(cf->mem_phys, cf->mem_size);
213 cf->io_size = PAGE_ALIGN(io.end - io.start);
214
215 area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END);
216 if (area == NULL)
217 return -ENOMEM;
218
219 cf->io_virt = (void __iomem *)(area->addr);
220
221 cf->gpio_base = ioremap(0xfc103000, 0x1000);
222 dev_set_drvdata(device, cf);
223
224 if (!cf->mem_base || !cf->io_virt || !cf->gpio_base ||
225 (__ioremap_at(io.start, cf->io_virt, cf->io_size,
226 _PAGE_NO_CACHE | _PAGE_GUARDED) == NULL)) {
227 dev_err(device, "can't ioremap ranges\n");
228 status = -ENOMEM;
229 goto fail1;
230 }
231
232
233 cf->io_base = (unsigned long)cf->io_virt - VMALLOC_END;
234
235 cf->iomem.start = (unsigned long)cf->mem_base;
236 cf->iomem.end = (unsigned long)cf->mem_base + (mem.end - mem.start);
237 cf->iomem.flags = IORESOURCE_MEM;
238
239 cf->irq = irq_of_parse_and_map(np, 0);
240
241 status = request_irq(cf->irq, electra_cf_irq, IRQF_SHARED,
242 driver_name, cf);
243 if (status < 0) {
244 dev_err(device, "request_irq failed\n");
245 goto fail1;
246 }
247
248 cf->socket.pci_irq = cf->irq;
249
250 prop = of_get_property(np, "card-detect-gpio", NULL);
251 if (!prop)
252 goto fail1;
253 cf->gpio_detect = *prop;
254
255 prop = of_get_property(np, "card-vsense-gpio", NULL);
256 if (!prop)
257 goto fail1;
258 cf->gpio_vsense = *prop;
259
260 prop = of_get_property(np, "card-3v-gpio", NULL);
261 if (!prop)
262 goto fail1;
263 cf->gpio_3v = *prop;
264
265 prop = of_get_property(np, "card-5v-gpio", NULL);
266 if (!prop)
267 goto fail1;
268 cf->gpio_5v = *prop;
269
270 cf->socket.io_offset = cf->io_base;
271
272 /* reserve chip-select regions */
273 if (!request_mem_region(cf->mem_phys, cf->mem_size, driver_name)) {
274 status = -ENXIO;
275 dev_err(device, "Can't claim memory region\n");
276 goto fail1;
277 }
278
279 if (!request_region(cf->io_base, cf->io_size, driver_name)) {
280 status = -ENXIO;
281 dev_err(device, "Can't claim I/O region\n");
282 goto fail2;
283 }
284
285 cf->socket.owner = THIS_MODULE;
286 cf->socket.dev.parent = &ofdev->dev;
287 cf->socket.ops = &electra_cf_ops;
288 cf->socket.resource_ops = &pccard_static_ops;
289 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP |
290 SS_CAP_MEM_ALIGN;
291 cf->socket.map_size = 0x800;
292
293 status = pcmcia_register_socket(&cf->socket);
294 if (status < 0) {
295 dev_err(device, "pcmcia_register_socket failed\n");
296 goto fail3;
297 }
298
299 dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n",
300 cf->mem_phys, io.start, cf->irq);
301
302 cf->active = 1;
303 electra_cf_timer((unsigned long)cf);
304 return 0;
305
306fail3:
307 release_region(cf->io_base, cf->io_size);
308fail2:
309 release_mem_region(cf->mem_phys, cf->mem_size);
310fail1:
311 if (cf->irq != NO_IRQ)
312 free_irq(cf->irq, cf);
313
314 if (cf->io_virt)
315 __iounmap_at(cf->io_virt, cf->io_size);
316 if (cf->mem_base)
317 iounmap(cf->mem_base);
318 if (cf->gpio_base)
319 iounmap(cf->gpio_base);
320 device_init_wakeup(&ofdev->dev, 0);
321 kfree(cf);
322 return status;
323
324}
325
326static int __devexit electra_cf_remove(struct of_device *ofdev)
327{
328 struct device *device = &ofdev->dev;
329 struct electra_cf_socket *cf;
330
331 cf = dev_get_drvdata(device);
332
333 cf->active = 0;
334 pcmcia_unregister_socket(&cf->socket);
335 free_irq(cf->irq, cf);
336 del_timer_sync(&cf->timer);
337
338 __iounmap_at(cf->io_virt, cf->io_size);
339 iounmap(cf->mem_base);
340 iounmap(cf->gpio_base);
341 release_mem_region(cf->mem_phys, cf->mem_size);
342 release_region(cf->io_base, cf->io_size);
343
344 kfree(cf);
345
346 return 0;
347}
348
349static struct of_device_id electra_cf_match[] = {
350 {
351 .compatible = "electra-cf",
352 },
353 {},
354};
355
356static struct of_platform_driver electra_cf_driver = {
357 .name = (char *)driver_name,
358 .match_table = electra_cf_match,
359 .probe = electra_cf_probe,
360 .remove = electra_cf_remove,
361};
362
363static int __init electra_cf_init(void)
364{
365 return of_register_platform_driver(&electra_cf_driver);
366}
367module_init(electra_cf_init);
368
369static void __exit electra_cf_exit(void)
370{
371 of_unregister_platform_driver(&electra_cf_driver);
372}
373module_exit(electra_cf_exit);
374
375MODULE_LICENSE("GPL");
376MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>");
377MODULE_DESCRIPTION("PA Semi Electra CF driver");
diff --git a/drivers/pnp/Makefile b/drivers/pnp/Makefile
index a381a92fd1b6..26f5abc9c3f7 100644
--- a/drivers/pnp/Makefile
+++ b/drivers/pnp/Makefile
@@ -7,3 +7,7 @@ obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quir
7obj-$(CONFIG_PNPACPI) += pnpacpi/ 7obj-$(CONFIG_PNPACPI) += pnpacpi/
8obj-$(CONFIG_PNPBIOS) += pnpbios/ 8obj-$(CONFIG_PNPBIOS) += pnpbios/
9obj-$(CONFIG_ISAPNP) += isapnp/ 9obj-$(CONFIG_ISAPNP) += isapnp/
10
11ifeq ($(CONFIG_PNP_DEBUG),y)
12EXTRA_CFLAGS += -DDEBUG
13endif
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index 6c0440c20e31..da1c9909eb44 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -104,10 +104,6 @@ int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
104{ 104{
105 struct pnp_id *ptr; 105 struct pnp_id *ptr;
106 106
107 if (!id)
108 return -EINVAL;
109 if (!card)
110 return -EINVAL;
111 id->next = NULL; 107 id->next = NULL;
112 ptr = card->id; 108 ptr = card->id;
113 while (ptr && ptr->next) 109 while (ptr && ptr->next)
@@ -124,8 +120,6 @@ static void pnp_free_card_ids(struct pnp_card *card)
124 struct pnp_id *id; 120 struct pnp_id *id;
125 struct pnp_id *next; 121 struct pnp_id *next;
126 122
127 if (!card)
128 return;
129 id = card->id; 123 id = card->id;
130 while (id) { 124 while (id) {
131 next = id->next; 125 next = id->next;
@@ -197,42 +191,39 @@ int pnp_add_card(struct pnp_card *card)
197 int error; 191 int error;
198 struct list_head *pos, *temp; 192 struct list_head *pos, *temp;
199 193
200 if (!card || !card->protocol)
201 return -EINVAL;
202
203 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, 194 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number,
204 card->number); 195 card->number);
205 card->dev.parent = &card->protocol->dev; 196 card->dev.parent = &card->protocol->dev;
206 card->dev.bus = NULL; 197 card->dev.bus = NULL;
207 card->dev.release = &pnp_release_card; 198 card->dev.release = &pnp_release_card;
208 error = device_register(&card->dev); 199 error = device_register(&card->dev);
200 if (error) {
201 dev_err(&card->dev, "could not register (err=%d)\n", error);
202 return error;
203 }
209 204
210 if (error == 0) { 205 pnp_interface_attach_card(card);
211 pnp_interface_attach_card(card); 206 spin_lock(&pnp_lock);
212 spin_lock(&pnp_lock); 207 list_add_tail(&card->global_list, &pnp_cards);
213 list_add_tail(&card->global_list, &pnp_cards); 208 list_add_tail(&card->protocol_list, &card->protocol->cards);
214 list_add_tail(&card->protocol_list, &card->protocol->cards); 209 spin_unlock(&pnp_lock);
215 spin_unlock(&pnp_lock);
216
217 /* we wait until now to add devices in order to ensure the drivers
218 * will be able to use all of the related devices on the card
219 * without waiting any unresonable length of time */
220 list_for_each(pos, &card->devices) {
221 struct pnp_dev *dev = card_to_pnp_dev(pos);
222 __pnp_add_device(dev);
223 }
224 210
225 /* match with card drivers */ 211 /* we wait until now to add devices in order to ensure the drivers
226 list_for_each_safe(pos, temp, &pnp_card_drivers) { 212 * will be able to use all of the related devices on the card
227 struct pnp_card_driver *drv = 213 * without waiting an unreasonable length of time */
228 list_entry(pos, struct pnp_card_driver, 214 list_for_each(pos, &card->devices) {
229 global_list); 215 struct pnp_dev *dev = card_to_pnp_dev(pos);
230 card_probe(card, drv); 216 __pnp_add_device(dev);
231 } 217 }
232 } else 218
233 pnp_err("sysfs failure, card '%s' will be unavailable", 219 /* match with card drivers */
234 card->dev.bus_id); 220 list_for_each_safe(pos, temp, &pnp_card_drivers) {
235 return error; 221 struct pnp_card_driver *drv =
222 list_entry(pos, struct pnp_card_driver,
223 global_list);
224 card_probe(card, drv);
225 }
226 return 0;
236} 227}
237 228
238/** 229/**
@@ -243,8 +234,6 @@ void pnp_remove_card(struct pnp_card *card)
243{ 234{
244 struct list_head *pos, *temp; 235 struct list_head *pos, *temp;
245 236
246 if (!card)
247 return;
248 device_unregister(&card->dev); 237 device_unregister(&card->dev);
249 spin_lock(&pnp_lock); 238 spin_lock(&pnp_lock);
250 list_del(&card->global_list); 239 list_del(&card->global_list);
@@ -263,8 +252,6 @@ void pnp_remove_card(struct pnp_card *card)
263 */ 252 */
264int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) 253int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
265{ 254{
266 if (!card || !dev || !dev->protocol)
267 return -EINVAL;
268 dev->dev.parent = &card->dev; 255 dev->dev.parent = &card->dev;
269 dev->card_link = NULL; 256 dev->card_link = NULL;
270 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", 257 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,
304 struct pnp_card *card; 291 struct pnp_card *card;
305 292
306 if (!clink || !id) 293 if (!clink || !id)
307 goto done; 294 return NULL;
295
308 card = clink->card; 296 card = clink->card;
309 drv = clink->driver; 297 drv = clink->driver;
310 if (!from) { 298 if (!from) {
311 pos = card->devices.next; 299 pos = card->devices.next;
312 } else { 300 } else {
313 if (from->card != card) 301 if (from->card != card)
314 goto done; 302 return NULL;
315 pos = from->card_list.next; 303 pos = from->card_list.next;
316 } 304 }
317 while (pos != &card->devices) { 305 while (pos != &card->devices) {
@@ -321,7 +309,6 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
321 pos = pos->next; 309 pos = pos->next;
322 } 310 }
323 311
324done:
325 return NULL; 312 return NULL;
326 313
327found: 314found:
@@ -348,8 +335,6 @@ void pnp_release_card_device(struct pnp_dev *dev)
348{ 335{
349 struct pnp_card_driver *drv = dev->card_link->driver; 336 struct pnp_card_driver *drv = dev->card_link->driver;
350 337
351 if (!drv)
352 return;
353 drv->link.remove = &card_remove; 338 drv->link.remove = &card_remove;
354 device_release_driver(&dev->dev); 339 device_release_driver(&dev->dev);
355 drv->link.remove = &card_remove_first; 340 drv->link.remove = &card_remove_first;
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index d5964feb14de..7d366ca672d3 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -125,9 +125,11 @@ int __pnp_add_device(struct pnp_dev *dev)
125 spin_unlock(&pnp_lock); 125 spin_unlock(&pnp_lock);
126 126
127 ret = device_register(&dev->dev); 127 ret = device_register(&dev->dev);
128 if (ret == 0) 128 if (ret)
129 pnp_interface_attach_device(dev); 129 return ret;
130 return ret; 130
131 pnp_interface_attach_device(dev);
132 return 0;
131} 133}
132 134
133/* 135/*
@@ -138,12 +140,30 @@ int __pnp_add_device(struct pnp_dev *dev)
138 */ 140 */
139int pnp_add_device(struct pnp_dev *dev) 141int pnp_add_device(struct pnp_dev *dev)
140{ 142{
143 int ret;
144
141 if (dev->card) 145 if (dev->card)
142 return -EINVAL; 146 return -EINVAL;
147
143 dev->dev.parent = &dev->protocol->dev; 148 dev->dev.parent = &dev->protocol->dev;
144 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, 149 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
145 dev->number); 150 dev->number);
146 return __pnp_add_device(dev); 151 ret = __pnp_add_device(dev);
152 if (ret)
153 return ret;
154
155#ifdef CONFIG_PNP_DEBUG
156 {
157 struct pnp_id *id;
158
159 dev_printk(KERN_DEBUG, &dev->dev, "%s device, IDs",
160 dev->protocol->name);
161 for (id = dev->id; id; id = id->next)
162 printk(" %s", id->id);
163 printk(" (%s)\n", dev->active ? "active" : "disabled");
164 }
165#endif
166 return 0;
147} 167}
148 168
149void __pnp_remove_device(struct pnp_dev *dev) 169void __pnp_remove_device(struct pnp_dev *dev)
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 2fa64a6b25c8..a262762c5b88 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -86,9 +86,6 @@ static int pnp_device_probe(struct device *dev)
86 pnp_dev = to_pnp_dev(dev); 86 pnp_dev = to_pnp_dev(dev);
87 pnp_drv = to_pnp_driver(dev->driver); 87 pnp_drv = to_pnp_driver(dev->driver);
88 88
89 pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
90 dev->bus_id, pnp_drv->name);
91
92 error = pnp_device_attach(pnp_dev); 89 error = pnp_device_attach(pnp_dev);
93 if (error < 0) 90 if (error < 0)
94 return error; 91 return error;
@@ -116,6 +113,8 @@ static int pnp_device_probe(struct device *dev)
116 error = 0; 113 error = 0;
117 } else 114 } else
118 goto fail; 115 goto fail;
116
117 dev_dbg(dev, "driver attached\n");
119 return error; 118 return error;
120 119
121fail: 120fail:
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index e0ee28a88da3..31548044fdde 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -327,8 +327,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
327 327
328 if (dev->status & PNP_ATTACHED) { 328 if (dev->status & PNP_ATTACHED) {
329 retval = -EBUSY; 329 retval = -EBUSY;
330 pnp_info("Device %s cannot be configured because it is in use.", 330 dev_info(&dev->dev, "in use; can't configure\n");
331 dev->dev.bus_id);
332 goto done; 331 goto done;
333 } 332 }
334 333
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index ea3eac2404ca..c6b3d4e63ccc 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -22,8 +22,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
22 unsigned long *flags; 22 unsigned long *flags;
23 23
24 if (idx >= PNP_MAX_PORT) { 24 if (idx >= PNP_MAX_PORT) {
25 pnp_err 25 dev_err(&dev->dev, "too many I/O port resources\n");
26 ("More than 4 ports is incompatible with pnp specifications.");
27 /* pretend we were successful so at least the manager won't try again */ 26 /* pretend we were successful so at least the manager won't try again */
28 return 1; 27 return 1;
29 } 28 }
@@ -64,8 +63,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
64 unsigned long *flags; 63 unsigned long *flags;
65 64
66 if (idx >= PNP_MAX_MEM) { 65 if (idx >= PNP_MAX_MEM) {
67 pnp_err 66 dev_err(&dev->dev, "too many memory resources\n");
68 ("More than 8 mems is incompatible with pnp specifications.");
69 /* pretend we were successful so at least the manager won't try again */ 67 /* pretend we were successful so at least the manager won't try again */
70 return 1; 68 return 1;
71 } 69 }
@@ -122,8 +120,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
122 }; 120 };
123 121
124 if (idx >= PNP_MAX_IRQ) { 122 if (idx >= PNP_MAX_IRQ) {
125 pnp_err 123 dev_err(&dev->dev, "too many IRQ resources\n");
126 ("More than 2 irqs is incompatible with pnp specifications.");
127 /* pretend we were successful so at least the manager won't try again */ 124 /* pretend we were successful so at least the manager won't try again */
128 return 1; 125 return 1;
129 } 126 }
@@ -161,7 +158,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
161 return 0; 158 return 0;
162} 159}
163 160
164static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) 161static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
165{ 162{
166 resource_size_t *start, *end; 163 resource_size_t *start, *end;
167 unsigned long *flags; 164 unsigned long *flags;
@@ -173,15 +170,13 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
173 }; 170 };
174 171
175 if (idx >= PNP_MAX_DMA) { 172 if (idx >= PNP_MAX_DMA) {
176 pnp_err 173 dev_err(&dev->dev, "too many DMA resources\n");
177 ("More than 2 dmas is incompatible with pnp specifications."); 174 return;
178 /* pretend we were successful so at least the manager won't try again */
179 return 1;
180 } 175 }
181 176
182 /* check if this resource has been manually set, if so skip */ 177 /* check if this resource has been manually set, if so skip */
183 if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO)) 178 if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO))
184 return 1; 179 return;
185 180
186 start = &dev->res.dma_resource[idx].start; 181 start = &dev->res.dma_resource[idx].start;
187 end = &dev->res.dma_resource[idx].end; 182 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)
191 *flags |= rule->flags | IORESOURCE_DMA; 186 *flags |= rule->flags | IORESOURCE_DMA;
192 *flags &= ~IORESOURCE_UNSET; 187 *flags &= ~IORESOURCE_UNSET;
193 188
194 if (!rule->map) {
195 *flags |= IORESOURCE_DISABLED;
196 return 1; /* skip disabled resource requests */
197 }
198
199 for (i = 0; i < 8; i++) { 189 for (i = 0; i < 8; i++) {
200 if (rule->map & (1 << xtab[i])) { 190 if (rule->map & (1 << xtab[i])) {
201 *start = *end = xtab[i]; 191 *start = *end = xtab[i];
202 if (pnp_check_dma(dev, idx)) 192 if (pnp_check_dma(dev, idx))
203 return 1; 193 return;
204 } 194 }
205 } 195 }
206 return 0; 196#ifdef MAX_DMA_CHANNELS
197 *start = *end = MAX_DMA_CHANNELS;
198#endif
199 *flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED;
207} 200}
208 201
209/** 202/**
@@ -330,8 +323,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
330 irq = irq->next; 323 irq = irq->next;
331 } 324 }
332 while (dma) { 325 while (dma) {
333 if (!pnp_assign_dma(dev, dma, ndma)) 326 pnp_assign_dma(dev, dma, ndma);
334 goto fail;
335 ndma++; 327 ndma++;
336 dma = dma->next; 328 dma = dma->next;
337 } 329 }
@@ -367,8 +359,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
367 irq = irq->next; 359 irq = irq->next;
368 } 360 }
369 while (dma) { 361 while (dma) {
370 if (!pnp_assign_dma(dev, dma, ndma)) 362 pnp_assign_dma(dev, dma, ndma);
371 goto fail;
372 ndma++; 363 ndma++;
373 dma = dma->next; 364 dma = dma->next;
374 } 365 }
@@ -447,8 +438,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
447 int i = 1; 438 int i = 1;
448 439
449 if (!pnp_can_configure(dev)) { 440 if (!pnp_can_configure(dev)) {
450 pnp_dbg("Device %s does not support resource configuration.", 441 dev_dbg(&dev->dev, "configuration not supported\n");
451 dev->dev.bus_id);
452 return -ENODEV; 442 return -ENODEV;
453 } 443 }
454 444
@@ -465,7 +455,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
465 } while (dep); 455 } while (dep);
466 } 456 }
467 457
468 pnp_err("Unable to assign resources to device %s.", dev->dev.bus_id); 458 dev_err(&dev->dev, "unable to assign resources\n");
469 return -EBUSY; 459 return -EBUSY;
470} 460}
471 461
@@ -478,17 +468,16 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
478int pnp_start_dev(struct pnp_dev *dev) 468int pnp_start_dev(struct pnp_dev *dev)
479{ 469{
480 if (!pnp_can_write(dev)) { 470 if (!pnp_can_write(dev)) {
481 pnp_dbg("Device %s does not support activation.", 471 dev_dbg(&dev->dev, "activation not supported\n");
482 dev->dev.bus_id);
483 return -EINVAL; 472 return -EINVAL;
484 } 473 }
485 474
486 if (dev->protocol->set(dev, &dev->res) < 0) { 475 if (dev->protocol->set(dev, &dev->res) < 0) {
487 pnp_err("Failed to activate device %s.", dev->dev.bus_id); 476 dev_err(&dev->dev, "activation failed\n");
488 return -EIO; 477 return -EIO;
489 } 478 }
490 479
491 pnp_info("Device %s activated.", dev->dev.bus_id); 480 dev_info(&dev->dev, "activated\n");
492 return 0; 481 return 0;
493} 482}
494 483
@@ -501,16 +490,15 @@ int pnp_start_dev(struct pnp_dev *dev)
501int pnp_stop_dev(struct pnp_dev *dev) 490int pnp_stop_dev(struct pnp_dev *dev)
502{ 491{
503 if (!pnp_can_disable(dev)) { 492 if (!pnp_can_disable(dev)) {
504 pnp_dbg("Device %s does not support disabling.", 493 dev_dbg(&dev->dev, "disabling not supported\n");
505 dev->dev.bus_id);
506 return -EINVAL; 494 return -EINVAL;
507 } 495 }
508 if (dev->protocol->disable(dev) < 0) { 496 if (dev->protocol->disable(dev) < 0) {
509 pnp_err("Failed to disable device %s.", dev->dev.bus_id); 497 dev_err(&dev->dev, "disable failed\n");
510 return -EIO; 498 return -EIO;
511 } 499 }
512 500
513 pnp_info("Device %s disabled.", dev->dev.bus_id); 501 dev_info(&dev->dev, "disabled\n");
514 return 0; 502 return 0;
515} 503}
516 504
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index a5a372222d69..dada89906314 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -130,11 +130,16 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
130#ifdef CONFIG_ACPI_SLEEP 130#ifdef CONFIG_ACPI_SLEEP
131static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) 131static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
132{ 132{
133 return acpi_bus_set_power((acpi_handle) dev->data, 133 int power_state;
134 acpi_pm_device_sleep_state(&dev->dev, 134
135 device_may_wakeup 135 power_state = acpi_pm_device_sleep_state(&dev->dev,
136 (&dev->dev), 136 device_may_wakeup(&dev->dev),
137 NULL)); 137 NULL);
138 if (power_state < 0)
139 power_state = (state.event == PM_EVENT_ON) ?
140 ACPI_STATE_D0 : ACPI_STATE_D3;
141
142 return acpi_bus_set_power((acpi_handle) dev->data, power_state);
138} 143}
139 144
140static int pnpacpi_resume(struct pnp_dev *dev) 145static int pnpacpi_resume(struct pnp_dev *dev)
@@ -166,7 +171,6 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
166 is_exclusive_device(device)) 171 is_exclusive_device(device))
167 return 0; 172 return 0;
168 173
169 pnp_dbg("ACPI device : hid %s", acpi_device_hid(device));
170 dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); 174 dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
171 if (!dev) { 175 if (!dev) {
172 pnp_err("Out of memory"); 176 pnp_err("Out of memory");
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 0e3b8d0ff06b..cd0a204d96d1 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -85,6 +85,16 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
85 if (i >= PNP_MAX_IRQ) 85 if (i >= PNP_MAX_IRQ)
86 return; 86 return;
87 87
88#ifdef CONFIG_X86
89 if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE ||
90 polarity != ACPI_ACTIVE_HIGH)) {
91 pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, "
92 "active high", gsi);
93 triggering = ACPI_EDGE_SENSITIVE;
94 polarity = ACPI_ACTIVE_HIGH;
95 }
96#endif
97
88 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 98 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
89 res->irq_resource[i].flags |= irq_flags(triggering, polarity); 99 res->irq_resource[i].flags |= irq_flags(triggering, polarity);
90 irq = acpi_register_gsi(gsi, triggering, polarity); 100 irq = acpi_register_gsi(gsi, triggering, polarity);
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 4e9fd37cff35..e33e03f71084 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -315,25 +315,31 @@ struct pnp_protocol pnpbios_protocol = {
315 .disable = pnpbios_disable_resources, 315 .disable = pnpbios_disable_resources,
316}; 316};
317 317
318static int insert_device(struct pnp_dev *dev, struct pnp_bios_node *node) 318static int insert_device(struct pnp_bios_node *node)
319{ 319{
320 struct list_head *pos; 320 struct list_head *pos;
321 struct pnp_dev *pnp_dev; 321 struct pnp_dev *dev;
322 struct pnp_id *dev_id; 322 struct pnp_id *dev_id;
323 char id[8]; 323 char id[8];
324 324
325 /* check if the device is already added */ 325 /* check if the device is already added */
326 dev->number = node->handle;
327 list_for_each(pos, &pnpbios_protocol.devices) { 326 list_for_each(pos, &pnpbios_protocol.devices) {
328 pnp_dev = list_entry(pos, struct pnp_dev, protocol_list); 327 dev = list_entry(pos, struct pnp_dev, protocol_list);
329 if (dev->number == pnp_dev->number) 328 if (dev->number == node->handle)
330 return -1; 329 return -1;
331 } 330 }
332 331
333 /* set the initial values for the PnP device */ 332 dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
333 if (!dev)
334 return -1;
335
334 dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 336 dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
335 if (!dev_id) 337 if (!dev_id) {
338 kfree(dev);
336 return -1; 339 return -1;
340 }
341
342 dev->number = node->handle;
337 pnpid32_to_pnpid(node->eisa_id, id); 343 pnpid32_to_pnpid(node->eisa_id, id);
338 memcpy(dev_id->id, id, 7); 344 memcpy(dev_id->id, id, 7);
339 pnp_add_id(dev_id, dev); 345 pnp_add_id(dev_id, dev);
@@ -367,7 +373,6 @@ static void __init build_devlist(void)
367 unsigned int nodes_got = 0; 373 unsigned int nodes_got = 0;
368 unsigned int devs = 0; 374 unsigned int devs = 0;
369 struct pnp_bios_node *node; 375 struct pnp_bios_node *node;
370 struct pnp_dev *dev;
371 376
372 node = kzalloc(node_info.max_node_size, GFP_KERNEL); 377 node = kzalloc(node_info.max_node_size, GFP_KERNEL);
373 if (!node) 378 if (!node)
@@ -388,12 +393,7 @@ static void __init build_devlist(void)
388 break; 393 break;
389 } 394 }
390 nodes_got++; 395 nodes_got++;
391 dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); 396 if (insert_device(node) == 0)
392 if (!dev)
393 break;
394 if (insert_device(dev, node) < 0)
395 kfree(dev);
396 else
397 devs++; 397 devs++;
398 if (nodenum <= thisnodenum) { 398 if (nodenum <= thisnodenum) {
399 printk(KERN_ERR 399 printk(KERN_ERR
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 9d9841f24a85..bb19bc957bad 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -94,8 +94,9 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
94 94
95 /* sanity check */ 95 /* sanity check */
96 if (escd_size > MAX_SANE_ESCD_SIZE) { 96 if (escd_size > MAX_SANE_ESCD_SIZE) {
97 printk(KERN_ERR 97 printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by"
98 "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n"); 98 " BIOS read_escd call is too great\n");
99 kfree(tmpbuf);
99 return -EFBIG; 100 return -EFBIG;
100 } 101 }
101 102
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 6b0cf0c2a088..e903b8c2b1fa 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -17,6 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pnp.h> 18#include <linux/pnp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/kallsyms.h>
20#include "base.h" 21#include "base.h"
21 22
22static void quirk_awe32_resources(struct pnp_dev *dev) 23static void quirk_awe32_resources(struct pnp_dev *dev)
@@ -133,11 +134,18 @@ static struct pnp_fixup pnp_fixups[] = {
133void pnp_fixup_device(struct pnp_dev *dev) 134void pnp_fixup_device(struct pnp_dev *dev)
134{ 135{
135 int i = 0; 136 int i = 0;
137 void (*quirk)(struct pnp_dev *);
136 138
137 while (*pnp_fixups[i].id) { 139 while (*pnp_fixups[i].id) {
138 if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { 140 if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
139 pnp_dbg("Calling quirk for %s", dev->dev.bus_id); 141 quirk = pnp_fixups[i].quirk_function;
140 pnp_fixups[i].quirk_function(dev); 142
143#ifdef DEBUG
144 dev_dbg(&dev->dev, "calling quirk 0x%p", quirk);
145 print_fn_descriptor_symbol(": %s()\n",
146 (unsigned long) *quirk);
147#endif
148 (*quirk)(dev);
141 } 149 }
142 i++; 150 i++;
143 } 151 }
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 087fed18628f..41d73a5e9312 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -51,7 +51,7 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
51 51
52 /* this should never happen but if it does we'll try to continue */ 52 /* this should never happen but if it does we'll try to continue */
53 if (dev->independent) 53 if (dev->independent)
54 pnp_err("independent resource already registered"); 54 dev_err(&dev->dev, "independent resource already registered\n");
55 dev->independent = option; 55 dev->independent = option;
56 return option; 56 return option;
57} 57}
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index a06f980b3ac9..55c4563986b3 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -22,36 +22,39 @@ static const struct pnp_device_id pnp_dev_table[] = {
22 {"", 0} 22 {"", 0}
23}; 23};
24 24
25static void reserve_range(const char *pnpid, resource_size_t start, 25static void reserve_range(struct pnp_dev *dev, resource_size_t start,
26 resource_size_t end, int port) 26 resource_size_t end, int port)
27{ 27{
28 struct resource *res;
29 char *regionid; 28 char *regionid;
29 const char *pnpid = dev->dev.bus_id;
30 struct resource *res;
30 31
31 regionid = kmalloc(16, GFP_KERNEL); 32 regionid = kmalloc(16, GFP_KERNEL);
32 if (regionid == NULL) 33 if (!regionid)
33 return; 34 return;
35
34 snprintf(regionid, 16, "pnp %s", pnpid); 36 snprintf(regionid, 16, "pnp %s", pnpid);
35 if (port) 37 if (port)
36 res = request_region(start, end - start + 1, regionid); 38 res = request_region(start, end - start + 1, regionid);
37 else 39 else
38 res = request_mem_region(start, end - start + 1, regionid); 40 res = request_mem_region(start, end - start + 1, regionid);
39 if (res == NULL) 41 if (res)
40 kfree(regionid);
41 else
42 res->flags &= ~IORESOURCE_BUSY; 42 res->flags &= ~IORESOURCE_BUSY;
43 else
44 kfree(regionid);
45
43 /* 46 /*
44 * Failures at this point are usually harmless. pci quirks for 47 * Failures at this point are usually harmless. pci quirks for
45 * example do reserve stuff they know about too, so we may well 48 * example do reserve stuff they know about too, so we may well
46 * have double reservations. 49 * have double reservations.
47 */ 50 */
48 printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n", 51 dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n",
49 pnpid, port ? "ioport" : "iomem", 52 port ? "ioport" : "iomem",
50 (unsigned long long)start, (unsigned long long)end, 53 (unsigned long long) start, (unsigned long long) end,
51 NULL != res ? "has been" : "could not be"); 54 res ? "has been" : "could not be");
52} 55}
53 56
54static void reserve_resources_of_dev(const struct pnp_dev *dev) 57static void reserve_resources_of_dev(struct pnp_dev *dev)
55{ 58{
56 int i; 59 int i;
57 60
@@ -73,7 +76,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
73 if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) 76 if (pnp_port_end(dev, i) < pnp_port_start(dev, i))
74 continue; /* invalid */ 77 continue; /* invalid */
75 78
76 reserve_range(dev->dev.bus_id, pnp_port_start(dev, i), 79 reserve_range(dev, pnp_port_start(dev, i),
77 pnp_port_end(dev, i), 1); 80 pnp_port_end(dev, i), 1);
78 } 81 }
79 82
@@ -81,7 +84,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
81 if (!pnp_mem_valid(dev, i)) 84 if (!pnp_mem_valid(dev, i))
82 continue; 85 continue;
83 86
84 reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), 87 reserve_range(dev, pnp_mem_start(dev, i),
85 pnp_mem_end(dev, i), 0); 88 pnp_mem_end(dev, i), 0);
86 } 89 }
87} 90}
diff --git a/drivers/s390/char/defkeymap.c b/drivers/s390/char/defkeymap.c
index 564baca01b7c..389346cda6c8 100644
--- a/drivers/s390/char/defkeymap.c
+++ b/drivers/s390/char/defkeymap.c
@@ -150,7 +150,7 @@ char *func_table[MAX_NR_FUNC] = {
150 NULL, 150 NULL,
151}; 151};
152 152
153struct kbdiacr accent_table[MAX_DIACR] = { 153struct kbdiacruc accent_table[MAX_DIACR] = {
154 {'^', 'c', '\003'}, {'^', 'd', '\004'}, 154 {'^', 'c', '\003'}, {'^', 'd', '\004'},
155 {'^', 'z', '\032'}, {'^', '\012', '\000'}, 155 {'^', 'z', '\032'}, {'^', '\012', '\000'},
156}; 156};
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
index f62f9a4e8950..cee4d4e42429 100644
--- a/drivers/s390/char/keyboard.c
+++ b/drivers/s390/char/keyboard.c
@@ -11,6 +11,7 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/sysrq.h> 12#include <linux/sysrq.h>
13 13
14#include <linux/consolemap.h>
14#include <linux/kbd_kern.h> 15#include <linux/kbd_kern.h>
15#include <linux/kbd_diacr.h> 16#include <linux/kbd_diacr.h>
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
@@ -82,11 +83,11 @@ kbd_alloc(void) {
82 if (!kbd->fn_handler) 83 if (!kbd->fn_handler)
83 goto out_func; 84 goto out_func;
84 kbd->accent_table = 85 kbd->accent_table =
85 kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL); 86 kmalloc(sizeof(struct kbdiacruc)*MAX_DIACR, GFP_KERNEL);
86 if (!kbd->accent_table) 87 if (!kbd->accent_table)
87 goto out_fn_handler; 88 goto out_fn_handler;
88 memcpy(kbd->accent_table, accent_table, 89 memcpy(kbd->accent_table, accent_table,
89 sizeof(struct kbdiacr)*MAX_DIACR); 90 sizeof(struct kbdiacruc)*MAX_DIACR);
90 kbd->accent_table_size = accent_table_size; 91 kbd->accent_table_size = accent_table_size;
91 return kbd; 92 return kbd;
92 93
@@ -183,8 +184,8 @@ kbd_ebcasc(struct kbd_data *kbd, unsigned char *ebcasc)
183 * Otherwise, conclude that DIACR was not combining after all, 184 * Otherwise, conclude that DIACR was not combining after all,
184 * queue it and return CH. 185 * queue it and return CH.
185 */ 186 */
186static unsigned char 187static unsigned int
187handle_diacr(struct kbd_data *kbd, unsigned char ch) 188handle_diacr(struct kbd_data *kbd, unsigned int ch)
188{ 189{
189 int i, d; 190 int i, d;
190 191
@@ -460,7 +461,6 @@ int
460kbd_ioctl(struct kbd_data *kbd, struct file *file, 461kbd_ioctl(struct kbd_data *kbd, struct file *file,
461 unsigned int cmd, unsigned long arg) 462 unsigned int cmd, unsigned long arg)
462{ 463{
463 struct kbdiacrs __user *a;
464 void __user *argp; 464 void __user *argp;
465 int ct, perm; 465 int ct, perm;
466 466
@@ -481,17 +481,40 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file,
481 case KDSKBSENT: 481 case KDSKBSENT:
482 return do_kdgkb_ioctl(kbd, argp, cmd, perm); 482 return do_kdgkb_ioctl(kbd, argp, cmd, perm);
483 case KDGKBDIACR: 483 case KDGKBDIACR:
484 a = argp; 484 {
485 struct kbdiacrs __user *a = argp;
486 struct kbdiacr diacr;
487 int i;
485 488
486 if (put_user(kbd->accent_table_size, &a->kb_cnt)) 489 if (put_user(kbd->accent_table_size, &a->kb_cnt))
487 return -EFAULT; 490 return -EFAULT;
491 for (i = 0; i < kbd->accent_table_size; i++) {
492 diacr.diacr = kbd->accent_table[i].diacr;
493 diacr.base = kbd->accent_table[i].base;
494 diacr.result = kbd->accent_table[i].result;
495 if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
496 return -EFAULT;
497 }
498 return 0;
499 }
500 case KDGKBDIACRUC:
501 {
502 struct kbdiacrsuc __user *a = argp;
503
488 ct = kbd->accent_table_size; 504 ct = kbd->accent_table_size;
489 if (copy_to_user(a->kbdiacr, kbd->accent_table, 505 if (put_user(ct, &a->kb_cnt))
490 ct * sizeof(struct kbdiacr))) 506 return -EFAULT;
507 if (copy_to_user(a->kbdiacruc, kbd->accent_table,
508 ct * sizeof(struct kbdiacruc)))
491 return -EFAULT; 509 return -EFAULT;
492 return 0; 510 return 0;
511 }
493 case KDSKBDIACR: 512 case KDSKBDIACR:
494 a = argp; 513 {
514 struct kbdiacrs __user *a = argp;
515 struct kbdiacr diacr;
516 int i;
517
495 if (!perm) 518 if (!perm)
496 return -EPERM; 519 return -EPERM;
497 if (get_user(ct, &a->kb_cnt)) 520 if (get_user(ct, &a->kb_cnt))
@@ -499,10 +522,31 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file,
499 if (ct >= MAX_DIACR) 522 if (ct >= MAX_DIACR)
500 return -EINVAL; 523 return -EINVAL;
501 kbd->accent_table_size = ct; 524 kbd->accent_table_size = ct;
502 if (copy_from_user(kbd->accent_table, a->kbdiacr, 525 for (i = 0; i < ct; i++) {
503 ct * sizeof(struct kbdiacr))) 526 if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr)))
527 return -EFAULT;
528 kbd->accent_table[i].diacr = diacr.diacr;
529 kbd->accent_table[i].base = diacr.base;
530 kbd->accent_table[i].result = diacr.result;
531 }
532 return 0;
533 }
534 case KDSKBDIACRUC:
535 {
536 struct kbdiacrsuc __user *a = argp;
537
538 if (!perm)
539 return -EPERM;
540 if (get_user(ct, &a->kb_cnt))
541 return -EFAULT;
542 if (ct >= MAX_DIACR)
543 return -EINVAL;
544 kbd->accent_table_size = ct;
545 if (copy_from_user(kbd->accent_table, a->kbdiacruc,
546 ct * sizeof(struct kbdiacruc)))
504 return -EFAULT; 547 return -EFAULT;
505 return 0; 548 return 0;
549 }
506 default: 550 default:
507 return -ENOIOCTLCMD; 551 return -ENOIOCTLCMD;
508 } 552 }
diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h
index f7bf45c6bf0d..5ccfe9cf126d 100644
--- a/drivers/s390/char/keyboard.h
+++ b/drivers/s390/char/keyboard.h
@@ -25,9 +25,9 @@ struct kbd_data {
25 unsigned short **key_maps; 25 unsigned short **key_maps;
26 char **func_table; 26 char **func_table;
27 fn_handler_fn **fn_handler; 27 fn_handler_fn **fn_handler;
28 struct kbdiacr *accent_table; 28 struct kbdiacruc *accent_table;
29 unsigned int accent_table_size; 29 unsigned int accent_table_size;
30 unsigned char diacr; 30 unsigned int diacr;
31 unsigned short sysrq; 31 unsigned short sysrq;
32}; 32};
33 33
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 281f23a371b2..94ec66372508 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -500,13 +500,11 @@ void jsm_input(struct jsm_channel *ch)
500{ 500{
501 struct jsm_board *bd; 501 struct jsm_board *bd;
502 struct tty_struct *tp; 502 struct tty_struct *tp;
503 struct tty_ldisc *ld;
504 u32 rmask; 503 u32 rmask;
505 u16 head; 504 u16 head;
506 u16 tail; 505 u16 tail;
507 int data_len; 506 int data_len;
508 unsigned long lock_flags; 507 unsigned long lock_flags;
509 int flip_len = 0;
510 int len = 0; 508 int len = 0;
511 int n = 0; 509 int n = 0;
512 int s = 0; 510 int s = 0;
@@ -574,45 +572,13 @@ void jsm_input(struct jsm_channel *ch)
574 572
575 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n"); 573 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n");
576 574
577 /* 575 if (data_len <= 0) {
578 * If the rxbuf is empty and we are not throttled, put as much
579 * as we can directly into the linux TTY buffer.
580 *
581 */
582 flip_len = TTY_FLIPBUF_SIZE;
583
584 len = min(data_len, flip_len);
585 len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt);
586 ld = tty_ldisc_ref(tp);
587
588 /*
589 * If we were unable to get a reference to the ld,
590 * don't flush our buffer, and act like the ld doesn't
591 * have any space to put the data right now.
592 */
593 if (!ld) {
594 len = 0;
595 } else {
596 /*
597 * If ld doesn't have a pointer to a receive_buf function,
598 * flush the data, then act like the ld doesn't have any
599 * space to put the data right now.
600 */
601 if (!ld->receive_buf) {
602 ch->ch_r_head = ch->ch_r_tail;
603 len = 0;
604 }
605 }
606
607 if (len <= 0) {
608 spin_unlock_irqrestore(&ch->ch_lock, lock_flags); 576 spin_unlock_irqrestore(&ch->ch_lock, lock_flags);
609 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n"); 577 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n");
610 if (ld)
611 tty_ldisc_deref(ld);
612 return; 578 return;
613 } 579 }
614 580
615 len = tty_buffer_request_room(tp, len); 581 len = tty_buffer_request_room(tp, data_len);
616 n = len; 582 n = len;
617 583
618 /* 584 /*
@@ -647,7 +613,7 @@ void jsm_input(struct jsm_channel *ch)
647 else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) 613 else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE)
648 tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME); 614 tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME);
649 else 615 else
650 tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL); 616 tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
651 } 617 }
652 } else { 618 } else {
653 tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; 619 tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ;
@@ -666,9 +632,6 @@ void jsm_input(struct jsm_channel *ch)
666 /* Tell the tty layer its okay to "eat" the data now */ 632 /* Tell the tty layer its okay to "eat" the data now */
667 tty_flip_buffer_push(tp); 633 tty_flip_buffer_push(tp);
668 634
669 if (ld)
670 tty_ldisc_deref(ld);
671
672 jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n"); 635 jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n");
673} 636}
674 637
diff --git a/drivers/tc/.gitignore b/drivers/tc/.gitignore
deleted file mode 100644
index acc0e1e6a650..000000000000
--- a/drivers/tc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1lk201-map.c
diff --git a/drivers/tc/Makefile b/drivers/tc/Makefile
index c899246bd362..623b21063228 100644
--- a/drivers/tc/Makefile
+++ b/drivers/tc/Makefile
@@ -5,18 +5,3 @@
5# Object file lists. 5# Object file lists.
6 6
7obj-$(CONFIG_TC) += tc.o tc-driver.o 7obj-$(CONFIG_TC) += tc.o tc-driver.o
8obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o
9
10$(obj)/lk201-map.o: $(obj)/lk201-map.c
11
12# Uncomment if you're changing the keymap and have an appropriate
13# loadkeys version for the map. By default, we'll use the shipped
14# versions.
15# GENERATE_KEYMAP := 1
16
17ifdef GENERATE_KEYMAP
18
19$(obj)/lk201-map.c: $(obj)/%.c: $(src)/%.map
20 loadkeys --mktable $< > $@
21
22endif
diff --git a/drivers/tc/lk201-map.c_shipped b/drivers/tc/lk201-map.c_shipped
deleted file mode 100644
index a9df8f5bf62b..000000000000
--- a/drivers/tc/lk201-map.c_shipped
+++ /dev/null
@@ -1,265 +0,0 @@
1
2/* Do not edit this file! It was automatically generated by */
3/* loadkeys --mktable defkeymap.map > defkeymap.c */
4
5#include <linux/types.h>
6#include <linux/keyboard.h>
7#include <linux/kd.h>
8
9u_short plain_map[NR_KEYS] = {
10 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
11 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf11b,
12 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf060, 0xf031, 0xf032,
13 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030,
14 0xf02d, 0xf03d, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
15 0xf200, 0xf200, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74,
16 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201,
17 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
18 0xf207, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a,
19 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf05c, 0xf603, 0xf304, 0xf305,
20 0xf306, 0xf200, 0xf700, 0xf03e, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
21 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf200, 0xf601,
22 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
23 0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
24 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
25 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
26};
27
28static u_short shift_map[NR_KEYS] = {
29 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
30 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf203,
31 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf07e, 0xf021, 0xf040,
32 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029,
33 0xf05f, 0xf02b, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
34 0xf200, 0xf200, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54,
35 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201,
36 0xf117, 0xf20b, 0xf20a, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
37 0xf207, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a,
38 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07c, 0xf603, 0xf304, 0xf305,
39 0xf306, 0xf200, 0xf700, 0xf03c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
40 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf200, 0xf601,
41 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
42 0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
43 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
44 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
45};
46
47static u_short altgr_map[NR_KEYS] = {
48 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
49 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf202,
50 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf040,
51 0xf200, 0xf024, 0xf200, 0xf200, 0xf07b, 0xf05b, 0xf05d, 0xf07d,
52 0xf05c, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
53 0xf200, 0xf200, 0xf200, 0xfb71, 0xfb77, 0xf918, 0xfb72, 0xfb74,
54 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf200, 0xf07e, 0xf201,
55 0xf117, 0xf118, 0xf119, 0xf911, 0xf912, 0xf913, 0xf30b, 0xf702,
56 0xf207, 0xf914, 0xfb73, 0xf917, 0xf919, 0xfb67, 0xfb68, 0xfb6a,
57 0xfb6b, 0xfb6c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf90e, 0xf90f,
58 0xf910, 0xf200, 0xf700, 0xf200, 0xfb7a, 0xfb78, 0xf916, 0xfb76,
59 0xf915, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
60 0xf600, 0xf602, 0xf90b, 0xf90c, 0xf90d, 0xf30e, 0xf200, 0xf703,
61 0xf200, 0xf200, 0xf200, 0xf90a, 0xf310, 0xf200, 0xf200, 0xf200,
62 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
63 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
64};
65
66static u_short ctrl_map[NR_KEYS] = {
67 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
68 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf204,
69 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf81b, 0xf200, 0xf000,
70 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200,
71 0xf01f, 0xf200, 0xf008, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
72 0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014,
73 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf201,
74 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
75 0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a,
76 0xf00b, 0xf00c, 0xf200, 0xf007, 0xf01c, 0xf603, 0xf304, 0xf305,
77 0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
78 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf20e, 0xf07f, 0xf200, 0xf601,
79 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
80 0xf000, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
81 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
82 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
83};
84
85static u_short shift_ctrl_map[NR_KEYS] = {
86 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
87 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf200,
88 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf000,
89 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
90 0xf01f, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
91 0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014,
92 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf201,
93 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
94 0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a,
95 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305,
96 0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
97 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
98 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
99 0xf200, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
100 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
101 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
102};
103
104static u_short alt_map[NR_KEYS] = {
105 0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
106 0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200,
107 0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf01b, 0xf831, 0xf832,
108 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830,
109 0xf82d, 0xf83d, 0xf87f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
110 0xf200, 0xf200, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874,
111 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d,
112 0xf117, 0xf118, 0xf119, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf702,
113 0xf207, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a,
114 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf85c, 0xf603, 0xf904, 0xf905,
115 0xf906, 0xf200, 0xf700, 0xf200, 0xf87a, 0xf878, 0xf863, 0xf876,
116 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf200, 0xf210,
117 0xf600, 0xf211, 0xf901, 0xf902, 0xf903, 0xf30e, 0xf200, 0xf703,
118 0xf820, 0xf200, 0xf200, 0xf900, 0xf310, 0xf200, 0xf200, 0xf200,
119 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
120 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
121};
122
123static u_short ctrl_alt_map[NR_KEYS] = {
124 0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
125 0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200,
126 0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf200, 0xf200, 0xf200,
127 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
128 0xf200, 0xf200, 0xf200, 0xf114, 0xf115, 0xf20c, 0xf200, 0xf200,
129 0xf200, 0xf200, 0xf200, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814,
130 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf200, 0xf200, 0xf201,
131 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
132 0xf207, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a,
133 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305,
134 0xf306, 0xf200, 0xf700, 0xf200, 0xf81a, 0xf818, 0xf803, 0xf816,
135 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
136 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
137 0xf200, 0xf200, 0xf200, 0xf300, 0xf20c, 0xf200, 0xf200, 0xf200,
138 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
139 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
140};
141
142ushort *key_maps[MAX_NR_KEYMAPS] = {
143 plain_map, shift_map, altgr_map, 0,
144 ctrl_map, shift_ctrl_map, 0, 0,
145 alt_map, 0, 0, 0,
146 ctrl_alt_map, 0
147};
148
149unsigned int keymap_count = 7;
150
151
152/*
153 * Philosophy: most people do not define more strings, but they who do
154 * often want quite a lot of string space. So, we statically allocate
155 * the default and allocate dynamically in chunks of 512 bytes.
156 */
157
158char func_buf[] = {
159 '\033', '[', '[', 'A', 0,
160 '\033', '[', '[', 'B', 0,
161 '\033', '[', '[', 'C', 0,
162 '\033', '[', '[', 'D', 0,
163 '\033', '[', '[', 'E', 0,
164 '\033', '[', '1', '7', '~', 0,
165 '\033', '[', '1', '8', '~', 0,
166 '\033', '[', '1', '9', '~', 0,
167 '\033', '[', '2', '0', '~', 0,
168 '\033', '[', '2', '1', '~', 0,
169 '\033', '[', '2', '3', '~', 0,
170 '\033', '[', '2', '4', '~', 0,
171 '\033', '[', '2', '5', '~', 0,
172 '\033', '[', '2', '6', '~', 0,
173 '\033', '[', '2', '8', '~', 0,
174 '\033', '[', '2', '9', '~', 0,
175 '\033', '[', '3', '1', '~', 0,
176 '\033', '[', '3', '2', '~', 0,
177 '\033', '[', '3', '3', '~', 0,
178 '\033', '[', '3', '4', '~', 0,
179 '\033', '[', '1', '~', 0,
180 '\033', '[', '2', '~', 0,
181 '\033', '[', '3', '~', 0,
182 '\033', '[', '4', '~', 0,
183 '\033', '[', '5', '~', 0,
184 '\033', '[', '6', '~', 0,
185 '\033', '[', 'M', 0,
186 '\033', '[', 'P', 0,
187};
188
189
190char *funcbufptr = func_buf;
191int funcbufsize = sizeof(func_buf);
192int funcbufleft = 0; /* space left */
193
194char *func_table[MAX_NR_FUNC] = {
195 func_buf + 0,
196 func_buf + 5,
197 func_buf + 10,
198 func_buf + 15,
199 func_buf + 20,
200 func_buf + 25,
201 func_buf + 31,
202 func_buf + 37,
203 func_buf + 43,
204 func_buf + 49,
205 func_buf + 55,
206 func_buf + 61,
207 func_buf + 67,
208 func_buf + 73,
209 func_buf + 79,
210 func_buf + 85,
211 func_buf + 91,
212 func_buf + 97,
213 func_buf + 103,
214 func_buf + 109,
215 func_buf + 115,
216 func_buf + 120,
217 func_buf + 125,
218 func_buf + 130,
219 func_buf + 135,
220 func_buf + 140,
221 func_buf + 145,
222 0,
223 0,
224 func_buf + 149,
225 0,
226};
227
228struct kbdiacr accent_table[MAX_DIACR] = {
229 {'`', 'A', 'À'}, {'`', 'a', 'à'},
230 {'\'', 'A', 'Á'}, {'\'', 'a', 'á'},
231 {'^', 'A', 'Â'}, {'^', 'a', 'â'},
232 {'~', 'A', 'Ã'}, {'~', 'a', 'ã'},
233 {'"', 'A', 'Ä'}, {'"', 'a', 'ä'},
234 {'O', 'A', 'Å'}, {'o', 'a', 'å'},
235 {'0', 'A', 'Å'}, {'0', 'a', 'å'},
236 {'A', 'A', 'Å'}, {'a', 'a', 'å'},
237 {'A', 'E', 'Æ'}, {'a', 'e', 'æ'},
238 {',', 'C', 'Ç'}, {',', 'c', 'ç'},
239 {'`', 'E', 'È'}, {'`', 'e', 'è'},
240 {'\'', 'E', 'É'}, {'\'', 'e', 'é'},
241 {'^', 'E', 'Ê'}, {'^', 'e', 'ê'},
242 {'"', 'E', 'Ë'}, {'"', 'e', 'ë'},
243 {'`', 'I', 'Ì'}, {'`', 'i', 'ì'},
244 {'\'', 'I', 'Í'}, {'\'', 'i', 'í'},
245 {'^', 'I', 'Î'}, {'^', 'i', 'î'},
246 {'"', 'I', 'Ï'}, {'"', 'i', 'ï'},
247 {'-', 'D', 'Ð'}, {'-', 'd', 'ð'},
248 {'~', 'N', 'Ñ'}, {'~', 'n', 'ñ'},
249 {'`', 'O', 'Ò'}, {'`', 'o', 'ò'},
250 {'\'', 'O', 'Ó'}, {'\'', 'o', 'ó'},
251 {'^', 'O', 'Ô'}, {'^', 'o', 'ô'},
252 {'~', 'O', 'Õ'}, {'~', 'o', 'õ'},
253 {'"', 'O', 'Ö'}, {'"', 'o', 'ö'},
254 {'/', 'O', 'Ø'}, {'/', 'o', 'ø'},
255 {'`', 'U', 'Ù'}, {'`', 'u', 'ù'},
256 {'\'', 'U', 'Ú'}, {'\'', 'u', 'ú'},
257 {'^', 'U', 'Û'}, {'^', 'u', 'û'},
258 {'"', 'U', 'Ü'}, {'"', 'u', 'ü'},
259 {'\'', 'Y', 'Ý'}, {'\'', 'y', 'ý'},
260 {'T', 'H', 'Þ'}, {'t', 'h', 'þ'},
261 {'s', 's', 'ß'}, {'"', 'y', 'ÿ'},
262 {'s', 'z', 'ß'}, {'i', 'j', 'ÿ'},
263};
264
265unsigned int accent_table_size = 68;
diff --git a/drivers/tc/lk201-map.map b/drivers/tc/lk201-map.map
deleted file mode 100644
index 2c636b4b7823..000000000000
--- a/drivers/tc/lk201-map.map
+++ /dev/null
@@ -1,356 +0,0 @@
1# Default kernel keymap. This uses 7 modifier combinations.
2keymaps 0-2,4-5,8,12
3# Change the above line into
4# keymaps 0-2,4-6,8,12
5# in case you want the entries
6# altgr control keycode 83 = Boot
7# altgr control keycode 111 = Boot
8# below.
9#
10# In fact AltGr is used very little, and one more keymap can
11# be saved by mapping AltGr to Alt (and adapting a few entries):
12# keycode 100 = Alt
13#
14keycode 0x15 = grave tilde
15 alt keycode 0x15 = Escape
16 control keycode 0x15 = Meta_Escape
17keycode 0x16 = one exclam
18 alt keycode 0x16 = Meta_one
19keycode 0x17 = two at at
20 control keycode 0x17 = nul
21 shift control keycode 0x17 = nul
22 alt keycode 0x17 = Meta_two
23keycode 0x18 = three numbersign
24 control keycode 0x18 = Escape
25 alt keycode 0x18 = Meta_three
26keycode 0x19 = four dollar dollar
27 control keycode 0x19 = Control_backslash
28 alt keycode 0x19 = Meta_four
29keycode 0x1a = five percent
30 control keycode 0x1a = Control_bracketright
31 alt keycode 0x1a = Meta_five
32keycode 0x1b = six asciicircum
33 control keycode 0x1b = Control_asciicircum
34 alt keycode 0x1b = Meta_six
35keycode 0x1c = seven ampersand braceleft
36 control keycode 0x1c = Control_underscore
37 alt keycode 0x1c = Meta_seven
38keycode 0x1d = eight asterisk bracketleft
39 control keycode 0x1d = Delete
40 alt keycode 0x1d = Meta_eight
41keycode 0x1e = nine parenleft bracketright
42 alt keycode 0x1e = Meta_nine
43keycode 0x1f = zero parenright braceright
44 alt keycode 0x1f = Meta_zero
45keycode 0x20 = minus underscore backslash
46 control keycode 0x20 = Control_underscore
47 shift control keycode 0x20 = Control_underscore
48 alt keycode 0x20 = Meta_minus
49keycode 0x21 = equal plus
50 alt keycode 0x21 = Meta_equal
51keycode 0x22 = Delete Delete
52 control keycode 0x22 = BackSpace
53 alt keycode 0x22 = Meta_Delete
54keycode 0x2a = Tab Tab
55 alt keycode 0x2a = Meta_Tab
56keycode 0x2b = q
57keycode 0x2c = w
58keycode 0x2d = e
59 altgr keycode 0x2d = Hex_E
60keycode 0x2e = r
61keycode 0x2f = t
62keycode 0x30 = y
63keycode 0x31 = u
64keycode 0x32 = i
65keycode 0x33 = o
66keycode 0x34 = p
67keycode 0x35 = bracketleft braceleft
68 control keycode 0x35 = Escape
69 alt keycode 0x35 = Meta_bracketleft
70keycode 0x36 = bracketright braceright asciitilde
71 control keycode 0x36 = Control_bracketright
72 alt keycode 0x36 = Meta_bracketright
73keycode 0x37 = Return
74 alt keycode 0x37 = Meta_Control_m
75keycode 0x3f = Control
76keycode 0x41 = a
77 altgr keycode 0x41 = Hex_A
78keycode 0x42 = s
79keycode 0x43 = d
80 altgr keycode 0x43 = Hex_D
81keycode 0x44 = f
82 altgr keycode 0x44 = Hex_F
83keycode 0x45 = g
84keycode 0x46 = h
85keycode 0x47 = j
86keycode 0x48 = k
87keycode 0x49 = l
88keycode 0x4a = semicolon colon
89 alt keycode 0x4a = Meta_semicolon
90keycode 0x4b = apostrophe quotedbl
91 control keycode 0x4b = Control_g
92 alt keycode 0x4b = Meta_apostrophe
93# keycode 41 = grave asciitilde
94# control keycode 41 = nul
95# alt keycode 41 = Meta_grave
96keycode 0x52 = Shift
97keycode 0x4c = backslash bar
98 control keycode 0x4c = Control_backslash
99 alt keycode 0x4c = Meta_backslash
100keycode 0x53 = greater less
101keycode 0x54 = z
102keycode 0x55 = x
103keycode 0x56 = c
104 altgr keycode 0x56 = Hex_C
105keycode 0x57 = v
106keycode 0x58 = b
107 altgr keycode 0x58 = Hex_B
108keycode 0x59 = n
109keycode 0x5a = m
110keycode 0x5b = comma less
111 alt keycode 0x5b = Meta_comma
112keycode 0x5c = period greater
113 control keycode 0x5c = Compose
114 alt keycode 0x5c = Meta_period
115keycode 0x5d = slash question
116 control keycode 0x5d = Delete
117 alt keycode 0x5d = Meta_slash
118
119keycode 0x67 = Alt
120keycode 0x68 = space space
121 control keycode 0x68 = nul
122 alt keycode 0x68 = Meta_space
123keycode 0x40 = Caps_Lock
124keycode 0x01 = F1
125 control keycode 0x01 = F1
126 alt keycode 0x01 = Console_1
127 control alt keycode 0x01 = Console_1
128keycode 0x02 = F2
129 control keycode 0x02 = F2
130 alt keycode 0x02 = Console_2
131 control alt keycode 0x02 = Console_2
132keycode 0x03 = F3
133 control keycode 0x03 = F3
134 alt keycode 0x03 = Console_3
135 control alt keycode 0x03 = Console_3
136keycode 0x04 = F4
137 control keycode 0x04 = F4
138 alt keycode 0x04 = Console_4
139 control alt keycode 0x04 = Console_4
140keycode 0x05 = F5
141 control keycode 0x05 = F5
142 alt keycode 0x05 = Console_5
143 control alt keycode 0x05 = Console_5
144keycode 0x06 = F6
145 control keycode 0x06 = F6
146 alt keycode 0x06 = Console_6
147 control alt keycode 0x06 = Console_6
148keycode 0x07 = F7
149 control keycode 0x07 = F7
150 alt keycode 0x07 = Console_7
151 control alt keycode 0x07 = Console_7
152keycode 0x08 = F8
153 control keycode 0x08 = F8
154 alt keycode 0x08 = Console_8
155 control alt keycode 0x08 = Console_8
156keycode 0x09 = F9
157 control keycode 0x09 = F9
158 alt keycode 0x09 = Console_9
159 control alt keycode 0x09 = Console_9
160keycode 0x0a = F10
161 control keycode 0x0a = F10
162 alt keycode 0x0a = Console_10
163 control alt keycode 0x0a = Console_10
164keycode 0x0b = F11
165 control keycode 0x0b = F11
166 alt keycode 0x0b = Console_11
167 control alt keycode 0x0b = Console_11
168keycode 0x0c = F12
169 control keycode 0x0c = F12
170 alt keycode 0x0c = Console_12
171 control alt keycode 0x0c = Console_12
172keycode 0x0d = F13
173 control keycode 0x0d = F13
174 alt keycode 0x0d = Console_13
175 control alt keycode 0x0d = Console_13
176keycode 0x0e = F14
177 control keycode 0x0e = F14
178 alt keycode 0x0e = Console_14
179 control alt keycode 0x0e = Console_14
180
181keycode 0x11 = F17
182 control keycode 0x11 = F17
183 alt keycode 0x11 = Console_17
184 control alt keycode 0x11 = Console_17
185keycode 0x12 = F18
186 control keycode 0x12 = F18
187 alt keycode 0x12 = Console_18
188 control alt keycode 0x12 = Console_18
189keycode 0x13 = F19
190 control keycode 0x13 = F19
191 alt keycode 0x13 = Console_19
192 control alt keycode 0x13 = Console_19
193keycode 0x14 = F20
194 control keycode 0x14 = F20
195 alt keycode 0x14 = Console_20
196 control alt keycode 0x14 = Console_20
197
198
199keycode 0x3b = KP_7
200 alt keycode 0x3b = Ascii_7
201 altgr keycode 0x3b = Hex_7
202keycode 0x3c = KP_8
203 alt keycode 0x3c = Ascii_8
204 altgr keycode 0x3c = Hex_8
205keycode 0x3d = KP_9
206 alt keycode 0x3d = Ascii_9
207 altgr keycode 0x3d = Hex_9
208keycode 0x3e = KP_Subtract
209keycode 0x4e = KP_4
210 alt keycode 0x4e = Ascii_4
211 altgr keycode 0x4e = Hex_4
212keycode 0x4f = KP_5
213 alt keycode 0x4f = Ascii_5
214 altgr keycode 0x4f = Hex_5
215keycode 0x50 = KP_6
216 alt keycode 0x50 = Ascii_6
217 altgr keycode 0x50 = Hex_6
218keycode 0x62 = KP_1
219 alt keycode 0x62 = Ascii_1
220 altgr keycode 0x62 = Hex_1
221keycode 0x63 = KP_2
222 alt keycode 0x63 = Ascii_2
223 altgr keycode 0x63 = Hex_2
224keycode 0x64 = KP_3
225 alt keycode 0x64 = Ascii_3
226 altgr keycode 0x64 = Hex_3
227keycode 0x6b = KP_0
228 alt keycode 0x6b = Ascii_0
229 altgr keycode 0x6b = Hex_0
230keycode 0x6c = KP_Period
231# altgr control keycode 0x6c = Boot
232 control alt keycode 0x6c = Boot
233keycode 0x65 = KP_Enter
234
235keycode 0x3f = Control
236
237# keycode 100 = AltGr
238
239keycode 0x23 = Find
240keycode 0x4d = Up
241keycode 0x39 = Prior
242 shift keycode 0x39 = Scroll_Backward
243keycode 0x5f = Left
244 alt keycode 0x5f = Decr_Console
245keycode 0x61 = Right
246 alt keycode 0x61 = Incr_Console
247keycode 0x38 = Select
248keycode 0x60 = Down
249keycode 0x3a = Next
250 shift keycode 0x3a = Scroll_Forward
251keycode 0x24 = Insert
252keycode 0x25 = Remove
253# altgr control keycode 0x25 = Boot
254 control alt keycode 0x25 = Boot
255
256keycode 0x0f = Help Show_Memory Show_Registers
257 control keycode 0x0f = Show_State
258
259keycode 0x10 = Do
260
261string F1 = "\033[[A"
262string F2 = "\033[[B"
263string F3 = "\033[[C"
264string F4 = "\033[[D"
265string F5 = "\033[[E"
266string F6 = "\033[17~"
267string F7 = "\033[18~"
268string F8 = "\033[19~"
269string F9 = "\033[20~"
270string F10 = "\033[21~"
271string F11 = "\033[23~"
272string F12 = "\033[24~"
273string F13 = "\033[25~"
274string F14 = "\033[26~"
275string F15 = "\033[28~"
276string F16 = "\033[29~"
277string F17 = "\033[31~"
278string F18 = "\033[32~"
279string F19 = "\033[33~"
280string F20 = "\033[34~"
281string Find = "\033[1~"
282string Insert = "\033[2~"
283string Remove = "\033[3~"
284string Select = "\033[4~"
285string Prior = "\033[5~"
286string Next = "\033[6~"
287string Macro = "\033[M"
288string Pause = "\033[P"
289compose '`' 'A' to 'À'
290compose '`' 'a' to 'à'
291compose '\'' 'A' to 'Á'
292compose '\'' 'a' to 'á'
293compose '^' 'A' to 'Â'
294compose '^' 'a' to 'â'
295compose '~' 'A' to 'Ã'
296compose '~' 'a' to 'ã'
297compose '"' 'A' to 'Ä'
298compose '"' 'a' to 'ä'
299compose 'O' 'A' to 'Å'
300compose 'o' 'a' to 'å'
301compose '0' 'A' to 'Å'
302compose '0' 'a' to 'å'
303compose 'A' 'A' to 'Å'
304compose 'a' 'a' to 'å'
305compose 'A' 'E' to 'Æ'
306compose 'a' 'e' to 'æ'
307compose ',' 'C' to 'Ç'
308compose ',' 'c' to 'ç'
309compose '`' 'E' to 'È'
310compose '`' 'e' to 'è'
311compose '\'' 'E' to 'É'
312compose '\'' 'e' to 'é'
313compose '^' 'E' to 'Ê'
314compose '^' 'e' to 'ê'
315compose '"' 'E' to 'Ë'
316compose '"' 'e' to 'ë'
317compose '`' 'I' to 'Ì'
318compose '`' 'i' to 'ì'
319compose '\'' 'I' to 'Í'
320compose '\'' 'i' to 'í'
321compose '^' 'I' to 'Î'
322compose '^' 'i' to 'î'
323compose '"' 'I' to 'Ï'
324compose '"' 'i' to 'ï'
325compose '-' 'D' to 'Ð'
326compose '-' 'd' to 'ð'
327compose '~' 'N' to 'Ñ'
328compose '~' 'n' to 'ñ'
329compose '`' 'O' to 'Ò'
330compose '`' 'o' to 'ò'
331compose '\'' 'O' to 'Ó'
332compose '\'' 'o' to 'ó'
333compose '^' 'O' to 'Ô'
334compose '^' 'o' to 'ô'
335compose '~' 'O' to 'Õ'
336compose '~' 'o' to 'õ'
337compose '"' 'O' to 'Ö'
338compose '"' 'o' to 'ö'
339compose '/' 'O' to 'Ø'
340compose '/' 'o' to 'ø'
341compose '`' 'U' to 'Ù'
342compose '`' 'u' to 'ù'
343compose '\'' 'U' to 'Ú'
344compose '\'' 'u' to 'ú'
345compose '^' 'U' to 'Û'
346compose '^' 'u' to 'û'
347compose '"' 'U' to 'Ü'
348compose '"' 'u' to 'ü'
349compose '\'' 'Y' to 'Ý'
350compose '\'' 'y' to 'ý'
351compose 'T' 'H' to 'Þ'
352compose 't' 'h' to 'þ'
353compose 's' 's' to 'ß'
354compose '"' 'y' to 'ÿ'
355compose 's' 'z' to 'ß'
356compose 'i' 'j' to 'ÿ'
diff --git a/drivers/tc/lk201-remap.c b/drivers/tc/lk201-remap.c
deleted file mode 100644
index d39098c2720e..000000000000
--- a/drivers/tc/lk201-remap.c
+++ /dev/null
@@ -1,172 +0,0 @@
1/*
2 * Keyboard mappings for DEC LK201/401/501 keyboards
3 *
4 * 17.05.99 Michael Engel (engel@unix-ag.org)
5 *
6 * DEC US keyboards generate keycodes in the range 0x55 - 0xfb
7 *
8 * This conflicts with Linux scancode conventions which define
9 * 0x00-0x7f as "normal" and 0x80-0xff as "shifted" scancodes, so we
10 * have to remap the keycodes to 0x00-0x7f with the scancodeRemap
11 * array. The generated scancode is simply the number of the key counted
12 * from the left upper to the right lower corner of the keyboard ...
13 *
14 * These scancodes are then being remapped (I hope ;-)) with the
15 * lk501*map[] arrays which define scancode -> Linux code mapping
16 *
17 * Oh man is this horrible ;-)
18 *
19 * Scancodes with dual labels exist for keyboards as follows:
20 *
21 * code: left label / right label
22 *
23 * 0x73: LKx01, LK421 / LK443, LK444
24 * 0x74: LKx01, LK421 / LK443, LK444
25 * 0x7c: LKx01, LK421 / LK443, LK444
26 * 0x8a: LKx01, LK421 / LK443, LK444
27 * 0x8b: LKx01, LK421 / LK443, LK444
28 * 0x8c: LKx01, LK421 / LK443, LK444
29 * 0x8d: LKx01, LK421 / LK443, LK444
30 * 0x8e: LKx01, LK421 / LK443, LK444
31 * 0x8f: LKx01, LK421 / LK443, LK444
32 * 0x9c: LKx01, LK421 / LK443, LK444
33 * 0xa1: LKx01, LK421 / LK443, LK444
34 * 0xa2: LKx01, LK421 / LK443, LK444
35 * 0xa3: LKx01, LK421 / LK443, LK444
36 * 0xa4: LKx01, LK421 / LK443, LK444
37 * 0xad: LK421 / LK443, LK444
38 * 0xc9: LKx01, LK421, LK443 / LK444
39 * 0xf7: LKx01, LK443 / LK444
40 */
41
42unsigned char scancodeRemap[256] = {
43/* ----- */
44/* 0 */ 0, 0, 0, 0,
45/* ----- */
46/* 4 */ 0, 0, 0, 0,
47/* ----- */
48/* 8 */ 0, 0, 0, 0,
49/* ----- */
50/* c */ 0, 0, 0, 0,
51/* ----- */
52/* 10 */ 0, 0, 0, 0,
53/* ----- */
54/* 14 */ 0, 0, 0, 0,
55/* ----- */
56/* 18 */ 0, 0, 0, 0,
57/* ----- */
58/* 1c */ 0, 0, 0, 0,
59/* ----- */
60/* 20 */ 0, 0, 0, 0,
61/* ----- */
62/* 24 */ 0, 0, 0, 0,
63/* ----- */
64/* 28 */ 0, 0, 0, 0,
65/* ----- */
66/* 2c */ 0, 0, 0, 0,
67/* ----- */
68/* 30 */ 0, 0, 0, 0,
69/* ----- */
70/* 34 */ 0, 0, 0, 0,
71/* ----- */
72/* 38 */ 0, 0, 0, 0,
73/* ----- */
74/* 3c */ 0, 0, 0, 0,
75/* ----- */
76/* 40 */ 0, 0, 0, 0,
77/* ----- */
78/* 44 */ 0, 0, 0, 0,
79/* ----- */
80/* 48 */ 0, 0, 0, 0,
81/* ----- */
82/* 4c */ 0, 0, 0, 0,
83/* ----- */
84/* 50 */ 0, 0, 0, 0,
85/* ----- ESC F1 F2 */
86/* 54 */ 0, 0, 0x01, 0x02,
87/* ----- F3 F4 F5 */
88/* 58 */ 0x03, 0x04, 0x05, 0,
89/* ----- */
90/* 5c */ 0, 0, 0, 0,
91/* ----- */
92/* 60 */ 0, 0, 0, 0,
93/* ----- F6 F7 F8 F9 */
94/* 64 */ 0x06, 0x07, 0x08, 0x09,
95/* ----- F10 */
96/* 68 */ 0x0a, 0, 0, 0,
97/* ----- */
98/* 6c */ 0, 0, 0, 0,
99/* ----- F11 F12 F13/PRNT SCRN */
100/* 70 */ 0, 0x0b, 0x0c, 0x0d,
101/* ----- F14/SCRL LCK */
102/* 74 */ 0x0e, 0, 0, 0,
103/* ----- */
104/* 78 */ 0, 0, 0, 0,
105/* ----- HELP/PAUSE DO */
106/* 7c */ 0x0f, 0x10, 0, 0,
107/* ----- F17 F18 F19 F20 */
108/* 80 */ 0x11, 0x12, 0x13, 0x14,
109/* ----- */
110/* 84 */ 0, 0, 0, 0,
111/* ----- FIND/INSERT INSERT/HOME */
112/* 88 */ 0, 0, 0x23, 0x24,
113/* ----- REMOVE/PG UP SELECT/DELETE PREVIOUS/END NEXT/PG DN */
114/* 8c */ 0x25, 0x38, 0x39, 0x3a,
115/* ----- KP 0 */
116/* 90 */ 0, 0, 0x6b, 0,
117/* ----- KP . KP ENTER KP 1 KP 2 */
118/* 94 */ 0x6c, 0x65, 0x62, 0x63,
119/* ----- KP 3 KP 4 KP 5 KP 6 */
120/* 98 */ 0x64, 0x4e, 0x4f, 0x50,
121/* ----- KP ,/KP + KP 7 KP 8 KP 9 */
122/* 9c */ 0x51, 0x3b, 0x3c, 0x3d,
123/* ----- KP - KP F1/NUM LCK KP F2/KP / KP F3/KP * */
124/* a0 */ 0x3e, 0x26, 0x27, 0x28,
125/* ----- KP F4/KP - LEFT */
126/* a4 */ 0x29, 0, 0, 0x5f,
127/* ----- RIGHT DOWN UP SHIFT Rt */
128/* a8 */ 0x61, 0x60, 0x4d, 0x5e,
129/* ----- ALT COMP Rt/CTRL Rt SHIFT CONTROL */
130/* ac */ 0, 0, 0x52, 0x3f,
131/* ----- CAPS COMPOSE ALT Rt */
132/* b0 */ 0x40, 0x67, 0, 0,
133/* ----- */
134/* b4 */ 0, 0, 0, 0,
135/* ----- */
136/* b8 */ 0, 0, 0, 0,
137/* ----- BKSP RET TAB ` */
138/* bc */ 0x22, 0x37, 0x2a, 0x15,
139/* ----- 1 q a z */
140/* c0 */ 0x16, 0x2b, 0x41, 0x54,
141/* ----- 2 w s */
142/* c4 */ 0, 0x17, 0x2c, 0x42,
143/* ----- x </\\ 3 */
144/* c8 */ 0x55, 0x53, 0, 0x18,
145/* ----- e d c */
146/* cc */ 0x2d, 0x43, 0x56, 0,
147/* ----- 4 r f v */
148/* d0 */ 0x19, 0x2e, 0x44, 0x57,
149/* ----- SPACE 5 t */
150/* d4 */ 0x68, 0, 0x1a, 0x2f,
151/* ----- g b 6 */
152/* d8 */ 0x45, 0x58, 0, 0x1b,
153/* ----- y h n */
154/* dc */ 0x30, 0x46, 0x59, 0,
155/* ----- 7 u j m */
156/* e0 */ 0x1c, 0x31, 0x47, 0x5a,
157/* ----- 8 i k */
158/* e4 */ 0, 0x1d, 0x32, 0x48,
159/* ----- , 9 o */
160/* e8 */ 0x5b, 0, 0x1e, 0x33,
161/* ----- l . 0 */
162/* ec */ 0x49, 0x5c, 0, 0x1f,
163/* ----- p ; / */
164/* f0 */ 0x34, 0, 0x4a, 0x5d,
165/* ----- = ] \\/\' */
166/* f4 */ 0, 0x21, 0x36, 0x4c,
167/* ----- - [ \' */
168/* f8 */ 0, 0x20, 0x35, 0x4b,
169/* ----- */
170/* fc */ 0, 0, 0, 0,
171};
172
diff --git a/drivers/tc/lk201.c b/drivers/tc/lk201.c
deleted file mode 100644
index a90c255f079d..000000000000
--- a/drivers/tc/lk201.c
+++ /dev/null
@@ -1,439 +0,0 @@
1/*
2 *
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1999-2002 Harald Koerfgen <hkoerfg@web.de>
8 * Copyright (C) 2001, 2002, 2003, 2004 Maciej W. Rozycki
9 */
10
11
12#include <linux/errno.h>
13#include <linux/tty.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/delay.h>
17#include <linux/kbd_ll.h>
18#include <linux/kbd_kern.h>
19#include <linux/vt_kern.h>
20
21#include <asm/keyboard.h>
22#include <asm/dec/tc.h>
23#include <asm/dec/machtype.h>
24#include <asm/dec/serial.h>
25
26#include "lk201.h"
27
28/*
29 * Only handle DECstations that have an LK201 interface.
30 * Maxine uses LK501 at the Access.Bus and various DECsystems
31 * have no keyboard interface at all.
32 */
33#define LK_IFACE (mips_machtype == MACH_DS23100 || \
34 mips_machtype == MACH_DS5000_200 || \
35 mips_machtype == MACH_DS5000_1XX || \
36 mips_machtype == MACH_DS5000_2X0)
37/*
38 * These use the Z8530 SCC. Others use the DZ11.
39 */
40#define LK_IFACE_ZS (mips_machtype == MACH_DS5000_1XX || \
41 mips_machtype == MACH_DS5000_2X0)
42
43/* Simple translation table for the SysRq keys */
44
45#ifdef CONFIG_MAGIC_SYSRQ
46/*
47 * Actually no translation at all, at least until we figure out
48 * how to define SysRq for LK201 and friends. --macro
49 */
50unsigned char lk201_sysrq_xlate[128];
51unsigned char *kbd_sysrq_xlate = lk201_sysrq_xlate;
52
53unsigned char kbd_sysrq_key = -1;
54#endif
55
56#define KEYB_LINE 3
57
58static int __init lk201_init(void *);
59static void __init lk201_info(void *);
60static void lk201_rx_char(unsigned char, unsigned char);
61
62static struct dec_serial_hook lk201_hook = {
63 .init_channel = lk201_init,
64 .init_info = lk201_info,
65 .rx_char = NULL,
66 .poll_rx_char = NULL,
67 .poll_tx_char = NULL,
68 .cflags = B4800 | CS8 | CSTOPB | CLOCAL,
69};
70
71/*
72 * This is used during keyboard initialisation
73 */
74static unsigned char lk201_reset_string[] = {
75 LK_CMD_SET_DEFAULTS,
76 LK_CMD_MODE(LK_MODE_RPT_DOWN, 1),
77 LK_CMD_MODE(LK_MODE_RPT_DOWN, 2),
78 LK_CMD_MODE(LK_MODE_RPT_DOWN, 3),
79 LK_CMD_MODE(LK_MODE_RPT_DOWN, 4),
80 LK_CMD_MODE(LK_MODE_DOWN_UP, 5),
81 LK_CMD_MODE(LK_MODE_DOWN_UP, 6),
82 LK_CMD_MODE(LK_MODE_RPT_DOWN, 7),
83 LK_CMD_MODE(LK_MODE_RPT_DOWN, 8),
84 LK_CMD_MODE(LK_MODE_RPT_DOWN, 9),
85 LK_CMD_MODE(LK_MODE_RPT_DOWN, 10),
86 LK_CMD_MODE(LK_MODE_RPT_DOWN, 11),
87 LK_CMD_MODE(LK_MODE_RPT_DOWN, 12),
88 LK_CMD_MODE(LK_MODE_DOWN, 13),
89 LK_CMD_MODE(LK_MODE_RPT_DOWN, 14),
90 LK_CMD_DIS_KEYCLK,
91 LK_CMD_ENB_BELL, LK_PARAM_VOLUME(4),
92};
93
94static void *lk201_handle;
95
96static int lk201_send(unsigned char ch)
97{
98 if (lk201_hook.poll_tx_char(lk201_handle, ch)) {
99 printk(KERN_ERR "lk201: transmit timeout\n");
100 return -EIO;
101 }
102 return 0;
103}
104
105static inline int lk201_get_id(void)
106{
107 return lk201_send(LK_CMD_REQ_ID);
108}
109
110static int lk201_reset(void)
111{
112 int i, r;
113
114 for (i = 0; i < sizeof(lk201_reset_string); i++) {
115 r = lk201_send(lk201_reset_string[i]);
116 if (r < 0)
117 return r;
118 }
119 return 0;
120}
121
122static void lk201_report(unsigned char id[6])
123{
124 char *report = "lk201: keyboard attached, ";
125
126 switch (id[2]) {
127 case LK_STAT_PWRUP_OK:
128 printk(KERN_INFO "%sself-test OK\n", report);
129 break;
130 case LK_STAT_PWRUP_KDOWN:
131 /* The keyboard will resend the power-up ID
132 after all keys are released, so we don't
133 bother handling the error specially. Still
134 there may be a short-circuit inside.
135 */
136 printk(KERN_ERR "%skey down (stuck?), code: 0x%02x\n",
137 report, id[3]);
138 break;
139 case LK_STAT_PWRUP_ERROR:
140 printk(KERN_ERR "%sself-test failure\n", report);
141 break;
142 default:
143 printk(KERN_ERR "%sunknown error: 0x%02x\n",
144 report, id[2]);
145 }
146}
147
148static void lk201_id(unsigned char id[6])
149{
150 /*
151 * Report whether there is an LK201 or an LK401
152 * The LK401 has ALT keys...
153 */
154 switch (id[4]) {
155 case 1:
156 printk(KERN_INFO "lk201: LK201 detected\n");
157 break;
158 case 2:
159 printk(KERN_INFO "lk201: LK401 detected\n");
160 break;
161 case 3:
162 printk(KERN_INFO "lk201: LK443 detected\n");
163 break;
164 case 4:
165 printk(KERN_INFO "lk201: LK421 detected\n");
166 break;
167 default:
168 printk(KERN_WARNING
169 "lk201: unknown keyboard detected, ID %d\n", id[4]);
170 printk(KERN_WARNING "lk201: ... please report to "
171 "<linux-mips@linux-mips.org>\n");
172 }
173}
174
175#define DEFAULT_KEYB_REP_DELAY (250/5) /* [5ms] */
176#define DEFAULT_KEYB_REP_RATE 30 /* [cps] */
177
178static struct kbd_repeat kbdrate = {
179 DEFAULT_KEYB_REP_DELAY,
180 DEFAULT_KEYB_REP_RATE
181};
182
183static void parse_kbd_rate(struct kbd_repeat *r)
184{
185 if (r->delay <= 0)
186 r->delay = kbdrate.delay;
187 if (r->rate <= 0)
188 r->rate = kbdrate.rate;
189
190 if (r->delay < 5)
191 r->delay = 5;
192 if (r->delay > 630)
193 r->delay = 630;
194 if (r->rate < 12)
195 r->rate = 12;
196 if (r->rate > 127)
197 r->rate = 127;
198 if (r->rate == 125)
199 r->rate = 124;
200}
201
202static int write_kbd_rate(struct kbd_repeat *rep)
203{
204 int delay, rate;
205 int i;
206
207 delay = rep->delay / 5;
208 rate = rep->rate;
209 for (i = 0; i < 4; i++) {
210 if (lk201_hook.poll_tx_char(lk201_handle,
211 LK_CMD_RPT_RATE(i)))
212 return 1;
213 if (lk201_hook.poll_tx_char(lk201_handle,
214 LK_PARAM_DELAY(delay)))
215 return 1;
216 if (lk201_hook.poll_tx_char(lk201_handle,
217 LK_PARAM_RATE(rate)))
218 return 1;
219 }
220 return 0;
221}
222
223static int lk201_kbd_rate(struct kbd_repeat *rep)
224{
225 if (rep == NULL)
226 return -EINVAL;
227
228 parse_kbd_rate(rep);
229
230 if (write_kbd_rate(rep)) {
231 memcpy(rep, &kbdrate, sizeof(struct kbd_repeat));
232 return -EIO;
233 }
234
235 memcpy(&kbdrate, rep, sizeof(struct kbd_repeat));
236
237 return 0;
238}
239
240static void lk201_kd_mksound(unsigned int hz, unsigned int ticks)
241{
242 if (!ticks)
243 return;
244
245 /*
246 * Can't set frequency and we "approximate"
247 * duration by volume. ;-)
248 */
249 ticks /= HZ / 32;
250 if (ticks > 7)
251 ticks = 7;
252 ticks = 7 - ticks;
253
254 if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_ENB_BELL))
255 return;
256 if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_VOLUME(ticks)))
257 return;
258 if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_BELL))
259 return;
260}
261
262void kbd_leds(unsigned char leds)
263{
264 unsigned char l = 0;
265
266 if (!lk201_handle) /* FIXME */
267 return;
268
269 /* FIXME -- Only Hold and Lock LEDs for now. --macro */
270 if (leds & LED_SCR)
271 l |= LK_LED_HOLD;
272 if (leds & LED_CAP)
273 l |= LK_LED_LOCK;
274
275 if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_ON))
276 return;
277 if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(l)))
278 return;
279 if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_OFF))
280 return;
281 if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(~l)))
282 return;
283}
284
285int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
286{
287 return -EINVAL;
288}
289
290int kbd_getkeycode(unsigned int scancode)
291{
292 return -EINVAL;
293}
294
295int kbd_translate(unsigned char scancode, unsigned char *keycode,
296 char raw_mode)
297{
298 *keycode = scancode;
299 return 1;
300}
301
302char kbd_unexpected_up(unsigned char keycode)
303{
304 return 0x80;
305}
306
307static void lk201_rx_char(unsigned char ch, unsigned char fl)
308{
309 static unsigned char id[6];
310 static int id_i;
311
312 static int shift_state = 0;
313 static int prev_scancode;
314 unsigned char c = scancodeRemap[ch];
315
316 if (fl != TTY_NORMAL && fl != TTY_OVERRUN) {
317 printk(KERN_ERR "lk201: keyboard receive error: 0x%02x\n", fl);
318 return;
319 }
320
321 /* Assume this is a power-up ID. */
322 if (ch == LK_STAT_PWRUP_ID && !id_i) {
323 id[id_i++] = ch;
324 return;
325 }
326
327 /* Handle the power-up sequence. */
328 if (id_i) {
329 id[id_i++] = ch;
330 if (id_i == 4) {
331 /* OK, the power-up concluded. */
332 lk201_report(id);
333 if (id[2] == LK_STAT_PWRUP_OK)
334 lk201_get_id();
335 else {
336 id_i = 0;
337 printk(KERN_ERR "lk201: keyboard power-up "
338 "error, skipping initialization\n");
339 }
340 } else if (id_i == 6) {
341 /* We got the ID; report it and start operation. */
342 id_i = 0;
343 lk201_id(id);
344 lk201_reset();
345 }
346 return;
347 }
348
349 /* Everything else is a scancode/status response. */
350 id_i = 0;
351 switch (ch) {
352 case LK_STAT_RESUME_ERR:
353 case LK_STAT_ERROR:
354 case LK_STAT_INHIBIT_ACK:
355 case LK_STAT_TEST_ACK:
356 case LK_STAT_MODE_KEYDOWN:
357 case LK_STAT_MODE_ACK:
358 break;
359 case LK_KEY_LOCK:
360 shift_state ^= LK_LOCK;
361 handle_scancode(c, (shift_state & LK_LOCK) ? 1 : 0);
362 break;
363 case LK_KEY_SHIFT:
364 shift_state ^= LK_SHIFT;
365 handle_scancode(c, (shift_state & LK_SHIFT) ? 1 : 0);
366 break;
367 case LK_KEY_CTRL:
368 shift_state ^= LK_CTRL;
369 handle_scancode(c, (shift_state & LK_CTRL) ? 1 : 0);
370 break;
371 case LK_KEY_COMP:
372 shift_state ^= LK_COMP;
373 handle_scancode(c, (shift_state & LK_COMP) ? 1 : 0);
374 break;
375 case LK_KEY_RELEASE:
376 if (shift_state & LK_SHIFT)
377 handle_scancode(scancodeRemap[LK_KEY_SHIFT], 0);
378 if (shift_state & LK_CTRL)
379 handle_scancode(scancodeRemap[LK_KEY_CTRL], 0);
380 if (shift_state & LK_COMP)
381 handle_scancode(scancodeRemap[LK_KEY_COMP], 0);
382 if (shift_state & LK_LOCK)
383 handle_scancode(scancodeRemap[LK_KEY_LOCK], 0);
384 shift_state = 0;
385 break;
386 case LK_KEY_REPEAT:
387 handle_scancode(prev_scancode, 1);
388 break;
389 default:
390 prev_scancode = c;
391 handle_scancode(c, 1);
392 break;
393 }
394 tasklet_schedule(&keyboard_tasklet);
395}
396
397static void __init lk201_info(void *handle)
398{
399}
400
401static int __init lk201_init(void *handle)
402{
403 /* First install handlers. */
404 lk201_handle = handle;
405 kbd_rate = lk201_kbd_rate;
406 kd_mksound = lk201_kd_mksound;
407
408 lk201_hook.rx_char = lk201_rx_char;
409
410 /* Then just issue a reset -- the handlers will do the rest. */
411 lk201_send(LK_CMD_POWER_UP);
412
413 return 0;
414}
415
416void __init kbd_init_hw(void)
417{
418 /* Maxine uses LK501 at the Access.Bus. */
419 if (!LK_IFACE)
420 return;
421
422 printk(KERN_INFO "lk201: DECstation LK keyboard driver v0.05.\n");
423
424 if (LK_IFACE_ZS) {
425 /*
426 * kbd_init_hw() is being called before
427 * rs_init() so just register the kbd hook
428 * and let zs_init do the rest :-)
429 */
430 if (!register_dec_serial_hook(KEYB_LINE, &lk201_hook))
431 unregister_dec_serial_hook(KEYB_LINE);
432 } else {
433 /*
434 * TODO: modify dz.c to allow similar hooks
435 * for LK201 handling on DS2100, DS3100, and DS5000/200
436 */
437 printk(KERN_ERR "lk201: support for DZ11 not yet ready.\n");
438 }
439}
diff --git a/drivers/tc/lk201.h b/drivers/tc/lk201.h
deleted file mode 100644
index 99f3203c41b8..000000000000
--- a/drivers/tc/lk201.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Commands to the keyboard processor
3 */
4
5#define LK_PARAM 0x80 /* start/end parameter list */
6
7#define LK_CMD_RESUME 0x8b /* resume transmission to the host */
8#define LK_CMD_INHIBIT 0x89 /* stop transmission to the host */
9#define LK_CMD_LEDS_ON 0x13 /* light LEDs */
10 /* 1st param: led bitmask */
11#define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */
12 /* 1st param: led bitmask */
13#define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */
14#define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick */
15 /* 1st param: volume */
16#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */
17#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */
18#define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick */
19#define LK_CMD_DIS_BELL 0xa1 /* disable the bell */
20#define LK_CMD_ENB_BELL 0x23 /* enable the bell */
21 /* 1st param: volume */
22#define LK_CMD_BELL 0xa7 /* emit a bell */
23#define LK_CMD_TMP_NORPT 0xd1 /* disable typematic */
24 /* for the currently pressed key */
25#define LK_CMD_ENB_RPT 0xe3 /* enable typematic */
26 /* for RPT_DOWN groups */
27#define LK_CMD_DIS_RPT 0xe1 /* disable typematic */
28 /* for RPT_DOWN groups */
29#define LK_CMD_RPT_TO_DOWN 0xd9 /* set RPT_DOWN groups to DOWN */
30#define LK_CMD_REQ_ID 0xab /* request the keyboard ID */
31#define LK_CMD_POWER_UP 0xfd /* init power-up sequence */
32#define LK_CMD_TEST_MODE 0xcb /* enter the factory test mode */
33#define LK_CMD_TEST_EXIT 0x80 /* exit the factory test mode */
34#define LK_CMD_SET_DEFAULTS 0xd3 /* set power-up defaults */
35
36#define LK_CMD_MODE(m,div) (LK_PARAM|(((div)&0xf)<<3)|(((m)&0x3)<<1))
37 /* select the repeat mode */
38 /* for the selected key group */
39#define LK_CMD_MODE_AR(m,div) ((((div)&0xf)<<3)|(((m)&0x3)<<1))
40 /* select the repeat mode */
41 /* and the repeat register */
42 /* for the selected key group */
43 /* 1st param: register number */
44#define LK_CMD_RPT_RATE(r) (0x78|(((r)&0x3)<<1))
45 /* set the delay and repeat rate */
46 /* for the selected repeat register */
47 /* 1st param: initial delay */
48 /* 2nd param: repeat rate */
49
50/* there are 4 leds, represent them in the low 4 bits of a byte */
51#define LK_PARAM_LED_MASK(ledbmap) (LK_PARAM|((ledbmap)&0xf))
52#define LK_LED_WAIT 0x1 /* Wait LED */
53#define LK_LED_COMP 0x2 /* Compose LED */
54#define LK_LED_LOCK 0x4 /* Lock LED */
55#define LK_LED_HOLD 0x8 /* Hold Screen LED */
56
57/* max volume is 0, lowest is 0x7 */
58#define LK_PARAM_VOLUME(v) (LK_PARAM|((v)&0x7))
59
60/* mode set command details, div is a key group number */
61#define LK_MODE_DOWN 0x0 /* make only */
62#define LK_MODE_RPT_DOWN 0x1 /* make and typematic */
63#define LK_MODE_DOWN_UP 0x3 /* make and release */
64
65/* there are 4 repeat registers */
66#define LK_PARAM_AR(r) (LK_PARAM|((v)&0x3))
67
68/*
69 * Mappings between key groups and keycodes are as follows:
70 *
71 * 1: 0xbf - 0xff -- alphanumeric,
72 * 2: 0x91 - 0xa5 -- numeric keypad,
73 * 3: 0xbc -- Backspace,
74 * 4: 0xbd - 0xbe -- Tab, Return,
75 * 5: 0xb0 - 0xb2 -- Lock, Compose Character,
76 * 6: 0xad - 0xaf -- Ctrl, Shift,
77 * 7: 0xa6 - 0xa8 -- Left Arrow, Right Arrow,
78 * 8: 0xa9 - 0xac -- Up Arrow, Down Arrow, Right Shift,
79 * 9: 0x88 - 0x90 -- editor keypad,
80 * 10: 0x56 - 0x62 -- F1 - F5,
81 * 11: 0x63 - 0x6e -- F6 - F10,
82 * 12: 0x6f - 0x7a -- F11 - F14,
83 * 13: 0x7b - 0x7d -- Help, Do,
84 * 14: 0x7e - 0x87 -- F17 - F20.
85 *
86 * Notes:
87 * 1. Codes in the 0x00 - 0x40 range are reserved.
88 * 2. The assignment of the 0x41 - 0x55 range is undiscovered, probably 10.
89 */
90
91/* delay is 5 - 630 ms; 0x00 and 0x7f are reserved */
92#define LK_PARAM_DELAY(t) ((t)&0x7f)
93
94/* rate is 12 - 127 Hz; 0x00 - 0x0b and 0x7d (power-up!) are reserved */
95#define LK_PARAM_RATE(r) (LK_PARAM|((r)&0x7f))
96
97#define LK_SHIFT 1<<0
98#define LK_CTRL 1<<1
99#define LK_LOCK 1<<2
100#define LK_COMP 1<<3
101
102#define LK_KEY_SHIFT 0xae
103#define LK_KEY_CTRL 0xaf
104#define LK_KEY_LOCK 0xb0
105#define LK_KEY_COMP 0xb1
106
107#define LK_KEY_RELEASE 0xb3 /* all keys released */
108#define LK_KEY_REPEAT 0xb4 /* repeat the last key */
109
110/* status responses */
111#define LK_STAT_RESUME_ERR 0xb5 /* keystrokes lost while inhibited */
112#define LK_STAT_ERROR 0xb6 /* an invalid command received */
113#define LK_STAT_INHIBIT_ACK 0xb7 /* transmission inhibited */
114#define LK_STAT_TEST_ACK 0xb8 /* the factory test mode entered */
115#define LK_STAT_MODE_KEYDOWN 0xb9 /* a key is down on a change */
116 /* to the DOWN_UP mode; */
117 /* the keycode follows */
118#define LK_STAT_MODE_ACK 0xba /* the mode command succeeded */
119
120#define LK_STAT_PWRUP_ID 0x01 /* the power-up response start mark */
121#define LK_STAT_PWRUP_OK 0x00 /* the power-up self test OK */
122#define LK_STAT_PWRUP_KDOWN 0x3d /* a key was down during the test */
123#define LK_STAT_PWRUP_ERROR 0x3e /* keyboard self test failure */
124
125extern unsigned char scancodeRemap[256];
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c99938d5f78e..69aa68287d3f 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -982,7 +982,6 @@ EXPORT_SYMBOL(usb_altnum_to_altsetting);
982 982
983EXPORT_SYMBOL(__usb_get_extra_descriptor); 983EXPORT_SYMBOL(__usb_get_extra_descriptor);
984 984
985EXPORT_SYMBOL(usb_find_device);
986EXPORT_SYMBOL(usb_get_current_frame_number); 985EXPORT_SYMBOL(usb_get_current_frame_number);
987 986
988EXPORT_SYMBOL(usb_buffer_alloc); 987EXPORT_SYMBOL(usb_buffer_alloc);
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index ebb04ac4857b..5e3e4e9b6c77 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -87,7 +87,7 @@ struct mon_reader_text {
87 87
88static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */ 88static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */
89 89
90static void mon_text_ctor(void *, struct kmem_cache *, unsigned long); 90static void mon_text_ctor(struct kmem_cache *, void *);
91 91
92struct mon_text_ptr { 92struct mon_text_ptr {
93 int cnt, limit; 93 int cnt, limit;
@@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus)
720/* 720/*
721 * Slab interface: constructor. 721 * Slab interface: constructor.
722 */ 722 */
723static void mon_text_ctor(void *mem, struct kmem_cache *slab, unsigned long sflags) 723static void mon_text_ctor(struct kmem_cache *slab, void *mem)
724{ 724{
725 /* 725 /*
726 * Nothing to initialize. No, really! 726 * Nothing to initialize. No, really!
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c
index 06d1107dbd47..55b952084f0c 100644
--- a/drivers/usb/storage/libusual.c
+++ b/drivers/usb/storage/libusual.c
@@ -30,7 +30,7 @@ static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS);
30#define BIAS_NAME_SIZE (sizeof("usb-storage")) 30#define BIAS_NAME_SIZE (sizeof("usb-storage"))
31static const char *bias_names[3] = { "none", "usb-storage", "ub" }; 31static const char *bias_names[3] = { "none", "usb-storage", "ub" };
32 32
33static DECLARE_MUTEX_LOCKED(usu_init_notify); 33static struct semaphore usu_init_notify;
34static DECLARE_COMPLETION(usu_end_notify); 34static DECLARE_COMPLETION(usu_end_notify);
35static atomic_t total_threads = ATOMIC_INIT(0); 35static atomic_t total_threads = ATOMIC_INIT(0);
36 36
@@ -204,6 +204,8 @@ static int __init usb_usual_init(void)
204{ 204{
205 int rc; 205 int rc;
206 206
207 sema_init(&usu_init_notify, 0);
208
207 rc = usb_register(&usu_driver); 209 rc = usb_register(&usu_driver);
208 up(&usu_init_notify); 210 up(&usu_init_notify);
209 return rc; 211 return rc;
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index d9315d99445f..b63860f7beab 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -18,8 +18,8 @@
18 */ 18 */
19 19
20#if defined(__arm__) 20#if defined(__arm__)
21#define DUMMY_COLUMNS ORIG_VIDEO_COLS 21#define DUMMY_COLUMNS screen_info.orig_video_cols
22#define DUMMY_ROWS ORIG_VIDEO_LINES 22#define DUMMY_ROWS screen_info.orig_video_lines
23#elif defined(__hppa__) 23#elif defined(__hppa__)
24/* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ 24/* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */
25#define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS 25#define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index e9afb7ebd566..f65bcd314d54 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -362,7 +362,7 @@ static const char *vgacon_startup(void)
362 u16 saved1, saved2; 362 u16 saved1, saved2;
363 volatile u16 *p; 363 volatile u16 *p;
364 364
365 if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) { 365 if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) {
366 no_vga: 366 no_vga:
367#ifdef CONFIG_DUMMY_CONSOLE 367#ifdef CONFIG_DUMMY_CONSOLE
368 conswitchp = &dummy_con; 368 conswitchp = &dummy_con;
@@ -372,29 +372,30 @@ static const char *vgacon_startup(void)
372#endif 372#endif
373 } 373 }
374 374
375 /* SCREEN_INFO initialized? */ 375 /* boot_params.screen_info initialized? */
376 if ((ORIG_VIDEO_MODE == 0) && 376 if ((screen_info.orig_video_mode == 0) &&
377 (ORIG_VIDEO_LINES == 0) && 377 (screen_info.orig_video_lines == 0) &&
378 (ORIG_VIDEO_COLS == 0)) 378 (screen_info.orig_video_cols == 0))
379 goto no_vga; 379 goto no_vga;
380 380
381 /* VGA16 modes are not handled by VGACON */ 381 /* VGA16 modes are not handled by VGACON */
382 if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */ 382 if ((screen_info.orig_video_mode == 0x0D) || /* 320x200/4 */
383 (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */ 383 (screen_info.orig_video_mode == 0x0E) || /* 640x200/4 */
384 (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */ 384 (screen_info.orig_video_mode == 0x10) || /* 640x350/4 */
385 (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */ 385 (screen_info.orig_video_mode == 0x12) || /* 640x480/4 */
386 (ORIG_VIDEO_MODE == 0x6A)) /* 800x600/4, 0x6A is very common */ 386 (screen_info.orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */
387 goto no_vga; 387 goto no_vga;
388 388
389 vga_video_num_lines = ORIG_VIDEO_LINES; 389 vga_video_num_lines = screen_info.orig_video_lines;
390 vga_video_num_columns = ORIG_VIDEO_COLS; 390 vga_video_num_columns = screen_info.orig_video_cols;
391 state.vgabase = NULL; 391 state.vgabase = NULL;
392 392
393 if (ORIG_VIDEO_MODE == 7) { /* Is this a monochrome display? */ 393 if (screen_info.orig_video_mode == 7) {
394 /* Monochrome display */
394 vga_vram_base = 0xb0000; 395 vga_vram_base = 0xb0000;
395 vga_video_port_reg = VGA_CRT_IM; 396 vga_video_port_reg = VGA_CRT_IM;
396 vga_video_port_val = VGA_CRT_DM; 397 vga_video_port_val = VGA_CRT_DM;
397 if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { 398 if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
398 static struct resource ega_console_resource = 399 static struct resource ega_console_resource =
399 { .name = "ega", .start = 0x3B0, .end = 0x3BF }; 400 { .name = "ega", .start = 0x3B0, .end = 0x3BF };
400 vga_video_type = VIDEO_TYPE_EGAM; 401 vga_video_type = VIDEO_TYPE_EGAM;
@@ -422,12 +423,12 @@ static const char *vgacon_startup(void)
422 vga_vram_base = 0xb8000; 423 vga_vram_base = 0xb8000;
423 vga_video_port_reg = VGA_CRT_IC; 424 vga_video_port_reg = VGA_CRT_IC;
424 vga_video_port_val = VGA_CRT_DC; 425 vga_video_port_val = VGA_CRT_DC;
425 if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { 426 if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
426 int i; 427 int i;
427 428
428 vga_vram_size = 0x8000; 429 vga_vram_size = 0x8000;
429 430
430 if (!ORIG_VIDEO_ISVGA) { 431 if (!screen_info.orig_video_isVGA) {
431 static struct resource ega_console_resource 432 static struct resource ega_console_resource
432 = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; 433 = { .name = "ega", .start = 0x3C0, .end = 0x3DF };
433 vga_video_type = VIDEO_TYPE_EGAC; 434 vga_video_type = VIDEO_TYPE_EGAC;
@@ -521,14 +522,14 @@ static const char *vgacon_startup(void)
521 || vga_video_type == VIDEO_TYPE_VGAC 522 || vga_video_type == VIDEO_TYPE_VGAC
522 || vga_video_type == VIDEO_TYPE_EGAM) { 523 || vga_video_type == VIDEO_TYPE_EGAM) {
523 vga_hardscroll_enabled = vga_hardscroll_user_enable; 524 vga_hardscroll_enabled = vga_hardscroll_user_enable;
524 vga_default_font_height = ORIG_VIDEO_POINTS; 525 vga_default_font_height = screen_info.orig_video_points;
525 vga_video_font_height = ORIG_VIDEO_POINTS; 526 vga_video_font_height = screen_info.orig_video_points;
526 /* This may be suboptimal but is a safe bet - go with it */ 527 /* This may be suboptimal but is a safe bet - go with it */
527 vga_scan_lines = 528 vga_scan_lines =
528 vga_video_font_height * vga_video_num_lines; 529 vga_video_font_height * vga_video_num_lines;
529 } 530 }
530 531
531 vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH; 532 vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH;
532 vgacon_yres = vga_scan_lines; 533 vgacon_yres = vga_scan_lines;
533 534
534 if (!vga_init_done) { 535 if (!vga_init_done) {
@@ -798,7 +799,7 @@ static int vgacon_switch(struct vc_data *c)
798{ 799{
799 int x = c->vc_cols * VGA_FONTWIDTH; 800 int x = c->vc_cols * VGA_FONTWIDTH;
800 int y = c->vc_rows * c->vc_font.height; 801 int y = c->vc_rows * c->vc_font.height;
801 int rows = ORIG_VIDEO_LINES * vga_default_font_height/ 802 int rows = screen_info.orig_video_lines * vga_default_font_height/
802 c->vc_font.height; 803 c->vc_font.height;
803 /* 804 /*
804 * We need to save screen size here as it's the only way 805 * We need to save screen size here as it's the only way
@@ -818,7 +819,7 @@ static int vgacon_switch(struct vc_data *c)
818 819
819 if ((vgacon_xres != x || vgacon_yres != y) && 820 if ((vgacon_xres != x || vgacon_yres != y) &&
820 (!(vga_video_num_columns % 2) && 821 (!(vga_video_num_columns % 2) &&
821 vga_video_num_columns <= ORIG_VIDEO_COLS && 822 vga_video_num_columns <= screen_info.orig_video_cols &&
822 vga_video_num_lines <= rows)) 823 vga_video_num_lines <= rows))
823 vgacon_doresize(c, c->vc_cols, c->vc_rows); 824 vgacon_doresize(c, c->vc_cols, c->vc_rows);
824 } 825 }
@@ -1280,8 +1281,8 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font)
1280static int vgacon_resize(struct vc_data *c, unsigned int width, 1281static int vgacon_resize(struct vc_data *c, unsigned int width,
1281 unsigned int height, unsigned int user) 1282 unsigned int height, unsigned int user)
1282{ 1283{
1283 if (width % 2 || width > ORIG_VIDEO_COLS || 1284 if (width % 2 || width > screen_info.orig_video_cols ||
1284 height > (ORIG_VIDEO_LINES * vga_default_font_height)/ 1285 height > (screen_info.orig_video_lines * vga_default_font_height)/
1285 c->vc_font.height) 1286 c->vc_font.height)
1286 /* let svgatextmode tinker with video timings and 1287 /* let svgatextmode tinker with video timings and
1287 return success */ 1288 return success */
@@ -1313,8 +1314,8 @@ static void vgacon_save_screen(struct vc_data *c)
1313 * console initialization routines. 1314 * console initialization routines.
1314 */ 1315 */
1315 vga_bootup_console = 1; 1316 vga_bootup_console = 1;
1316 c->vc_x = ORIG_X; 1317 c->vc_x = screen_info.orig_x;
1317 c->vc_y = ORIG_Y; 1318 c->vc_y = screen_info.orig_y;
1318 } 1319 }
1319 1320
1320 /* We can't copy in more then the size of the video buffer, 1321 /* We can't copy in more then the size of the video buffer,
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 0428f211f192..e8e38edb9b5b 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -804,7 +804,8 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev,
804 if (bailearly == 1) 804 if (bailearly == 1)
805 bailout(dinfo); 805 bailout(dinfo);
806 806
807 if (FIXED_MODE(dinfo) && ORIG_VIDEO_ISVGA != VIDEO_TYPE_VLFB) { 807 if (FIXED_MODE(dinfo) &&
808 screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) {
808 ERR_MSG("Video mode must be programmed at boot time.\n"); 809 ERR_MSG("Video mode must be programmed at boot time.\n");
809 cleanup(dinfo); 810 cleanup(dinfo);
810 return -ENODEV; 811 return -ENODEV;
@@ -815,7 +816,7 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev,
815 816
816 /* Initialise dinfo and related data. */ 817 /* Initialise dinfo and related data. */
817 /* If an initial mode was programmed at boot time, get its details. */ 818 /* If an initial mode was programmed at boot time, get its details. */
818 if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) 819 if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB)
819 get_initial_mode(dinfo); 820 get_initial_mode(dinfo);
820 821
821 if (bailearly == 3) 822 if (bailearly == 3)
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
index 51807b4e26d1..c604d935c188 100644
--- a/drivers/video/omap/lcd_h3.c
+++ b/drivers/video/omap/lcd_h3.c
@@ -28,8 +28,6 @@
28 28
29#define MODULE_NAME "omapfb-lcd_h3" 29#define MODULE_NAME "omapfb-lcd_h3"
30 30
31#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
32
33static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) 31static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
34{ 32{
35 return 0; 33 return 0;
@@ -48,7 +46,7 @@ static int h3_panel_enable(struct lcd_panel *panel)
48 if (!r) 46 if (!r)
49 r = tps65010_set_gpio_out_value(GPIO2, HIGH); 47 r = tps65010_set_gpio_out_value(GPIO2, HIGH);
50 if (r) 48 if (r)
51 pr_err("Unable to turn on LCD panel\n"); 49 pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
52 50
53 return r; 51 return r;
54} 52}
@@ -62,7 +60,7 @@ static void h3_panel_disable(struct lcd_panel *panel)
62 if (!r) 60 if (!r)
63 tps65010_set_gpio_out_value(GPIO2, LOW); 61 tps65010_set_gpio_out_value(GPIO2, LOW);
64 if (r) 62 if (r)
65 pr_err("Unable to turn off LCD panel\n"); 63 pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
66} 64}
67 65
68static unsigned long h3_panel_get_caps(struct lcd_panel *panel) 66static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index 95604ca43301..5ef119c813e0 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -27,20 +27,18 @@
27 27
28#define MODULE_NAME "omapfb-lcd_h3" 28#define MODULE_NAME "omapfb-lcd_h3"
29 29
30#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
31
32static int innovator1610_panel_init(struct lcd_panel *panel, 30static int innovator1610_panel_init(struct lcd_panel *panel,
33 struct omapfb_device *fbdev) 31 struct omapfb_device *fbdev)
34{ 32{
35 int r = 0; 33 int r = 0;
36 34
37 if (omap_request_gpio(14)) { 35 if (omap_request_gpio(14)) {
38 pr_err("can't request GPIO 14\n"); 36 pr_err(MODULE_NAME ": can't request GPIO 14\n");
39 r = -1; 37 r = -1;
40 goto exit; 38 goto exit;
41 } 39 }
42 if (omap_request_gpio(15)) { 40 if (omap_request_gpio(15)) {
43 pr_err("can't request GPIO 15\n"); 41 pr_err(MODULE_NAME ": can't request GPIO 15\n");
44 omap_free_gpio(14); 42 omap_free_gpio(14);
45 r = -1; 43 r = -1;
46 goto exit; 44 goto exit;
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index 2a14d28c4163..9b3c5923365e 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -1364,7 +1364,7 @@ static int __init vga16fb_probe(struct platform_device *dev)
1364 par = info->par; 1364 par = info->par;
1365 1365
1366 mutex_init(&par->open_lock); 1366 mutex_init(&par->open_lock);
1367 par->isVGA = ORIG_VIDEO_ISVGA; 1367 par->isVGA = screen_info.orig_video_isVGA;
1368 par->palette_blanked = 0; 1368 par->palette_blanked = 0;
1369 par->vesa_blanked = 0; 1369 par->vesa_blanked = 0;
1370 1370
diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c
index d356da5709fc..1550431ccb6a 100644
--- a/drivers/w1/masters/matrox_w1.c
+++ b/drivers/w1/masters/matrox_w1.c
@@ -33,7 +33,6 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/pci_ids.h> 34#include <linux/pci_ids.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/timer.h>
37 36
38#include "../w1.h" 37#include "../w1.h"
39#include "../w1_int.h" 38#include "../w1_int.h"
diff --git a/fs/Kconfig b/fs/Kconfig
index 815d201d8600..d8062745716a 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -534,6 +534,24 @@ config QUOTA
534 with the quota tools. Probably the quota support is only useful for 534 with the quota tools. Probably the quota support is only useful for
535 multi user systems. If unsure, say N. 535 multi user systems. If unsure, say N.
536 536
537config QUOTA_NETLINK_INTERFACE
538 bool "Report quota messages through netlink interface"
539 depends on QUOTA && NET
540 help
541 If you say Y here, quota warnings (about exceeding softlimit, reaching
542 hardlimit, etc.) will be reported through netlink interface. If unsure,
543 say Y.
544
545config PRINT_QUOTA_WARNING
546 bool "Print quota warnings to console (OBSOLETE)"
547 depends on QUOTA
548 default y
549 help
550 If you say Y here, quota warnings (about exceeding softlimit, reaching
551 hardlimit, etc.) will be printed to the process' controlling terminal.
552 Note that this behavior is currently deprecated and may go away in
553 future. Please use notification via netlink socket instead.
554
537config QFMT_V1 555config QFMT_V1
538 tristate "Old quota format support" 556 tristate "Old quota format support"
539 depends on QUOTA 557 depends on QUOTA
@@ -555,7 +573,7 @@ config QUOTACTL
555 default y 573 default y
556 574
557config DNOTIFY 575config DNOTIFY
558 bool "Dnotify support" if EMBEDDED 576 bool "Dnotify support"
559 default y 577 default y
560 help 578 help
561 Dnotify is a directory-based per-fd file change notification system 579 Dnotify is a directory-based per-fd file change notification system
@@ -563,7 +581,7 @@ config DNOTIFY
563 superior alternatives, but some applications may still rely on 581 superior alternatives, but some applications may still rely on
564 dnotify. 582 dnotify.
565 583
566 Because of this, if unsure, say Y. 584 If unsure, say Y.
567 585
568config AUTOFS_FS 586config AUTOFS_FS
569 tristate "Kernel automounter support" 587 tristate "Kernel automounter support"
@@ -999,20 +1017,6 @@ config HUGETLBFS
999config HUGETLB_PAGE 1017config HUGETLB_PAGE
1000 def_bool HUGETLBFS 1018 def_bool HUGETLBFS
1001 1019
1002config RAMFS
1003 bool
1004 default y
1005 ---help---
1006 Ramfs is a file system which keeps all files in RAM. It allows
1007 read and write access.
1008
1009 It is more of an programming example than a useable file system. If
1010 you need a file system which lives in RAM with limit checking use
1011 tmpfs.
1012
1013 To compile this as a module, choose M here: the module will be called
1014 ramfs.
1015
1016config CONFIGFS_FS 1020config CONFIGFS_FS
1017 tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)" 1021 tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)"
1018 depends on SYSFS && EXPERIMENTAL 1022 depends on SYSFS && EXPERIMENTAL
@@ -1543,8 +1547,20 @@ config UFS_DEBUG
1543 1547
1544endmenu 1548endmenu
1545 1549
1546menu "Network File Systems" 1550menuconfig NETWORK_FILESYSTEMS
1551 bool "Network File Systems"
1552 default y
1547 depends on NET 1553 depends on NET
1554 ---help---
1555 Say Y here to get to see options for network filesystems and
1556 filesystem-related networking code, such as NFS daemon and
1557 RPCSEC security modules.
1558 This option alone does not add any kernel code.
1559
1560 If you say N, all options in this submenu will be skipped and
1561 disabled; if unsure, say Y here.
1562
1563if NETWORK_FILESYSTEMS
1548 1564
1549config NFS_FS 1565config NFS_FS
1550 tristate "NFS file system support" 1566 tristate "NFS file system support"
@@ -2090,7 +2106,7 @@ config 9P_FS
2090 2106
2091 If unsure, say N. 2107 If unsure, say N.
2092 2108
2093endmenu 2109endif # NETWORK_FILESYSTEMS
2094 2110
2095if BLOCK 2111if BLOCK
2096menu "Partition Types" 2112menu "Partition Types"
diff --git a/fs/Makefile b/fs/Makefile
index 720c29d57a62..500cf15cdb4b 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -72,7 +72,7 @@ obj-$(CONFIG_JBD) += jbd/
72obj-$(CONFIG_JBD2) += jbd2/ 72obj-$(CONFIG_JBD2) += jbd2/
73obj-$(CONFIG_EXT2_FS) += ext2/ 73obj-$(CONFIG_EXT2_FS) += ext2/
74obj-$(CONFIG_CRAMFS) += cramfs/ 74obj-$(CONFIG_CRAMFS) += cramfs/
75obj-$(CONFIG_RAMFS) += ramfs/ 75obj-y += ramfs/
76obj-$(CONFIG_HUGETLBFS) += hugetlbfs/ 76obj-$(CONFIG_HUGETLBFS) += hugetlbfs/
77obj-$(CONFIG_CODA_FS) += coda/ 77obj-$(CONFIG_CODA_FS) += coda/
78obj-$(CONFIG_MINIX_FS) += minix/ 78obj-$(CONFIG_MINIX_FS) += minix/
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 1c9fd3029496..b36695ae5c2e 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -228,7 +228,7 @@ static void adfs_destroy_inode(struct inode *inode)
228 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode)); 228 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
229} 229}
230 230
231static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 231static void init_once(struct kmem_cache *cachep, void *foo)
232{ 232{
233 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo; 233 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
234 234
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c
index b330009fe42d..c4a5ad09ddf2 100644
--- a/fs/affs/bitmap.c
+++ b/fs/affs/bitmap.c
@@ -11,7 +11,7 @@
11 11
12/* This is, of course, shamelessly stolen from fs/minix */ 12/* This is, of course, shamelessly stolen from fs/minix */
13 13
14static int nibblemap[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 }; 14static const int nibblemap[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 };
15 15
16static u32 16static u32
17affs_count_free_bits(u32 blocksize, const void *data) 17affs_count_free_bits(u32 blocksize, const void *data)
diff --git a/fs/affs/super.c b/fs/affs/super.c
index c80191ae2059..b53e5d0ec65c 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -84,7 +84,7 @@ static void affs_destroy_inode(struct inode *inode)
84 kmem_cache_free(affs_inode_cachep, AFFS_I(inode)); 84 kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
85} 85}
86 86
87static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 87static void init_once(struct kmem_cache *cachep, void *foo)
88{ 88{
89 struct affs_inode_info *ei = (struct affs_inode_info *) foo; 89 struct affs_inode_info *ei = (struct affs_inode_info *) foo;
90 90
diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index b8243945818d..a78d5b236bb1 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -20,7 +20,9 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include "internal.h" 21#include "internal.h"
22 22
23#if 0
23unsigned afs_vnode_update_timeout = 10; 24unsigned afs_vnode_update_timeout = 10;
25#endif /* 0 */
24 26
25#define afs_breakring_space(server) \ 27#define afs_breakring_space(server) \
26 CIRC_SPACE((server)->cb_break_head, (server)->cb_break_tail, \ 28 CIRC_SPACE((server)->cb_break_head, (server)->cb_break_tail, \
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 175a567db78c..970d38f30565 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -33,6 +33,7 @@ static struct afs_cell *afs_cell_root;
33static struct afs_cell *afs_cell_alloc(const char *name, char *vllist) 33static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)
34{ 34{
35 struct afs_cell *cell; 35 struct afs_cell *cell;
36 struct key *key;
36 size_t namelen; 37 size_t namelen;
37 char keyname[4 + AFS_MAXCELLNAME + 1], *cp, *dp, *next; 38 char keyname[4 + AFS_MAXCELLNAME + 1], *cp, *dp, *next;
38 int ret; 39 int ret;
@@ -89,20 +90,14 @@ static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)
89 do { 90 do {
90 *dp++ = toupper(*cp); 91 *dp++ = toupper(*cp);
91 } while (*cp++); 92 } while (*cp++);
92 cell->anonymous_key = key_alloc(&key_type_rxrpc, keyname, 0, 0, current,
93 KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
94 if (IS_ERR(cell->anonymous_key)) {
95 _debug("no key");
96 ret = PTR_ERR(cell->anonymous_key);
97 goto error;
98 }
99 93
100 ret = key_instantiate_and_link(cell->anonymous_key, NULL, 0, 94 key = rxrpc_get_null_key(keyname);
101 NULL, NULL); 95 if (IS_ERR(key)) {
102 if (ret < 0) { 96 _debug("no key");
103 _debug("instantiate failed"); 97 ret = PTR_ERR(key);
104 goto error; 98 goto error;
105 } 99 }
100 cell->anonymous_key = key;
106 101
107 _debug("anon key %p{%x}", 102 _debug("anon key %p{%x}",
108 cell->anonymous_key, key_serial(cell->anonymous_key)); 103 cell->anonymous_key, key_serial(cell->anonymous_key));
@@ -265,6 +260,7 @@ struct afs_cell *afs_cell_lookup(const char *name, unsigned namesz)
265 return cell; 260 return cell;
266} 261}
267 262
263#if 0
268/* 264/*
269 * try and get a cell record 265 * try and get a cell record
270 */ 266 */
@@ -280,6 +276,7 @@ struct afs_cell *afs_get_cell_maybe(struct afs_cell *cell)
280 write_unlock(&afs_cells_lock); 276 write_unlock(&afs_cells_lock);
281 return cell; 277 return cell;
282} 278}
279#endif /* 0 */
283 280
284/* 281/*
285 * destroy a cell record 282 * destroy a cell record
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index d5b2ad6575bc..47b71c8947f9 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -16,7 +16,9 @@
16#include "internal.h" 16#include "internal.h"
17#include "afs_cm.h" 17#include "afs_cm.h"
18 18
19#if 0
19struct workqueue_struct *afs_cm_workqueue; 20struct workqueue_struct *afs_cm_workqueue;
21#endif /* 0 */
20 22
21static int afs_deliver_cb_init_call_back_state(struct afs_call *, 23static int afs_deliver_cb_init_call_back_state(struct afs_call *,
22 struct sk_buff *, bool); 24 struct sk_buff *, bool);
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 6306438f331f..5ca3625cd39e 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -570,7 +570,6 @@ extern int afs_abort_to_error(u32);
570 */ 570 */
571extern const struct inode_operations afs_mntpt_inode_operations; 571extern const struct inode_operations afs_mntpt_inode_operations;
572extern const struct file_operations afs_mntpt_file_operations; 572extern const struct file_operations afs_mntpt_file_operations;
573extern unsigned long afs_mntpt_expiry_timeout;
574 573
575extern int afs_mntpt_check_symlink(struct afs_vnode *, struct key *); 574extern int afs_mntpt_check_symlink(struct afs_vnode *, struct key *);
576extern void afs_mntpt_kill_timer(void); 575extern void afs_mntpt_kill_timer(void);
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 6f8c96fb29eb..5ce43b63c60e 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -42,7 +42,7 @@ const struct inode_operations afs_mntpt_inode_operations = {
42static LIST_HEAD(afs_vfsmounts); 42static LIST_HEAD(afs_vfsmounts);
43static DECLARE_DELAYED_WORK(afs_mntpt_expiry_timer, afs_mntpt_expiry_timed_out); 43static DECLARE_DELAYED_WORK(afs_mntpt_expiry_timer, afs_mntpt_expiry_timed_out);
44 44
45unsigned long afs_mntpt_expiry_timeout = 10 * 60; 45static unsigned long afs_mntpt_expiry_timeout = 10 * 60;
46 46
47/* 47/*
48 * check a symbolic link to see whether it actually encodes a mountpoint 48 * check a symbolic link to see whether it actually encodes a mountpoint
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 6edb56683b9a..846c7615ac9e 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -513,7 +513,7 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
513 up_read(&cell->vl_sem); 513 up_read(&cell->vl_sem);
514} 514}
515 515
516const char afs_vlocation_states[][4] = { 516static const char afs_vlocation_states[][4] = {
517 [AFS_VL_NEW] = "New", 517 [AFS_VL_NEW] = "New",
518 [AFS_VL_CREATING] = "Crt", 518 [AFS_VL_CREATING] = "Crt",
519 [AFS_VL_VALID] = "Val", 519 [AFS_VL_VALID] = "Val",
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 8ccee9ee1d9d..bde3f19c0995 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -239,7 +239,8 @@ void afs_flat_call_destructor(struct afs_call *call)
239/* 239/*
240 * attach the data from a bunch of pages on an inode to a call 240 * attach the data from a bunch of pages on an inode to a call
241 */ 241 */
242int afs_send_pages(struct afs_call *call, struct msghdr *msg, struct kvec *iov) 242static int afs_send_pages(struct afs_call *call, struct msghdr *msg,
243 struct kvec *iov)
243{ 244{
244 struct page *pages[8]; 245 struct page *pages[8];
245 unsigned count, n, loop, offset, to; 246 unsigned count, n, loop, offset, to;
diff --git a/fs/afs/server.c b/fs/afs/server.c
index 231ae4150279..28f2451419e1 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -13,7 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include "internal.h" 14#include "internal.h"
15 15
16unsigned afs_server_timeout = 10; /* server timeout in seconds */ 16static unsigned afs_server_timeout = 10; /* server timeout in seconds */
17 17
18static void afs_reap_server(struct work_struct *); 18static void afs_reap_server(struct work_struct *);
19 19
diff --git a/fs/afs/super.c b/fs/afs/super.c
index b8808b40f82b..4b2558c42213 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -27,8 +27,7 @@
27 27
28#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ 28#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
29 29
30static void afs_i_init_once(void *foo, struct kmem_cache *cachep, 30static void afs_i_init_once(struct kmem_cache *cachep, void *foo);
31 unsigned long flags);
32static int afs_get_sb(struct file_system_type *fs_type, 31static int afs_get_sb(struct file_system_type *fs_type,
33 int flags, const char *dev_name, 32 int flags, const char *dev_name,
34 void *data, struct vfsmount *mnt); 33 void *data, struct vfsmount *mnt);
@@ -446,8 +445,7 @@ static void afs_put_super(struct super_block *sb)
446/* 445/*
447 * initialise an inode cache slab element prior to any use 446 * initialise an inode cache slab element prior to any use
448 */ 447 */
449static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, 448static void afs_i_init_once(struct kmem_cache *cachep, void *_vnode)
450 unsigned long flags)
451{ 449{
452 struct afs_vnode *vnode = _vnode; 450 struct afs_vnode *vnode = _vnode;
453 451
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c
index 09e3ad0fc7cc..7b4bbe48112d 100644
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -15,8 +15,8 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include "internal.h" 16#include "internal.h"
17 17
18unsigned afs_vlocation_timeout = 10; /* volume location timeout in seconds */ 18static unsigned afs_vlocation_timeout = 10; /* volume location timeout in seconds */
19unsigned afs_vlocation_update_timeout = 10 * 60; 19static unsigned afs_vlocation_update_timeout = 10 * 60;
20 20
21static void afs_vlocation_reaper(struct work_struct *); 21static void afs_vlocation_reaper(struct work_struct *);
22static void afs_vlocation_updater(struct work_struct *); 22static void afs_vlocation_updater(struct work_struct *);
@@ -335,7 +335,7 @@ static int afs_vlocation_fill_in_record(struct afs_vlocation *vl,
335/* 335/*
336 * queue a vlocation record for updates 336 * queue a vlocation record for updates
337 */ 337 */
338void afs_vlocation_queue_for_updates(struct afs_vlocation *vl) 338static void afs_vlocation_queue_for_updates(struct afs_vlocation *vl)
339{ 339{
340 struct afs_vlocation *xvl; 340 struct afs_vlocation *xvl;
341 341
diff --git a/fs/afs/write.c b/fs/afs/write.c
index a03b92a0fe1d..9a849ad3c489 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -8,7 +8,7 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11#include <linux/backing-dev.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
@@ -510,9 +510,9 @@ int afs_writepage(struct page *page, struct writeback_control *wbc)
510/* 510/*
511 * write a region of pages back to the server 511 * write a region of pages back to the server
512 */ 512 */
513int afs_writepages_region(struct address_space *mapping, 513static int afs_writepages_region(struct address_space *mapping,
514 struct writeback_control *wbc, 514 struct writeback_control *wbc,
515 pgoff_t index, pgoff_t end, pgoff_t *_next) 515 pgoff_t index, pgoff_t end, pgoff_t *_next)
516{ 516{
517 struct backing_dev_info *bdi = mapping->backing_dev_info; 517 struct backing_dev_info *bdi = mapping->backing_dev_info;
518 struct afs_writeback *wb; 518 struct afs_writeback *wb;
diff --git a/fs/aio.c b/fs/aio.c
index ea2e19820381..d02f43b50a3d 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -303,7 +303,7 @@ static void wait_for_all_aios(struct kioctx *ctx)
303 set_task_state(tsk, TASK_UNINTERRUPTIBLE); 303 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
304 while (ctx->reqs_active) { 304 while (ctx->reqs_active) {
305 spin_unlock_irq(&ctx->ctx_lock); 305 spin_unlock_irq(&ctx->ctx_lock);
306 schedule(); 306 io_schedule();
307 set_task_state(tsk, TASK_UNINTERRUPTIBLE); 307 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
308 spin_lock_irq(&ctx->ctx_lock); 308 spin_lock_irq(&ctx->ctx_lock);
309 } 309 }
@@ -323,7 +323,7 @@ ssize_t fastcall wait_on_sync_kiocb(struct kiocb *iocb)
323 set_current_state(TASK_UNINTERRUPTIBLE); 323 set_current_state(TASK_UNINTERRUPTIBLE);
324 if (!iocb->ki_users) 324 if (!iocb->ki_users)
325 break; 325 break;
326 schedule(); 326 io_schedule();
327 } 327 }
328 __set_current_state(TASK_RUNNING); 328 __set_current_state(TASK_RUNNING);
329 return iocb->ki_user_data; 329 return iocb->ki_user_data;
@@ -1170,7 +1170,7 @@ retry:
1170 ret = 0; 1170 ret = 0;
1171 if (to.timed_out) /* Only check after read evt */ 1171 if (to.timed_out) /* Only check after read evt */
1172 break; 1172 break;
1173 schedule(); 1173 io_schedule();
1174 if (signal_pending(tsk)) { 1174 if (signal_pending(tsk)) {
1175 ret = -EINTR; 1175 ret = -EINTR;
1176 break; 1176 break;
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index b4a75880f6fd..23321889d9b0 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -76,7 +76,6 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
76{ 76{
77 struct qstr this; 77 struct qstr this;
78 struct dentry *dentry; 78 struct dentry *dentry;
79 struct inode *inode;
80 struct file *file; 79 struct file *file;
81 int error, fd; 80 int error, fd;
82 81
@@ -86,15 +85,9 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
86 if (!file) 85 if (!file)
87 return -ENFILE; 86 return -ENFILE;
88 87
89 inode = igrab(anon_inode_inode);
90 if (IS_ERR(inode)) {
91 error = PTR_ERR(inode);
92 goto err_put_filp;
93 }
94
95 error = get_unused_fd(); 88 error = get_unused_fd();
96 if (error < 0) 89 if (error < 0)
97 goto err_iput; 90 goto err_put_filp;
98 fd = error; 91 fd = error;
99 92
100 /* 93 /*
@@ -108,14 +101,22 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
108 dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this); 101 dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this);
109 if (!dentry) 102 if (!dentry)
110 goto err_put_unused_fd; 103 goto err_put_unused_fd;
104
105 /*
106 * We know the anon_inode inode count is always greater than zero,
107 * so we can avoid doing an igrab() and we can use an open-coded
108 * atomic_inc().
109 */
110 atomic_inc(&anon_inode_inode->i_count);
111
111 dentry->d_op = &anon_inodefs_dentry_operations; 112 dentry->d_op = &anon_inodefs_dentry_operations;
112 /* Do not publish this dentry inside the global dentry hash table */ 113 /* Do not publish this dentry inside the global dentry hash table */
113 dentry->d_flags &= ~DCACHE_UNHASHED; 114 dentry->d_flags &= ~DCACHE_UNHASHED;
114 d_instantiate(dentry, inode); 115 d_instantiate(dentry, anon_inode_inode);
115 116
116 file->f_path.mnt = mntget(anon_inode_mnt); 117 file->f_path.mnt = mntget(anon_inode_mnt);
117 file->f_path.dentry = dentry; 118 file->f_path.dentry = dentry;
118 file->f_mapping = inode->i_mapping; 119 file->f_mapping = anon_inode_inode->i_mapping;
119 120
120 file->f_pos = 0; 121 file->f_pos = 0;
121 file->f_flags = O_RDWR; 122 file->f_flags = O_RDWR;
@@ -127,14 +128,12 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
127 fd_install(fd, file); 128 fd_install(fd, file);
128 129
129 *pfd = fd; 130 *pfd = fd;
130 *pinode = inode; 131 *pinode = anon_inode_inode;
131 *pfile = file; 132 *pfile = file;
132 return 0; 133 return 0;
133 134
134err_put_unused_fd: 135err_put_unused_fd:
135 put_unused_fd(fd); 136 put_unused_fd(fd);
136err_iput:
137 iput(inode);
138err_put_filp: 137err_put_filp:
139 put_filp(file); 138 put_filp(file);
140 return error; 139 return error;
diff --git a/fs/attr.c b/fs/attr.c
index f8dfc2269d85..ae58bd3f875f 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -116,6 +116,15 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
116 attr->ia_atime = now; 116 attr->ia_atime = now;
117 if (!(ia_valid & ATTR_MTIME_SET)) 117 if (!(ia_valid & ATTR_MTIME_SET))
118 attr->ia_mtime = now; 118 attr->ia_mtime = now;
119 if (ia_valid & ATTR_KILL_PRIV) {
120 attr->ia_valid &= ~ATTR_KILL_PRIV;
121 ia_valid &= ~ATTR_KILL_PRIV;
122 error = security_inode_need_killpriv(dentry);
123 if (error > 0)
124 error = security_inode_killpriv(dentry);
125 if (error)
126 return error;
127 }
119 if (ia_valid & ATTR_KILL_SUID) { 128 if (ia_valid & ATTR_KILL_SUID) {
120 attr->ia_valid &= ~ATTR_KILL_SUID; 129 attr->ia_valid &= ~ATTR_KILL_SUID;
121 if (mode & S_ISUID) { 130 if (mode & S_ISUID) {
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 692364e8ffc3..cd81f0836671 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -312,13 +312,11 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
312 struct autofs_sb_info *sbi; 312 struct autofs_sb_info *sbi;
313 struct autofs_info *ino; 313 struct autofs_info *ino;
314 314
315 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 315 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
316 if (!sbi) 316 if (!sbi)
317 goto fail_unlock; 317 goto fail_unlock;
318 DPRINTK("starting up, sbi = %p",sbi); 318 DPRINTK("starting up, sbi = %p",sbi);
319 319
320 memset(sbi, 0, sizeof(*sbi));
321
322 s->s_fs_info = sbi; 320 s->s_fs_info = sbi;
323 sbi->magic = AUTOFS_SBI_MAGIC; 321 sbi->magic = AUTOFS_SBI_MAGIC;
324 sbi->pipefd = -1; 322 sbi->pipefd = -1;
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index a45141827681..b28a20e61b80 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -289,7 +289,7 @@ befs_destroy_inode(struct inode *inode)
289 kmem_cache_free(befs_inode_cachep, BEFS_I(inode)); 289 kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
290} 290}
291 291
292static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 292static void init_once(struct kmem_cache *cachep, void *foo)
293{ 293{
294 struct befs_inode_info *bi = (struct befs_inode_info *) foo; 294 struct befs_inode_info *bi = (struct befs_inode_info *) foo;
295 295
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index f346eb14e86f..7bd9c2bbe6ee 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -244,7 +244,7 @@ static void bfs_destroy_inode(struct inode *inode)
244 kmem_cache_free(bfs_inode_cachep, BFS_I(inode)); 244 kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
245} 245}
246 246
247static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 247static void init_once(struct kmem_cache *cachep, void *foo)
248{ 248{
249 struct bfs_inode_info *bi = foo; 249 struct bfs_inode_info *bi = foo;
250 250
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 813a887cd2b3..e176d195e7e5 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -31,7 +31,7 @@
31 31
32static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 32static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
33static int load_aout_library(struct file*); 33static int load_aout_library(struct file*);
34static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 34static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
35 35
36static struct linux_binfmt aout_format = { 36static struct linux_binfmt aout_format = {
37 .module = THIS_MODULE, 37 .module = THIS_MODULE,
@@ -88,7 +88,7 @@ if (file->f_op->llseek) { \
88 * dumping of the process results in another error.. 88 * dumping of the process results in another error..
89 */ 89 */
90 90
91static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file) 91static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
92{ 92{
93 mm_segment_t fs; 93 mm_segment_t fs;
94 int has_dumped = 0; 94 int has_dumped = 0;
@@ -123,23 +123,19 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
123/* If the size of the dump file exceeds the rlimit, then see what would happen 123/* If the size of the dump file exceeds the rlimit, then see what would happen
124 if we wrote the stack, but not the data area. */ 124 if we wrote the stack, but not the data area. */
125#ifdef __sparc__ 125#ifdef __sparc__
126 if ((dump.u_dsize+dump.u_ssize) > 126 if ((dump.u_dsize + dump.u_ssize) > limit)
127 current->signal->rlim[RLIMIT_CORE].rlim_cur)
128 dump.u_dsize = 0; 127 dump.u_dsize = 0;
129#else 128#else
130 if ((dump.u_dsize+dump.u_ssize+1) * PAGE_SIZE > 129 if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > limit)
131 current->signal->rlim[RLIMIT_CORE].rlim_cur)
132 dump.u_dsize = 0; 130 dump.u_dsize = 0;
133#endif 131#endif
134 132
135/* Make sure we have enough room to write the stack and data areas. */ 133/* Make sure we have enough room to write the stack and data areas. */
136#ifdef __sparc__ 134#ifdef __sparc__
137 if ((dump.u_ssize) > 135 if (dump.u_ssize > limit)
138 current->signal->rlim[RLIMIT_CORE].rlim_cur)
139 dump.u_ssize = 0; 136 dump.u_ssize = 0;
140#else 137#else
141 if ((dump.u_ssize+1) * PAGE_SIZE > 138 if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
142 current->signal->rlim[RLIMIT_CORE].rlim_cur)
143 dump.u_ssize = 0; 139 dump.u_ssize = 0;
144#endif 140#endif
145 141
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f3037c645ca9..6e2f3b8dde7f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -52,7 +52,7 @@ static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, i
52 * don't even try. 52 * don't even try.
53 */ 53 */
54#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) 54#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
55static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file); 55static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
56#else 56#else
57#define elf_core_dump NULL 57#define elf_core_dump NULL
58#endif 58#endif
@@ -151,6 +151,14 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
151 struct vm_area_struct *vma; 151 struct vm_area_struct *vma;
152 152
153 /* 153 /*
154 * In some cases (e.g. Hyper-Threading), we want to avoid L1
155 * evictions by the processes running on the same package. One
156 * thing we can do is to shuffle the initial stack for them.
157 */
158
159 p = arch_align_stack(p);
160
161 /*
154 * If this architecture has a platform capability string, copy it 162 * If this architecture has a platform capability string, copy it
155 * to userspace. In some cases (Sparc), this info is impossible 163 * to userspace. In some cases (Sparc), this info is impossible
156 * for userspace to get any other way, in others (i386) it is 164 * for userspace to get any other way, in others (i386) it is
@@ -160,14 +168,6 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
160 if (k_platform) { 168 if (k_platform) {
161 size_t len = strlen(k_platform) + 1; 169 size_t len = strlen(k_platform) + 1;
162 170
163 /*
164 * In some cases (e.g. Hyper-Threading), we want to avoid L1
165 * evictions by the processes running on the same package. One
166 * thing we can do is to shuffle the initial stack for them.
167 */
168
169 p = arch_align_stack(p);
170
171 u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len); 171 u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
172 if (__copy_to_user(u_platform, k_platform, len)) 172 if (__copy_to_user(u_platform, k_platform, len))
173 return -EFAULT; 173 return -EFAULT;
@@ -175,6 +175,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
175 175
176 /* Create the ELF interpreter info */ 176 /* Create the ELF interpreter info */
177 elf_info = (elf_addr_t *)current->mm->saved_auxv; 177 elf_info = (elf_addr_t *)current->mm->saved_auxv;
178 /* update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes */
178#define NEW_AUX_ENT(id, val) \ 179#define NEW_AUX_ENT(id, val) \
179 do { \ 180 do { \
180 elf_info[ei_index++] = id; \ 181 elf_info[ei_index++] = id; \
@@ -185,6 +186,8 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
185 /* 186 /*
186 * ARCH_DLINFO must come first so PPC can do its special alignment of 187 * ARCH_DLINFO must come first so PPC can do its special alignment of
187 * AUXV. 188 * AUXV.
189 * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT() in
190 * ARCH_DLINFO changes
188 */ 191 */
189 ARCH_DLINFO; 192 ARCH_DLINFO;
190#endif 193#endif
@@ -730,6 +733,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
730 733
731 /* Some simple consistency checks for the interpreter */ 734 /* Some simple consistency checks for the interpreter */
732 if (elf_interpreter) { 735 if (elf_interpreter) {
736 static int warn;
733 interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT; 737 interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT;
734 738
735 /* Now figure out which format our binary is */ 739 /* 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)
741 if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0) 745 if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
742 interpreter_type &= ~INTERPRETER_ELF; 746 interpreter_type &= ~INTERPRETER_ELF;
743 747
748 if (interpreter_type == INTERPRETER_AOUT && warn < 10) {
749 printk(KERN_WARNING "a.out ELF interpreter %s is "
750 "deprecated and will not be supported "
751 "after Linux 2.6.25\n", elf_interpreter);
752 warn++;
753 }
754
744 retval = -ELIBBAD; 755 retval = -ELIBBAD;
745 if (!interpreter_type) 756 if (!interpreter_type)
746 goto out_free_dentry; 757 goto out_free_dentry;
@@ -1193,35 +1204,68 @@ static int dump_seek(struct file *file, loff_t off)
1193} 1204}
1194 1205
1195/* 1206/*
1196 * Decide whether a segment is worth dumping; default is yes to be 1207 * Decide what to dump of a segment, part, all or none.
1197 * sure (missing info is worse than too much; etc).
1198 * Personally I'd include everything, and use the coredump limit...
1199 *
1200 * I think we should skip something. But I am not sure how. H.J.
1201 */ 1208 */
1202static int maydump(struct vm_area_struct *vma, unsigned long mm_flags) 1209static unsigned long vma_dump_size(struct vm_area_struct *vma,
1210 unsigned long mm_flags)
1203{ 1211{
1204 /* The vma can be set up to tell us the answer directly. */ 1212 /* The vma can be set up to tell us the answer directly. */
1205 if (vma->vm_flags & VM_ALWAYSDUMP) 1213 if (vma->vm_flags & VM_ALWAYSDUMP)
1206 return 1; 1214 goto whole;
1207 1215
1208 /* Do not dump I/O mapped devices or special mappings */ 1216 /* Do not dump I/O mapped devices or special mappings */
1209 if (vma->vm_flags & (VM_IO | VM_RESERVED)) 1217 if (vma->vm_flags & (VM_IO | VM_RESERVED))
1210 return 0; 1218 return 0;
1211 1219
1220#define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type))
1221
1212 /* By default, dump shared memory if mapped from an anonymous file. */ 1222 /* By default, dump shared memory if mapped from an anonymous file. */
1213 if (vma->vm_flags & VM_SHARED) { 1223 if (vma->vm_flags & VM_SHARED) {
1214 if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) 1224 if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ?
1215 return test_bit(MMF_DUMP_ANON_SHARED, &mm_flags); 1225 FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED))
1216 else 1226 goto whole;
1217 return test_bit(MMF_DUMP_MAPPED_SHARED, &mm_flags); 1227 return 0;
1218 } 1228 }
1219 1229
1220 /* By default, if it hasn't been written to, don't write it out. */ 1230 /* Dump segments that have been written to. */
1221 if (!vma->anon_vma) 1231 if (vma->anon_vma && FILTER(ANON_PRIVATE))
1222 return test_bit(MMF_DUMP_MAPPED_PRIVATE, &mm_flags); 1232 goto whole;
1233 if (vma->vm_file == NULL)
1234 return 0;
1235
1236 if (FILTER(MAPPED_PRIVATE))
1237 goto whole;
1223 1238
1224 return test_bit(MMF_DUMP_ANON_PRIVATE, &mm_flags); 1239 /*
1240 * If this looks like the beginning of a DSO or executable mapping,
1241 * check for an ELF header. If we find one, dump the first page to
1242 * aid in determining what was mapped here.
1243 */
1244 if (FILTER(ELF_HEADERS) && vma->vm_file != NULL && vma->vm_pgoff == 0) {
1245 u32 __user *header = (u32 __user *) vma->vm_start;
1246 u32 word;
1247 /*
1248 * Doing it this way gets the constant folded by GCC.
1249 */
1250 union {
1251 u32 cmp;
1252 char elfmag[SELFMAG];
1253 } magic;
1254 BUILD_BUG_ON(SELFMAG != sizeof word);
1255 magic.elfmag[EI_MAG0] = ELFMAG0;
1256 magic.elfmag[EI_MAG1] = ELFMAG1;
1257 magic.elfmag[EI_MAG2] = ELFMAG2;
1258 magic.elfmag[EI_MAG3] = ELFMAG3;
1259 if (get_user(word, header) == 0 && word == magic.cmp)
1260 return PAGE_SIZE;
1261 }
1262
1263#undef FILTER
1264
1265 return 0;
1266
1267whole:
1268 return vma->vm_end - vma->vm_start;
1225} 1269}
1226 1270
1227/* An ELF note in memory */ 1271/* An ELF note in memory */
@@ -1411,7 +1455,7 @@ struct elf_thread_status
1411 elf_fpregset_t fpu; /* NT_PRFPREG */ 1455 elf_fpregset_t fpu; /* NT_PRFPREG */
1412 struct task_struct *thread; 1456 struct task_struct *thread;
1413#ifdef ELF_CORE_COPY_XFPREGS 1457#ifdef ELF_CORE_COPY_XFPREGS
1414 elf_fpxregset_t xfpu; /* NT_PRXFPREG */ 1458 elf_fpxregset_t xfpu; /* ELF_CORE_XFPREG_TYPE */
1415#endif 1459#endif
1416 struct memelfnote notes[3]; 1460 struct memelfnote notes[3];
1417 int num_notes; 1461 int num_notes;
@@ -1446,8 +1490,8 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)
1446 1490
1447#ifdef ELF_CORE_COPY_XFPREGS 1491#ifdef ELF_CORE_COPY_XFPREGS
1448 if (elf_core_copy_task_xfpregs(p, &t->xfpu)) { 1492 if (elf_core_copy_task_xfpregs(p, &t->xfpu)) {
1449 fill_note(&t->notes[2], "LINUX", NT_PRXFPREG, sizeof(t->xfpu), 1493 fill_note(&t->notes[2], "LINUX", ELF_CORE_XFPREG_TYPE,
1450 &t->xfpu); 1494 sizeof(t->xfpu), &t->xfpu);
1451 t->num_notes++; 1495 t->num_notes++;
1452 sz += notesize(&t->notes[2]); 1496 sz += notesize(&t->notes[2]);
1453 } 1497 }
@@ -1488,7 +1532,7 @@ static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
1488 * and then they are actually written out. If we run out of core limit 1532 * and then they are actually written out. If we run out of core limit
1489 * we just truncate. 1533 * we just truncate.
1490 */ 1534 */
1491static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) 1535static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
1492{ 1536{
1493#define NUM_NOTES 6 1537#define NUM_NOTES 6
1494 int has_dumped = 0; 1538 int has_dumped = 0;
@@ -1499,7 +1543,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1499 struct vm_area_struct *vma, *gate_vma; 1543 struct vm_area_struct *vma, *gate_vma;
1500 struct elfhdr *elf = NULL; 1544 struct elfhdr *elf = NULL;
1501 loff_t offset = 0, dataoff, foffset; 1545 loff_t offset = 0, dataoff, foffset;
1502 unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1503 int numnote; 1546 int numnote;
1504 struct memelfnote *notes = NULL; 1547 struct memelfnote *notes = NULL;
1505 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */ 1548 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)
1621#ifdef ELF_CORE_COPY_XFPREGS 1664#ifdef ELF_CORE_COPY_XFPREGS
1622 if (elf_core_copy_task_xfpregs(current, xfpu)) 1665 if (elf_core_copy_task_xfpregs(current, xfpu))
1623 fill_note(notes + numnote++, 1666 fill_note(notes + numnote++,
1624 "LINUX", NT_PRXFPREG, sizeof(*xfpu), xfpu); 1667 "LINUX", ELF_CORE_XFPREG_TYPE, sizeof(*xfpu), xfpu);
1625#endif 1668#endif
1626 1669
1627 fs = get_fs(); 1670 fs = get_fs();
@@ -1662,16 +1705,13 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1662 for (vma = first_vma(current, gate_vma); vma != NULL; 1705 for (vma = first_vma(current, gate_vma); vma != NULL;
1663 vma = next_vma(vma, gate_vma)) { 1706 vma = next_vma(vma, gate_vma)) {
1664 struct elf_phdr phdr; 1707 struct elf_phdr phdr;
1665 size_t sz;
1666
1667 sz = vma->vm_end - vma->vm_start;
1668 1708
1669 phdr.p_type = PT_LOAD; 1709 phdr.p_type = PT_LOAD;
1670 phdr.p_offset = offset; 1710 phdr.p_offset = offset;
1671 phdr.p_vaddr = vma->vm_start; 1711 phdr.p_vaddr = vma->vm_start;
1672 phdr.p_paddr = 0; 1712 phdr.p_paddr = 0;
1673 phdr.p_filesz = maydump(vma, mm_flags) ? sz : 0; 1713 phdr.p_filesz = vma_dump_size(vma, mm_flags);
1674 phdr.p_memsz = sz; 1714 phdr.p_memsz = vma->vm_end - vma->vm_start;
1675 offset += phdr.p_filesz; 1715 offset += phdr.p_filesz;
1676 phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0; 1716 phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0;
1677 if (vma->vm_flags & VM_WRITE) 1717 if (vma->vm_flags & VM_WRITE)
@@ -1711,13 +1751,11 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1711 for (vma = first_vma(current, gate_vma); vma != NULL; 1751 for (vma = first_vma(current, gate_vma); vma != NULL;
1712 vma = next_vma(vma, gate_vma)) { 1752 vma = next_vma(vma, gate_vma)) {
1713 unsigned long addr; 1753 unsigned long addr;
1754 unsigned long end;
1714 1755
1715 if (!maydump(vma, mm_flags)) 1756 end = vma->vm_start + vma_dump_size(vma, mm_flags);
1716 continue;
1717 1757
1718 for (addr = vma->vm_start; 1758 for (addr = vma->vm_start; addr < end; addr += PAGE_SIZE) {
1719 addr < vma->vm_end;
1720 addr += PAGE_SIZE) {
1721 struct page *page; 1759 struct page *page;
1722 struct vm_area_struct *vma; 1760 struct vm_area_struct *vma;
1723 1761
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index c5ca2f0aca7f..033861c6b8f1 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -75,7 +75,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *,
75 struct file *, struct mm_struct *); 75 struct file *, struct mm_struct *);
76 76
77#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) 77#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
78static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *); 78static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *, unsigned long limit);
79#endif 79#endif
80 80
81static struct linux_binfmt elf_fdpic_format = { 81static struct linux_binfmt elf_fdpic_format = {
@@ -1417,7 +1417,7 @@ struct elf_thread_status
1417 elf_fpregset_t fpu; /* NT_PRFPREG */ 1417 elf_fpregset_t fpu; /* NT_PRFPREG */
1418 struct task_struct *thread; 1418 struct task_struct *thread;
1419#ifdef ELF_CORE_COPY_XFPREGS 1419#ifdef ELF_CORE_COPY_XFPREGS
1420 elf_fpxregset_t xfpu; /* NT_PRXFPREG */ 1420 elf_fpxregset_t xfpu; /* ELF_CORE_XFPREG_TYPE */
1421#endif 1421#endif
1422 struct memelfnote notes[3]; 1422 struct memelfnote notes[3];
1423 int num_notes; 1423 int num_notes;
@@ -1453,8 +1453,8 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)
1453 1453
1454#ifdef ELF_CORE_COPY_XFPREGS 1454#ifdef ELF_CORE_COPY_XFPREGS
1455 if (elf_core_copy_task_xfpregs(p, &t->xfpu)) { 1455 if (elf_core_copy_task_xfpregs(p, &t->xfpu)) {
1456 fill_note(&t->notes[2], "LINUX", NT_PRXFPREG, sizeof(t->xfpu), 1456 fill_note(&t->notes[2], "LINUX", ELF_CORE_XFPREG_TYPE,
1457 &t->xfpu); 1457 sizeof(t->xfpu), &t->xfpu);
1458 t->num_notes++; 1458 t->num_notes++;
1459 sz += notesize(&t->notes[2]); 1459 sz += notesize(&t->notes[2]);
1460 } 1460 }
@@ -1552,7 +1552,7 @@ static int elf_fdpic_dump_segments(struct file *file, size_t *size,
1552 * we just truncate. 1552 * we just truncate.
1553 */ 1553 */
1554static int elf_fdpic_core_dump(long signr, struct pt_regs *regs, 1554static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1555 struct file *file) 1555 struct file *file, unsigned long limit)
1556{ 1556{
1557#define NUM_NOTES 6 1557#define NUM_NOTES 6
1558 int has_dumped = 0; 1558 int has_dumped = 0;
@@ -1563,7 +1563,6 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1563 struct vm_area_struct *vma; 1563 struct vm_area_struct *vma;
1564 struct elfhdr *elf = NULL; 1564 struct elfhdr *elf = NULL;
1565 loff_t offset = 0, dataoff; 1565 loff_t offset = 0, dataoff;
1566 unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1567 int numnote; 1566 int numnote;
1568 struct memelfnote *notes = NULL; 1567 struct memelfnote *notes = NULL;
1569 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */ 1568 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */
@@ -1690,7 +1689,7 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1690#ifdef ELF_CORE_COPY_XFPREGS 1689#ifdef ELF_CORE_COPY_XFPREGS
1691 if (elf_core_copy_task_xfpregs(current, xfpu)) 1690 if (elf_core_copy_task_xfpregs(current, xfpu))
1692 fill_note(notes + numnote++, 1691 fill_note(notes + numnote++,
1693 "LINUX", NT_PRXFPREG, sizeof(*xfpu), xfpu); 1692 "LINUX", ELF_CORE_XFPREG_TYPE, sizeof(*xfpu), xfpu);
1694#endif 1693#endif
1695 1694
1696 fs = get_fs(); 1695 fs = get_fs();
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index fcb3405bb14e..33764fd6db66 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -75,7 +75,7 @@ static int load_flat_shared_library(int id, struct lib_info *p);
75#endif 75#endif
76 76
77static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs); 77static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs);
78static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file); 78static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
79 79
80static struct linux_binfmt flat_format = { 80static struct linux_binfmt flat_format = {
81 .module = THIS_MODULE, 81 .module = THIS_MODULE,
@@ -90,7 +90,7 @@ static struct linux_binfmt flat_format = {
90 * Currently only a stub-function. 90 * Currently only a stub-function.
91 */ 91 */
92 92
93static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file) 93static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
94{ 94{
95 printk("Process %s:%d received signr %d and should have core dumped\n", 95 printk("Process %s:%d received signr %d and should have core dumped\n",
96 current->comm, current->pid, (int) signr); 96 current->comm, current->pid, (int) signr);
@@ -113,7 +113,7 @@ static unsigned long create_flat_tables(
113 char * p = (char*)pp; 113 char * p = (char*)pp;
114 int argc = bprm->argc; 114 int argc = bprm->argc;
115 int envc = bprm->envc; 115 int envc = bprm->envc;
116 char dummy; 116 char uninitialized_var(dummy);
117 117
118 sp = (unsigned long *) ((-(unsigned long)sizeof(char *))&(unsigned long) p); 118 sp = (unsigned long *) ((-(unsigned long)sizeof(char *))&(unsigned long) p);
119 119
@@ -290,7 +290,6 @@ out_free_buf:
290 kfree(buf); 290 kfree(buf);
291out_free: 291out_free:
292 kfree(strm.workspace); 292 kfree(strm.workspace);
293out:
294 return retval; 293 return retval;
295} 294}
296 295
@@ -459,7 +458,9 @@ static int load_flat_file(struct linux_binprm * bprm,
459 printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename); 458 printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
460 459
461 if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { 460 if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) {
462 printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION); 461 printk("BINFMT_FLAT: bad flat file version 0x%x (supported "
462 "0x%lx and 0x%lx)\n",
463 rev, FLAT_VERSION, OLD_FLAT_VERSION);
463 ret = -ENOEXEC; 464 ret = -ENOEXEC;
464 goto err; 465 goto err;
465 } 466 }
@@ -515,7 +516,8 @@ static int load_flat_file(struct linux_binprm * bprm,
515 /* 516 /*
516 * calculate the extra space we need to map in 517 * calculate the extra space we need to map in
517 */ 518 */
518 extra = max(bss_len + stack_len, relocs * sizeof(unsigned long)); 519 extra = max_t(unsigned long, bss_len + stack_len,
520 relocs * sizeof(unsigned long));
519 521
520 /* 522 /*
521 * there are a couple of cases here, the separate code/data 523 * there are a couple of cases here, the separate code/data
@@ -546,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm,
546 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); 548 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
547 /* Remap to use all availabe slack region space */ 549 /* Remap to use all availabe slack region space */
548 if (realdatastart && (realdatastart < (unsigned long)-4096)) { 550 if (realdatastart && (realdatastart < (unsigned long)-4096)) {
549 reallen = ksize(realdatastart); 551 reallen = ksize((void *)realdatastart);
550 if (reallen > len) { 552 if (reallen > len) {
551 realdatastart = do_mremap(realdatastart, len, 553 realdatastart = do_mremap(realdatastart, len,
552 reallen, MREMAP_FIXED, realdatastart); 554 reallen, MREMAP_FIXED, realdatastart);
@@ -598,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm,
598 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); 600 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
599 /* Remap to use all availabe slack region space */ 601 /* Remap to use all availabe slack region space */
600 if (textpos && (textpos < (unsigned long) -4096)) { 602 if (textpos && (textpos < (unsigned long) -4096)) {
601 reallen = ksize(textpos); 603 reallen = ksize((void *)textpos);
602 if (reallen > len) { 604 if (reallen > len) {
603 textpos = do_mremap(textpos, len, reallen, 605 textpos = do_mremap(textpos, len, reallen,
604 MREMAP_FIXED, textpos); 606 MREMAP_FIXED, textpos);
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
index 5bcdaaf4eae0..9208c41209f9 100644
--- a/fs/binfmt_som.c
+++ b/fs/binfmt_som.c
@@ -44,7 +44,7 @@ static int load_som_library(struct file *);
44 * don't even try. 44 * don't even try.
45 */ 45 */
46#if 0 46#if 0
47static int som_core_dump(long signr, struct pt_regs * regs); 47static int som_core_dump(long signr, struct pt_regs *regs, unsigned long limit);
48#else 48#else
49#define som_core_dump NULL 49#define som_core_dump NULL
50#endif 50#endif
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 379a446e243e..993f78c55221 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -465,7 +465,7 @@ static void bdev_destroy_inode(struct inode *inode)
465 kmem_cache_free(bdev_cachep, bdi); 465 kmem_cache_free(bdev_cachep, bdi);
466} 466}
467 467
468static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 468static void init_once(struct kmem_cache * cachep, void *foo)
469{ 469{
470 struct bdev_inode *ei = (struct bdev_inode *) foo; 470 struct bdev_inode *ei = (struct bdev_inode *) foo;
471 struct block_device *bdev = &ei->bdev; 471 struct block_device *bdev = &ei->bdev;
diff --git a/fs/buffer.c b/fs/buffer.c
index faceb5eecca9..76403b1764c5 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -710,6 +710,8 @@ static int __set_page_dirty(struct page *page,
710 710
711 if (mapping_cap_account_dirty(mapping)) { 711 if (mapping_cap_account_dirty(mapping)) {
712 __inc_zone_page_state(page, NR_FILE_DIRTY); 712 __inc_zone_page_state(page, NR_FILE_DIRTY);
713 __inc_bdi_stat(mapping->backing_dev_info,
714 BDI_RECLAIMABLE);
713 task_io_account_write(PAGE_CACHE_SIZE); 715 task_io_account_write(PAGE_CACHE_SIZE);
714 } 716 }
715 radix_tree_tag_set(&mapping->page_tree, 717 radix_tree_tag_set(&mapping->page_tree,
@@ -1728,7 +1730,6 @@ done:
1728 * The page and buffer_heads can be released at any time from 1730 * The page and buffer_heads can be released at any time from
1729 * here on. 1731 * here on.
1730 */ 1732 */
1731 wbc->pages_skipped++; /* We didn't write this page */
1732 } 1733 }
1733 return err; 1734 return err;
1734 1735
diff --git a/fs/char_dev.c b/fs/char_dev.c
index bbbf07baa145..c3bfa76765c4 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -545,6 +545,7 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
545void __init chrdev_init(void) 545void __init chrdev_init(void)
546{ 546{
547 cdev_map = kobj_map_init(base_probe, &chrdevs_lock); 547 cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
548 bdi_init(&directly_mappable_cdev_bdi);
548} 549}
549 550
550 551
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index cabb6a55d7dd..ba8f7868cb23 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -704,7 +704,7 @@ const struct file_operations cifs_dir_ops = {
704}; 704};
705 705
706static void 706static void
707cifs_init_once(void *inode, struct kmem_cache *cachep, unsigned long flags) 707cifs_init_once(struct kmem_cache *cachep, void *inode)
708{ 708{
709 struct cifsInodeInfo *cifsi = inode; 709 struct cifsInodeInfo *cifsi = inode;
710 710
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 342f4e0d582e..2f58dfc70083 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -58,7 +58,7 @@ static void coda_destroy_inode(struct inode *inode)
58 kmem_cache_free(coda_inode_cachep, ITOC(inode)); 58 kmem_cache_free(coda_inode_cachep, ITOC(inode));
59} 59}
60 60
61static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 61static void init_once(struct kmem_cache * cachep, void *foo)
62{ 62{
63 struct coda_inode_info *ei = (struct coda_inode_info *) foo; 63 struct coda_inode_info *ei = (struct coda_inode_info *) foo;
64 64
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 9c3fd07f35e0..6dacd39bf048 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -108,7 +108,6 @@
108#include <linux/dvb/dmx.h> 108#include <linux/dvb/dmx.h>
109#include <linux/dvb/frontend.h> 109#include <linux/dvb/frontend.h>
110#include <linux/dvb/video.h> 110#include <linux/dvb/video.h>
111#include <linux/lp.h>
112 111
113#ifdef CONFIG_SPARC 112#ifdef CONFIG_SPARC
114#include <asm/fbio.h> 113#include <asm/fbio.h>
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index 3b0185fdf9a4..cca98609aa7f 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -56,6 +56,8 @@ extern int configfs_is_root(struct config_item *item);
56 56
57extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *); 57extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *);
58extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *)); 58extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *));
59extern int configfs_inode_init(void);
60extern void configfs_inode_exit(void);
59 61
60extern int configfs_create_file(struct config_item *, const struct configfs_attribute *); 62extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
61extern int configfs_make_dirent(struct configfs_dirent *, 63extern int configfs_make_dirent(struct configfs_dirent *,
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 2f436d4f1d6d..50ed691098bc 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -142,7 +142,7 @@ static int init_dir(struct inode * inode)
142 return 0; 142 return 0;
143} 143}
144 144
145static int init_file(struct inode * inode) 145static int configfs_init_file(struct inode * inode)
146{ 146{
147 inode->i_size = PAGE_SIZE; 147 inode->i_size = PAGE_SIZE;
148 inode->i_fop = &configfs_file_operations; 148 inode->i_fop = &configfs_file_operations;
@@ -283,7 +283,8 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
283 283
284 dentry->d_fsdata = configfs_get(sd); 284 dentry->d_fsdata = configfs_get(sd);
285 sd->s_dentry = dentry; 285 sd->s_dentry = dentry;
286 error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG, init_file); 286 error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG,
287 configfs_init_file);
287 if (error) { 288 if (error) {
288 configfs_put(sd); 289 configfs_put(sd);
289 return error; 290 return error;
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index dbd257d956c4..4c1ebff778ee 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -256,4 +256,12 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
256 mutex_unlock(&dir->d_inode->i_mutex); 256 mutex_unlock(&dir->d_inode->i_mutex);
257} 257}
258 258
259int __init configfs_inode_init(void)
260{
261 return bdi_init(&configfs_backing_dev_info);
262}
259 263
264void __exit configfs_inode_exit(void)
265{
266 bdi_destroy(&configfs_backing_dev_info);
267}
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 871b0cb61839..3bf0278ea843 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -154,8 +154,16 @@ static int __init configfs_init(void)
154 subsystem_unregister(&config_subsys); 154 subsystem_unregister(&config_subsys);
155 kmem_cache_destroy(configfs_dir_cachep); 155 kmem_cache_destroy(configfs_dir_cachep);
156 configfs_dir_cachep = NULL; 156 configfs_dir_cachep = NULL;
157 goto out;
157 } 158 }
158 159
160 err = configfs_inode_init();
161 if (err) {
162 unregister_filesystem(&configfs_fs_type);
163 subsystem_unregister(&config_subsys);
164 kmem_cache_destroy(configfs_dir_cachep);
165 configfs_dir_cachep = NULL;
166 }
159out: 167out:
160 return err; 168 return err;
161} 169}
@@ -166,6 +174,7 @@ static void __exit configfs_exit(void)
166 subsystem_unregister(&config_subsys); 174 subsystem_unregister(&config_subsys);
167 kmem_cache_destroy(configfs_dir_cachep); 175 kmem_cache_destroy(configfs_dir_cachep);
168 configfs_dir_cachep = NULL; 176 configfs_dir_cachep = NULL;
177 configfs_inode_exit();
169} 178}
170 179
171MODULE_AUTHOR("Oracle"); 180MODULE_AUTHOR("Oracle");
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 3d194a2be3f5..5c817bd08389 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -258,12 +258,21 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
258 258
259 /* Do sanity checks on the superblock */ 259 /* Do sanity checks on the superblock */
260 if (super.magic != CRAMFS_MAGIC) { 260 if (super.magic != CRAMFS_MAGIC) {
261 /* check for wrong endianess */
262 if (super.magic == CRAMFS_MAGIC_WEND) {
263 if (!silent)
264 printk(KERN_ERR "cramfs: wrong endianess\n");
265 goto out;
266 }
267
261 /* check at 512 byte offset */ 268 /* check at 512 byte offset */
262 mutex_lock(&read_mutex); 269 mutex_lock(&read_mutex);
263 memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super)); 270 memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
264 mutex_unlock(&read_mutex); 271 mutex_unlock(&read_mutex);
265 if (super.magic != CRAMFS_MAGIC) { 272 if (super.magic != CRAMFS_MAGIC) {
266 if (!silent) 273 if (super.magic == CRAMFS_MAGIC_WEND && !silent)
274 printk(KERN_ERR "cramfs: wrong endianess\n");
275 else if (!silent)
267 printk(KERN_ERR "cramfs: wrong magic\n"); 276 printk(KERN_ERR "cramfs: wrong magic\n");
268 goto out; 277 goto out;
269 } 278 }
diff --git a/fs/dcache.c b/fs/dcache.c
index 7da0cf50873e..5489b2d98a00 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -381,20 +381,17 @@ restart:
381 * Throw away a dentry - free the inode, dput the parent. This requires that 381 * Throw away a dentry - free the inode, dput the parent. This requires that
382 * the LRU list has already been removed. 382 * the LRU list has already been removed.
383 * 383 *
384 * If prune_parents is true, try to prune ancestors as well. 384 * Try to prune ancestors as well. This is necessary to prevent
385 * quadratic behavior of shrink_dcache_parent(), but is also expected
386 * to be beneficial in reducing dentry cache fragmentation.
385 * 387 *
386 * Called with dcache_lock, drops it and then regains. 388 * Called with dcache_lock, drops it and then regains.
387 * Called with dentry->d_lock held, drops it. 389 * Called with dentry->d_lock held, drops it.
388 */ 390 */
389static void prune_one_dentry(struct dentry * dentry, int prune_parents) 391static void prune_one_dentry(struct dentry * dentry)
390{ 392{
391 __d_drop(dentry); 393 __d_drop(dentry);
392 dentry = d_kill(dentry); 394 dentry = d_kill(dentry);
393 if (!prune_parents) {
394 dput(dentry);
395 spin_lock(&dcache_lock);
396 return;
397 }
398 395
399 /* 396 /*
400 * Prune ancestors. Locking is simpler than in dput(), 397 * Prune ancestors. Locking is simpler than in dput(),
@@ -422,7 +419,6 @@ static void prune_one_dentry(struct dentry * dentry, int prune_parents)
422 * @count: number of entries to try and free 419 * @count: number of entries to try and free
423 * @sb: if given, ignore dentries for other superblocks 420 * @sb: if given, ignore dentries for other superblocks
424 * which are being unmounted. 421 * which are being unmounted.
425 * @prune_parents: if true, try to prune ancestors as well in one go
426 * 422 *
427 * Shrink the dcache. This is done when we need 423 * Shrink the dcache. This is done when we need
428 * more memory, or simply when we need to unmount 424 * more memory, or simply when we need to unmount
@@ -433,7 +429,7 @@ static void prune_one_dentry(struct dentry * dentry, int prune_parents)
433 * all the dentries are in use. 429 * all the dentries are in use.
434 */ 430 */
435 431
436static void prune_dcache(int count, struct super_block *sb, int prune_parents) 432static void prune_dcache(int count, struct super_block *sb)
437{ 433{
438 spin_lock(&dcache_lock); 434 spin_lock(&dcache_lock);
439 for (; count ; count--) { 435 for (; count ; count--) {
@@ -493,7 +489,7 @@ static void prune_dcache(int count, struct super_block *sb, int prune_parents)
493 * without taking the s_umount lock (I already hold it). 489 * without taking the s_umount lock (I already hold it).
494 */ 490 */
495 if (sb && dentry->d_sb == sb) { 491 if (sb && dentry->d_sb == sb) {
496 prune_one_dentry(dentry, prune_parents); 492 prune_one_dentry(dentry);
497 continue; 493 continue;
498 } 494 }
499 /* 495 /*
@@ -508,7 +504,7 @@ static void prune_dcache(int count, struct super_block *sb, int prune_parents)
508 s_umount = &dentry->d_sb->s_umount; 504 s_umount = &dentry->d_sb->s_umount;
509 if (down_read_trylock(s_umount)) { 505 if (down_read_trylock(s_umount)) {
510 if (dentry->d_sb->s_root != NULL) { 506 if (dentry->d_sb->s_root != NULL) {
511 prune_one_dentry(dentry, prune_parents); 507 prune_one_dentry(dentry);
512 up_read(s_umount); 508 up_read(s_umount);
513 continue; 509 continue;
514 } 510 }
@@ -557,18 +553,18 @@ void shrink_dcache_sb(struct super_block * sb)
557 * superblock to the most recent end of the unused list. 553 * superblock to the most recent end of the unused list.
558 */ 554 */
559 spin_lock(&dcache_lock); 555 spin_lock(&dcache_lock);
560 list_for_each_safe(tmp, next, &dentry_unused) { 556 list_for_each_prev_safe(tmp, next, &dentry_unused) {
561 dentry = list_entry(tmp, struct dentry, d_lru); 557 dentry = list_entry(tmp, struct dentry, d_lru);
562 if (dentry->d_sb != sb) 558 if (dentry->d_sb != sb)
563 continue; 559 continue;
564 list_move(tmp, &dentry_unused); 560 list_move_tail(tmp, &dentry_unused);
565 } 561 }
566 562
567 /* 563 /*
568 * Pass two ... free the dentries for this superblock. 564 * Pass two ... free the dentries for this superblock.
569 */ 565 */
570repeat: 566repeat:
571 list_for_each_safe(tmp, next, &dentry_unused) { 567 list_for_each_prev_safe(tmp, next, &dentry_unused) {
572 dentry = list_entry(tmp, struct dentry, d_lru); 568 dentry = list_entry(tmp, struct dentry, d_lru);
573 if (dentry->d_sb != sb) 569 if (dentry->d_sb != sb)
574 continue; 570 continue;
@@ -579,7 +575,7 @@ repeat:
579 spin_unlock(&dentry->d_lock); 575 spin_unlock(&dentry->d_lock);
580 continue; 576 continue;
581 } 577 }
582 prune_one_dentry(dentry, 1); 578 prune_one_dentry(dentry);
583 cond_resched_lock(&dcache_lock); 579 cond_resched_lock(&dcache_lock);
584 goto repeat; 580 goto repeat;
585 } 581 }
@@ -858,7 +854,7 @@ void shrink_dcache_parent(struct dentry * parent)
858 int found; 854 int found;
859 855
860 while ((found = select_parent(parent)) != 0) 856 while ((found = select_parent(parent)) != 0)
861 prune_dcache(found, parent->d_sb, 1); 857 prune_dcache(found, parent->d_sb);
862} 858}
863 859
864/* 860/*
@@ -878,7 +874,7 @@ static int shrink_dcache_memory(int nr, gfp_t gfp_mask)
878 if (nr) { 874 if (nr) {
879 if (!(gfp_mask & __GFP_FS)) 875 if (!(gfp_mask & __GFP_FS))
880 return -1; 876 return -1;
881 prune_dcache(nr, NULL, 1); 877 prune_dcache(nr, NULL);
882 } 878 }
883 return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure; 879 return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
884} 880}
@@ -1514,8 +1510,8 @@ static void switch_names(struct dentry *dentry, struct dentry *target)
1514 * This forceful removal will result in ugly /proc output if 1510 * This forceful removal will result in ugly /proc output if
1515 * somebody holds a file open that got deleted due to a rename. 1511 * somebody holds a file open that got deleted due to a rename.
1516 * We could be nicer about the deleted file, and let it show 1512 * We could be nicer about the deleted file, and let it show
1517 * up under the name it got deleted rather than the name that 1513 * up under the name it had before it was deleted rather than
1518 * deleted it. 1514 * under the original name of the file that was moved on top of it.
1519 */ 1515 */
1520 1516
1521/* 1517/*
@@ -1546,7 +1542,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target)
1546 } 1542 }
1547 1543
1548 /* Move the dentry to the target hash queue, if on different bucket */ 1544 /* Move the dentry to the target hash queue, if on different bucket */
1549 if (dentry->d_flags & DCACHE_UNHASHED) 1545 if (d_unhashed(dentry))
1550 goto already_unhashed; 1546 goto already_unhashed;
1551 1547
1552 hlist_del_rcu(&dentry->d_hash); 1548 hlist_del_rcu(&dentry->d_hash);
@@ -2108,7 +2104,7 @@ static void __init dcache_init_early(void)
2108 INIT_HLIST_HEAD(&dentry_hashtable[loop]); 2104 INIT_HLIST_HEAD(&dentry_hashtable[loop]);
2109} 2105}
2110 2106
2111static void __init dcache_init(unsigned long mempages) 2107static void __init dcache_init(void)
2112{ 2108{
2113 int loop; 2109 int loop;
2114 2110
@@ -2170,10 +2166,10 @@ void __init vfs_caches_init(unsigned long mempages)
2170 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, 2166 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
2171 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 2167 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
2172 2168
2173 dcache_init(mempages); 2169 dcache_init();
2174 inode_init(mempages); 2170 inode_init();
2175 files_init(mempages); 2171 files_init(mempages);
2176 mnt_init(mempages); 2172 mnt_init();
2177 bdev_cache_init(); 2173 bdev_cache_init();
2178 chrdev_init(); 2174 chrdev_init();
2179} 2175}
diff --git a/fs/dlm/Kconfig b/fs/dlm/Kconfig
index 54bcc00ec8df..2dbb422e8116 100644
--- a/fs/dlm/Kconfig
+++ b/fs/dlm/Kconfig
@@ -1,8 +1,6 @@
1menu "Distributed Lock Manager" 1menuconfig DLM
2 depends on EXPERIMENTAL && INET
3
4config DLM
5 tristate "Distributed Lock Manager (DLM)" 2 tristate "Distributed Lock Manager (DLM)"
3 depends on EXPERIMENTAL && INET
6 depends on SYSFS && (IPV6 || IPV6=n) 4 depends on SYSFS && (IPV6 || IPV6=n)
7 select CONFIGFS_FS 5 select CONFIGFS_FS
8 select IP_SCTP 6 select IP_SCTP
@@ -17,5 +15,3 @@ config DLM_DEBUG
17 Under the debugfs mount point, the name of each lockspace will 15 Under the debugfs mount point, the name of each lockspace will
18 appear as a file in the "dlm" directory. The output is the 16 appear as a file in the "dlm" directory. The output is the
19 list of resource and locks the local node knows about. 17 list of resource and locks the local node knows about.
20
21endmenu
diff --git a/fs/dquot.c b/fs/dquot.c
index de9a29f64ff3..2809768d9c41 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -79,6 +79,10 @@
79#include <linux/capability.h> 79#include <linux/capability.h>
80#include <linux/quotaops.h> 80#include <linux/quotaops.h>
81#include <linux/writeback.h> /* for inode_lock, oddly enough.. */ 81#include <linux/writeback.h> /* for inode_lock, oddly enough.. */
82#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
83#include <net/netlink.h>
84#include <net/genetlink.h>
85#endif
82 86
83#include <asm/uaccess.h> 87#include <asm/uaccess.h>
84 88
@@ -823,6 +827,7 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
823 clear_bit(DQ_BLKS_B, &dquot->dq_flags); 827 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
824} 828}
825 829
830#ifdef CONFIG_PRINT_QUOTA_WARNING
826static int flag_print_warnings = 1; 831static int flag_print_warnings = 1;
827 832
828static inline int need_print_warning(struct dquot *dquot) 833static inline int need_print_warning(struct dquot *dquot)
@@ -839,22 +844,15 @@ static inline int need_print_warning(struct dquot *dquot)
839 return 0; 844 return 0;
840} 845}
841 846
842/* Values of warnings */
843#define NOWARN 0
844#define IHARDWARN 1
845#define ISOFTLONGWARN 2
846#define ISOFTWARN 3
847#define BHARDWARN 4
848#define BSOFTLONGWARN 5
849#define BSOFTWARN 6
850
851/* Print warning to user which exceeded quota */ 847/* Print warning to user which exceeded quota */
852static void print_warning(struct dquot *dquot, const char warntype) 848static void print_warning(struct dquot *dquot, const char warntype)
853{ 849{
854 char *msg = NULL; 850 char *msg = NULL;
855 struct tty_struct *tty; 851 struct tty_struct *tty;
856 int flag = (warntype == BHARDWARN || warntype == BSOFTLONGWARN) ? DQ_BLKS_B : 852 int flag = (warntype == QUOTA_NL_BHARDWARN ||
857 ((warntype == IHARDWARN || warntype == ISOFTLONGWARN) ? DQ_INODES_B : 0); 853 warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
854 ((warntype == QUOTA_NL_IHARDWARN ||
855 warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
858 856
859 if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags))) 857 if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
860 return; 858 return;
@@ -864,28 +862,28 @@ static void print_warning(struct dquot *dquot, const char warntype)
864 if (!tty) 862 if (!tty)
865 goto out_lock; 863 goto out_lock;
866 tty_write_message(tty, dquot->dq_sb->s_id); 864 tty_write_message(tty, dquot->dq_sb->s_id);
867 if (warntype == ISOFTWARN || warntype == BSOFTWARN) 865 if (warntype == QUOTA_NL_ISOFTWARN || warntype == QUOTA_NL_BSOFTWARN)
868 tty_write_message(tty, ": warning, "); 866 tty_write_message(tty, ": warning, ");
869 else 867 else
870 tty_write_message(tty, ": write failed, "); 868 tty_write_message(tty, ": write failed, ");
871 tty_write_message(tty, quotatypes[dquot->dq_type]); 869 tty_write_message(tty, quotatypes[dquot->dq_type]);
872 switch (warntype) { 870 switch (warntype) {
873 case IHARDWARN: 871 case QUOTA_NL_IHARDWARN:
874 msg = " file limit reached.\r\n"; 872 msg = " file limit reached.\r\n";
875 break; 873 break;
876 case ISOFTLONGWARN: 874 case QUOTA_NL_ISOFTLONGWARN:
877 msg = " file quota exceeded too long.\r\n"; 875 msg = " file quota exceeded too long.\r\n";
878 break; 876 break;
879 case ISOFTWARN: 877 case QUOTA_NL_ISOFTWARN:
880 msg = " file quota exceeded.\r\n"; 878 msg = " file quota exceeded.\r\n";
881 break; 879 break;
882 case BHARDWARN: 880 case QUOTA_NL_BHARDWARN:
883 msg = " block limit reached.\r\n"; 881 msg = " block limit reached.\r\n";
884 break; 882 break;
885 case BSOFTLONGWARN: 883 case QUOTA_NL_BSOFTLONGWARN:
886 msg = " block quota exceeded too long.\r\n"; 884 msg = " block quota exceeded too long.\r\n";
887 break; 885 break;
888 case BSOFTWARN: 886 case QUOTA_NL_BSOFTWARN:
889 msg = " block quota exceeded.\r\n"; 887 msg = " block quota exceeded.\r\n";
890 break; 888 break;
891 } 889 }
@@ -893,14 +891,93 @@ static void print_warning(struct dquot *dquot, const char warntype)
893out_lock: 891out_lock:
894 mutex_unlock(&tty_mutex); 892 mutex_unlock(&tty_mutex);
895} 893}
894#endif
895
896#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
897
898/* Size of quota netlink message - actually an upperbound for buffer size */
899#define QUOTA_NL_MSG_SIZE 32
900
901/* Netlink family structure for quota */
902static struct genl_family quota_genl_family = {
903 .id = GENL_ID_GENERATE,
904 .hdrsize = 0,
905 .name = "VFS_DQUOT",
906 .version = 1,
907 .maxattr = QUOTA_NL_A_MAX,
908};
909
910/* Send warning to userspace about user which exceeded quota */
911static void send_warning(const struct dquot *dquot, const char warntype)
912{
913 static atomic_t seq;
914 struct sk_buff *skb;
915 void *msg_head;
916 int ret;
917
918 /* We have to allocate using GFP_NOFS as we are called from a
919 * filesystem performing write and thus further recursion into
920 * the fs to free some data could cause deadlocks. */
921 skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS);
922 if (!skb) {
923 printk(KERN_ERR
924 "VFS: Not enough memory to send quota warning.\n");
925 return;
926 }
927 msg_head = genlmsg_put(skb, 0, atomic_add_return(1, &seq),
928 &quota_genl_family, 0, QUOTA_NL_C_WARNING);
929 if (!msg_head) {
930 printk(KERN_ERR
931 "VFS: Cannot store netlink header in quota warning.\n");
932 goto err_out;
933 }
934 ret = nla_put_u32(skb, QUOTA_NL_A_QTYPE, dquot->dq_type);
935 if (ret)
936 goto attr_err_out;
937 ret = nla_put_u64(skb, QUOTA_NL_A_EXCESS_ID, dquot->dq_id);
938 if (ret)
939 goto attr_err_out;
940 ret = nla_put_u32(skb, QUOTA_NL_A_WARNING, warntype);
941 if (ret)
942 goto attr_err_out;
943 ret = nla_put_u32(skb, QUOTA_NL_A_DEV_MAJOR,
944 MAJOR(dquot->dq_sb->s_dev));
945 if (ret)
946 goto attr_err_out;
947 ret = nla_put_u32(skb, QUOTA_NL_A_DEV_MINOR,
948 MINOR(dquot->dq_sb->s_dev));
949 if (ret)
950 goto attr_err_out;
951 ret = nla_put_u64(skb, QUOTA_NL_A_CAUSED_ID, current->user->uid);
952 if (ret)
953 goto attr_err_out;
954 genlmsg_end(skb, msg_head);
955
956 ret = genlmsg_multicast(skb, 0, quota_genl_family.id, GFP_NOFS);
957 if (ret < 0 && ret != -ESRCH)
958 printk(KERN_ERR
959 "VFS: Failed to send notification message: %d\n", ret);
960 return;
961attr_err_out:
962 printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret);
963err_out:
964 kfree_skb(skb);
965}
966#endif
896 967
897static inline void flush_warnings(struct dquot **dquots, char *warntype) 968static inline void flush_warnings(struct dquot **dquots, char *warntype)
898{ 969{
899 int i; 970 int i;
900 971
901 for (i = 0; i < MAXQUOTAS; i++) 972 for (i = 0; i < MAXQUOTAS; i++)
902 if (dquots[i] != NODQUOT && warntype[i] != NOWARN) 973 if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN) {
974#ifdef CONFIG_PRINT_QUOTA_WARNING
903 print_warning(dquots[i], warntype[i]); 975 print_warning(dquots[i], warntype[i]);
976#endif
977#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
978 send_warning(dquots[i], warntype[i]);
979#endif
980 }
904} 981}
905 982
906static inline char ignore_hardlimit(struct dquot *dquot) 983static inline char ignore_hardlimit(struct dquot *dquot)
@@ -914,14 +991,14 @@ static inline char ignore_hardlimit(struct dquot *dquot)
914/* needs dq_data_lock */ 991/* needs dq_data_lock */
915static int check_idq(struct dquot *dquot, ulong inodes, char *warntype) 992static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
916{ 993{
917 *warntype = NOWARN; 994 *warntype = QUOTA_NL_NOWARN;
918 if (inodes <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags)) 995 if (inodes <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags))
919 return QUOTA_OK; 996 return QUOTA_OK;
920 997
921 if (dquot->dq_dqb.dqb_ihardlimit && 998 if (dquot->dq_dqb.dqb_ihardlimit &&
922 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_ihardlimit && 999 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_ihardlimit &&
923 !ignore_hardlimit(dquot)) { 1000 !ignore_hardlimit(dquot)) {
924 *warntype = IHARDWARN; 1001 *warntype = QUOTA_NL_IHARDWARN;
925 return NO_QUOTA; 1002 return NO_QUOTA;
926 } 1003 }
927 1004
@@ -929,14 +1006,14 @@ static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
929 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit && 1006 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit &&
930 dquot->dq_dqb.dqb_itime && get_seconds() >= dquot->dq_dqb.dqb_itime && 1007 dquot->dq_dqb.dqb_itime && get_seconds() >= dquot->dq_dqb.dqb_itime &&
931 !ignore_hardlimit(dquot)) { 1008 !ignore_hardlimit(dquot)) {
932 *warntype = ISOFTLONGWARN; 1009 *warntype = QUOTA_NL_ISOFTLONGWARN;
933 return NO_QUOTA; 1010 return NO_QUOTA;
934 } 1011 }
935 1012
936 if (dquot->dq_dqb.dqb_isoftlimit && 1013 if (dquot->dq_dqb.dqb_isoftlimit &&
937 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit && 1014 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit &&
938 dquot->dq_dqb.dqb_itime == 0) { 1015 dquot->dq_dqb.dqb_itime == 0) {
939 *warntype = ISOFTWARN; 1016 *warntype = QUOTA_NL_ISOFTWARN;
940 dquot->dq_dqb.dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; 1017 dquot->dq_dqb.dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace;
941 } 1018 }
942 1019
@@ -946,7 +1023,7 @@ static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
946/* needs dq_data_lock */ 1023/* needs dq_data_lock */
947static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warntype) 1024static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warntype)
948{ 1025{
949 *warntype = 0; 1026 *warntype = QUOTA_NL_NOWARN;
950 if (space <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags)) 1027 if (space <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags))
951 return QUOTA_OK; 1028 return QUOTA_OK;
952 1029
@@ -954,7 +1031,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
954 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bhardlimit && 1031 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bhardlimit &&
955 !ignore_hardlimit(dquot)) { 1032 !ignore_hardlimit(dquot)) {
956 if (!prealloc) 1033 if (!prealloc)
957 *warntype = BHARDWARN; 1034 *warntype = QUOTA_NL_BHARDWARN;
958 return NO_QUOTA; 1035 return NO_QUOTA;
959 } 1036 }
960 1037
@@ -963,7 +1040,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
963 dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime && 1040 dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime &&
964 !ignore_hardlimit(dquot)) { 1041 !ignore_hardlimit(dquot)) {
965 if (!prealloc) 1042 if (!prealloc)
966 *warntype = BSOFTLONGWARN; 1043 *warntype = QUOTA_NL_BSOFTLONGWARN;
967 return NO_QUOTA; 1044 return NO_QUOTA;
968 } 1045 }
969 1046
@@ -971,7 +1048,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
971 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit && 1048 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit &&
972 dquot->dq_dqb.dqb_btime == 0) { 1049 dquot->dq_dqb.dqb_btime == 0) {
973 if (!prealloc) { 1050 if (!prealloc) {
974 *warntype = BSOFTWARN; 1051 *warntype = QUOTA_NL_BSOFTWARN;
975 dquot->dq_dqb.dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace; 1052 dquot->dq_dqb.dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace;
976 } 1053 }
977 else 1054 else
@@ -1066,7 +1143,7 @@ out_add:
1066 return QUOTA_OK; 1143 return QUOTA_OK;
1067 } 1144 }
1068 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1145 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1069 warntype[cnt] = NOWARN; 1146 warntype[cnt] = QUOTA_NL_NOWARN;
1070 1147
1071 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1148 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1072 if (IS_NOQUOTA(inode)) { /* Now we can do reliable test... */ 1149 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)
1112 if (IS_NOQUOTA(inode)) 1189 if (IS_NOQUOTA(inode))
1113 return QUOTA_OK; 1190 return QUOTA_OK;
1114 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1191 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1115 warntype[cnt] = NOWARN; 1192 warntype[cnt] = QUOTA_NL_NOWARN;
1116 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1193 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1117 if (IS_NOQUOTA(inode)) { 1194 if (IS_NOQUOTA(inode)) {
1118 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1195 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -1234,7 +1311,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1234 /* Clear the arrays */ 1311 /* Clear the arrays */
1235 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1312 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1236 transfer_to[cnt] = transfer_from[cnt] = NODQUOT; 1313 transfer_to[cnt] = transfer_from[cnt] = NODQUOT;
1237 warntype[cnt] = NOWARN; 1314 warntype[cnt] = QUOTA_NL_NOWARN;
1238 } 1315 }
1239 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1316 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1240 /* Now recheck reliably when holding dqptr_sem */ 1317 /* Now recheck reliably when holding dqptr_sem */
@@ -1808,6 +1885,7 @@ static ctl_table fs_dqstats_table[] = {
1808 .mode = 0444, 1885 .mode = 0444,
1809 .proc_handler = &proc_dointvec, 1886 .proc_handler = &proc_dointvec,
1810 }, 1887 },
1888#ifdef CONFIG_PRINT_QUOTA_WARNING
1811 { 1889 {
1812 .ctl_name = FS_DQ_WARNINGS, 1890 .ctl_name = FS_DQ_WARNINGS,
1813 .procname = "warnings", 1891 .procname = "warnings",
@@ -1816,6 +1894,7 @@ static ctl_table fs_dqstats_table[] = {
1816 .mode = 0644, 1894 .mode = 0644,
1817 .proc_handler = &proc_dointvec, 1895 .proc_handler = &proc_dointvec,
1818 }, 1896 },
1897#endif
1819 { .ctl_name = 0 }, 1898 { .ctl_name = 0 },
1820}; 1899};
1821 1900
@@ -1877,6 +1956,11 @@ static int __init dquot_init(void)
1877 1956
1878 register_shrinker(&dqcache_shrinker); 1957 register_shrinker(&dqcache_shrinker);
1879 1958
1959#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
1960 if (genl_register_family(&quota_genl_family) != 0)
1961 printk(KERN_ERR "VFS: Failed to create quota netlink interface.\n");
1962#endif
1963
1880 return 0; 1964 return 0;
1881} 1965}
1882module_init(dquot_init); 1966module_init(dquot_init);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 97e6801f722c..b83a512b7e08 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -32,7 +32,6 @@
32#include <linux/crypto.h> 32#include <linux/crypto.h>
33#include <linux/netlink.h> 33#include <linux/netlink.h>
34#include <linux/mount.h> 34#include <linux/mount.h>
35#include <linux/dcache.h>
36#include <linux/pagemap.h> 35#include <linux/pagemap.h>
37#include <linux/key.h> 36#include <linux/key.h>
38#include <linux/parser.h> 37#include <linux/parser.h>
@@ -611,7 +610,7 @@ static struct file_system_type ecryptfs_fs_type = {
611 * Initializes the ecryptfs_inode_info_cache when it is created 610 * Initializes the ecryptfs_inode_info_cache when it is created
612 */ 611 */
613static void 612static void
614inode_info_init_once(void *vptr, struct kmem_cache *cachep, unsigned long flags) 613inode_info_init_once(struct kmem_cache *cachep, void *vptr)
615{ 614{
616 struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr; 615 struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr;
617 616
@@ -622,7 +621,7 @@ static struct ecryptfs_cache_info {
622 struct kmem_cache **cache; 621 struct kmem_cache **cache;
623 const char *name; 622 const char *name;
624 size_t size; 623 size_t size;
625 void (*ctor)(void*, struct kmem_cache *, unsigned long); 624 void (*ctor)(struct kmem_cache *cache, void *obj);
626} ecryptfs_cache_infos[] = { 625} ecryptfs_cache_infos[] = {
627 { 626 {
628 .cache = &ecryptfs_auth_tok_list_item_cache, 627 .cache = &ecryptfs_auth_tok_list_item_cache,
diff --git a/fs/efs/super.c b/fs/efs/super.c
index ce4acb8ff819..25d0326c5f1c 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -69,7 +69,7 @@ static void efs_destroy_inode(struct inode *inode)
69 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode)); 69 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
70} 70}
71 71
72static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 72static void init_once(struct kmem_cache *cachep, void *foo)
73{ 73{
74 struct efs_inode_info *ei = (struct efs_inode_info *) foo; 74 struct efs_inode_info *ei = (struct efs_inode_info *) foo;
75 75
diff --git a/fs/exec.c b/fs/exec.c
index 073b0b8c6d05..070ddf13cb71 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -29,6 +29,7 @@
29#include <linux/stat.h> 29#include <linux/stat.h>
30#include <linux/fcntl.h> 30#include <linux/fcntl.h>
31#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
32#include <linux/string.h>
32#include <linux/init.h> 33#include <linux/init.h>
33#include <linux/pagemap.h> 34#include <linux/pagemap.h>
34#include <linux/highmem.h> 35#include <linux/highmem.h>
@@ -63,52 +64,28 @@ int core_uses_pid;
63char core_pattern[CORENAME_MAX_SIZE] = "core"; 64char core_pattern[CORENAME_MAX_SIZE] = "core";
64int suid_dumpable = 0; 65int suid_dumpable = 0;
65 66
66EXPORT_SYMBOL(suid_dumpable);
67/* The maximal length of core_pattern is also specified in sysctl.c */ 67/* The maximal length of core_pattern is also specified in sysctl.c */
68 68
69static struct linux_binfmt *formats; 69static LIST_HEAD(formats);
70static DEFINE_RWLOCK(binfmt_lock); 70static DEFINE_RWLOCK(binfmt_lock);
71 71
72int register_binfmt(struct linux_binfmt * fmt) 72int register_binfmt(struct linux_binfmt * fmt)
73{ 73{
74 struct linux_binfmt ** tmp = &formats;
75
76 if (!fmt) 74 if (!fmt)
77 return -EINVAL; 75 return -EINVAL;
78 if (fmt->next)
79 return -EBUSY;
80 write_lock(&binfmt_lock); 76 write_lock(&binfmt_lock);
81 while (*tmp) { 77 list_add(&fmt->lh, &formats);
82 if (fmt == *tmp) {
83 write_unlock(&binfmt_lock);
84 return -EBUSY;
85 }
86 tmp = &(*tmp)->next;
87 }
88 fmt->next = formats;
89 formats = fmt;
90 write_unlock(&binfmt_lock); 78 write_unlock(&binfmt_lock);
91 return 0; 79 return 0;
92} 80}
93 81
94EXPORT_SYMBOL(register_binfmt); 82EXPORT_SYMBOL(register_binfmt);
95 83
96int unregister_binfmt(struct linux_binfmt * fmt) 84void unregister_binfmt(struct linux_binfmt * fmt)
97{ 85{
98 struct linux_binfmt ** tmp = &formats;
99
100 write_lock(&binfmt_lock); 86 write_lock(&binfmt_lock);
101 while (*tmp) { 87 list_del(&fmt->lh);
102 if (fmt == *tmp) {
103 *tmp = fmt->next;
104 fmt->next = NULL;
105 write_unlock(&binfmt_lock);
106 return 0;
107 }
108 tmp = &(*tmp)->next;
109 }
110 write_unlock(&binfmt_lock); 88 write_unlock(&binfmt_lock);
111 return -EINVAL;
112} 89}
113 90
114EXPORT_SYMBOL(unregister_binfmt); 91EXPORT_SYMBOL(unregister_binfmt);
@@ -134,9 +111,6 @@ asmlinkage long sys_uselib(const char __user * library)
134 if (error) 111 if (error)
135 goto out; 112 goto out;
136 113
137 error = -EACCES;
138 if (nd.mnt->mnt_flags & MNT_NOEXEC)
139 goto exit;
140 error = -EINVAL; 114 error = -EINVAL;
141 if (!S_ISREG(nd.dentry->d_inode->i_mode)) 115 if (!S_ISREG(nd.dentry->d_inode->i_mode))
142 goto exit; 116 goto exit;
@@ -155,7 +129,7 @@ asmlinkage long sys_uselib(const char __user * library)
155 struct linux_binfmt * fmt; 129 struct linux_binfmt * fmt;
156 130
157 read_lock(&binfmt_lock); 131 read_lock(&binfmt_lock);
158 for (fmt = formats ; fmt ; fmt = fmt->next) { 132 list_for_each_entry(fmt, &formats, lh) {
159 if (!fmt->load_shlib) 133 if (!fmt->load_shlib)
160 continue; 134 continue;
161 if (!try_module_get(fmt->module)) 135 if (!try_module_get(fmt->module))
@@ -680,8 +654,7 @@ struct file *open_exec(const char *name)
680 if (!err) { 654 if (!err) {
681 struct inode *inode = nd.dentry->d_inode; 655 struct inode *inode = nd.dentry->d_inode;
682 file = ERR_PTR(-EACCES); 656 file = ERR_PTR(-EACCES);
683 if (!(nd.mnt->mnt_flags & MNT_NOEXEC) && 657 if (S_ISREG(inode->i_mode)) {
684 S_ISREG(inode->i_mode)) {
685 int err = vfs_permission(&nd, MAY_EXEC); 658 int err = vfs_permission(&nd, MAY_EXEC);
686 file = ERR_PTR(err); 659 file = ERR_PTR(err);
687 if (!err) { 660 if (!err) {
@@ -773,24 +746,11 @@ static int exec_mmap(struct mm_struct *mm)
773static int de_thread(struct task_struct *tsk) 746static int de_thread(struct task_struct *tsk)
774{ 747{
775 struct signal_struct *sig = tsk->signal; 748 struct signal_struct *sig = tsk->signal;
776 struct sighand_struct *newsighand, *oldsighand = tsk->sighand; 749 struct sighand_struct *oldsighand = tsk->sighand;
777 spinlock_t *lock = &oldsighand->siglock; 750 spinlock_t *lock = &oldsighand->siglock;
778 struct task_struct *leader = NULL; 751 struct task_struct *leader = NULL;
779 int count; 752 int count;
780 753
781 /*
782 * If we don't share sighandlers, then we aren't sharing anything
783 * and we can just re-use it all.
784 */
785 if (atomic_read(&oldsighand->count) <= 1) {
786 exit_itimers(sig);
787 return 0;
788 }
789
790 newsighand = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
791 if (!newsighand)
792 return -ENOMEM;
793
794 if (thread_group_empty(tsk)) 754 if (thread_group_empty(tsk))
795 goto no_thread_group; 755 goto no_thread_group;
796 756
@@ -807,7 +767,6 @@ static int de_thread(struct task_struct *tsk)
807 */ 767 */
808 spin_unlock_irq(lock); 768 spin_unlock_irq(lock);
809 read_unlock(&tasklist_lock); 769 read_unlock(&tasklist_lock);
810 kmem_cache_free(sighand_cachep, newsighand);
811 return -EAGAIN; 770 return -EAGAIN;
812 } 771 }
813 772
@@ -841,16 +800,15 @@ static int de_thread(struct task_struct *tsk)
841 hrtimer_restart(&sig->real_timer); 800 hrtimer_restart(&sig->real_timer);
842 spin_lock_irq(lock); 801 spin_lock_irq(lock);
843 } 802 }
803
804 sig->notify_count = count;
805 sig->group_exit_task = tsk;
844 while (atomic_read(&sig->count) > count) { 806 while (atomic_read(&sig->count) > count) {
845 sig->group_exit_task = tsk;
846 sig->notify_count = count;
847 __set_current_state(TASK_UNINTERRUPTIBLE); 807 __set_current_state(TASK_UNINTERRUPTIBLE);
848 spin_unlock_irq(lock); 808 spin_unlock_irq(lock);
849 schedule(); 809 schedule();
850 spin_lock_irq(lock); 810 spin_lock_irq(lock);
851 } 811 }
852 sig->group_exit_task = NULL;
853 sig->notify_count = 0;
854 spin_unlock_irq(lock); 812 spin_unlock_irq(lock);
855 813
856 /* 814 /*
@@ -859,14 +817,17 @@ static int de_thread(struct task_struct *tsk)
859 * and to assume its PID: 817 * and to assume its PID:
860 */ 818 */
861 if (!thread_group_leader(tsk)) { 819 if (!thread_group_leader(tsk)) {
862 /*
863 * Wait for the thread group leader to be a zombie.
864 * It should already be zombie at this point, most
865 * of the time.
866 */
867 leader = tsk->group_leader; 820 leader = tsk->group_leader;
868 while (leader->exit_state != EXIT_ZOMBIE) 821
869 yield(); 822 sig->notify_count = -1;
823 for (;;) {
824 write_lock_irq(&tasklist_lock);
825 if (likely(leader->exit_state))
826 break;
827 __set_current_state(TASK_UNINTERRUPTIBLE);
828 write_unlock_irq(&tasklist_lock);
829 schedule();
830 }
870 831
871 /* 832 /*
872 * The only record we have of the real-time age of a 833 * The only record we have of the real-time age of a
@@ -880,8 +841,6 @@ static int de_thread(struct task_struct *tsk)
880 */ 841 */
881 tsk->start_time = leader->start_time; 842 tsk->start_time = leader->start_time;
882 843
883 write_lock_irq(&tasklist_lock);
884
885 BUG_ON(leader->tgid != tsk->tgid); 844 BUG_ON(leader->tgid != tsk->tgid);
886 BUG_ON(tsk->pid == tsk->tgid); 845 BUG_ON(tsk->pid == tsk->tgid);
887 /* 846 /*
@@ -914,6 +873,8 @@ static int de_thread(struct task_struct *tsk)
914 write_unlock_irq(&tasklist_lock); 873 write_unlock_irq(&tasklist_lock);
915 } 874 }
916 875
876 sig->group_exit_task = NULL;
877 sig->notify_count = 0;
917 /* 878 /*
918 * There may be one thread left which is just exiting, 879 * There may be one thread left which is just exiting,
919 * but it's safe to stop telling the group to kill themselves. 880 * but it's safe to stop telling the group to kill themselves.
@@ -925,29 +886,23 @@ no_thread_group:
925 if (leader) 886 if (leader)
926 release_task(leader); 887 release_task(leader);
927 888
928 if (atomic_read(&oldsighand->count) == 1) { 889 if (atomic_read(&oldsighand->count) != 1) {
929 /* 890 struct sighand_struct *newsighand;
930 * Now that we nuked the rest of the thread group,
931 * it turns out we are not sharing sighand any more either.
932 * So we can just keep it.
933 */
934 kmem_cache_free(sighand_cachep, newsighand);
935 } else {
936 /* 891 /*
937 * Move our state over to newsighand and switch it in. 892 * This ->sighand is shared with the CLONE_SIGHAND
893 * but not CLONE_THREAD task, switch to the new one.
938 */ 894 */
895 newsighand = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
896 if (!newsighand)
897 return -ENOMEM;
898
939 atomic_set(&newsighand->count, 1); 899 atomic_set(&newsighand->count, 1);
940 memcpy(newsighand->action, oldsighand->action, 900 memcpy(newsighand->action, oldsighand->action,
941 sizeof(newsighand->action)); 901 sizeof(newsighand->action));
942 902
943 write_lock_irq(&tasklist_lock); 903 write_lock_irq(&tasklist_lock);
944 spin_lock(&oldsighand->siglock); 904 spin_lock(&oldsighand->siglock);
945 spin_lock_nested(&newsighand->siglock, SINGLE_DEPTH_NESTING);
946
947 rcu_assign_pointer(tsk->sighand, newsighand); 905 rcu_assign_pointer(tsk->sighand, newsighand);
948 recalc_sigpending();
949
950 spin_unlock(&newsighand->siglock);
951 spin_unlock(&oldsighand->siglock); 906 spin_unlock(&oldsighand->siglock);
952 write_unlock_irq(&tasklist_lock); 907 write_unlock_irq(&tasklist_lock);
953 908
@@ -957,12 +912,11 @@ no_thread_group:
957 BUG_ON(!thread_group_leader(tsk)); 912 BUG_ON(!thread_group_leader(tsk));
958 return 0; 913 return 0;
959} 914}
960 915
961/* 916/*
962 * These functions flushes out all traces of the currently running executable 917 * These functions flushes out all traces of the currently running executable
963 * so that a new one can be started 918 * so that a new one can be started
964 */ 919 */
965
966static void flush_old_files(struct files_struct * files) 920static void flush_old_files(struct files_struct * files)
967{ 921{
968 long j = -1; 922 long j = -1;
@@ -1284,7 +1238,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1284 retval = -ENOENT; 1238 retval = -ENOENT;
1285 for (try=0; try<2; try++) { 1239 for (try=0; try<2; try++) {
1286 read_lock(&binfmt_lock); 1240 read_lock(&binfmt_lock);
1287 for (fmt = formats ; fmt ; fmt = fmt->next) { 1241 list_for_each_entry(fmt, &formats, lh) {
1288 int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary; 1242 int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary;
1289 if (!fn) 1243 if (!fn)
1290 continue; 1244 continue;
@@ -1537,6 +1491,14 @@ static int format_corename(char *corename, const char *pattern, long signr)
1537 goto out; 1491 goto out;
1538 out_ptr += rc; 1492 out_ptr += rc;
1539 break; 1493 break;
1494 /* core limit size */
1495 case 'c':
1496 rc = snprintf(out_ptr, out_end - out_ptr,
1497 "%lu", current->signal->rlim[RLIMIT_CORE].rlim_cur);
1498 if (rc > out_end - out_ptr)
1499 goto out;
1500 out_ptr += rc;
1501 break;
1540 default: 1502 default:
1541 break; 1503 break;
1542 } 1504 }
@@ -1699,7 +1661,6 @@ void set_dumpable(struct mm_struct *mm, int value)
1699 break; 1661 break;
1700 } 1662 }
1701} 1663}
1702EXPORT_SYMBOL_GPL(set_dumpable);
1703 1664
1704int get_dumpable(struct mm_struct *mm) 1665int get_dumpable(struct mm_struct *mm)
1705{ 1666{
@@ -1720,6 +1681,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1720 int fsuid = current->fsuid; 1681 int fsuid = current->fsuid;
1721 int flag = 0; 1682 int flag = 0;
1722 int ispipe = 0; 1683 int ispipe = 0;
1684 unsigned long core_limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1685 char **helper_argv = NULL;
1686 int helper_argc = 0;
1687 char *delimit;
1723 1688
1724 audit_core_dumps(signr); 1689 audit_core_dumps(signr);
1725 1690
@@ -1753,9 +1718,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1753 */ 1718 */
1754 clear_thread_flag(TIF_SIGPENDING); 1719 clear_thread_flag(TIF_SIGPENDING);
1755 1720
1756 if (current->signal->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
1757 goto fail_unlock;
1758
1759 /* 1721 /*
1760 * lock_kernel() because format_corename() is controlled by sysctl, which 1722 * lock_kernel() because format_corename() is controlled by sysctl, which
1761 * uses lock_kernel() 1723 * uses lock_kernel()
@@ -1763,9 +1725,39 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1763 lock_kernel(); 1725 lock_kernel();
1764 ispipe = format_corename(corename, core_pattern, signr); 1726 ispipe = format_corename(corename, core_pattern, signr);
1765 unlock_kernel(); 1727 unlock_kernel();
1728 /*
1729 * Don't bother to check the RLIMIT_CORE value if core_pattern points
1730 * to a pipe. Since we're not writing directly to the filesystem
1731 * RLIMIT_CORE doesn't really apply, as no actual core file will be
1732 * created unless the pipe reader choses to write out the core file
1733 * at which point file size limits and permissions will be imposed
1734 * as it does with any other process
1735 */
1736 if ((!ispipe) && (core_limit < binfmt->min_coredump))
1737 goto fail_unlock;
1738
1766 if (ispipe) { 1739 if (ispipe) {
1740 helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
1741 /* Terminate the string before the first option */
1742 delimit = strchr(corename, ' ');
1743 if (delimit)
1744 *delimit = '\0';
1745 delimit = strrchr(helper_argv[0], '/');
1746 if (delimit)
1747 delimit++;
1748 else
1749 delimit = helper_argv[0];
1750 if (!strcmp(delimit, current->comm)) {
1751 printk(KERN_NOTICE "Recursive core dump detected, "
1752 "aborting\n");
1753 goto fail_unlock;
1754 }
1755
1756 core_limit = RLIM_INFINITY;
1757
1767 /* SIGPIPE can happen, but it's just never processed */ 1758 /* SIGPIPE can happen, but it's just never processed */
1768 if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) { 1759 if (call_usermodehelper_pipe(corename+1, helper_argv, NULL,
1760 &file)) {
1769 printk(KERN_INFO "Core dump to %s pipe failed\n", 1761 printk(KERN_INFO "Core dump to %s pipe failed\n",
1770 corename); 1762 corename);
1771 goto fail_unlock; 1763 goto fail_unlock;
@@ -1793,13 +1785,16 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1793 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0) 1785 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
1794 goto close_fail; 1786 goto close_fail;
1795 1787
1796 retval = binfmt->core_dump(signr, regs, file); 1788 retval = binfmt->core_dump(signr, regs, file, core_limit);
1797 1789
1798 if (retval) 1790 if (retval)
1799 current->signal->group_exit_code |= 0x80; 1791 current->signal->group_exit_code |= 0x80;
1800close_fail: 1792close_fail:
1801 filp_close(file, NULL); 1793 filp_close(file, NULL);
1802fail_unlock: 1794fail_unlock:
1795 if (helper_argv)
1796 argv_free(helper_argv);
1797
1803 current->fsuid = fsuid; 1798 current->fsuid = fsuid;
1804 complete_all(&mm->core_done); 1799 complete_all(&mm->core_done);
1805fail: 1800fail:
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index baf71dd721fa..18a42de25b55 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -69,6 +69,14 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
69 return desc + offset; 69 return desc + offset;
70} 70}
71 71
72static inline int
73block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
74{
75 return ext2_test_bit ((block -
76 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) %
77 EXT2_BLOCKS_PER_GROUP(sb), map);
78}
79
72/* 80/*
73 * Read the bitmap for a given block_group, reading into the specified 81 * Read the bitmap for a given block_group, reading into the specified
74 * slot in the superblock's bitmap cache. 82 * slot in the superblock's bitmap cache.
@@ -78,55 +86,51 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
78static struct buffer_head * 86static struct buffer_head *
79read_block_bitmap(struct super_block *sb, unsigned int block_group) 87read_block_bitmap(struct super_block *sb, unsigned int block_group)
80{ 88{
89 int i;
81 struct ext2_group_desc * desc; 90 struct ext2_group_desc * desc;
82 struct buffer_head * bh = NULL; 91 struct buffer_head * bh = NULL;
83 92 unsigned int bitmap_blk;
93
84 desc = ext2_get_group_desc (sb, block_group, NULL); 94 desc = ext2_get_group_desc (sb, block_group, NULL);
85 if (!desc) 95 if (!desc)
86 goto error_out; 96 return NULL;
87 bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap)); 97 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
98 bh = sb_bread(sb, bitmap_blk);
88 if (!bh) 99 if (!bh)
89 ext2_error (sb, "read_block_bitmap", 100 ext2_error (sb, __FUNCTION__,
90 "Cannot read block bitmap - " 101 "Cannot read block bitmap - "
91 "block_group = %d, block_bitmap = %u", 102 "block_group = %d, block_bitmap = %u",
92 block_group, le32_to_cpu(desc->bg_block_bitmap)); 103 block_group, le32_to_cpu(desc->bg_block_bitmap));
93error_out:
94 return bh;
95}
96
97/*
98 * Set sb->s_dirt here because the superblock was "logically" altered. We
99 * need to recalculate its free blocks count and flush it out.
100 */
101static int reserve_blocks(struct super_block *sb, int count)
102{
103 struct ext2_sb_info *sbi = EXT2_SB(sb);
104 struct ext2_super_block *es = sbi->s_es;
105 unsigned free_blocks;
106 unsigned root_blocks;
107
108 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
109 root_blocks = le32_to_cpu(es->s_r_blocks_count);
110 104
111 if (free_blocks < count) 105 /* check whether block bitmap block number is set */
112 count = free_blocks; 106 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
113 107 /* bad block bitmap */
114 if (free_blocks < root_blocks + count && !capable(CAP_SYS_RESOURCE) && 108 goto error_out;
115 sbi->s_resuid != current->fsuid &&
116 (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
117 /*
118 * We are too close to reserve and we are not privileged.
119 * Can we allocate anything at all?
120 */
121 if (free_blocks > root_blocks)
122 count = free_blocks - root_blocks;
123 else
124 return 0;
125 } 109 }
110 /* check whether the inode bitmap block number is set */
111 bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
112 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
113 /* bad block bitmap */
114 goto error_out;
115 }
116 /* check whether the inode table block number is set */
117 bitmap_blk = le32_to_cpu(desc->bg_inode_table);
118 for (i = 0; i < EXT2_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
119 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
120 /* bad block bitmap */
121 goto error_out;
122 }
123 }
124
125 return bh;
126 126
127 percpu_counter_mod(&sbi->s_freeblocks_counter, -count); 127error_out:
128 sb->s_dirt = 1; 128 brelse(bh);
129 return count; 129 ext2_error(sb, __FUNCTION__,
130 "Invalid block bitmap - "
131 "block_group = %d, block = %u",
132 block_group, bitmap_blk);
133 return NULL;
130} 134}
131 135
132static void release_blocks(struct super_block *sb, int count) 136static void release_blocks(struct super_block *sb, int count)
@@ -134,30 +138,12 @@ static void release_blocks(struct super_block *sb, int count)
134 if (count) { 138 if (count) {
135 struct ext2_sb_info *sbi = EXT2_SB(sb); 139 struct ext2_sb_info *sbi = EXT2_SB(sb);
136 140
137 percpu_counter_mod(&sbi->s_freeblocks_counter, count); 141 percpu_counter_add(&sbi->s_freeblocks_counter, count);
138 sb->s_dirt = 1; 142 sb->s_dirt = 1;
139 } 143 }
140} 144}
141 145
142static int group_reserve_blocks(struct ext2_sb_info *sbi, int group_no, 146static void group_adjust_blocks(struct super_block *sb, int group_no,
143 struct ext2_group_desc *desc, struct buffer_head *bh, int count)
144{
145 unsigned free_blocks;
146
147 if (!desc->bg_free_blocks_count)
148 return 0;
149
150 spin_lock(sb_bgl_lock(sbi, group_no));
151 free_blocks = le16_to_cpu(desc->bg_free_blocks_count);
152 if (free_blocks < count)
153 count = free_blocks;
154 desc->bg_free_blocks_count = cpu_to_le16(free_blocks - count);
155 spin_unlock(sb_bgl_lock(sbi, group_no));
156 mark_buffer_dirty(bh);
157 return count;
158}
159
160static void group_release_blocks(struct super_block *sb, int group_no,
161 struct ext2_group_desc *desc, struct buffer_head *bh, int count) 147 struct ext2_group_desc *desc, struct buffer_head *bh, int count)
162{ 148{
163 if (count) { 149 if (count) {
@@ -173,7 +159,306 @@ static void group_release_blocks(struct super_block *sb, int group_no,
173 } 159 }
174} 160}
175 161
176/* Free given blocks, update quota and i_blocks field */ 162/*
163 * The reservation window structure operations
164 * --------------------------------------------
165 * Operations include:
166 * dump, find, add, remove, is_empty, find_next_reservable_window, etc.
167 *
168 * We use a red-black tree to represent per-filesystem reservation
169 * windows.
170 *
171 */
172
173/**
174 * __rsv_window_dump() -- Dump the filesystem block allocation reservation map
175 * @rb_root: root of per-filesystem reservation rb tree
176 * @verbose: verbose mode
177 * @fn: function which wishes to dump the reservation map
178 *
179 * If verbose is turned on, it will print the whole block reservation
180 * windows(start, end). Otherwise, it will only print out the "bad" windows,
181 * those windows that overlap with their immediate neighbors.
182 */
183#if 1
184static void __rsv_window_dump(struct rb_root *root, int verbose,
185 const char *fn)
186{
187 struct rb_node *n;
188 struct ext2_reserve_window_node *rsv, *prev;
189 int bad;
190
191restart:
192 n = rb_first(root);
193 bad = 0;
194 prev = NULL;
195
196 printk("Block Allocation Reservation Windows Map (%s):\n", fn);
197 while (n) {
198 rsv = rb_entry(n, struct ext2_reserve_window_node, rsv_node);
199 if (verbose)
200 printk("reservation window 0x%p "
201 "start: %lu, end: %lu\n",
202 rsv, rsv->rsv_start, rsv->rsv_end);
203 if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
204 printk("Bad reservation %p (start >= end)\n",
205 rsv);
206 bad = 1;
207 }
208 if (prev && prev->rsv_end >= rsv->rsv_start) {
209 printk("Bad reservation %p (prev->end >= start)\n",
210 rsv);
211 bad = 1;
212 }
213 if (bad) {
214 if (!verbose) {
215 printk("Restarting reservation walk in verbose mode\n");
216 verbose = 1;
217 goto restart;
218 }
219 }
220 n = rb_next(n);
221 prev = rsv;
222 }
223 printk("Window map complete.\n");
224 if (bad)
225 BUG();
226}
227#define rsv_window_dump(root, verbose) \
228 __rsv_window_dump((root), (verbose), __FUNCTION__)
229#else
230#define rsv_window_dump(root, verbose) do {} while (0)
231#endif
232
233/**
234 * goal_in_my_reservation()
235 * @rsv: inode's reservation window
236 * @grp_goal: given goal block relative to the allocation block group
237 * @group: the current allocation block group
238 * @sb: filesystem super block
239 *
240 * Test if the given goal block (group relative) is within the file's
241 * own block reservation window range.
242 *
243 * If the reservation window is outside the goal allocation group, return 0;
244 * grp_goal (given goal block) could be -1, which means no specific
245 * goal block. In this case, always return 1.
246 * If the goal block is within the reservation window, return 1;
247 * otherwise, return 0;
248 */
249static int
250goal_in_my_reservation(struct ext2_reserve_window *rsv, ext2_grpblk_t grp_goal,
251 unsigned int group, struct super_block * sb)
252{
253 ext2_fsblk_t group_first_block, group_last_block;
254
255 group_first_block = ext2_group_first_block_no(sb, group);
256 group_last_block = group_first_block + EXT2_BLOCKS_PER_GROUP(sb) - 1;
257
258 if ((rsv->_rsv_start > group_last_block) ||
259 (rsv->_rsv_end < group_first_block))
260 return 0;
261 if ((grp_goal >= 0) && ((grp_goal + group_first_block < rsv->_rsv_start)
262 || (grp_goal + group_first_block > rsv->_rsv_end)))
263 return 0;
264 return 1;
265}
266
267/**
268 * search_reserve_window()
269 * @rb_root: root of reservation tree
270 * @goal: target allocation block
271 *
272 * Find the reserved window which includes the goal, or the previous one
273 * if the goal is not in any window.
274 * Returns NULL if there are no windows or if all windows start after the goal.
275 */
276static struct ext2_reserve_window_node *
277search_reserve_window(struct rb_root *root, ext2_fsblk_t goal)
278{
279 struct rb_node *n = root->rb_node;
280 struct ext2_reserve_window_node *rsv;
281
282 if (!n)
283 return NULL;
284
285 do {
286 rsv = rb_entry(n, struct ext2_reserve_window_node, rsv_node);
287
288 if (goal < rsv->rsv_start)
289 n = n->rb_left;
290 else if (goal > rsv->rsv_end)
291 n = n->rb_right;
292 else
293 return rsv;
294 } while (n);
295 /*
296 * We've fallen off the end of the tree: the goal wasn't inside
297 * any particular node. OK, the previous node must be to one
298 * side of the interval containing the goal. If it's the RHS,
299 * we need to back up one.
300 */
301 if (rsv->rsv_start > goal) {
302 n = rb_prev(&rsv->rsv_node);
303 rsv = rb_entry(n, struct ext2_reserve_window_node, rsv_node);
304 }
305 return rsv;
306}
307
308/*
309 * ext2_rsv_window_add() -- Insert a window to the block reservation rb tree.
310 * @sb: super block
311 * @rsv: reservation window to add
312 *
313 * Must be called with rsv_lock held.
314 */
315void ext2_rsv_window_add(struct super_block *sb,
316 struct ext2_reserve_window_node *rsv)
317{
318 struct rb_root *root = &EXT2_SB(sb)->s_rsv_window_root;
319 struct rb_node *node = &rsv->rsv_node;
320 ext2_fsblk_t start = rsv->rsv_start;
321
322 struct rb_node ** p = &root->rb_node;
323 struct rb_node * parent = NULL;
324 struct ext2_reserve_window_node *this;
325
326 while (*p)
327 {
328 parent = *p;
329 this = rb_entry(parent, struct ext2_reserve_window_node, rsv_node);
330
331 if (start < this->rsv_start)
332 p = &(*p)->rb_left;
333 else if (start > this->rsv_end)
334 p = &(*p)->rb_right;
335 else {
336 rsv_window_dump(root, 1);
337 BUG();
338 }
339 }
340
341 rb_link_node(node, parent, p);
342 rb_insert_color(node, root);
343}
344
345/**
346 * rsv_window_remove() -- unlink a window from the reservation rb tree
347 * @sb: super block
348 * @rsv: reservation window to remove
349 *
350 * Mark the block reservation window as not allocated, and unlink it
351 * from the filesystem reservation window rb tree. Must be called with
352 * rsv_lock held.
353 */
354static void rsv_window_remove(struct super_block *sb,
355 struct ext2_reserve_window_node *rsv)
356{
357 rsv->rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
358 rsv->rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
359 rsv->rsv_alloc_hit = 0;
360 rb_erase(&rsv->rsv_node, &EXT2_SB(sb)->s_rsv_window_root);
361}
362
363/*
364 * rsv_is_empty() -- Check if the reservation window is allocated.
365 * @rsv: given reservation window to check
366 *
367 * returns 1 if the end block is EXT2_RESERVE_WINDOW_NOT_ALLOCATED.
368 */
369static inline int rsv_is_empty(struct ext2_reserve_window *rsv)
370{
371 /* a valid reservation end block could not be 0 */
372 return (rsv->_rsv_end == EXT2_RESERVE_WINDOW_NOT_ALLOCATED);
373}
374
375/**
376 * ext2_init_block_alloc_info()
377 * @inode: file inode structure
378 *
379 * Allocate and initialize the reservation window structure, and
380 * link the window to the ext2 inode structure at last
381 *
382 * The reservation window structure is only dynamically allocated
383 * and linked to ext2 inode the first time the open file
384 * needs a new block. So, before every ext2_new_block(s) call, for
385 * regular files, we should check whether the reservation window
386 * structure exists or not. In the latter case, this function is called.
387 * Fail to do so will result in block reservation being turned off for that
388 * open file.
389 *
390 * This function is called from ext2_get_blocks_handle(), also called
391 * when setting the reservation window size through ioctl before the file
392 * is open for write (needs block allocation).
393 *
394 * Needs truncate_mutex protection prior to calling this function.
395 */
396void ext2_init_block_alloc_info(struct inode *inode)
397{
398 struct ext2_inode_info *ei = EXT2_I(inode);
399 struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info;
400 struct super_block *sb = inode->i_sb;
401
402 block_i = kmalloc(sizeof(*block_i), GFP_NOFS);
403 if (block_i) {
404 struct ext2_reserve_window_node *rsv = &block_i->rsv_window_node;
405
406 rsv->rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
407 rsv->rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
408
409 /*
410 * if filesystem is mounted with NORESERVATION, the goal
411 * reservation window size is set to zero to indicate
412 * block reservation is off
413 */
414 if (!test_opt(sb, RESERVATION))
415 rsv->rsv_goal_size = 0;
416 else
417 rsv->rsv_goal_size = EXT2_DEFAULT_RESERVE_BLOCKS;
418 rsv->rsv_alloc_hit = 0;
419 block_i->last_alloc_logical_block = 0;
420 block_i->last_alloc_physical_block = 0;
421 }
422 ei->i_block_alloc_info = block_i;
423}
424
425/**
426 * ext2_discard_reservation()
427 * @inode: inode
428 *
429 * Discard(free) block reservation window on last file close, or truncate
430 * or at last iput().
431 *
432 * It is being called in three cases:
433 * ext2_release_file(): last writer closes the file
434 * ext2_clear_inode(): last iput(), when nobody links to this file.
435 * ext2_truncate(): when the block indirect map is about to change.
436 */
437void ext2_discard_reservation(struct inode *inode)
438{
439 struct ext2_inode_info *ei = EXT2_I(inode);
440 struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info;
441 struct ext2_reserve_window_node *rsv;
442 spinlock_t *rsv_lock = &EXT2_SB(inode->i_sb)->s_rsv_window_lock;
443
444 if (!block_i)
445 return;
446
447 rsv = &block_i->rsv_window_node;
448 if (!rsv_is_empty(&rsv->rsv_window)) {
449 spin_lock(rsv_lock);
450 if (!rsv_is_empty(&rsv->rsv_window))
451 rsv_window_remove(inode->i_sb, rsv);
452 spin_unlock(rsv_lock);
453 }
454}
455
456/**
457 * ext2_free_blocks_sb() -- Free given blocks and update quota and i_blocks
458 * @inode: inode
459 * @block: start physcial block to free
460 * @count: number of blocks to free
461 */
177void ext2_free_blocks (struct inode * inode, unsigned long block, 462void ext2_free_blocks (struct inode * inode, unsigned long block,
178 unsigned long count) 463 unsigned long count)
179{ 464{
@@ -248,7 +533,7 @@ do_more:
248 if (sb->s_flags & MS_SYNCHRONOUS) 533 if (sb->s_flags & MS_SYNCHRONOUS)
249 sync_dirty_buffer(bitmap_bh); 534 sync_dirty_buffer(bitmap_bh);
250 535
251 group_release_blocks(sb, block_group, desc, bh2, group_freed); 536 group_adjust_blocks(sb, block_group, desc, bh2, group_freed);
252 freed += group_freed; 537 freed += group_freed;
253 538
254 if (overflow) { 539 if (overflow) {
@@ -262,16 +547,46 @@ error_return:
262 DQUOT_FREE_BLOCK(inode, freed); 547 DQUOT_FREE_BLOCK(inode, freed);
263} 548}
264 549
265static int grab_block(spinlock_t *lock, char *map, unsigned size, int goal) 550/**
551 * bitmap_search_next_usable_block()
552 * @start: the starting block (group relative) of the search
553 * @bh: bufferhead contains the block group bitmap
554 * @maxblocks: the ending block (group relative) of the reservation
555 *
556 * The bitmap search --- search forward through the actual bitmap on disk until
557 * we find a bit free.
558 */
559static ext2_grpblk_t
560bitmap_search_next_usable_block(ext2_grpblk_t start, struct buffer_head *bh,
561 ext2_grpblk_t maxblocks)
266{ 562{
267 int k; 563 ext2_grpblk_t next;
268 char *p, *r;
269 564
270 if (!ext2_test_bit(goal, map)) 565 next = ext2_find_next_zero_bit(bh->b_data, maxblocks, start);
271 goto got_it; 566 if (next >= maxblocks)
567 return -1;
568 return next;
569}
272 570
273repeat: 571/**
274 if (goal) { 572 * find_next_usable_block()
573 * @start: the starting block (group relative) to find next
574 * allocatable block in bitmap.
575 * @bh: bufferhead contains the block group bitmap
576 * @maxblocks: the ending block (group relative) for the search
577 *
578 * Find an allocatable block in a bitmap. We perform the "most
579 * appropriate allocation" algorithm of looking for a free block near
580 * the initial goal; then for a free byte somewhere in the bitmap;
581 * then for any free bit in the bitmap.
582 */
583static ext2_grpblk_t
584find_next_usable_block(int start, struct buffer_head *bh, int maxblocks)
585{
586 ext2_grpblk_t here, next;
587 char *p, *r;
588
589 if (start > 0) {
275 /* 590 /*
276 * The goal was occupied; search forward for a free 591 * The goal was occupied; search forward for a free
277 * block within the next XX blocks. 592 * block within the next XX blocks.
@@ -280,249 +595,812 @@ repeat:
280 * less than EXT2_BLOCKS_PER_GROUP. Aligning up to the 595 * less than EXT2_BLOCKS_PER_GROUP. Aligning up to the
281 * next 64-bit boundary is simple.. 596 * next 64-bit boundary is simple..
282 */ 597 */
283 k = (goal + 63) & ~63; 598 ext2_grpblk_t end_goal = (start + 63) & ~63;
284 goal = ext2_find_next_zero_bit(map, k, goal); 599 if (end_goal > maxblocks)
285 if (goal < k) 600 end_goal = maxblocks;
286 goto got_it; 601 here = ext2_find_next_zero_bit(bh->b_data, end_goal, start);
602 if (here < end_goal)
603 return here;
604 ext2_debug("Bit not found near goal\n");
605 }
606
607 here = start;
608 if (here < 0)
609 here = 0;
610
611 p = ((char *)bh->b_data) + (here >> 3);
612 r = memscan(p, 0, ((maxblocks + 7) >> 3) - (here >> 3));
613 next = (r - ((char *)bh->b_data)) << 3;
614
615 if (next < maxblocks && next >= here)
616 return next;
617
618 here = bitmap_search_next_usable_block(here, bh, maxblocks);
619 return here;
620}
621
622/*
623 * ext2_try_to_allocate()
624 * @sb: superblock
625 * @handle: handle to this transaction
626 * @group: given allocation block group
627 * @bitmap_bh: bufferhead holds the block bitmap
628 * @grp_goal: given target block within the group
629 * @count: target number of blocks to allocate
630 * @my_rsv: reservation window
631 *
632 * Attempt to allocate blocks within a give range. Set the range of allocation
633 * first, then find the first free bit(s) from the bitmap (within the range),
634 * and at last, allocate the blocks by claiming the found free bit as allocated.
635 *
636 * To set the range of this allocation:
637 * if there is a reservation window, only try to allocate block(s)
638 * from the file's own reservation window;
639 * Otherwise, the allocation range starts from the give goal block,
640 * ends at the block group's last block.
641 *
642 * If we failed to allocate the desired block then we may end up crossing to a
643 * new bitmap.
644 */
645static int
646ext2_try_to_allocate(struct super_block *sb, int group,
647 struct buffer_head *bitmap_bh, ext2_grpblk_t grp_goal,
648 unsigned long *count,
649 struct ext2_reserve_window *my_rsv)
650{
651 ext2_fsblk_t group_first_block;
652 ext2_grpblk_t start, end;
653 unsigned long num = 0;
654
655 /* we do allocation within the reservation window if we have a window */
656 if (my_rsv) {
657 group_first_block = ext2_group_first_block_no(sb, group);
658 if (my_rsv->_rsv_start >= group_first_block)
659 start = my_rsv->_rsv_start - group_first_block;
660 else
661 /* reservation window cross group boundary */
662 start = 0;
663 end = my_rsv->_rsv_end - group_first_block + 1;
664 if (end > EXT2_BLOCKS_PER_GROUP(sb))
665 /* reservation window crosses group boundary */
666 end = EXT2_BLOCKS_PER_GROUP(sb);
667 if ((start <= grp_goal) && (grp_goal < end))
668 start = grp_goal;
669 else
670 grp_goal = -1;
671 } else {
672 if (grp_goal > 0)
673 start = grp_goal;
674 else
675 start = 0;
676 end = EXT2_BLOCKS_PER_GROUP(sb);
677 }
678
679 BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
680
681repeat:
682 if (grp_goal < 0) {
683 grp_goal = find_next_usable_block(start, bitmap_bh, end);
684 if (grp_goal < 0)
685 goto fail_access;
686 if (!my_rsv) {
687 int i;
688
689 for (i = 0; i < 7 && grp_goal > start &&
690 !ext2_test_bit(grp_goal - 1,
691 bitmap_bh->b_data);
692 i++, grp_goal--)
693 ;
694 }
695 }
696 start = grp_goal;
697
698 if (ext2_set_bit_atomic(sb_bgl_lock(EXT2_SB(sb), group), grp_goal,
699 bitmap_bh->b_data)) {
700 /*
701 * The block was allocated by another thread, or it was
702 * allocated and then freed by another thread
703 */
704 start++;
705 grp_goal++;
706 if (start >= end)
707 goto fail_access;
708 goto repeat;
709 }
710 num++;
711 grp_goal++;
712 while (num < *count && grp_goal < end
713 && !ext2_set_bit_atomic(sb_bgl_lock(EXT2_SB(sb), group),
714 grp_goal, bitmap_bh->b_data)) {
715 num++;
716 grp_goal++;
717 }
718 *count = num;
719 return grp_goal - num;
720fail_access:
721 *count = num;
722 return -1;
723}
724
725/**
726 * find_next_reservable_window():
727 * find a reservable space within the given range.
728 * It does not allocate the reservation window for now:
729 * alloc_new_reservation() will do the work later.
730 *
731 * @search_head: the head of the searching list;
732 * This is not necessarily the list head of the whole filesystem
733 *
734 * We have both head and start_block to assist the search
735 * for the reservable space. The list starts from head,
736 * but we will shift to the place where start_block is,
737 * then start from there, when looking for a reservable space.
738 *
739 * @size: the target new reservation window size
740 *
741 * @group_first_block: the first block we consider to start
742 * the real search from
743 *
744 * @last_block:
745 * the maximum block number that our goal reservable space
746 * could start from. This is normally the last block in this
747 * group. The search will end when we found the start of next
748 * possible reservable space is out of this boundary.
749 * This could handle the cross boundary reservation window
750 * request.
751 *
752 * basically we search from the given range, rather than the whole
753 * reservation double linked list, (start_block, last_block)
754 * to find a free region that is of my size and has not
755 * been reserved.
756 *
757 */
758static int find_next_reservable_window(
759 struct ext2_reserve_window_node *search_head,
760 struct ext2_reserve_window_node *my_rsv,
761 struct super_block * sb,
762 ext2_fsblk_t start_block,
763 ext2_fsblk_t last_block)
764{
765 struct rb_node *next;
766 struct ext2_reserve_window_node *rsv, *prev;
767 ext2_fsblk_t cur;
768 int size = my_rsv->rsv_goal_size;
769
770 /* TODO: make the start of the reservation window byte-aligned */
771 /* cur = *start_block & ~7;*/
772 cur = start_block;
773 rsv = search_head;
774 if (!rsv)
775 return -1;
776
777 while (1) {
778 if (cur <= rsv->rsv_end)
779 cur = rsv->rsv_end + 1;
780
781 /* TODO?
782 * in the case we could not find a reservable space
783 * that is what is expected, during the re-search, we could
784 * remember what's the largest reservable space we could have
785 * and return that one.
786 *
787 * For now it will fail if we could not find the reservable
788 * space with expected-size (or more)...
789 */
790 if (cur > last_block)
791 return -1; /* fail */
792
793 prev = rsv;
794 next = rb_next(&rsv->rsv_node);
795 rsv = rb_entry(next,struct ext2_reserve_window_node,rsv_node);
796
797 /*
798 * Reached the last reservation, we can just append to the
799 * previous one.
800 */
801 if (!next)
802 break;
803
804 if (cur + size <= rsv->rsv_start) {
805 /*
806 * Found a reserveable space big enough. We could
807 * have a reservation across the group boundary here
808 */
809 break;
810 }
811 }
812 /*
813 * we come here either :
814 * when we reach the end of the whole list,
815 * and there is empty reservable space after last entry in the list.
816 * append it to the end of the list.
817 *
818 * or we found one reservable space in the middle of the list,
819 * return the reservation window that we could append to.
820 * succeed.
821 */
822
823 if ((prev != my_rsv) && (!rsv_is_empty(&my_rsv->rsv_window)))
824 rsv_window_remove(sb, my_rsv);
825
826 /*
827 * Let's book the whole avaliable window for now. We will check the
828 * disk bitmap later and then, if there are free blocks then we adjust
829 * the window size if it's larger than requested.
830 * Otherwise, we will remove this node from the tree next time
831 * call find_next_reservable_window.
832 */
833 my_rsv->rsv_start = cur;
834 my_rsv->rsv_end = cur + size - 1;
835 my_rsv->rsv_alloc_hit = 0;
836
837 if (prev != my_rsv)
838 ext2_rsv_window_add(sb, my_rsv);
839
840 return 0;
841}
842
843/**
844 * alloc_new_reservation()--allocate a new reservation window
845 *
846 * To make a new reservation, we search part of the filesystem
847 * reservation list (the list that inside the group). We try to
848 * allocate a new reservation window near the allocation goal,
849 * or the beginning of the group, if there is no goal.
850 *
851 * We first find a reservable space after the goal, then from
852 * there, we check the bitmap for the first free block after
853 * it. If there is no free block until the end of group, then the
854 * whole group is full, we failed. Otherwise, check if the free
855 * block is inside the expected reservable space, if so, we
856 * succeed.
857 * If the first free block is outside the reservable space, then
858 * start from the first free block, we search for next available
859 * space, and go on.
860 *
861 * on succeed, a new reservation will be found and inserted into the list
862 * It contains at least one free block, and it does not overlap with other
863 * reservation windows.
864 *
865 * failed: we failed to find a reservation window in this group
866 *
867 * @rsv: the reservation
868 *
869 * @grp_goal: The goal (group-relative). It is where the search for a
870 * free reservable space should start from.
871 * if we have a goal(goal >0 ), then start from there,
872 * no goal(goal = -1), we start from the first block
873 * of the group.
874 *
875 * @sb: the super block
876 * @group: the group we are trying to allocate in
877 * @bitmap_bh: the block group block bitmap
878 *
879 */
880static int alloc_new_reservation(struct ext2_reserve_window_node *my_rsv,
881 ext2_grpblk_t grp_goal, struct super_block *sb,
882 unsigned int group, struct buffer_head *bitmap_bh)
883{
884 struct ext2_reserve_window_node *search_head;
885 ext2_fsblk_t group_first_block, group_end_block, start_block;
886 ext2_grpblk_t first_free_block;
887 struct rb_root *fs_rsv_root = &EXT2_SB(sb)->s_rsv_window_root;
888 unsigned long size;
889 int ret;
890 spinlock_t *rsv_lock = &EXT2_SB(sb)->s_rsv_window_lock;
891
892 group_first_block = ext2_group_first_block_no(sb, group);
893 group_end_block = group_first_block + (EXT2_BLOCKS_PER_GROUP(sb) - 1);
894
895 if (grp_goal < 0)
896 start_block = group_first_block;
897 else
898 start_block = grp_goal + group_first_block;
899
900 size = my_rsv->rsv_goal_size;
901
902 if (!rsv_is_empty(&my_rsv->rsv_window)) {
287 /* 903 /*
288 * Search in the remainder of the current group. 904 * if the old reservation is cross group boundary
905 * and if the goal is inside the old reservation window,
906 * we will come here when we just failed to allocate from
907 * the first part of the window. We still have another part
908 * that belongs to the next group. In this case, there is no
909 * point to discard our window and try to allocate a new one
910 * in this group(which will fail). we should
911 * keep the reservation window, just simply move on.
912 *
913 * Maybe we could shift the start block of the reservation
914 * window to the first block of next group.
289 */ 915 */
916
917 if ((my_rsv->rsv_start <= group_end_block) &&
918 (my_rsv->rsv_end > group_end_block) &&
919 (start_block >= my_rsv->rsv_start))
920 return -1;
921
922 if ((my_rsv->rsv_alloc_hit >
923 (my_rsv->rsv_end - my_rsv->rsv_start + 1) / 2)) {
924 /*
925 * if the previously allocation hit ratio is
926 * greater than 1/2, then we double the size of
927 * the reservation window the next time,
928 * otherwise we keep the same size window
929 */
930 size = size * 2;
931 if (size > EXT2_MAX_RESERVE_BLOCKS)
932 size = EXT2_MAX_RESERVE_BLOCKS;
933 my_rsv->rsv_goal_size= size;
934 }
290 } 935 }
291 936
292 p = map + (goal >> 3); 937 spin_lock(rsv_lock);
293 r = memscan(p, 0, (size - goal + 7) >> 3); 938 /*
294 k = (r - map) << 3; 939 * shift the search start to the window near the goal block
295 if (k < size) { 940 */
296 /* 941 search_head = search_reserve_window(fs_rsv_root, start_block);
297 * We have succeeded in finding a free byte in the block 942
298 * bitmap. Now search backwards to find the start of this 943 /*
299 * group of free blocks - won't take more than 7 iterations. 944 * find_next_reservable_window() simply finds a reservable window
945 * inside the given range(start_block, group_end_block).
946 *
947 * To make sure the reservation window has a free bit inside it, we
948 * need to check the bitmap after we found a reservable window.
949 */
950retry:
951 ret = find_next_reservable_window(search_head, my_rsv, sb,
952 start_block, group_end_block);
953
954 if (ret == -1) {
955 if (!rsv_is_empty(&my_rsv->rsv_window))
956 rsv_window_remove(sb, my_rsv);
957 spin_unlock(rsv_lock);
958 return -1;
959 }
960
961 /*
962 * On success, find_next_reservable_window() returns the
963 * reservation window where there is a reservable space after it.
964 * Before we reserve this reservable space, we need
965 * to make sure there is at least a free block inside this region.
966 *
967 * Search the first free bit on the block bitmap. Search starts from
968 * the start block of the reservable space we just found.
969 */
970 spin_unlock(rsv_lock);
971 first_free_block = bitmap_search_next_usable_block(
972 my_rsv->rsv_start - group_first_block,
973 bitmap_bh, group_end_block - group_first_block + 1);
974
975 if (first_free_block < 0) {
976 /*
977 * no free block left on the bitmap, no point
978 * to reserve the space. return failed.
300 */ 979 */
301 for (goal = k; goal && !ext2_test_bit (goal - 1, map); goal--) 980 spin_lock(rsv_lock);
302 ; 981 if (!rsv_is_empty(&my_rsv->rsv_window))
303 goto got_it; 982 rsv_window_remove(sb, my_rsv);
983 spin_unlock(rsv_lock);
984 return -1; /* failed */
304 } 985 }
305 986
306 k = ext2_find_next_zero_bit ((u32 *)map, size, goal); 987 start_block = first_free_block + group_first_block;
307 if (k < size) { 988 /*
308 goal = k; 989 * check if the first free block is within the
309 goto got_it; 990 * free space we just reserved
991 */
992 if (start_block >= my_rsv->rsv_start && start_block <= my_rsv->rsv_end)
993 return 0; /* success */
994 /*
995 * if the first free bit we found is out of the reservable space
996 * continue search for next reservable space,
997 * start from where the free block is,
998 * we also shift the list head to where we stopped last time
999 */
1000 search_head = my_rsv;
1001 spin_lock(rsv_lock);
1002 goto retry;
1003}
1004
1005/**
1006 * try_to_extend_reservation()
1007 * @my_rsv: given reservation window
1008 * @sb: super block
1009 * @size: the delta to extend
1010 *
1011 * Attempt to expand the reservation window large enough to have
1012 * required number of free blocks
1013 *
1014 * Since ext2_try_to_allocate() will always allocate blocks within
1015 * the reservation window range, if the window size is too small,
1016 * multiple blocks allocation has to stop at the end of the reservation
1017 * window. To make this more efficient, given the total number of
1018 * blocks needed and the current size of the window, we try to
1019 * expand the reservation window size if necessary on a best-effort
1020 * basis before ext2_new_blocks() tries to allocate blocks.
1021 */
1022static void try_to_extend_reservation(struct ext2_reserve_window_node *my_rsv,
1023 struct super_block *sb, int size)
1024{
1025 struct ext2_reserve_window_node *next_rsv;
1026 struct rb_node *next;
1027 spinlock_t *rsv_lock = &EXT2_SB(sb)->s_rsv_window_lock;
1028
1029 if (!spin_trylock(rsv_lock))
1030 return;
1031
1032 next = rb_next(&my_rsv->rsv_node);
1033
1034 if (!next)
1035 my_rsv->rsv_end += size;
1036 else {
1037 next_rsv = rb_entry(next, struct ext2_reserve_window_node, rsv_node);
1038
1039 if ((next_rsv->rsv_start - my_rsv->rsv_end - 1) >= size)
1040 my_rsv->rsv_end += size;
1041 else
1042 my_rsv->rsv_end = next_rsv->rsv_start - 1;
310 } 1043 }
311 return -1; 1044 spin_unlock(rsv_lock);
312got_it: 1045}
313 if (ext2_set_bit_atomic(lock, goal, (void *) map)) 1046
314 goto repeat; 1047/**
315 return goal; 1048 * ext2_try_to_allocate_with_rsv()
1049 * @sb: superblock
1050 * @group: given allocation block group
1051 * @bitmap_bh: bufferhead holds the block bitmap
1052 * @grp_goal: given target block within the group
1053 * @count: target number of blocks to allocate
1054 * @my_rsv: reservation window
1055 *
1056 * This is the main function used to allocate a new block and its reservation
1057 * window.
1058 *
1059 * Each time when a new block allocation is need, first try to allocate from
1060 * its own reservation. If it does not have a reservation window, instead of
1061 * looking for a free bit on bitmap first, then look up the reservation list to
1062 * see if it is inside somebody else's reservation window, we try to allocate a
1063 * reservation window for it starting from the goal first. Then do the block
1064 * allocation within the reservation window.
1065 *
1066 * This will avoid keeping on searching the reservation list again and
1067 * again when somebody is looking for a free block (without
1068 * reservation), and there are lots of free blocks, but they are all
1069 * being reserved.
1070 *
1071 * We use a red-black tree for the per-filesystem reservation list.
1072 */
1073static ext2_grpblk_t
1074ext2_try_to_allocate_with_rsv(struct super_block *sb, unsigned int group,
1075 struct buffer_head *bitmap_bh, ext2_grpblk_t grp_goal,
1076 struct ext2_reserve_window_node * my_rsv,
1077 unsigned long *count)
1078{
1079 ext2_fsblk_t group_first_block, group_last_block;
1080 ext2_grpblk_t ret = 0;
1081 unsigned long num = *count;
1082
1083 /*
1084 * we don't deal with reservation when
1085 * filesystem is mounted without reservation
1086 * or the file is not a regular file
1087 * or last attempt to allocate a block with reservation turned on failed
1088 */
1089 if (my_rsv == NULL) {
1090 return ext2_try_to_allocate(sb, group, bitmap_bh,
1091 grp_goal, count, NULL);
1092 }
1093 /*
1094 * grp_goal is a group relative block number (if there is a goal)
1095 * 0 <= grp_goal < EXT2_BLOCKS_PER_GROUP(sb)
1096 * first block is a filesystem wide block number
1097 * first block is the block number of the first block in this group
1098 */
1099 group_first_block = ext2_group_first_block_no(sb, group);
1100 group_last_block = group_first_block + (EXT2_BLOCKS_PER_GROUP(sb) - 1);
1101
1102 /*
1103 * Basically we will allocate a new block from inode's reservation
1104 * window.
1105 *
1106 * We need to allocate a new reservation window, if:
1107 * a) inode does not have a reservation window; or
1108 * b) last attempt to allocate a block from existing reservation
1109 * failed; or
1110 * c) we come here with a goal and with a reservation window
1111 *
1112 * We do not need to allocate a new reservation window if we come here
1113 * at the beginning with a goal and the goal is inside the window, or
1114 * we don't have a goal but already have a reservation window.
1115 * then we could go to allocate from the reservation window directly.
1116 */
1117 while (1) {
1118 if (rsv_is_empty(&my_rsv->rsv_window) || (ret < 0) ||
1119 !goal_in_my_reservation(&my_rsv->rsv_window,
1120 grp_goal, group, sb)) {
1121 if (my_rsv->rsv_goal_size < *count)
1122 my_rsv->rsv_goal_size = *count;
1123 ret = alloc_new_reservation(my_rsv, grp_goal, sb,
1124 group, bitmap_bh);
1125 if (ret < 0)
1126 break; /* failed */
1127
1128 if (!goal_in_my_reservation(&my_rsv->rsv_window,
1129 grp_goal, group, sb))
1130 grp_goal = -1;
1131 } else if (grp_goal >= 0) {
1132 int curr = my_rsv->rsv_end -
1133 (grp_goal + group_first_block) + 1;
1134
1135 if (curr < *count)
1136 try_to_extend_reservation(my_rsv, sb,
1137 *count - curr);
1138 }
1139
1140 if ((my_rsv->rsv_start > group_last_block) ||
1141 (my_rsv->rsv_end < group_first_block)) {
1142 rsv_window_dump(&EXT2_SB(sb)->s_rsv_window_root, 1);
1143 BUG();
1144 }
1145 ret = ext2_try_to_allocate(sb, group, bitmap_bh, grp_goal,
1146 &num, &my_rsv->rsv_window);
1147 if (ret >= 0) {
1148 my_rsv->rsv_alloc_hit += num;
1149 *count = num;
1150 break; /* succeed */
1151 }
1152 num = *count;
1153 }
1154 return ret;
1155}
1156
1157/**
1158 * ext2_has_free_blocks()
1159 * @sbi: in-core super block structure.
1160 *
1161 * Check if filesystem has at least 1 free block available for allocation.
1162 */
1163static int ext2_has_free_blocks(struct ext2_sb_info *sbi)
1164{
1165 ext2_fsblk_t free_blocks, root_blocks;
1166
1167 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
1168 root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count);
1169 if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) &&
1170 sbi->s_resuid != current->fsuid &&
1171 (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
1172 return 0;
1173 }
1174 return 1;
316} 1175}
317 1176
318/* 1177/*
319 * ext2_new_block uses a goal block to assist allocation. If the goal is 1178 * ext2_new_blocks() -- core block(s) allocation function
1179 * @inode: file inode
1180 * @goal: given target block(filesystem wide)
1181 * @count: target number of blocks to allocate
1182 * @errp: error code
1183 *
1184 * ext2_new_blocks uses a goal block to assist allocation. If the goal is
320 * free, or there is a free block within 32 blocks of the goal, that block 1185 * free, or there is a free block within 32 blocks of the goal, that block
321 * is allocated. Otherwise a forward search is made for a free block; within 1186 * is allocated. Otherwise a forward search is made for a free block; within
322 * each block group the search first looks for an entire free byte in the block 1187 * each block group the search first looks for an entire free byte in the block
323 * bitmap, and then for any free bit if that fails. 1188 * bitmap, and then for any free bit if that fails.
324 * This function also updates quota and i_blocks field. 1189 * This function also updates quota and i_blocks field.
325 */ 1190 */
326int ext2_new_block(struct inode *inode, unsigned long goal, 1191ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
327 u32 *prealloc_count, u32 *prealloc_block, int *err) 1192 unsigned long *count, int *errp)
328{ 1193{
329 struct buffer_head *bitmap_bh = NULL; 1194 struct buffer_head *bitmap_bh = NULL;
330 struct buffer_head *gdp_bh; /* bh2 */ 1195 struct buffer_head *gdp_bh;
331 struct ext2_group_desc *desc; 1196 int group_no;
332 int group_no; /* i */ 1197 int goal_group;
333 int ret_block; /* j */ 1198 ext2_grpblk_t grp_target_blk; /* blockgroup relative goal block */
334 int group_idx; /* k */ 1199 ext2_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/
335 int target_block; /* tmp */ 1200 ext2_fsblk_t ret_block; /* filesyetem-wide allocated block */
336 int block = 0; 1201 int bgi; /* blockgroup iteration index */
337 struct super_block *sb = inode->i_sb; 1202 int performed_allocation = 0;
338 struct ext2_sb_info *sbi = EXT2_SB(sb); 1203 ext2_grpblk_t free_blocks; /* number of free blocks in a group */
339 struct ext2_super_block *es = sbi->s_es; 1204 struct super_block *sb;
340 unsigned group_size = EXT2_BLOCKS_PER_GROUP(sb); 1205 struct ext2_group_desc *gdp;
341 unsigned prealloc_goal = es->s_prealloc_blocks; 1206 struct ext2_super_block *es;
342 unsigned group_alloc = 0, es_alloc, dq_alloc; 1207 struct ext2_sb_info *sbi;
343 int nr_scanned_groups; 1208 struct ext2_reserve_window_node *my_rsv = NULL;
344 1209 struct ext2_block_alloc_info *block_i;
345 if (!prealloc_goal--) 1210 unsigned short windowsz = 0;
346 prealloc_goal = EXT2_DEFAULT_PREALLOC_BLOCKS - 1; 1211 unsigned long ngroups;
347 if (!prealloc_count || *prealloc_count) 1212 unsigned long num = *count;
348 prealloc_goal = 0; 1213
349 1214 *errp = -ENOSPC;
350 if (DQUOT_ALLOC_BLOCK(inode, 1)) { 1215 sb = inode->i_sb;
351 *err = -EDQUOT; 1216 if (!sb) {
352 goto out; 1217 printk("ext2_new_blocks: nonexistent device");
1218 return 0;
353 } 1219 }
354 1220
355 while (prealloc_goal && DQUOT_PREALLOC_BLOCK(inode, prealloc_goal)) 1221 /*
356 prealloc_goal--; 1222 * Check quota for allocation of this block.
1223 */
1224 if (DQUOT_ALLOC_BLOCK(inode, num)) {
1225 *errp = -EDQUOT;
1226 return 0;
1227 }
357 1228
358 dq_alloc = prealloc_goal + 1; 1229 sbi = EXT2_SB(sb);
359 es_alloc = reserve_blocks(sb, dq_alloc); 1230 es = EXT2_SB(sb)->s_es;
360 if (!es_alloc) { 1231 ext2_debug("goal=%lu.\n", goal);
361 *err = -ENOSPC; 1232 /*
362 goto out_dquot; 1233 * Allocate a block from reservation only when
1234 * filesystem is mounted with reservation(default,-o reservation), and
1235 * it's a regular file, and
1236 * the desired window size is greater than 0 (One could use ioctl
1237 * command EXT2_IOC_SETRSVSZ to set the window size to 0 to turn off
1238 * reservation on that particular file)
1239 */
1240 block_i = EXT2_I(inode)->i_block_alloc_info;
1241 if (block_i) {
1242 windowsz = block_i->rsv_window_node.rsv_goal_size;
1243 if (windowsz > 0)
1244 my_rsv = &block_i->rsv_window_node;
363 } 1245 }
364 1246
365 ext2_debug ("goal=%lu.\n", goal); 1247 if (!ext2_has_free_blocks(sbi)) {
1248 *errp = -ENOSPC;
1249 goto out;
1250 }
366 1251
1252 /*
1253 * First, test whether the goal block is free.
1254 */
367 if (goal < le32_to_cpu(es->s_first_data_block) || 1255 if (goal < le32_to_cpu(es->s_first_data_block) ||
368 goal >= le32_to_cpu(es->s_blocks_count)) 1256 goal >= le32_to_cpu(es->s_blocks_count))
369 goal = le32_to_cpu(es->s_first_data_block); 1257 goal = le32_to_cpu(es->s_first_data_block);
370 group_no = (goal - le32_to_cpu(es->s_first_data_block)) / group_size; 1258 group_no = (goal - le32_to_cpu(es->s_first_data_block)) /
371 desc = ext2_get_group_desc (sb, group_no, &gdp_bh); 1259 EXT2_BLOCKS_PER_GROUP(sb);
372 if (!desc) { 1260 goal_group = group_no;
373 /* 1261retry_alloc:
374 * gdp_bh may still be uninitialised. But group_release_blocks 1262 gdp = ext2_get_group_desc(sb, group_no, &gdp_bh);
375 * will not touch it because group_alloc is zero. 1263 if (!gdp)
376 */
377 goto io_error; 1264 goto io_error;
378 }
379 1265
380 group_alloc = group_reserve_blocks(sbi, group_no, desc, 1266 free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
381 gdp_bh, es_alloc); 1267 /*
382 if (group_alloc) { 1268 * if there is not enough free blocks to make a new resevation
383 ret_block = ((goal - le32_to_cpu(es->s_first_data_block)) % 1269 * turn off reservation for this allocation
384 group_size); 1270 */
385 brelse(bitmap_bh); 1271 if (my_rsv && (free_blocks < windowsz)
1272 && (rsv_is_empty(&my_rsv->rsv_window)))
1273 my_rsv = NULL;
1274
1275 if (free_blocks > 0) {
1276 grp_target_blk = ((goal - le32_to_cpu(es->s_first_data_block)) %
1277 EXT2_BLOCKS_PER_GROUP(sb));
386 bitmap_bh = read_block_bitmap(sb, group_no); 1278 bitmap_bh = read_block_bitmap(sb, group_no);
387 if (!bitmap_bh) 1279 if (!bitmap_bh)
388 goto io_error; 1280 goto io_error;
389 1281 grp_alloc_blk = ext2_try_to_allocate_with_rsv(sb, group_no,
390 ext2_debug("goal is at %d:%d.\n", group_no, ret_block); 1282 bitmap_bh, grp_target_blk,
391 1283 my_rsv, &num);
392 ret_block = grab_block(sb_bgl_lock(sbi, group_no), 1284 if (grp_alloc_blk >= 0)
393 bitmap_bh->b_data, group_size, ret_block); 1285 goto allocated;
394 if (ret_block >= 0)
395 goto got_block;
396 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
397 group_alloc = 0;
398 } 1286 }
399 1287
400 ext2_debug ("Bit not found in block group %d.\n", group_no); 1288 ngroups = EXT2_SB(sb)->s_groups_count;
1289 smp_rmb();
401 1290
402 /* 1291 /*
403 * Now search the rest of the groups. We assume that 1292 * Now search the rest of the groups. We assume that
404 * i and desc correctly point to the last group visited. 1293 * i and gdp correctly point to the last group visited.
405 */ 1294 */
406 nr_scanned_groups = 0; 1295 for (bgi = 0; bgi < ngroups; bgi++) {
407retry:
408 for (group_idx = 0; !group_alloc &&
409 group_idx < sbi->s_groups_count; group_idx++) {
410 group_no++; 1296 group_no++;
411 if (group_no >= sbi->s_groups_count) 1297 if (group_no >= ngroups)
412 group_no = 0; 1298 group_no = 0;
413 desc = ext2_get_group_desc(sb, group_no, &gdp_bh); 1299 gdp = ext2_get_group_desc(sb, group_no, &gdp_bh);
414 if (!desc) 1300 if (!gdp)
415 goto io_error; 1301 goto io_error;
416 group_alloc = group_reserve_blocks(sbi, group_no, desc,
417 gdp_bh, es_alloc);
418 }
419 if (!group_alloc) {
420 *err = -ENOSPC;
421 goto out_release;
422 }
423 brelse(bitmap_bh);
424 bitmap_bh = read_block_bitmap(sb, group_no);
425 if (!bitmap_bh)
426 goto io_error;
427 1302
428 ret_block = grab_block(sb_bgl_lock(sbi, group_no), bitmap_bh->b_data, 1303 free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
429 group_size, 0);
430 if (ret_block < 0) {
431 /* 1304 /*
432 * If a free block counter is corrupted we can loop inifintely. 1305 * skip this group if the number of
433 * Detect that here. 1306 * free blocks is less than half of the reservation
1307 * window size.
434 */ 1308 */
435 nr_scanned_groups++; 1309 if (free_blocks <= (windowsz/2))
436 if (nr_scanned_groups > 2 * sbi->s_groups_count) { 1310 continue;
437 ext2_error(sb, "ext2_new_block", 1311
438 "corrupted free blocks counters"); 1312 brelse(bitmap_bh);
1313 bitmap_bh = read_block_bitmap(sb, group_no);
1314 if (!bitmap_bh)
439 goto io_error; 1315 goto io_error;
440 }
441 /* 1316 /*
442 * Someone else grabbed the last free block in this blockgroup 1317 * try to allocate block(s) from this group, without a goal(-1).
443 * before us. Retry the scan.
444 */ 1318 */
445 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc); 1319 grp_alloc_blk = ext2_try_to_allocate_with_rsv(sb, group_no,
446 group_alloc = 0; 1320 bitmap_bh, -1, my_rsv, &num);
447 goto retry; 1321 if (grp_alloc_blk >= 0)
1322 goto allocated;
1323 }
1324 /*
1325 * We may end up a bogus ealier ENOSPC error due to
1326 * filesystem is "full" of reservations, but
1327 * there maybe indeed free blocks avaliable on disk
1328 * In this case, we just forget about the reservations
1329 * just do block allocation as without reservations.
1330 */
1331 if (my_rsv) {
1332 my_rsv = NULL;
1333 windowsz = 0;
1334 group_no = goal_group;
1335 goto retry_alloc;
448 } 1336 }
1337 /* No space left on the device */
1338 *errp = -ENOSPC;
1339 goto out;
1340
1341allocated:
449 1342
450got_block:
451 ext2_debug("using block group %d(%d)\n", 1343 ext2_debug("using block group %d(%d)\n",
452 group_no, desc->bg_free_blocks_count); 1344 group_no, gdp->bg_free_blocks_count);
453 1345
454 target_block = ret_block + group_no * group_size + 1346 ret_block = grp_alloc_blk + ext2_group_first_block_no(sb, group_no);
455 le32_to_cpu(es->s_first_data_block);
456 1347
457 if (target_block == le32_to_cpu(desc->bg_block_bitmap) || 1348 if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) ||
458 target_block == le32_to_cpu(desc->bg_inode_bitmap) || 1349 in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) ||
459 in_range(target_block, le32_to_cpu(desc->bg_inode_table), 1350 in_range(ret_block, le32_to_cpu(gdp->bg_inode_table),
460 sbi->s_itb_per_group)) 1351 EXT2_SB(sb)->s_itb_per_group) ||
461 ext2_error (sb, "ext2_new_block", 1352 in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table),
1353 EXT2_SB(sb)->s_itb_per_group))
1354 ext2_error(sb, "ext2_new_blocks",
462 "Allocating block in system zone - " 1355 "Allocating block in system zone - "
463 "block = %u", target_block); 1356 "blocks from "E2FSBLK", length %lu",
1357 ret_block, num);
1358
1359 performed_allocation = 1;
464 1360
465 if (target_block >= le32_to_cpu(es->s_blocks_count)) { 1361 if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) {
466 ext2_error (sb, "ext2_new_block", 1362 ext2_error(sb, "ext2_new_blocks",
467 "block(%d) >= blocks count(%d) - " 1363 "block("E2FSBLK") >= blocks count(%d) - "
468 "block_group = %d, es == %p ", ret_block, 1364 "block_group = %d, es == %p ", ret_block,
469 le32_to_cpu(es->s_blocks_count), group_no, es); 1365 le32_to_cpu(es->s_blocks_count), group_no, es);
470 goto io_error; 1366 goto out;
471 } 1367 }
472 block = target_block;
473 1368
474 /* OK, we _had_ allocated something */ 1369 group_adjust_blocks(sb, group_no, gdp, gdp_bh, -num);
475 ext2_debug("found bit %d\n", ret_block); 1370 percpu_counter_sub(&sbi->s_freeblocks_counter, num);
476
477 dq_alloc--;
478 es_alloc--;
479 group_alloc--;
480
481 /*
482 * Do block preallocation now if required.
483 */
484 write_lock(&EXT2_I(inode)->i_meta_lock);
485 if (group_alloc && !*prealloc_count) {
486 unsigned n;
487
488 for (n = 0; n < group_alloc && ++ret_block < group_size; n++) {
489 if (ext2_set_bit_atomic(sb_bgl_lock(sbi, group_no),
490 ret_block,
491 (void*) bitmap_bh->b_data))
492 break;
493 }
494 *prealloc_block = block + 1;
495 *prealloc_count = n;
496 es_alloc -= n;
497 dq_alloc -= n;
498 group_alloc -= n;
499 }
500 write_unlock(&EXT2_I(inode)->i_meta_lock);
501 1371
502 mark_buffer_dirty(bitmap_bh); 1372 mark_buffer_dirty(bitmap_bh);
503 if (sb->s_flags & MS_SYNCHRONOUS) 1373 if (sb->s_flags & MS_SYNCHRONOUS)
504 sync_dirty_buffer(bitmap_bh); 1374 sync_dirty_buffer(bitmap_bh);
505 1375
506 ext2_debug ("allocating block %d. ", block); 1376 *errp = 0;
1377 brelse(bitmap_bh);
1378 DQUOT_FREE_BLOCK(inode, *count-num);
1379 *count = num;
1380 return ret_block;
507 1381
508 *err = 0; 1382io_error:
509out_release: 1383 *errp = -EIO;
510 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
511 release_blocks(sb, es_alloc);
512out_dquot:
513 DQUOT_FREE_BLOCK(inode, dq_alloc);
514out: 1384out:
1385 /*
1386 * Undo the block allocation
1387 */
1388 if (!performed_allocation)
1389 DQUOT_FREE_BLOCK(inode, *count);
515 brelse(bitmap_bh); 1390 brelse(bitmap_bh);
516 return block; 1391 return 0;
1392}
517 1393
518io_error: 1394ext2_fsblk_t ext2_new_block(struct inode *inode, unsigned long goal, int *errp)
519 *err = -EIO; 1395{
520 goto out_release; 1396 unsigned long count = 1;
1397
1398 return ext2_new_blocks(inode, goal, &count, errp);
521} 1399}
522 1400
523#ifdef EXT2FS_DEBUG 1401#ifdef EXT2FS_DEBUG
524 1402
525static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; 1403static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
526 1404
527unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars) 1405unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars)
528{ 1406{
@@ -583,13 +1461,6 @@ unsigned long ext2_count_free_blocks (struct super_block * sb)
583#endif 1461#endif
584} 1462}
585 1463
586static inline int
587block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
588{
589 return ext2_test_bit ((block -
590 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) %
591 EXT2_BLOCKS_PER_GROUP(sb), map);
592}
593 1464
594static inline int test_root(int a, int b) 1465static inline int test_root(int a, int b)
595{ 1466{
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index a08052d2c008..7730388c4931 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -33,22 +33,9 @@ struct ext2_inode_info {
33 */ 33 */
34 __u32 i_block_group; 34 __u32 i_block_group;
35 35
36 /* 36 /* block reservation info */
37 * i_next_alloc_block is the logical (file-relative) number of the 37 struct ext2_block_alloc_info *i_block_alloc_info;
38 * most-recently-allocated block in this file. Yes, it is misnamed.
39 * We use this for detecting linearly ascending allocation requests.
40 */
41 __u32 i_next_alloc_block;
42 38
43 /*
44 * i_next_alloc_goal is the *physical* companion to i_next_alloc_block.
45 * it the the physical block number of the block which was most-recently
46 * allocated to this file. This give us the goal (target) for the next
47 * allocation when we detect linearly ascending requests.
48 */
49 __u32 i_next_alloc_goal;
50 __u32 i_prealloc_block;
51 __u32 i_prealloc_count;
52 __u32 i_dir_start_lookup; 39 __u32 i_dir_start_lookup;
53#ifdef CONFIG_EXT2_FS_XATTR 40#ifdef CONFIG_EXT2_FS_XATTR
54 /* 41 /*
@@ -65,7 +52,16 @@ struct ext2_inode_info {
65 struct posix_acl *i_default_acl; 52 struct posix_acl *i_default_acl;
66#endif 53#endif
67 rwlock_t i_meta_lock; 54 rwlock_t i_meta_lock;
55
56 /*
57 * truncate_mutex is for serialising ext2_truncate() against
58 * ext2_getblock(). It also protects the internals of the inode's
59 * reservation data structures: ext2_reserve_window and
60 * ext2_reserve_window_node.
61 */
62 struct mutex truncate_mutex;
68 struct inode vfs_inode; 63 struct inode vfs_inode;
64 struct list_head i_orphan; /* unlinked but open inodes */
69}; 65};
70 66
71/* 67/*
@@ -91,8 +87,9 @@ static inline struct ext2_inode_info *EXT2_I(struct inode *inode)
91/* balloc.c */ 87/* balloc.c */
92extern int ext2_bg_has_super(struct super_block *sb, int group); 88extern int ext2_bg_has_super(struct super_block *sb, int group);
93extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group); 89extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
94extern int ext2_new_block (struct inode *, unsigned long, 90extern ext2_fsblk_t ext2_new_block(struct inode *, unsigned long, int *);
95 __u32 *, __u32 *, int *); 91extern ext2_fsblk_t ext2_new_blocks(struct inode *, unsigned long,
92 unsigned long *, int *);
96extern void ext2_free_blocks (struct inode *, unsigned long, 93extern void ext2_free_blocks (struct inode *, unsigned long,
97 unsigned long); 94 unsigned long);
98extern unsigned long ext2_count_free_blocks (struct super_block *); 95extern unsigned long ext2_count_free_blocks (struct super_block *);
@@ -101,6 +98,10 @@ extern void ext2_check_blocks_bitmap (struct super_block *);
101extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, 98extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
102 unsigned int block_group, 99 unsigned int block_group,
103 struct buffer_head ** bh); 100 struct buffer_head ** bh);
101extern void ext2_discard_reservation (struct inode *);
102extern int ext2_should_retry_alloc(struct super_block *sb, int *retries);
103extern void ext2_init_block_alloc_info(struct inode *);
104extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_window_node *rsv);
104 105
105/* dir.c */ 106/* dir.c */
106extern int ext2_add_link (struct dentry *, struct inode *); 107extern int ext2_add_link (struct dentry *, struct inode *);
@@ -128,7 +129,6 @@ extern int ext2_write_inode (struct inode *, int);
128extern void ext2_put_inode (struct inode *); 129extern void ext2_put_inode (struct inode *);
129extern void ext2_delete_inode (struct inode *); 130extern void ext2_delete_inode (struct inode *);
130extern int ext2_sync_inode (struct inode *); 131extern int ext2_sync_inode (struct inode *);
131extern void ext2_discard_prealloc (struct inode *);
132extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); 132extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
133extern void ext2_truncate (struct inode *); 133extern void ext2_truncate (struct inode *);
134extern int ext2_setattr (struct dentry *, struct iattr *); 134extern int ext2_setattr (struct dentry *, struct iattr *);
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index ab7961260c49..c051798459a1 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -30,8 +30,11 @@
30 */ 30 */
31static int ext2_release_file (struct inode * inode, struct file * filp) 31static int ext2_release_file (struct inode * inode, struct file * filp)
32{ 32{
33 if (filp->f_mode & FMODE_WRITE) 33 if (filp->f_mode & FMODE_WRITE) {
34 ext2_discard_prealloc (inode); 34 mutex_lock(&EXT2_I(inode)->truncate_mutex);
35 ext2_discard_reservation(inode);
36 mutex_unlock(&EXT2_I(inode)->truncate_mutex);
37 }
35 return 0; 38 return 0;
36} 39}
37 40
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 2cb545bf0f3c..5deb8b74e649 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -177,7 +177,6 @@ static void ext2_preread_inode(struct inode *inode)
177 unsigned long block_group; 177 unsigned long block_group;
178 unsigned long offset; 178 unsigned long offset;
179 unsigned long block; 179 unsigned long block;
180 struct buffer_head *bh;
181 struct ext2_group_desc * gdp; 180 struct ext2_group_desc * gdp;
182 struct backing_dev_info *bdi; 181 struct backing_dev_info *bdi;
183 182
@@ -188,7 +187,7 @@ static void ext2_preread_inode(struct inode *inode)
188 return; 187 return;
189 188
190 block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb); 189 block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
191 gdp = ext2_get_group_desc(inode->i_sb, block_group, &bh); 190 gdp = ext2_get_group_desc(inode->i_sb, block_group, NULL);
192 if (gdp == NULL) 191 if (gdp == NULL)
193 return; 192 return;
194 193
@@ -217,11 +216,10 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
217 int ngroups = EXT2_SB(sb)->s_groups_count; 216 int ngroups = EXT2_SB(sb)->s_groups_count;
218 int avefreei = ext2_count_free_inodes(sb) / ngroups; 217 int avefreei = ext2_count_free_inodes(sb) / ngroups;
219 struct ext2_group_desc *desc, *best_desc = NULL; 218 struct ext2_group_desc *desc, *best_desc = NULL;
220 struct buffer_head *bh, *best_bh = NULL;
221 int group, best_group = -1; 219 int group, best_group = -1;
222 220
223 for (group = 0; group < ngroups; group++) { 221 for (group = 0; group < ngroups; group++) {
224 desc = ext2_get_group_desc (sb, group, &bh); 222 desc = ext2_get_group_desc (sb, group, NULL);
225 if (!desc || !desc->bg_free_inodes_count) 223 if (!desc || !desc->bg_free_inodes_count)
226 continue; 224 continue;
227 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) 225 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)
231 le16_to_cpu(best_desc->bg_free_blocks_count))) { 229 le16_to_cpu(best_desc->bg_free_blocks_count))) {
232 best_group = group; 230 best_group = group;
233 best_desc = desc; 231 best_desc = desc;
234 best_bh = bh;
235 } 232 }
236 } 233 }
237 if (!best_desc) 234 if (!best_desc)
@@ -284,7 +281,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
284 int max_debt, max_dirs, min_blocks, min_inodes; 281 int max_debt, max_dirs, min_blocks, min_inodes;
285 int group = -1, i; 282 int group = -1, i;
286 struct ext2_group_desc *desc; 283 struct ext2_group_desc *desc;
287 struct buffer_head *bh;
288 284
289 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); 285 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
290 avefreei = freei / ngroups; 286 avefreei = freei / ngroups;
@@ -295,7 +291,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
295 if ((parent == sb->s_root->d_inode) || 291 if ((parent == sb->s_root->d_inode) ||
296 (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) { 292 (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
297 struct ext2_group_desc *best_desc = NULL; 293 struct ext2_group_desc *best_desc = NULL;
298 struct buffer_head *best_bh = NULL;
299 int best_ndir = inodes_per_group; 294 int best_ndir = inodes_per_group;
300 int best_group = -1; 295 int best_group = -1;
301 296
@@ -303,7 +298,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
303 parent_group = (unsigned)group % ngroups; 298 parent_group = (unsigned)group % ngroups;
304 for (i = 0; i < ngroups; i++) { 299 for (i = 0; i < ngroups; i++) {
305 group = (parent_group + i) % ngroups; 300 group = (parent_group + i) % ngroups;
306 desc = ext2_get_group_desc (sb, group, &bh); 301 desc = ext2_get_group_desc (sb, group, NULL);
307 if (!desc || !desc->bg_free_inodes_count) 302 if (!desc || !desc->bg_free_inodes_count)
308 continue; 303 continue;
309 if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) 304 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)
315 best_group = group; 310 best_group = group;
316 best_ndir = le16_to_cpu(desc->bg_used_dirs_count); 311 best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
317 best_desc = desc; 312 best_desc = desc;
318 best_bh = bh;
319 } 313 }
320 if (best_group >= 0) { 314 if (best_group >= 0) {
321 desc = best_desc; 315 desc = best_desc;
322 bh = best_bh;
323 group = best_group; 316 group = best_group;
324 goto found; 317 goto found;
325 } 318 }
@@ -345,7 +338,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
345 338
346 for (i = 0; i < ngroups; i++) { 339 for (i = 0; i < ngroups; i++) {
347 group = (parent_group + i) % ngroups; 340 group = (parent_group + i) % ngroups;
348 desc = ext2_get_group_desc (sb, group, &bh); 341 desc = ext2_get_group_desc (sb, group, NULL);
349 if (!desc || !desc->bg_free_inodes_count) 342 if (!desc || !desc->bg_free_inodes_count)
350 continue; 343 continue;
351 if (sbi->s_debts[group] >= max_debt) 344 if (sbi->s_debts[group] >= max_debt)
@@ -362,7 +355,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
362fallback: 355fallback:
363 for (i = 0; i < ngroups; i++) { 356 for (i = 0; i < ngroups; i++) {
364 group = (parent_group + i) % ngroups; 357 group = (parent_group + i) % ngroups;
365 desc = ext2_get_group_desc (sb, group, &bh); 358 desc = ext2_get_group_desc (sb, group, NULL);
366 if (!desc || !desc->bg_free_inodes_count) 359 if (!desc || !desc->bg_free_inodes_count)
367 continue; 360 continue;
368 if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) 361 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)
389 int parent_group = EXT2_I(parent)->i_block_group; 382 int parent_group = EXT2_I(parent)->i_block_group;
390 int ngroups = EXT2_SB(sb)->s_groups_count; 383 int ngroups = EXT2_SB(sb)->s_groups_count;
391 struct ext2_group_desc *desc; 384 struct ext2_group_desc *desc;
392 struct buffer_head *bh;
393 int group, i; 385 int group, i;
394 386
395 /* 387 /*
396 * Try to place the inode in its parent directory 388 * Try to place the inode in its parent directory
397 */ 389 */
398 group = parent_group; 390 group = parent_group;
399 desc = ext2_get_group_desc (sb, group, &bh); 391 desc = ext2_get_group_desc (sb, group, NULL);
400 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 392 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
401 le16_to_cpu(desc->bg_free_blocks_count)) 393 le16_to_cpu(desc->bg_free_blocks_count))
402 goto found; 394 goto found;
@@ -420,7 +412,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
420 group += i; 412 group += i;
421 if (group >= ngroups) 413 if (group >= ngroups)
422 group -= ngroups; 414 group -= ngroups;
423 desc = ext2_get_group_desc (sb, group, &bh); 415 desc = ext2_get_group_desc (sb, group, NULL);
424 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 416 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
425 le16_to_cpu(desc->bg_free_blocks_count)) 417 le16_to_cpu(desc->bg_free_blocks_count))
426 goto found; 418 goto found;
@@ -434,7 +426,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
434 for (i = 0; i < ngroups; i++) { 426 for (i = 0; i < ngroups; i++) {
435 if (++group >= ngroups) 427 if (++group >= ngroups)
436 group = 0; 428 group = 0;
437 desc = ext2_get_group_desc (sb, group, &bh); 429 desc = ext2_get_group_desc (sb, group, NULL);
438 if (desc && le16_to_cpu(desc->bg_free_inodes_count)) 430 if (desc && le16_to_cpu(desc->bg_free_inodes_count))
439 goto found; 431 goto found;
440 } 432 }
@@ -542,7 +534,7 @@ got:
542 goto fail; 534 goto fail;
543 } 535 }
544 536
545 percpu_counter_mod(&sbi->s_freeinodes_counter, -1); 537 percpu_counter_add(&sbi->s_freeinodes_counter, -1);
546 if (S_ISDIR(mode)) 538 if (S_ISDIR(mode))
547 percpu_counter_inc(&sbi->s_dirs_counter); 539 percpu_counter_inc(&sbi->s_dirs_counter);
548 540
@@ -589,11 +581,8 @@ got:
589 ei->i_file_acl = 0; 581 ei->i_file_acl = 0;
590 ei->i_dir_acl = 0; 582 ei->i_dir_acl = 0;
591 ei->i_dtime = 0; 583 ei->i_dtime = 0;
584 ei->i_block_alloc_info = NULL;
592 ei->i_block_group = group; 585 ei->i_block_group = group;
593 ei->i_next_alloc_block = 0;
594 ei->i_next_alloc_goal = 0;
595 ei->i_prealloc_block = 0;
596 ei->i_prealloc_count = 0;
597 ei->i_dir_start_lookup = 0; 586 ei->i_dir_start_lookup = 0;
598 ei->i_state = EXT2_STATE_NEW; 587 ei->i_state = EXT2_STATE_NEW;
599 ext2_set_inode_flags(inode); 588 ext2_set_inode_flags(inode);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 1b102a1ccebb..b1ab32ab5a77 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -54,19 +54,6 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode)
54} 54}
55 55
56/* 56/*
57 * Called at each iput().
58 *
59 * The inode may be "bad" if ext2_read_inode() saw an error from
60 * ext2_get_inode(), so we need to check that to avoid freeing random disk
61 * blocks.
62 */
63void ext2_put_inode(struct inode *inode)
64{
65 if (!is_bad_inode(inode))
66 ext2_discard_prealloc(inode);
67}
68
69/*
70 * Called at the last iput() if i_nlink is zero. 57 * Called at the last iput() if i_nlink is zero.
71 */ 58 */
72void ext2_delete_inode (struct inode * inode) 59void ext2_delete_inode (struct inode * inode)
@@ -89,61 +76,6 @@ no_delete:
89 clear_inode(inode); /* We must guarantee clearing of inode... */ 76 clear_inode(inode); /* We must guarantee clearing of inode... */
90} 77}
91 78
92void ext2_discard_prealloc (struct inode * inode)
93{
94#ifdef EXT2_PREALLOCATE
95 struct ext2_inode_info *ei = EXT2_I(inode);
96 write_lock(&ei->i_meta_lock);
97 if (ei->i_prealloc_count) {
98 unsigned short total = ei->i_prealloc_count;
99 unsigned long block = ei->i_prealloc_block;
100 ei->i_prealloc_count = 0;
101 ei->i_prealloc_block = 0;
102 write_unlock(&ei->i_meta_lock);
103 ext2_free_blocks (inode, block, total);
104 return;
105 } else
106 write_unlock(&ei->i_meta_lock);
107#endif
108}
109
110static int ext2_alloc_block (struct inode * inode, unsigned long goal, int *err)
111{
112#ifdef EXT2FS_DEBUG
113 static unsigned long alloc_hits, alloc_attempts;
114#endif
115 unsigned long result;
116
117
118#ifdef EXT2_PREALLOCATE
119 struct ext2_inode_info *ei = EXT2_I(inode);
120 write_lock(&ei->i_meta_lock);
121 if (ei->i_prealloc_count &&
122 (goal == ei->i_prealloc_block || goal + 1 == ei->i_prealloc_block))
123 {
124 result = ei->i_prealloc_block++;
125 ei->i_prealloc_count--;
126 write_unlock(&ei->i_meta_lock);
127 ext2_debug ("preallocation hit (%lu/%lu).\n",
128 ++alloc_hits, ++alloc_attempts);
129 } else {
130 write_unlock(&ei->i_meta_lock);
131 ext2_discard_prealloc (inode);
132 ext2_debug ("preallocation miss (%lu/%lu).\n",
133 alloc_hits, ++alloc_attempts);
134 if (S_ISREG(inode->i_mode))
135 result = ext2_new_block (inode, goal,
136 &ei->i_prealloc_count,
137 &ei->i_prealloc_block, err);
138 else
139 result = ext2_new_block(inode, goal, NULL, NULL, err);
140 }
141#else
142 result = ext2_new_block (inode, goal, 0, 0, err);
143#endif
144 return result;
145}
146
147typedef struct { 79typedef struct {
148 __le32 *p; 80 __le32 *p;
149 __le32 key; 81 __le32 key;
@@ -228,7 +160,8 @@ static int ext2_block_to_path(struct inode *inode,
228 ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big"); 160 ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big");
229 } 161 }
230 if (boundary) 162 if (boundary)
231 *boundary = (i_block & (ptrs - 1)) == (final - 1); 163 *boundary = final - 1 - (i_block & (ptrs - 1));
164
232 return n; 165 return n;
233} 166}
234 167
@@ -355,39 +288,129 @@ static unsigned long ext2_find_near(struct inode *inode, Indirect *ind)
355 * @block: block we want 288 * @block: block we want
356 * @chain: chain of indirect blocks 289 * @chain: chain of indirect blocks
357 * @partial: pointer to the last triple within a chain 290 * @partial: pointer to the last triple within a chain
358 * @goal: place to store the result.
359 * 291 *
360 * Normally this function find the prefered place for block allocation, 292 * Returns preferred place for a block (the goal).
361 * stores it in *@goal and returns zero. If the branch had been changed
362 * under us we return -EAGAIN.
363 */ 293 */
364 294
365static inline int ext2_find_goal(struct inode *inode, 295static inline int ext2_find_goal(struct inode *inode,
366 long block, 296 long block,
367 Indirect chain[4], 297 Indirect chain[4],
368 Indirect *partial, 298 Indirect *partial)
369 unsigned long *goal)
370{ 299{
371 struct ext2_inode_info *ei = EXT2_I(inode); 300 struct ext2_block_alloc_info *block_i;
372 write_lock(&ei->i_meta_lock); 301
373 if ((block == ei->i_next_alloc_block + 1) && ei->i_next_alloc_goal) { 302 block_i = EXT2_I(inode)->i_block_alloc_info;
374 ei->i_next_alloc_block++; 303
375 ei->i_next_alloc_goal++; 304 /*
376 } 305 * try the heuristic for sequential allocation,
377 if (verify_chain(chain, partial)) { 306 * failing that at least try to get decent locality.
378 /* 307 */
379 * try the heuristic for sequential allocation, 308 if (block_i && (block == block_i->last_alloc_logical_block + 1)
380 * failing that at least try to get decent locality. 309 && (block_i->last_alloc_physical_block != 0)) {
381 */ 310 return block_i->last_alloc_physical_block + 1;
382 if (block == ei->i_next_alloc_block)
383 *goal = ei->i_next_alloc_goal;
384 if (!*goal)
385 *goal = ext2_find_near(inode, partial);
386 write_unlock(&ei->i_meta_lock);
387 return 0;
388 } 311 }
389 write_unlock(&ei->i_meta_lock); 312
390 return -EAGAIN; 313 return ext2_find_near(inode, partial);
314}
315
316/**
317 * ext2_blks_to_allocate: Look up the block map and count the number
318 * of direct blocks need to be allocated for the given branch.
319 *
320 * @branch: chain of indirect blocks
321 * @k: number of blocks need for indirect blocks
322 * @blks: number of data blocks to be mapped.
323 * @blocks_to_boundary: the offset in the indirect block
324 *
325 * return the total number of blocks to be allocate, including the
326 * direct and indirect blocks.
327 */
328static int
329ext2_blks_to_allocate(Indirect * branch, int k, unsigned long blks,
330 int blocks_to_boundary)
331{
332 unsigned long count = 0;
333
334 /*
335 * Simple case, [t,d]Indirect block(s) has not allocated yet
336 * then it's clear blocks on that path have not allocated
337 */
338 if (k > 0) {
339 /* right now don't hanel cross boundary allocation */
340 if (blks < blocks_to_boundary + 1)
341 count += blks;
342 else
343 count += blocks_to_boundary + 1;
344 return count;
345 }
346
347 count++;
348 while (count < blks && count <= blocks_to_boundary
349 && le32_to_cpu(*(branch[0].p + count)) == 0) {
350 count++;
351 }
352 return count;
353}
354
355/**
356 * ext2_alloc_blocks: multiple allocate blocks needed for a branch
357 * @indirect_blks: the number of blocks need to allocate for indirect
358 * blocks
359 *
360 * @new_blocks: on return it will store the new block numbers for
361 * the indirect blocks(if needed) and the first direct block,
362 * @blks: on return it will store the total number of allocated
363 * direct blocks
364 */
365static int ext2_alloc_blocks(struct inode *inode,
366 ext2_fsblk_t goal, int indirect_blks, int blks,
367 ext2_fsblk_t new_blocks[4], int *err)
368{
369 int target, i;
370 unsigned long count = 0;
371 int index = 0;
372 ext2_fsblk_t current_block = 0;
373 int ret = 0;
374
375 /*
376 * Here we try to allocate the requested multiple blocks at once,
377 * on a best-effort basis.
378 * To build a branch, we should allocate blocks for
379 * the indirect blocks(if not allocated yet), and at least
380 * the first direct block of this branch. That's the
381 * minimum number of blocks need to allocate(required)
382 */
383 target = blks + indirect_blks;
384
385 while (1) {
386 count = target;
387 /* allocating blocks for indirect blocks and direct blocks */
388 current_block = ext2_new_blocks(inode,goal,&count,err);
389 if (*err)
390 goto failed_out;
391
392 target -= count;
393 /* allocate blocks for indirect blocks */
394 while (index < indirect_blks && count) {
395 new_blocks[index++] = current_block++;
396 count--;
397 }
398
399 if (count > 0)
400 break;
401 }
402
403 /* save the new block number for the first direct block */
404 new_blocks[index] = current_block;
405
406 /* total number of blocks allocated for direct blocks */
407 ret = count;
408 *err = 0;
409 return ret;
410failed_out:
411 for (i = 0; i <index; i++)
412 ext2_free_blocks(inode, new_blocks[i], 1);
413 return ret;
391} 414}
392 415
393/** 416/**
@@ -416,39 +439,49 @@ static inline int ext2_find_goal(struct inode *inode,
416 */ 439 */
417 440
418static int ext2_alloc_branch(struct inode *inode, 441static int ext2_alloc_branch(struct inode *inode,
419 int num, 442 int indirect_blks, int *blks, ext2_fsblk_t goal,
420 unsigned long goal, 443 int *offsets, Indirect *branch)
421 int *offsets,
422 Indirect *branch)
423{ 444{
424 int blocksize = inode->i_sb->s_blocksize; 445 int blocksize = inode->i_sb->s_blocksize;
425 int n = 0; 446 int i, n = 0;
426 int err; 447 int err = 0;
427 int i; 448 struct buffer_head *bh;
428 int parent = ext2_alloc_block(inode, goal, &err); 449 int num;
429 450 ext2_fsblk_t new_blocks[4];
430 branch[0].key = cpu_to_le32(parent); 451 ext2_fsblk_t current_block;
431 if (parent) for (n = 1; n < num; n++) { 452
432 struct buffer_head *bh; 453 num = ext2_alloc_blocks(inode, goal, indirect_blks,
433 /* Allocate the next block */ 454 *blks, new_blocks, &err);
434 int nr = ext2_alloc_block(inode, parent, &err); 455 if (err)
435 if (!nr) 456 return err;
436 break; 457
437 branch[n].key = cpu_to_le32(nr); 458 branch[0].key = cpu_to_le32(new_blocks[0]);
459 /*
460 * metadata blocks and data blocks are allocated.
461 */
462 for (n = 1; n <= indirect_blks; n++) {
438 /* 463 /*
439 * Get buffer_head for parent block, zero it out and set 464 * Get buffer_head for parent block, zero it out
440 * the pointer to new one, then send parent to disk. 465 * and set the pointer to new one, then send
466 * parent to disk.
441 */ 467 */
442 bh = sb_getblk(inode->i_sb, parent); 468 bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
443 if (!bh) { 469 branch[n].bh = bh;
444 err = -EIO;
445 break;
446 }
447 lock_buffer(bh); 470 lock_buffer(bh);
448 memset(bh->b_data, 0, blocksize); 471 memset(bh->b_data, 0, blocksize);
449 branch[n].bh = bh;
450 branch[n].p = (__le32 *) bh->b_data + offsets[n]; 472 branch[n].p = (__le32 *) bh->b_data + offsets[n];
473 branch[n].key = cpu_to_le32(new_blocks[n]);
451 *branch[n].p = branch[n].key; 474 *branch[n].p = branch[n].key;
475 if ( n == indirect_blks) {
476 current_block = new_blocks[n];
477 /*
478 * End of chain, update the last new metablock of
479 * the chain to point to the new allocated
480 * data blocks numbers
481 */
482 for (i=1; i < num; i++)
483 *(branch[n].p + i) = cpu_to_le32(++current_block);
484 }
452 set_buffer_uptodate(bh); 485 set_buffer_uptodate(bh);
453 unlock_buffer(bh); 486 unlock_buffer(bh);
454 mark_buffer_dirty_inode(bh, inode); 487 mark_buffer_dirty_inode(bh, inode);
@@ -458,77 +491,68 @@ static int ext2_alloc_branch(struct inode *inode,
458 */ 491 */
459 if (S_ISDIR(inode->i_mode) && IS_DIRSYNC(inode)) 492 if (S_ISDIR(inode->i_mode) && IS_DIRSYNC(inode))
460 sync_dirty_buffer(bh); 493 sync_dirty_buffer(bh);
461 parent = nr;
462 } 494 }
463 if (n == num) 495 *blks = num;
464 return 0;
465
466 /* Allocation failed, free what we already allocated */
467 for (i = 1; i < n; i++)
468 bforget(branch[i].bh);
469 for (i = 0; i < n; i++)
470 ext2_free_blocks(inode, le32_to_cpu(branch[i].key), 1);
471 return err; 496 return err;
472} 497}
473 498
474/** 499/**
475 * ext2_splice_branch - splice the allocated branch onto inode. 500 * ext2_splice_branch - splice the allocated branch onto inode.
476 * @inode: owner 501 * @inode: owner
477 * @block: (logical) number of block we are adding 502 * @block: (logical) number of block we are adding
478 * @chain: chain of indirect blocks (with a missing link - see 503 * @chain: chain of indirect blocks (with a missing link - see
479 * ext2_alloc_branch) 504 * ext2_alloc_branch)
480 * @where: location of missing link 505 * @where: location of missing link
481 * @num: number of blocks we are adding 506 * @num: number of indirect blocks we are adding
507 * @blks: number of direct blocks we are adding
482 * 508 *
483 * This function verifies that chain (up to the missing link) had not 509 * This function fills the missing link and does all housekeeping needed in
484 * changed, fills the missing link and does all housekeeping needed in 510 * inode (->i_blocks, etc.). In case of success we end up with the full
485 * inode (->i_blocks, etc.). In case of success we end up with the full 511 * chain to new block and return 0.
486 * chain to new block and return 0. Otherwise (== chain had been changed)
487 * we free the new blocks (forgetting their buffer_heads, indeed) and
488 * return -EAGAIN.
489 */ 512 */
490 513static void ext2_splice_branch(struct inode *inode,
491static inline int ext2_splice_branch(struct inode *inode, 514 long block, Indirect *where, int num, int blks)
492 long block,
493 Indirect chain[4],
494 Indirect *where,
495 int num)
496{ 515{
497 struct ext2_inode_info *ei = EXT2_I(inode);
498 int i; 516 int i;
517 struct ext2_block_alloc_info *block_i;
518 ext2_fsblk_t current_block;
499 519
500 /* Verify that place we are splicing to is still there and vacant */ 520 block_i = EXT2_I(inode)->i_block_alloc_info;
501
502 write_lock(&ei->i_meta_lock);
503 if (!verify_chain(chain, where-1) || *where->p)
504 goto changed;
505 521
522 /* XXX LOCKING probably should have i_meta_lock ?*/
506 /* That's it */ 523 /* That's it */
507 524
508 *where->p = where->key; 525 *where->p = where->key;
509 ei->i_next_alloc_block = block;
510 ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
511 526
512 write_unlock(&ei->i_meta_lock); 527 /*
528 * Update the host buffer_head or inode to point to more just allocated
529 * direct blocks blocks
530 */
531 if (num == 0 && blks > 1) {
532 current_block = le32_to_cpu(where->key) + 1;
533 for (i = 1; i < blks; i++)
534 *(where->p + i ) = cpu_to_le32(current_block++);
535 }
513 536
514 /* We are done with atomic stuff, now do the rest of housekeeping */ 537 /*
538 * update the most recently allocated logical & physical block
539 * in i_block_alloc_info, to assist find the proper goal block for next
540 * allocation
541 */
542 if (block_i) {
543 block_i->last_alloc_logical_block = block + blks - 1;
544 block_i->last_alloc_physical_block =
545 le32_to_cpu(where[num].key) + blks - 1;
546 }
515 547
516 inode->i_ctime = CURRENT_TIME_SEC; 548 /* We are done with atomic stuff, now do the rest of housekeeping */
517 549
518 /* had we spliced it onto indirect block? */ 550 /* had we spliced it onto indirect block? */
519 if (where->bh) 551 if (where->bh)
520 mark_buffer_dirty_inode(where->bh, inode); 552 mark_buffer_dirty_inode(where->bh, inode);
521 553
554 inode->i_ctime = CURRENT_TIME_SEC;
522 mark_inode_dirty(inode); 555 mark_inode_dirty(inode);
523 return 0;
524
525changed:
526 write_unlock(&ei->i_meta_lock);
527 for (i = 1; i < num; i++)
528 bforget(where[i].bh);
529 for (i = 0; i < num; i++)
530 ext2_free_blocks(inode, le32_to_cpu(where[i].key), 1);
531 return -EAGAIN;
532} 556}
533 557
534/* 558/*
@@ -542,64 +566,99 @@ changed:
542 * That has a nice additional property: no special recovery from the failed 566 * That has a nice additional property: no special recovery from the failed
543 * allocations is needed - we simply release blocks and do not touch anything 567 * allocations is needed - we simply release blocks and do not touch anything
544 * reachable from inode. 568 * reachable from inode.
569 *
570 * `handle' can be NULL if create == 0.
571 *
572 * The BKL may not be held on entry here. Be sure to take it early.
573 * return > 0, # of blocks mapped or allocated.
574 * return = 0, if plain lookup failed.
575 * return < 0, error case.
545 */ 576 */
546 577static int ext2_get_blocks(struct inode *inode,
547int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) 578 sector_t iblock, unsigned long maxblocks,
579 struct buffer_head *bh_result,
580 int create)
548{ 581{
549 int err = -EIO; 582 int err = -EIO;
550 int offsets[4]; 583 int offsets[4];
551 Indirect chain[4]; 584 Indirect chain[4];
552 Indirect *partial; 585 Indirect *partial;
553 unsigned long goal; 586 ext2_fsblk_t goal;
554 int left; 587 int indirect_blks;
555 int boundary = 0; 588 int blocks_to_boundary = 0;
556 int depth = ext2_block_to_path(inode, iblock, offsets, &boundary); 589 int depth;
590 struct ext2_inode_info *ei = EXT2_I(inode);
591 int count = 0;
592 ext2_fsblk_t first_block = 0;
557 593
558 if (depth == 0) 594 depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary);
559 goto out;
560 595
596 if (depth == 0)
597 return (err);
561reread: 598reread:
562 partial = ext2_get_branch(inode, depth, offsets, chain, &err); 599 partial = ext2_get_branch(inode, depth, offsets, chain, &err);
563 600
564 /* Simplest case - block found, no allocation needed */ 601 /* Simplest case - block found, no allocation needed */
565 if (!partial) { 602 if (!partial) {
566got_it: 603 first_block = le32_to_cpu(chain[depth - 1].key);
567 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); 604 clear_buffer_new(bh_result); /* What's this do? */
568 if (boundary) 605 count++;
569 set_buffer_boundary(bh_result); 606 /*map more blocks*/
570 /* Clean up and exit */ 607 while (count < maxblocks && count <= blocks_to_boundary) {
571 partial = chain+depth-1; /* the whole chain */ 608 ext2_fsblk_t blk;
572 goto cleanup; 609
610 if (!verify_chain(chain, partial)) {
611 /*
612 * Indirect block might be removed by
613 * truncate while we were reading it.
614 * Handling of that case: forget what we've
615 * got now, go to reread.
616 */
617 count = 0;
618 goto changed;
619 }
620 blk = le32_to_cpu(*(chain[depth-1].p + count));
621 if (blk == first_block + count)
622 count++;
623 else
624 break;
625 }
626 goto got_it;
573 } 627 }
574 628
575 /* Next simple case - plain lookup or failed read of indirect block */ 629 /* Next simple case - plain lookup or failed read of indirect block */
576 if (!create || err == -EIO) { 630 if (!create || err == -EIO)
577cleanup: 631 goto cleanup;
578 while (partial > chain) { 632
579 brelse(partial->bh); 633 mutex_lock(&ei->truncate_mutex);
580 partial--;
581 }
582out:
583 return err;
584 }
585 634
586 /* 635 /*
587 * Indirect block might be removed by truncate while we were 636 * Okay, we need to do block allocation. Lazily initialize the block
588 * reading it. Handling of that case (forget what we've got and 637 * allocation info here if necessary
589 * reread) is taken out of the main path. 638 */
590 */ 639 if (S_ISREG(inode->i_mode) && (!ei->i_block_alloc_info))
591 if (err == -EAGAIN) 640 ext2_init_block_alloc_info(inode);
592 goto changed;
593 641
594 goal = 0; 642 goal = ext2_find_goal(inode, iblock, chain, partial);
595 if (ext2_find_goal(inode, iblock, chain, partial, &goal) < 0)
596 goto changed;
597 643
598 left = (chain + depth) - partial; 644 /* the number of blocks need to allocate for [d,t]indirect blocks */
599 err = ext2_alloc_branch(inode, left, goal, 645 indirect_blks = (chain + depth) - partial - 1;
600 offsets+(partial-chain), partial); 646 /*
601 if (err) 647 * Next look up the indirect map to count the totoal number of
648 * direct blocks to allocate for this branch.
649 */
650 count = ext2_blks_to_allocate(partial, indirect_blks,
651 maxblocks, blocks_to_boundary);
652 /*
653 * XXX ???? Block out ext2_truncate while we alter the tree
654 */
655 err = ext2_alloc_branch(inode, indirect_blks, &count, goal,
656 offsets + (partial - chain), partial);
657
658 if (err) {
659 mutex_unlock(&ei->truncate_mutex);
602 goto cleanup; 660 goto cleanup;
661 }
603 662
604 if (ext2_use_xip(inode->i_sb)) { 663 if (ext2_use_xip(inode->i_sb)) {
605 /* 664 /*
@@ -607,16 +666,28 @@ out:
607 */ 666 */
608 err = ext2_clear_xip_target (inode, 667 err = ext2_clear_xip_target (inode,
609 le32_to_cpu(chain[depth-1].key)); 668 le32_to_cpu(chain[depth-1].key));
610 if (err) 669 if (err) {
670 mutex_unlock(&ei->truncate_mutex);
611 goto cleanup; 671 goto cleanup;
672 }
612 } 673 }
613 674
614 if (ext2_splice_branch(inode, iblock, chain, partial, left) < 0) 675 ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
615 goto changed; 676 mutex_unlock(&ei->truncate_mutex);
616
617 set_buffer_new(bh_result); 677 set_buffer_new(bh_result);
618 goto got_it; 678got_it:
619 679 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
680 if (count > blocks_to_boundary)
681 set_buffer_boundary(bh_result);
682 err = count;
683 /* Clean up and exit */
684 partial = chain + depth - 1; /* the whole chain */
685cleanup:
686 while (partial > chain) {
687 brelse(partial->bh);
688 partial--;
689 }
690 return err;
620changed: 691changed:
621 while (partial > chain) { 692 while (partial > chain) {
622 brelse(partial->bh); 693 brelse(partial->bh);
@@ -625,6 +696,19 @@ changed:
625 goto reread; 696 goto reread;
626} 697}
627 698
699int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
700{
701 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
702 int ret = ext2_get_blocks(inode, iblock, max_blocks,
703 bh_result, create);
704 if (ret > 0) {
705 bh_result->b_size = (ret << inode->i_blkbits);
706 ret = 0;
707 }
708 return ret;
709
710}
711
628static int ext2_writepage(struct page *page, struct writeback_control *wbc) 712static int ext2_writepage(struct page *page, struct writeback_control *wbc)
629{ 713{
630 return block_write_full_page(page, ext2_get_block, wbc); 714 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
913 ext2_free_data(inode, p, q); 997 ext2_free_data(inode, p, q);
914} 998}
915 999
916void ext2_truncate (struct inode * inode) 1000void ext2_truncate(struct inode *inode)
917{ 1001{
918 __le32 *i_data = EXT2_I(inode)->i_data; 1002 __le32 *i_data = EXT2_I(inode)->i_data;
1003 struct ext2_inode_info *ei = EXT2_I(inode);
919 int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb); 1004 int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb);
920 int offsets[4]; 1005 int offsets[4];
921 Indirect chain[4]; 1006 Indirect chain[4];
@@ -933,8 +1018,6 @@ void ext2_truncate (struct inode * inode)
933 if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 1018 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
934 return; 1019 return;
935 1020
936 ext2_discard_prealloc(inode);
937
938 blocksize = inode->i_sb->s_blocksize; 1021 blocksize = inode->i_sb->s_blocksize;
939 iblock = (inode->i_size + blocksize-1) 1022 iblock = (inode->i_size + blocksize-1)
940 >> EXT2_BLOCK_SIZE_BITS(inode->i_sb); 1023 >> EXT2_BLOCK_SIZE_BITS(inode->i_sb);
@@ -952,6 +1035,12 @@ void ext2_truncate (struct inode * inode)
952 if (n == 0) 1035 if (n == 0)
953 return; 1036 return;
954 1037
1038 /*
1039 * From here we block out all ext2_get_block() callers who want to
1040 * modify the block allocation tree.
1041 */
1042 mutex_lock(&ei->truncate_mutex);
1043
955 if (n == 1) { 1044 if (n == 1) {
956 ext2_free_data(inode, i_data+offsets[0], 1045 ext2_free_data(inode, i_data+offsets[0],
957 i_data + EXT2_NDIR_BLOCKS); 1046 i_data + EXT2_NDIR_BLOCKS);
@@ -1004,6 +1093,10 @@ do_indirects:
1004 case EXT2_TIND_BLOCK: 1093 case EXT2_TIND_BLOCK:
1005 ; 1094 ;
1006 } 1095 }
1096
1097 ext2_discard_reservation(inode);
1098
1099 mutex_unlock(&ei->truncate_mutex);
1007 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 1100 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
1008 if (inode_needs_sync(inode)) { 1101 if (inode_needs_sync(inode)) {
1009 sync_mapping_buffers(inode->i_mapping); 1102 sync_mapping_buffers(inode->i_mapping);
@@ -1028,7 +1121,7 @@ static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino,
1028 goto Einval; 1121 goto Einval;
1029 1122
1030 block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb); 1123 block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);
1031 gdp = ext2_get_group_desc(sb, block_group, &bh); 1124 gdp = ext2_get_group_desc(sb, block_group, NULL);
1032 if (!gdp) 1125 if (!gdp)
1033 goto Egdp; 1126 goto Egdp;
1034 /* 1127 /*
@@ -1104,6 +1197,8 @@ void ext2_read_inode (struct inode * inode)
1104 ei->i_acl = EXT2_ACL_NOT_CACHED; 1197 ei->i_acl = EXT2_ACL_NOT_CACHED;
1105 ei->i_default_acl = EXT2_ACL_NOT_CACHED; 1198 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
1106#endif 1199#endif
1200 ei->i_block_alloc_info = NULL;
1201
1107 if (IS_ERR(raw_inode)) 1202 if (IS_ERR(raw_inode))
1108 goto bad_inode; 1203 goto bad_inode;
1109 1204
@@ -1145,9 +1240,6 @@ void ext2_read_inode (struct inode * inode)
1145 ei->i_dtime = 0; 1240 ei->i_dtime = 0;
1146 inode->i_generation = le32_to_cpu(raw_inode->i_generation); 1241 inode->i_generation = le32_to_cpu(raw_inode->i_generation);
1147 ei->i_state = 0; 1242 ei->i_state = 0;
1148 ei->i_next_alloc_block = 0;
1149 ei->i_next_alloc_goal = 0;
1150 ei->i_prealloc_count = 0;
1151 ei->i_block_group = (ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb); 1243 ei->i_block_group = (ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
1152 ei->i_dir_start_lookup = 0; 1244 ei->i_dir_start_lookup = 0;
1153 1245
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 3bcd25422ee4..c2324d5fe4ac 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -22,6 +22,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
22{ 22{
23 struct ext2_inode_info *ei = EXT2_I(inode); 23 struct ext2_inode_info *ei = EXT2_I(inode);
24 unsigned int flags; 24 unsigned int flags;
25 unsigned short rsv_window_size;
25 26
26 ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg); 27 ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg);
27 28
@@ -83,6 +84,50 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
83 inode->i_ctime = CURRENT_TIME_SEC; 84 inode->i_ctime = CURRENT_TIME_SEC;
84 mark_inode_dirty(inode); 85 mark_inode_dirty(inode);
85 return 0; 86 return 0;
87 case EXT2_IOC_GETRSVSZ:
88 if (test_opt(inode->i_sb, RESERVATION)
89 && S_ISREG(inode->i_mode)
90 && ei->i_block_alloc_info) {
91 rsv_window_size = ei->i_block_alloc_info->rsv_window_node.rsv_goal_size;
92 return put_user(rsv_window_size, (int __user *)arg);
93 }
94 return -ENOTTY;
95 case EXT2_IOC_SETRSVSZ: {
96
97 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
98 return -ENOTTY;
99
100 if (IS_RDONLY(inode))
101 return -EROFS;
102
103 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
104 return -EACCES;
105
106 if (get_user(rsv_window_size, (int __user *)arg))
107 return -EFAULT;
108
109 if (rsv_window_size > EXT2_MAX_RESERVE_BLOCKS)
110 rsv_window_size = EXT2_MAX_RESERVE_BLOCKS;
111
112 /*
113 * need to allocate reservation structure for this inode
114 * before set the window size
115 */
116 /*
117 * XXX What lock should protect the rsv_goal_size?
118 * Accessed in ext2_get_block only. ext3 uses i_truncate.
119 */
120 mutex_lock(&ei->truncate_mutex);
121 if (!ei->i_block_alloc_info)
122 ext2_init_block_alloc_info(inode);
123
124 if (ei->i_block_alloc_info){
125 struct ext2_reserve_window_node *rsv = &ei->i_block_alloc_info->rsv_window_node;
126 rsv->rsv_goal_size = rsv_window_size;
127 }
128 mutex_unlock(&ei->truncate_mutex);
129 return 0;
130 }
86 default: 131 default:
87 return -ENOTTY; 132 return -ENOTTY;
88 } 133 }
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 639a32c3c9c1..77bd5f9262f9 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -30,6 +30,7 @@
30#include <linux/vfs.h> 30#include <linux/vfs.h>
31#include <linux/seq_file.h> 31#include <linux/seq_file.h>
32#include <linux/mount.h> 32#include <linux/mount.h>
33#include <linux/log2.h>
33#include <asm/uaccess.h> 34#include <asm/uaccess.h>
34#include "ext2.h" 35#include "ext2.h"
35#include "xattr.h" 36#include "xattr.h"
@@ -148,6 +149,7 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
148 ei->i_acl = EXT2_ACL_NOT_CACHED; 149 ei->i_acl = EXT2_ACL_NOT_CACHED;
149 ei->i_default_acl = EXT2_ACL_NOT_CACHED; 150 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
150#endif 151#endif
152 ei->i_block_alloc_info = NULL;
151 ei->vfs_inode.i_version = 1; 153 ei->vfs_inode.i_version = 1;
152 return &ei->vfs_inode; 154 return &ei->vfs_inode;
153} 155}
@@ -157,7 +159,7 @@ static void ext2_destroy_inode(struct inode *inode)
157 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); 159 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
158} 160}
159 161
160static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 162static void init_once(struct kmem_cache * cachep, void *foo)
161{ 163{
162 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; 164 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
163 165
@@ -165,6 +167,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
165#ifdef CONFIG_EXT2_FS_XATTR 167#ifdef CONFIG_EXT2_FS_XATTR
166 init_rwsem(&ei->xattr_sem); 168 init_rwsem(&ei->xattr_sem);
167#endif 169#endif
170 mutex_init(&ei->truncate_mutex);
168 inode_init_once(&ei->vfs_inode); 171 inode_init_once(&ei->vfs_inode);
169} 172}
170 173
@@ -187,6 +190,7 @@ static void destroy_inodecache(void)
187 190
188static void ext2_clear_inode(struct inode *inode) 191static void ext2_clear_inode(struct inode *inode)
189{ 192{
193 struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info;
190#ifdef CONFIG_EXT2_FS_POSIX_ACL 194#ifdef CONFIG_EXT2_FS_POSIX_ACL
191 struct ext2_inode_info *ei = EXT2_I(inode); 195 struct ext2_inode_info *ei = EXT2_I(inode);
192 196
@@ -199,14 +203,74 @@ static void ext2_clear_inode(struct inode *inode)
199 ei->i_default_acl = EXT2_ACL_NOT_CACHED; 203 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
200 } 204 }
201#endif 205#endif
206 ext2_discard_reservation(inode);
207 EXT2_I(inode)->i_block_alloc_info = NULL;
208 if (unlikely(rsv))
209 kfree(rsv);
202} 210}
203 211
204static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs) 212static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
205{ 213{
206 struct ext2_sb_info *sbi = EXT2_SB(vfs->mnt_sb); 214 struct super_block *sb = vfs->mnt_sb;
215 struct ext2_sb_info *sbi = EXT2_SB(sb);
216 struct ext2_super_block *es = sbi->s_es;
217 unsigned long def_mount_opts;
218
219 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
207 220
208 if (sbi->s_mount_opt & EXT2_MOUNT_GRPID) 221 if (sbi->s_sb_block != 1)
222 seq_printf(seq, ",sb=%lu", sbi->s_sb_block);
223 if (test_opt(sb, MINIX_DF))
224 seq_puts(seq, ",minixdf");
225 if (test_opt(sb, GRPID))
209 seq_puts(seq, ",grpid"); 226 seq_puts(seq, ",grpid");
227 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT2_DEFM_BSDGROUPS))
228 seq_puts(seq, ",nogrpid");
229 if (sbi->s_resuid != EXT2_DEF_RESUID ||
230 le16_to_cpu(es->s_def_resuid) != EXT2_DEF_RESUID) {
231 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
232 }
233 if (sbi->s_resgid != EXT2_DEF_RESGID ||
234 le16_to_cpu(es->s_def_resgid) != EXT2_DEF_RESGID) {
235 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
236 }
237 if (test_opt(sb, ERRORS_CONT)) {
238 int def_errors = le16_to_cpu(es->s_errors);
239
240 if (def_errors == EXT2_ERRORS_PANIC ||
241 def_errors == EXT2_ERRORS_RO) {
242 seq_puts(seq, ",errors=continue");
243 }
244 }
245 if (test_opt(sb, ERRORS_RO))
246 seq_puts(seq, ",errors=remount-ro");
247 if (test_opt(sb, ERRORS_PANIC))
248 seq_puts(seq, ",errors=panic");
249 if (test_opt(sb, NO_UID32))
250 seq_puts(seq, ",nouid32");
251 if (test_opt(sb, DEBUG))
252 seq_puts(seq, ",debug");
253 if (test_opt(sb, OLDALLOC))
254 seq_puts(seq, ",oldalloc");
255
256#ifdef CONFIG_EXT2_FS_XATTR
257 if (test_opt(sb, XATTR_USER))
258 seq_puts(seq, ",user_xattr");
259 if (!test_opt(sb, XATTR_USER) &&
260 (def_mount_opts & EXT2_DEFM_XATTR_USER)) {
261 seq_puts(seq, ",nouser_xattr");
262 }
263#endif
264
265#ifdef CONFIG_EXT2_FS_POSIX_ACL
266 if (test_opt(sb, POSIX_ACL))
267 seq_puts(seq, ",acl");
268 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT2_DEFM_ACL))
269 seq_puts(seq, ",noacl");
270#endif
271
272 if (test_opt(sb, NOBH))
273 seq_puts(seq, ",nobh");
210 274
211#if defined(CONFIG_QUOTA) 275#if defined(CONFIG_QUOTA)
212 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) 276 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
@@ -234,7 +298,6 @@ static const struct super_operations ext2_sops = {
234 .destroy_inode = ext2_destroy_inode, 298 .destroy_inode = ext2_destroy_inode,
235 .read_inode = ext2_read_inode, 299 .read_inode = ext2_read_inode,
236 .write_inode = ext2_write_inode, 300 .write_inode = ext2_write_inode,
237 .put_inode = ext2_put_inode,
238 .delete_inode = ext2_delete_inode, 301 .delete_inode = ext2_delete_inode,
239 .put_super = ext2_put_super, 302 .put_super = ext2_put_super,
240 .write_super = ext2_write_super, 303 .write_super = ext2_write_super,
@@ -322,7 +385,7 @@ enum {
322 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, 385 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
323 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, 386 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
324 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, 387 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
325 Opt_usrquota, Opt_grpquota 388 Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
326}; 389};
327 390
328static match_table_t tokens = { 391static match_table_t tokens = {
@@ -354,6 +417,8 @@ static match_table_t tokens = {
354 {Opt_ignore, "noquota"}, 417 {Opt_ignore, "noquota"},
355 {Opt_quota, "quota"}, 418 {Opt_quota, "quota"},
356 {Opt_usrquota, "usrquota"}, 419 {Opt_usrquota, "usrquota"},
420 {Opt_reservation, "reservation"},
421 {Opt_noreservation, "noreservation"},
357 {Opt_err, NULL} 422 {Opt_err, NULL}
358}; 423};
359 424
@@ -486,6 +551,14 @@ static int parse_options (char * options,
486 break; 551 break;
487#endif 552#endif
488 553
554 case Opt_reservation:
555 set_opt(sbi->s_mount_opt, RESERVATION);
556 printk("reservations ON\n");
557 break;
558 case Opt_noreservation:
559 clear_opt(sbi->s_mount_opt, RESERVATION);
560 printk("reservations OFF\n");
561 break;
489 case Opt_ignore: 562 case Opt_ignore:
490 break; 563 break;
491 default: 564 default:
@@ -653,11 +726,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
653 int db_count; 726 int db_count;
654 int i, j; 727 int i, j;
655 __le32 features; 728 __le32 features;
729 int err;
656 730
657 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 731 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
658 if (!sbi) 732 if (!sbi)
659 return -ENOMEM; 733 return -ENOMEM;
660 sb->s_fs_info = sbi; 734 sb->s_fs_info = sbi;
735 sbi->s_sb_block = sb_block;
661 736
662 /* 737 /*
663 * See what the current blocksize for the device is, and 738 * 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)
725 sbi->s_resuid = le16_to_cpu(es->s_def_resuid); 800 sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
726 sbi->s_resgid = le16_to_cpu(es->s_def_resgid); 801 sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
727 802
803 set_opt(sbi->s_mount_opt, RESERVATION);
804
728 if (!parse_options ((char *) data, sbi)) 805 if (!parse_options ((char *) data, sbi))
729 goto failed_mount; 806 goto failed_mount;
730 807
@@ -804,7 +881,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
804 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); 881 sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
805 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); 882 sbi->s_first_ino = le32_to_cpu(es->s_first_ino);
806 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || 883 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) ||
807 (sbi->s_inode_size & (sbi->s_inode_size - 1)) || 884 !is_power_of_2(sbi->s_inode_size) ||
808 (sbi->s_inode_size > blocksize)) { 885 (sbi->s_inode_size > blocksize)) {
809 printk ("EXT2-fs: unsupported inode size: %d\n", 886 printk ("EXT2-fs: unsupported inode size: %d\n",
810 sbi->s_inode_size); 887 sbi->s_inode_size);
@@ -906,12 +983,35 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
906 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 983 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
907 spin_lock_init(&sbi->s_next_gen_lock); 984 spin_lock_init(&sbi->s_next_gen_lock);
908 985
909 percpu_counter_init(&sbi->s_freeblocks_counter, 986 /* per fileystem reservation list head & lock */
987 spin_lock_init(&sbi->s_rsv_window_lock);
988 sbi->s_rsv_window_root = RB_ROOT;
989 /*
990 * Add a single, static dummy reservation to the start of the
991 * reservation window list --- it gives us a placeholder for
992 * append-at-start-of-list which makes the allocation logic
993 * _much_ simpler.
994 */
995 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
996 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
997 sbi->s_rsv_window_head.rsv_alloc_hit = 0;
998 sbi->s_rsv_window_head.rsv_goal_size = 0;
999 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head);
1000
1001 err = percpu_counter_init(&sbi->s_freeblocks_counter,
910 ext2_count_free_blocks(sb)); 1002 ext2_count_free_blocks(sb));
911 percpu_counter_init(&sbi->s_freeinodes_counter, 1003 if (!err) {
1004 err = percpu_counter_init(&sbi->s_freeinodes_counter,
912 ext2_count_free_inodes(sb)); 1005 ext2_count_free_inodes(sb));
913 percpu_counter_init(&sbi->s_dirs_counter, 1006 }
1007 if (!err) {
1008 err = percpu_counter_init(&sbi->s_dirs_counter,
914 ext2_count_dirs(sb)); 1009 ext2_count_dirs(sb));
1010 }
1011 if (err) {
1012 printk(KERN_ERR "EXT2-fs: insufficient memory\n");
1013 goto failed_mount3;
1014 }
915 /* 1015 /*
916 * set up enough so that it can read an inode 1016 * set up enough so that it can read an inode
917 */ 1017 */
@@ -1193,7 +1293,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data,
1193 1293
1194 tmp_bh.b_state = 0; 1294 tmp_bh.b_state = 0;
1195 err = ext2_get_block(inode, blk, &tmp_bh, 0); 1295 err = ext2_get_block(inode, blk, &tmp_bh, 0);
1196 if (err) 1296 if (err < 0)
1197 return err; 1297 return err;
1198 if (!buffer_mapped(&tmp_bh)) /* A hole? */ 1298 if (!buffer_mapped(&tmp_bh)) /* A hole? */
1199 memset(data, 0, tocopy); 1299 memset(data, 0, tocopy);
@@ -1232,7 +1332,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
1232 1332
1233 tmp_bh.b_state = 0; 1333 tmp_bh.b_state = 0;
1234 err = ext2_get_block(inode, blk, &tmp_bh, 1); 1334 err = ext2_get_block(inode, blk, &tmp_bh, 1);
1235 if (err) 1335 if (err < 0)
1236 goto out; 1336 goto out;
1237 if (offset || tocopy != EXT2_BLOCK_SIZE(sb)) 1337 if (offset || tocopy != EXT2_BLOCK_SIZE(sb))
1238 bh = sb_bread(sb, tmp_bh.b_blocknr); 1338 bh = sb_bread(sb, tmp_bh.b_blocknr);
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 247efd0b51d6..3e8683dbb13f 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -664,8 +664,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
664 s_first_data_block) + 664 s_first_data_block) +
665 EXT2_I(inode)->i_block_group * 665 EXT2_I(inode)->i_block_group *
666 EXT2_BLOCKS_PER_GROUP(sb); 666 EXT2_BLOCKS_PER_GROUP(sb);
667 int block = ext2_new_block(inode, goal, 667 int block = ext2_new_block(inode, goal, &error);
668 NULL, NULL, &error);
669 if (error) 668 if (error)
670 goto cleanup; 669 goto cleanup;
671 ea_idebug(inode, "creating block %d", block); 670 ea_idebug(inode, "creating block %d", block);
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index ca8aee6efe37..7a87d15523be 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -80,6 +80,14 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
80 return desc + offset; 80 return desc + offset;
81} 81}
82 82
83static inline int
84block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
85{
86 return ext3_test_bit ((block -
87 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
88 EXT3_BLOCKS_PER_GROUP(sb), map);
89}
90
83/** 91/**
84 * read_block_bitmap() 92 * read_block_bitmap()
85 * @sb: super block 93 * @sb: super block
@@ -93,20 +101,51 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
93static struct buffer_head * 101static struct buffer_head *
94read_block_bitmap(struct super_block *sb, unsigned int block_group) 102read_block_bitmap(struct super_block *sb, unsigned int block_group)
95{ 103{
104 int i;
96 struct ext3_group_desc * desc; 105 struct ext3_group_desc * desc;
97 struct buffer_head * bh = NULL; 106 struct buffer_head * bh = NULL;
107 ext3_fsblk_t bitmap_blk;
98 108
99 desc = ext3_get_group_desc (sb, block_group, NULL); 109 desc = ext3_get_group_desc (sb, block_group, NULL);
100 if (!desc) 110 if (!desc)
101 goto error_out; 111 return NULL;
102 bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap)); 112 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
113 bh = sb_bread(sb, bitmap_blk);
103 if (!bh) 114 if (!bh)
104 ext3_error (sb, "read_block_bitmap", 115 ext3_error (sb, __FUNCTION__,
105 "Cannot read block bitmap - " 116 "Cannot read block bitmap - "
106 "block_group = %d, block_bitmap = %u", 117 "block_group = %d, block_bitmap = %u",
107 block_group, le32_to_cpu(desc->bg_block_bitmap)); 118 block_group, le32_to_cpu(desc->bg_block_bitmap));
108error_out: 119
120 /* check whether block bitmap block number is set */
121 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
122 /* bad block bitmap */
123 goto error_out;
124 }
125 /* check whether the inode bitmap block number is set */
126 bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
127 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
128 /* bad block bitmap */
129 goto error_out;
130 }
131 /* check whether the inode table block number is set */
132 bitmap_blk = le32_to_cpu(desc->bg_inode_table);
133 for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
134 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
135 /* bad block bitmap */
136 goto error_out;
137 }
138 }
139
109 return bh; 140 return bh;
141
142error_out:
143 brelse(bh);
144 ext3_error(sb, __FUNCTION__,
145 "Invalid block bitmap - "
146 "block_group = %d, block = %lu",
147 block_group, bitmap_blk);
148 return NULL;
110} 149}
111/* 150/*
112 * The reservation window structure operations 151 * The reservation window structure operations
@@ -570,7 +609,7 @@ do_more:
570 cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) + 609 cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
571 group_freed); 610 group_freed);
572 spin_unlock(sb_bgl_lock(sbi, block_group)); 611 spin_unlock(sb_bgl_lock(sbi, block_group));
573 percpu_counter_mod(&sbi->s_freeblocks_counter, count); 612 percpu_counter_add(&sbi->s_freeblocks_counter, count);
574 613
575 /* We dirtied the bitmap block */ 614 /* We dirtied the bitmap block */
576 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); 615 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
@@ -1633,7 +1672,7 @@ allocated:
1633 gdp->bg_free_blocks_count = 1672 gdp->bg_free_blocks_count =
1634 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num); 1673 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
1635 spin_unlock(sb_bgl_lock(sbi, group_no)); 1674 spin_unlock(sb_bgl_lock(sbi, group_no));
1636 percpu_counter_mod(&sbi->s_freeblocks_counter, -num); 1675 percpu_counter_sub(&sbi->s_freeblocks_counter, num);
1637 1676
1638 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor"); 1677 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
1639 err = ext3_journal_dirty_metadata(handle, gdp_bh); 1678 err = ext3_journal_dirty_metadata(handle, gdp_bh);
@@ -1733,13 +1772,6 @@ ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb)
1733#endif 1772#endif
1734} 1773}
1735 1774
1736static inline int
1737block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
1738{
1739 return ext3_test_bit ((block -
1740 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
1741 EXT3_BLOCKS_PER_GROUP(sb), map);
1742}
1743 1775
1744static inline int test_root(int a, int b) 1776static inline int test_root(int a, int b)
1745{ 1777{
diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c
index b9176eed98d1..6afc39d80253 100644
--- a/fs/ext3/bitmap.c
+++ b/fs/ext3/bitmap.c
@@ -13,7 +13,7 @@
13 13
14#ifdef EXT3FS_DEBUG 14#ifdef EXT3FS_DEBUG
15 15
16static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; 16static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
17 17
18unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) 18unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars)
19{ 19{
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index c2c3491b18cf..c8e4ee3af1d0 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -47,9 +47,7 @@ const struct file_operations ext3_dir_operations = {
47 .compat_ioctl = ext3_compat_ioctl, 47 .compat_ioctl = ext3_compat_ioctl,
48#endif 48#endif
49 .fsync = ext3_sync_file, /* BKL held */ 49 .fsync = ext3_sync_file, /* BKL held */
50#ifdef CONFIG_EXT3_INDEX
51 .release = ext3_release_dir, 50 .release = ext3_release_dir,
52#endif
53}; 51};
54 52
55 53
@@ -107,7 +105,6 @@ static int ext3_readdir(struct file * filp,
107 105
108 sb = inode->i_sb; 106 sb = inode->i_sb;
109 107
110#ifdef CONFIG_EXT3_INDEX
111 if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb, 108 if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb,
112 EXT3_FEATURE_COMPAT_DIR_INDEX) && 109 EXT3_FEATURE_COMPAT_DIR_INDEX) &&
113 ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) || 110 ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) ||
@@ -123,7 +120,6 @@ static int ext3_readdir(struct file * filp,
123 */ 120 */
124 EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL; 121 EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
125 } 122 }
126#endif
127 stored = 0; 123 stored = 0;
128 offset = filp->f_pos & (sb->s_blocksize - 1); 124 offset = filp->f_pos & (sb->s_blocksize - 1);
129 125
@@ -210,7 +206,7 @@ revalidate:
210 * not the directory has been modified 206 * not the directory has been modified
211 * during the copy operation. 207 * during the copy operation.
212 */ 208 */
213 unsigned long version = filp->f_version; 209 u64 version = filp->f_version;
214 210
215 error = filldir(dirent, de->name, 211 error = filldir(dirent, de->name,
216 de->name_len, 212 de->name_len,
@@ -232,7 +228,6 @@ out:
232 return ret; 228 return ret;
233} 229}
234 230
235#ifdef CONFIG_EXT3_INDEX
236/* 231/*
237 * These functions convert from the major/minor hash to an f_pos 232 * These functions convert from the major/minor hash to an f_pos
238 * value. 233 * value.
@@ -518,5 +513,3 @@ static int ext3_release_dir (struct inode * inode, struct file * filp)
518 513
519 return 0; 514 return 0;
520} 515}
521
522#endif
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index e45dbd651736..1bc8cd89c51d 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -204,14 +204,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
204 int ngroups = EXT3_SB(sb)->s_groups_count; 204 int ngroups = EXT3_SB(sb)->s_groups_count;
205 unsigned int freei, avefreei; 205 unsigned int freei, avefreei;
206 struct ext3_group_desc *desc, *best_desc = NULL; 206 struct ext3_group_desc *desc, *best_desc = NULL;
207 struct buffer_head *bh;
208 int group, best_group = -1; 207 int group, best_group = -1;
209 208
210 freei = percpu_counter_read_positive(&EXT3_SB(sb)->s_freeinodes_counter); 209 freei = percpu_counter_read_positive(&EXT3_SB(sb)->s_freeinodes_counter);
211 avefreei = freei / ngroups; 210 avefreei = freei / ngroups;
212 211
213 for (group = 0; group < ngroups; group++) { 212 for (group = 0; group < ngroups; group++) {
214 desc = ext3_get_group_desc (sb, group, &bh); 213 desc = ext3_get_group_desc (sb, group, NULL);
215 if (!desc || !desc->bg_free_inodes_count) 214 if (!desc || !desc->bg_free_inodes_count)
216 continue; 215 continue;
217 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) 216 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)
269 ext3_grpblk_t min_blocks; 268 ext3_grpblk_t min_blocks;
270 int group = -1, i; 269 int group = -1, i;
271 struct ext3_group_desc *desc; 270 struct ext3_group_desc *desc;
272 struct buffer_head *bh;
273 271
274 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); 272 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
275 avefreei = freei / ngroups; 273 avefreei = freei / ngroups;
@@ -286,7 +284,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
286 parent_group = (unsigned)group % ngroups; 284 parent_group = (unsigned)group % ngroups;
287 for (i = 0; i < ngroups; i++) { 285 for (i = 0; i < ngroups; i++) {
288 group = (parent_group + i) % ngroups; 286 group = (parent_group + i) % ngroups;
289 desc = ext3_get_group_desc (sb, group, &bh); 287 desc = ext3_get_group_desc (sb, group, NULL);
290 if (!desc || !desc->bg_free_inodes_count) 288 if (!desc || !desc->bg_free_inodes_count)
291 continue; 289 continue;
292 if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) 290 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)
319 317
320 for (i = 0; i < ngroups; i++) { 318 for (i = 0; i < ngroups; i++) {
321 group = (parent_group + i) % ngroups; 319 group = (parent_group + i) % ngroups;
322 desc = ext3_get_group_desc (sb, group, &bh); 320 desc = ext3_get_group_desc (sb, group, NULL);
323 if (!desc || !desc->bg_free_inodes_count) 321 if (!desc || !desc->bg_free_inodes_count)
324 continue; 322 continue;
325 if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs) 323 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)
334fallback: 332fallback:
335 for (i = 0; i < ngroups; i++) { 333 for (i = 0; i < ngroups; i++) {
336 group = (parent_group + i) % ngroups; 334 group = (parent_group + i) % ngroups;
337 desc = ext3_get_group_desc (sb, group, &bh); 335 desc = ext3_get_group_desc (sb, group, NULL);
338 if (!desc || !desc->bg_free_inodes_count) 336 if (!desc || !desc->bg_free_inodes_count)
339 continue; 337 continue;
340 if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) 338 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)
358 int parent_group = EXT3_I(parent)->i_block_group; 356 int parent_group = EXT3_I(parent)->i_block_group;
359 int ngroups = EXT3_SB(sb)->s_groups_count; 357 int ngroups = EXT3_SB(sb)->s_groups_count;
360 struct ext3_group_desc *desc; 358 struct ext3_group_desc *desc;
361 struct buffer_head *bh;
362 int group, i; 359 int group, i;
363 360
364 /* 361 /*
365 * Try to place the inode in its parent directory 362 * Try to place the inode in its parent directory
366 */ 363 */
367 group = parent_group; 364 group = parent_group;
368 desc = ext3_get_group_desc (sb, group, &bh); 365 desc = ext3_get_group_desc (sb, group, NULL);
369 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 366 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
370 le16_to_cpu(desc->bg_free_blocks_count)) 367 le16_to_cpu(desc->bg_free_blocks_count))
371 return group; 368 return group;
@@ -389,7 +386,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
389 group += i; 386 group += i;
390 if (group >= ngroups) 387 if (group >= ngroups)
391 group -= ngroups; 388 group -= ngroups;
392 desc = ext3_get_group_desc (sb, group, &bh); 389 desc = ext3_get_group_desc (sb, group, NULL);
393 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 390 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
394 le16_to_cpu(desc->bg_free_blocks_count)) 391 le16_to_cpu(desc->bg_free_blocks_count))
395 return group; 392 return group;
@@ -403,7 +400,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
403 for (i = 0; i < ngroups; i++) { 400 for (i = 0; i < ngroups; i++) {
404 if (++group >= ngroups) 401 if (++group >= ngroups)
405 group = 0; 402 group = 0;
406 desc = ext3_get_group_desc (sb, group, &bh); 403 desc = ext3_get_group_desc (sb, group, NULL);
407 if (desc && le16_to_cpu(desc->bg_free_inodes_count)) 404 if (desc && le16_to_cpu(desc->bg_free_inodes_count))
408 return group; 405 return group;
409 } 406 }
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index c1fa1908dba0..ec8170adac53 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -144,7 +144,6 @@ struct dx_map_entry
144 u16 size; 144 u16 size;
145}; 145};
146 146
147#ifdef CONFIG_EXT3_INDEX
148static inline unsigned dx_get_block (struct dx_entry *entry); 147static inline unsigned dx_get_block (struct dx_entry *entry);
149static void dx_set_block (struct dx_entry *entry, unsigned value); 148static void dx_set_block (struct dx_entry *entry, unsigned value);
150static inline unsigned dx_get_hash (struct dx_entry *entry); 149static 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)
768 dx_set_block(new, block); 767 dx_set_block(new, block);
769 dx_set_count(entries, count + 1); 768 dx_set_count(entries, count + 1);
770} 769}
771#endif
772
773 770
774static void ext3_update_dx_flag(struct inode *inode) 771static void ext3_update_dx_flag(struct inode *inode)
775{ 772{
@@ -871,7 +868,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
871 name = dentry->d_name.name; 868 name = dentry->d_name.name;
872 if (namelen > EXT3_NAME_LEN) 869 if (namelen > EXT3_NAME_LEN)
873 return NULL; 870 return NULL;
874#ifdef CONFIG_EXT3_INDEX
875 if (is_dx(dir)) { 871 if (is_dx(dir)) {
876 bh = ext3_dx_find_entry(dentry, res_dir, &err); 872 bh = ext3_dx_find_entry(dentry, res_dir, &err);
877 /* 873 /*
@@ -883,7 +879,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
883 return bh; 879 return bh;
884 dxtrace(printk("ext3_find_entry: dx failed, falling back\n")); 880 dxtrace(printk("ext3_find_entry: dx failed, falling back\n"));
885 } 881 }
886#endif
887 nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb); 882 nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
888 start = EXT3_I(dir)->i_dir_start_lookup; 883 start = EXT3_I(dir)->i_dir_start_lookup;
889 if (start >= nblocks) 884 if (start >= nblocks)
@@ -959,7 +954,6 @@ cleanup_and_exit:
959 return ret; 954 return ret;
960} 955}
961 956
962#ifdef CONFIG_EXT3_INDEX
963static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, 957static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
964 struct ext3_dir_entry_2 **res_dir, int *err) 958 struct ext3_dir_entry_2 **res_dir, int *err)
965{ 959{
@@ -1027,7 +1021,6 @@ errout:
1027 dx_release (frames); 1021 dx_release (frames);
1028 return NULL; 1022 return NULL;
1029} 1023}
1030#endif
1031 1024
1032static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) 1025static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
1033{ 1026{
@@ -1123,7 +1116,6 @@ static inline void ext3_set_de_type(struct super_block *sb,
1123 de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; 1116 de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
1124} 1117}
1125 1118
1126#ifdef CONFIG_EXT3_INDEX
1127/* 1119/*
1128 * Move count entries from end of map between two memory locations. 1120 * Move count entries from end of map between two memory locations.
1129 * Returns pointer to last entry moved. 1121 * Returns pointer to last entry moved.
@@ -1268,7 +1260,6 @@ errout:
1268 *error = err; 1260 *error = err;
1269 return NULL; 1261 return NULL;
1270} 1262}
1271#endif
1272 1263
1273 1264
1274/* 1265/*
@@ -1366,7 +1357,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1366 return 0; 1357 return 0;
1367} 1358}
1368 1359
1369#ifdef CONFIG_EXT3_INDEX
1370/* 1360/*
1371 * This converts a one block unindexed directory to a 3 block indexed 1361 * This converts a one block unindexed directory to a 3 block indexed
1372 * directory, and adds the dentry to the indexed directory. 1362 * directory, and adds the dentry to the indexed directory.
@@ -1445,7 +1435,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1445 1435
1446 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1436 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1447} 1437}
1448#endif
1449 1438
1450/* 1439/*
1451 * ext3_add_entry() 1440 * ext3_add_entry()
@@ -1466,9 +1455,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1466 struct ext3_dir_entry_2 *de; 1455 struct ext3_dir_entry_2 *de;
1467 struct super_block * sb; 1456 struct super_block * sb;
1468 int retval; 1457 int retval;
1469#ifdef CONFIG_EXT3_INDEX
1470 int dx_fallback=0; 1458 int dx_fallback=0;
1471#endif
1472 unsigned blocksize; 1459 unsigned blocksize;
1473 u32 block, blocks; 1460 u32 block, blocks;
1474 1461
@@ -1476,7 +1463,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1476 blocksize = sb->s_blocksize; 1463 blocksize = sb->s_blocksize;
1477 if (!dentry->d_name.len) 1464 if (!dentry->d_name.len)
1478 return -EINVAL; 1465 return -EINVAL;
1479#ifdef CONFIG_EXT3_INDEX
1480 if (is_dx(dir)) { 1466 if (is_dx(dir)) {
1481 retval = ext3_dx_add_entry(handle, dentry, inode); 1467 retval = ext3_dx_add_entry(handle, dentry, inode);
1482 if (!retval || (retval != ERR_BAD_DX_DIR)) 1468 if (!retval || (retval != ERR_BAD_DX_DIR))
@@ -1485,7 +1471,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1485 dx_fallback++; 1471 dx_fallback++;
1486 ext3_mark_inode_dirty(handle, dir); 1472 ext3_mark_inode_dirty(handle, dir);
1487 } 1473 }
1488#endif
1489 blocks = dir->i_size >> sb->s_blocksize_bits; 1474 blocks = dir->i_size >> sb->s_blocksize_bits;
1490 for (block = 0, offset = 0; block < blocks; block++) { 1475 for (block = 0, offset = 0; block < blocks; block++) {
1491 bh = ext3_bread(handle, dir, block, 0, &retval); 1476 bh = ext3_bread(handle, dir, block, 0, &retval);
@@ -1495,11 +1480,9 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1495 if (retval != -ENOSPC) 1480 if (retval != -ENOSPC)
1496 return retval; 1481 return retval;
1497 1482
1498#ifdef CONFIG_EXT3_INDEX
1499 if (blocks == 1 && !dx_fallback && 1483 if (blocks == 1 && !dx_fallback &&
1500 EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX)) 1484 EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
1501 return make_indexed_dir(handle, dentry, inode, bh); 1485 return make_indexed_dir(handle, dentry, inode, bh);
1502#endif
1503 brelse(bh); 1486 brelse(bh);
1504 } 1487 }
1505 bh = ext3_append(handle, dir, &block, &retval); 1488 bh = ext3_append(handle, dir, &block, &retval);
@@ -1511,7 +1494,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1511 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1494 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1512} 1495}
1513 1496
1514#ifdef CONFIG_EXT3_INDEX
1515/* 1497/*
1516 * Returns 0 for success, or a negative error value 1498 * Returns 0 for success, or a negative error value
1517 */ 1499 */
@@ -1646,7 +1628,6 @@ cleanup:
1646 dx_release(frames); 1628 dx_release(frames);
1647 return err; 1629 return err;
1648} 1630}
1649#endif
1650 1631
1651/* 1632/*
1652 * ext3_delete_entry deletes a directory entry by merging it with the 1633 * ext3_delete_entry deletes a directory entry by merging it with the
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 2c97e09c6c6b..771f7ada15d9 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -154,6 +154,34 @@ static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
154} 154}
155 155
156/* 156/*
157 * If we have fewer than thresh credits, extend by EXT3_MAX_TRANS_DATA.
158 * If that fails, restart the transaction & regain write access for the
159 * buffer head which is used for block_bitmap modifications.
160 */
161static int extend_or_restart_transaction(handle_t *handle, int thresh,
162 struct buffer_head *bh)
163{
164 int err;
165
166 if (handle->h_buffer_credits >= thresh)
167 return 0;
168
169 err = ext3_journal_extend(handle, EXT3_MAX_TRANS_DATA);
170 if (err < 0)
171 return err;
172 if (err) {
173 err = ext3_journal_restart(handle, EXT3_MAX_TRANS_DATA);
174 if (err)
175 return err;
176 err = ext3_journal_get_write_access(handle, bh);
177 if (err)
178 return err;
179 }
180
181 return 0;
182}
183
184/*
157 * Set up the block and inode bitmaps, and the inode table for the new group. 185 * Set up the block and inode bitmaps, and the inode table for the new group.
158 * This doesn't need to be part of the main transaction, since we are only 186 * This doesn't need to be part of the main transaction, since we are only
159 * changing blocks outside the actual filesystem. We still do journaling to 187 * changing blocks outside the actual filesystem. We still do journaling to
@@ -175,8 +203,9 @@ static int setup_new_group_blocks(struct super_block *sb,
175 int i; 203 int i;
176 int err = 0, err2; 204 int err = 0, err2;
177 205
178 handle = ext3_journal_start_sb(sb, reserved_gdb + gdblocks + 206 /* This transaction may be extended/restarted along the way */
179 2 + sbi->s_itb_per_group); 207 handle = ext3_journal_start_sb(sb, EXT3_MAX_TRANS_DATA);
208
180 if (IS_ERR(handle)) 209 if (IS_ERR(handle))
181 return PTR_ERR(handle); 210 return PTR_ERR(handle);
182 211
@@ -203,6 +232,10 @@ static int setup_new_group_blocks(struct super_block *sb,
203 232
204 ext3_debug("update backup group %#04lx (+%d)\n", block, bit); 233 ext3_debug("update backup group %#04lx (+%d)\n", block, bit);
205 234
235 err = extend_or_restart_transaction(handle, 1, bh);
236 if (err)
237 goto exit_bh;
238
206 gdb = sb_getblk(sb, block); 239 gdb = sb_getblk(sb, block);
207 if (!gdb) { 240 if (!gdb) {
208 err = -EIO; 241 err = -EIO;
@@ -228,6 +261,10 @@ static int setup_new_group_blocks(struct super_block *sb,
228 261
229 ext3_debug("clear reserved block %#04lx (+%d)\n", block, bit); 262 ext3_debug("clear reserved block %#04lx (+%d)\n", block, bit);
230 263
264 err = extend_or_restart_transaction(handle, 1, bh);
265 if (err)
266 goto exit_bh;
267
231 if (IS_ERR(gdb = bclean(handle, sb, block))) { 268 if (IS_ERR(gdb = bclean(handle, sb, block))) {
232 err = PTR_ERR(bh); 269 err = PTR_ERR(bh);
233 goto exit_bh; 270 goto exit_bh;
@@ -249,6 +286,11 @@ static int setup_new_group_blocks(struct super_block *sb,
249 struct buffer_head *it; 286 struct buffer_head *it;
250 287
251 ext3_debug("clear inode block %#04lx (+%d)\n", block, bit); 288 ext3_debug("clear inode block %#04lx (+%d)\n", block, bit);
289
290 err = extend_or_restart_transaction(handle, 1, bh);
291 if (err)
292 goto exit_bh;
293
252 if (IS_ERR(it = bclean(handle, sb, block))) { 294 if (IS_ERR(it = bclean(handle, sb, block))) {
253 err = PTR_ERR(it); 295 err = PTR_ERR(it);
254 goto exit_bh; 296 goto exit_bh;
@@ -257,6 +299,11 @@ static int setup_new_group_blocks(struct super_block *sb,
257 brelse(it); 299 brelse(it);
258 ext3_set_bit(bit, bh->b_data); 300 ext3_set_bit(bit, bh->b_data);
259 } 301 }
302
303 err = extend_or_restart_transaction(handle, 2, bh);
304 if (err)
305 goto exit_bh;
306
260 mark_bitmap_end(input->blocks_count, EXT3_BLOCKS_PER_GROUP(sb), 307 mark_bitmap_end(input->blocks_count, EXT3_BLOCKS_PER_GROUP(sb),
261 bh->b_data); 308 bh->b_data);
262 ext3_journal_dirty_metadata(handle, bh); 309 ext3_journal_dirty_metadata(handle, bh);
@@ -884,9 +931,9 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
884 input->reserved_blocks); 931 input->reserved_blocks);
885 932
886 /* Update the free space counts */ 933 /* Update the free space counts */
887 percpu_counter_mod(&sbi->s_freeblocks_counter, 934 percpu_counter_add(&sbi->s_freeblocks_counter,
888 input->free_blocks_count); 935 input->free_blocks_count);
889 percpu_counter_mod(&sbi->s_freeinodes_counter, 936 percpu_counter_add(&sbi->s_freeinodes_counter,
890 EXT3_INODES_PER_GROUP(sb)); 937 EXT3_INODES_PER_GROUP(sb));
891 938
892 ext3_journal_dirty_metadata(handle, sbi->s_sbh); 939 ext3_journal_dirty_metadata(handle, sbi->s_sbh);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 9537316a0714..141573de7a9a 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -472,7 +472,7 @@ static void ext3_destroy_inode(struct inode *inode)
472 kmem_cache_free(ext3_inode_cachep, EXT3_I(inode)); 472 kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
473} 473}
474 474
475static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 475static void init_once(struct kmem_cache * cachep, void *foo)
476{ 476{
477 struct ext3_inode_info *ei = (struct ext3_inode_info *) foo; 477 struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;
478 478
@@ -545,9 +545,78 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl
545#endif 545#endif
546} 546}
547 547
548/*
549 * Show an option if
550 * - it's set to a non-default value OR
551 * - if the per-sb default is different from the global default
552 */
548static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) 553static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
549{ 554{
550 struct super_block *sb = vfs->mnt_sb; 555 struct super_block *sb = vfs->mnt_sb;
556 struct ext3_sb_info *sbi = EXT3_SB(sb);
557 struct ext3_super_block *es = sbi->s_es;
558 unsigned long def_mount_opts;
559
560 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
561
562 if (sbi->s_sb_block != 1)
563 seq_printf(seq, ",sb=%lu", sbi->s_sb_block);
564 if (test_opt(sb, MINIX_DF))
565 seq_puts(seq, ",minixdf");
566 if (test_opt(sb, GRPID))
567 seq_puts(seq, ",grpid");
568 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT3_DEFM_BSDGROUPS))
569 seq_puts(seq, ",nogrpid");
570 if (sbi->s_resuid != EXT3_DEF_RESUID ||
571 le16_to_cpu(es->s_def_resuid) != EXT3_DEF_RESUID) {
572 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
573 }
574 if (sbi->s_resgid != EXT3_DEF_RESGID ||
575 le16_to_cpu(es->s_def_resgid) != EXT3_DEF_RESGID) {
576 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
577 }
578 if (test_opt(sb, ERRORS_CONT)) {
579 int def_errors = le16_to_cpu(es->s_errors);
580
581 if (def_errors == EXT3_ERRORS_PANIC ||
582 def_errors == EXT3_ERRORS_RO) {
583 seq_puts(seq, ",errors=continue");
584 }
585 }
586 if (test_opt(sb, ERRORS_RO))
587 seq_puts(seq, ",errors=remount-ro");
588 if (test_opt(sb, ERRORS_PANIC))
589 seq_puts(seq, ",errors=panic");
590 if (test_opt(sb, NO_UID32))
591 seq_puts(seq, ",nouid32");
592 if (test_opt(sb, DEBUG))
593 seq_puts(seq, ",debug");
594 if (test_opt(sb, OLDALLOC))
595 seq_puts(seq, ",oldalloc");
596#ifdef CONFIG_EXT3_FS_XATTR
597 if (test_opt(sb, XATTR_USER))
598 seq_puts(seq, ",user_xattr");
599 if (!test_opt(sb, XATTR_USER) &&
600 (def_mount_opts & EXT3_DEFM_XATTR_USER)) {
601 seq_puts(seq, ",nouser_xattr");
602 }
603#endif
604#ifdef CONFIG_EXT3_FS_POSIX_ACL
605 if (test_opt(sb, POSIX_ACL))
606 seq_puts(seq, ",acl");
607 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT3_DEFM_ACL))
608 seq_puts(seq, ",noacl");
609#endif
610 if (!test_opt(sb, RESERVATION))
611 seq_puts(seq, ",noreservation");
612 if (sbi->s_commit_interval) {
613 seq_printf(seq, ",commit=%u",
614 (unsigned) (sbi->s_commit_interval / HZ));
615 }
616 if (test_opt(sb, BARRIER))
617 seq_puts(seq, ",barrier=1");
618 if (test_opt(sb, NOBH))
619 seq_puts(seq, ",nobh");
551 620
552 if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) 621 if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
553 seq_puts(seq, ",data=journal"); 622 seq_puts(seq, ",data=journal");
@@ -1416,6 +1485,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1416 int i; 1485 int i;
1417 int needs_recovery; 1486 int needs_recovery;
1418 __le32 features; 1487 __le32 features;
1488 int err;
1419 1489
1420 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 1490 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
1421 if (!sbi) 1491 if (!sbi)
@@ -1424,6 +1494,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1424 sbi->s_mount_opt = 0; 1494 sbi->s_mount_opt = 0;
1425 sbi->s_resuid = EXT3_DEF_RESUID; 1495 sbi->s_resuid = EXT3_DEF_RESUID;
1426 sbi->s_resgid = EXT3_DEF_RESGID; 1496 sbi->s_resgid = EXT3_DEF_RESGID;
1497 sbi->s_sb_block = sb_block;
1427 1498
1428 unlock_kernel(); 1499 unlock_kernel();
1429 1500
@@ -1675,12 +1746,20 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1675 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 1746 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
1676 spin_lock_init(&sbi->s_next_gen_lock); 1747 spin_lock_init(&sbi->s_next_gen_lock);
1677 1748
1678 percpu_counter_init(&sbi->s_freeblocks_counter, 1749 err = percpu_counter_init(&sbi->s_freeblocks_counter,
1679 ext3_count_free_blocks(sb)); 1750 ext3_count_free_blocks(sb));
1680 percpu_counter_init(&sbi->s_freeinodes_counter, 1751 if (!err) {
1681 ext3_count_free_inodes(sb)); 1752 err = percpu_counter_init(&sbi->s_freeinodes_counter,
1682 percpu_counter_init(&sbi->s_dirs_counter, 1753 ext3_count_free_inodes(sb));
1683 ext3_count_dirs(sb)); 1754 }
1755 if (!err) {
1756 err = percpu_counter_init(&sbi->s_dirs_counter,
1757 ext3_count_dirs(sb));
1758 }
1759 if (err) {
1760 printk(KERN_ERR "EXT3-fs: insufficient memory\n");
1761 goto failed_mount3;
1762 }
1684 1763
1685 /* per fileystem reservation list head & lock */ 1764 /* per fileystem reservation list head & lock */
1686 spin_lock_init(&sbi->s_rsv_window_lock); 1765 spin_lock_init(&sbi->s_rsv_window_lock);
@@ -2472,13 +2551,13 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
2472 buf->f_type = EXT3_SUPER_MAGIC; 2551 buf->f_type = EXT3_SUPER_MAGIC;
2473 buf->f_bsize = sb->s_blocksize; 2552 buf->f_bsize = sb->s_blocksize;
2474 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; 2553 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last;
2475 buf->f_bfree = percpu_counter_sum(&sbi->s_freeblocks_counter); 2554 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter);
2476 es->s_free_blocks_count = cpu_to_le32(buf->f_bfree); 2555 es->s_free_blocks_count = cpu_to_le32(buf->f_bfree);
2477 buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); 2556 buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
2478 if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) 2557 if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
2479 buf->f_bavail = 0; 2558 buf->f_bavail = 0;
2480 buf->f_files = le32_to_cpu(es->s_inodes_count); 2559 buf->f_files = le32_to_cpu(es->s_inodes_count);
2481 buf->f_ffree = percpu_counter_sum(&sbi->s_freeinodes_counter); 2560 buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
2482 es->s_free_inodes_count = cpu_to_le32(buf->f_ffree); 2561 es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
2483 buf->f_namelen = EXT3_NAME_LEN; 2562 buf->f_namelen = EXT3_NAME_LEN;
2484 fsid = le64_to_cpup((void *)es->s_uuid) ^ 2563 fsid = le64_to_cpup((void *)es->s_uuid) ^
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index e53b4af52f11..b74bf4368441 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -100,6 +100,15 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
100 return desc; 100 return desc;
101} 101}
102 102
103static inline int
104block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
105{
106 ext4_grpblk_t offset;
107
108 ext4_get_group_no_and_offset(sb, block, NULL, &offset);
109 return ext4_test_bit (offset, map);
110}
111
103/** 112/**
104 * read_block_bitmap() 113 * read_block_bitmap()
105 * @sb: super block 114 * @sb: super block
@@ -113,21 +122,53 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
113static struct buffer_head * 122static struct buffer_head *
114read_block_bitmap(struct super_block *sb, unsigned int block_group) 123read_block_bitmap(struct super_block *sb, unsigned int block_group)
115{ 124{
125 int i;
116 struct ext4_group_desc * desc; 126 struct ext4_group_desc * desc;
117 struct buffer_head * bh = NULL; 127 struct buffer_head * bh = NULL;
128 ext4_fsblk_t bitmap_blk;
118 129
119 desc = ext4_get_group_desc (sb, block_group, NULL); 130 desc = ext4_get_group_desc (sb, block_group, NULL);
120 if (!desc) 131 if (!desc)
121 goto error_out; 132 return NULL;
122 bh = sb_bread(sb, ext4_block_bitmap(sb, desc)); 133 bitmap_blk = ext4_block_bitmap(sb, desc);
134 bh = sb_bread(sb, bitmap_blk);
123 if (!bh) 135 if (!bh)
124 ext4_error (sb, "read_block_bitmap", 136 ext4_error (sb, __FUNCTION__,
125 "Cannot read block bitmap - " 137 "Cannot read block bitmap - "
126 "block_group = %d, block_bitmap = %llu", 138 "block_group = %d, block_bitmap = %llu",
127 block_group, 139 block_group, bitmap_blk);
128 ext4_block_bitmap(sb, desc)); 140
129error_out: 141 /* check whether block bitmap block number is set */
142 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
143 /* bad block bitmap */
144 goto error_out;
145 }
146
147 /* check whether the inode bitmap block number is set */
148 bitmap_blk = ext4_inode_bitmap(sb, desc);
149 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
150 /* bad block bitmap */
151 goto error_out;
152 }
153 /* check whether the inode table block number is set */
154 bitmap_blk = ext4_inode_table(sb, desc);
155 for (i = 0; i < EXT4_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
156 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
157 /* bad block bitmap */
158 goto error_out;
159 }
160 }
161
130 return bh; 162 return bh;
163
164error_out:
165 brelse(bh);
166 ext4_error(sb, __FUNCTION__,
167 "Invalid block bitmap - "
168 "block_group = %d, block = %llu",
169 block_group, bitmap_blk);
170 return NULL;
171
131} 172}
132/* 173/*
133 * The reservation window structure operations 174 * The reservation window structure operations
@@ -587,7 +628,7 @@ do_more:
587 cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) + 628 cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
588 group_freed); 629 group_freed);
589 spin_unlock(sb_bgl_lock(sbi, block_group)); 630 spin_unlock(sb_bgl_lock(sbi, block_group));
590 percpu_counter_mod(&sbi->s_freeblocks_counter, count); 631 percpu_counter_add(&sbi->s_freeblocks_counter, count);
591 632
592 /* We dirtied the bitmap block */ 633 /* We dirtied the bitmap block */
593 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); 634 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
@@ -1647,7 +1688,7 @@ allocated:
1647 gdp->bg_free_blocks_count = 1688 gdp->bg_free_blocks_count =
1648 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num); 1689 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
1649 spin_unlock(sb_bgl_lock(sbi, group_no)); 1690 spin_unlock(sb_bgl_lock(sbi, group_no));
1650 percpu_counter_mod(&sbi->s_freeblocks_counter, -num); 1691 percpu_counter_sub(&sbi->s_freeblocks_counter, num);
1651 1692
1652 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor"); 1693 BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
1653 err = ext4_journal_dirty_metadata(handle, gdp_bh); 1694 err = ext4_journal_dirty_metadata(handle, gdp_bh);
@@ -1747,15 +1788,6 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
1747#endif 1788#endif
1748} 1789}
1749 1790
1750static inline int
1751block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
1752{
1753 ext4_grpblk_t offset;
1754
1755 ext4_get_group_no_and_offset(sb, block, NULL, &offset);
1756 return ext4_test_bit (offset, map);
1757}
1758
1759static inline int test_root(int a, int b) 1791static inline int test_root(int a, int b)
1760{ 1792{
1761 int num = b; 1793 int num = b;
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 11e93c169bcf..420554f8f79d 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -13,7 +13,7 @@
13 13
14#ifdef EXT4FS_DEBUG 14#ifdef EXT4FS_DEBUG
15 15
16static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; 16static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
17 17
18unsigned long ext4_count_free (struct buffer_head * map, unsigned int numchars) 18unsigned long ext4_count_free (struct buffer_head * map, unsigned int numchars)
19{ 19{
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index e11890acfa21..0fb1e62b20d0 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -210,7 +210,7 @@ revalidate:
210 * not the directory has been modified 210 * not the directory has been modified
211 * during the copy operation. 211 * during the copy operation.
212 */ 212 */
213 unsigned long version = filp->f_version; 213 u64 version = filp->f_version;
214 214
215 error = filldir(dirent, de->name, 215 error = filldir(dirent, de->name,
216 de->name_len, 216 de->name_len,
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 427f83066a0d..d0c7793d9393 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -204,14 +204,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
204 int ngroups = EXT4_SB(sb)->s_groups_count; 204 int ngroups = EXT4_SB(sb)->s_groups_count;
205 unsigned int freei, avefreei; 205 unsigned int freei, avefreei;
206 struct ext4_group_desc *desc, *best_desc = NULL; 206 struct ext4_group_desc *desc, *best_desc = NULL;
207 struct buffer_head *bh;
208 int group, best_group = -1; 207 int group, best_group = -1;
209 208
210 freei = percpu_counter_read_positive(&EXT4_SB(sb)->s_freeinodes_counter); 209 freei = percpu_counter_read_positive(&EXT4_SB(sb)->s_freeinodes_counter);
211 avefreei = freei / ngroups; 210 avefreei = freei / ngroups;
212 211
213 for (group = 0; group < ngroups; group++) { 212 for (group = 0; group < ngroups; group++) {
214 desc = ext4_get_group_desc (sb, group, &bh); 213 desc = ext4_get_group_desc (sb, group, NULL);
215 if (!desc || !desc->bg_free_inodes_count) 214 if (!desc || !desc->bg_free_inodes_count)
216 continue; 215 continue;
217 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) 216 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)
269 ext4_grpblk_t min_blocks; 268 ext4_grpblk_t min_blocks;
270 int group = -1, i; 269 int group = -1, i;
271 struct ext4_group_desc *desc; 270 struct ext4_group_desc *desc;
272 struct buffer_head *bh;
273 271
274 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); 272 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
275 avefreei = freei / ngroups; 273 avefreei = freei / ngroups;
@@ -287,7 +285,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
287 parent_group = (unsigned)group % ngroups; 285 parent_group = (unsigned)group % ngroups;
288 for (i = 0; i < ngroups; i++) { 286 for (i = 0; i < ngroups; i++) {
289 group = (parent_group + i) % ngroups; 287 group = (parent_group + i) % ngroups;
290 desc = ext4_get_group_desc (sb, group, &bh); 288 desc = ext4_get_group_desc (sb, group, NULL);
291 if (!desc || !desc->bg_free_inodes_count) 289 if (!desc || !desc->bg_free_inodes_count)
292 continue; 290 continue;
293 if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) 291 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)
322 320
323 for (i = 0; i < ngroups; i++) { 321 for (i = 0; i < ngroups; i++) {
324 group = (parent_group + i) % ngroups; 322 group = (parent_group + i) % ngroups;
325 desc = ext4_get_group_desc (sb, group, &bh); 323 desc = ext4_get_group_desc (sb, group, NULL);
326 if (!desc || !desc->bg_free_inodes_count) 324 if (!desc || !desc->bg_free_inodes_count)
327 continue; 325 continue;
328 if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs) 326 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)
337fallback: 335fallback:
338 for (i = 0; i < ngroups; i++) { 336 for (i = 0; i < ngroups; i++) {
339 group = (parent_group + i) % ngroups; 337 group = (parent_group + i) % ngroups;
340 desc = ext4_get_group_desc (sb, group, &bh); 338 desc = ext4_get_group_desc (sb, group, NULL);
341 if (!desc || !desc->bg_free_inodes_count) 339 if (!desc || !desc->bg_free_inodes_count)
342 continue; 340 continue;
343 if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) 341 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)
361 int parent_group = EXT4_I(parent)->i_block_group; 359 int parent_group = EXT4_I(parent)->i_block_group;
362 int ngroups = EXT4_SB(sb)->s_groups_count; 360 int ngroups = EXT4_SB(sb)->s_groups_count;
363 struct ext4_group_desc *desc; 361 struct ext4_group_desc *desc;
364 struct buffer_head *bh;
365 int group, i; 362 int group, i;
366 363
367 /* 364 /*
368 * Try to place the inode in its parent directory 365 * Try to place the inode in its parent directory
369 */ 366 */
370 group = parent_group; 367 group = parent_group;
371 desc = ext4_get_group_desc (sb, group, &bh); 368 desc = ext4_get_group_desc (sb, group, NULL);
372 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 369 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
373 le16_to_cpu(desc->bg_free_blocks_count)) 370 le16_to_cpu(desc->bg_free_blocks_count))
374 return group; 371 return group;
@@ -392,7 +389,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
392 group += i; 389 group += i;
393 if (group >= ngroups) 390 if (group >= ngroups)
394 group -= ngroups; 391 group -= ngroups;
395 desc = ext4_get_group_desc (sb, group, &bh); 392 desc = ext4_get_group_desc (sb, group, NULL);
396 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 393 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
397 le16_to_cpu(desc->bg_free_blocks_count)) 394 le16_to_cpu(desc->bg_free_blocks_count))
398 return group; 395 return group;
@@ -406,7 +403,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
406 for (i = 0; i < ngroups; i++) { 403 for (i = 0; i < ngroups; i++) {
407 if (++group >= ngroups) 404 if (++group >= ngroups)
408 group = 0; 405 group = 0;
409 desc = ext4_get_group_desc (sb, group, &bh); 406 desc = ext4_get_group_desc (sb, group, NULL);
410 if (desc && le16_to_cpu(desc->bg_free_inodes_count)) 407 if (desc && le16_to_cpu(desc->bg_free_inodes_count))
411 return group; 408 return group;
412 } 409 }
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index aa11d7dbe970..472fc0d3e1c0 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -893,9 +893,9 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
893 input->reserved_blocks); 893 input->reserved_blocks);
894 894
895 /* Update the free space counts */ 895 /* Update the free space counts */
896 percpu_counter_mod(&sbi->s_freeblocks_counter, 896 percpu_counter_add(&sbi->s_freeblocks_counter,
897 input->free_blocks_count); 897 input->free_blocks_count);
898 percpu_counter_mod(&sbi->s_freeinodes_counter, 898 percpu_counter_add(&sbi->s_freeinodes_counter,
899 EXT4_INODES_PER_GROUP(sb)); 899 EXT4_INODES_PER_GROUP(sb));
900 900
901 ext4_journal_dirty_metadata(handle, sbi->s_sbh); 901 ext4_journal_dirty_metadata(handle, sbi->s_sbh);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3c1397fa83df..4c8d31c61454 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -523,7 +523,7 @@ static void ext4_destroy_inode(struct inode *inode)
523 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode)); 523 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
524} 524}
525 525
526static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 526static void init_once(struct kmem_cache *cachep, void *foo)
527{ 527{
528 struct ext4_inode_info *ei = (struct ext4_inode_info *) foo; 528 struct ext4_inode_info *ei = (struct ext4_inode_info *) foo;
529 529
@@ -596,9 +596,80 @@ static inline void ext4_show_quota_options(struct seq_file *seq, struct super_bl
596#endif 596#endif
597} 597}
598 598
599/*
600 * Show an option if
601 * - it's set to a non-default value OR
602 * - if the per-sb default is different from the global default
603 */
599static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) 604static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
600{ 605{
601 struct super_block *sb = vfs->mnt_sb; 606 struct super_block *sb = vfs->mnt_sb;
607 struct ext4_sb_info *sbi = EXT4_SB(sb);
608 struct ext4_super_block *es = sbi->s_es;
609 unsigned long def_mount_opts;
610
611 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
612
613 if (sbi->s_sb_block != 1)
614 seq_printf(seq, ",sb=%llu", sbi->s_sb_block);
615 if (test_opt(sb, MINIX_DF))
616 seq_puts(seq, ",minixdf");
617 if (test_opt(sb, GRPID))
618 seq_puts(seq, ",grpid");
619 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS))
620 seq_puts(seq, ",nogrpid");
621 if (sbi->s_resuid != EXT4_DEF_RESUID ||
622 le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) {
623 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
624 }
625 if (sbi->s_resgid != EXT4_DEF_RESGID ||
626 le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) {
627 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
628 }
629 if (test_opt(sb, ERRORS_CONT)) {
630 int def_errors = le16_to_cpu(es->s_errors);
631
632 if (def_errors == EXT4_ERRORS_PANIC ||
633 def_errors == EXT4_ERRORS_RO) {
634 seq_puts(seq, ",errors=continue");
635 }
636 }
637 if (test_opt(sb, ERRORS_RO))
638 seq_puts(seq, ",errors=remount-ro");
639 if (test_opt(sb, ERRORS_PANIC))
640 seq_puts(seq, ",errors=panic");
641 if (test_opt(sb, NO_UID32))
642 seq_puts(seq, ",nouid32");
643 if (test_opt(sb, DEBUG))
644 seq_puts(seq, ",debug");
645 if (test_opt(sb, OLDALLOC))
646 seq_puts(seq, ",oldalloc");
647#ifdef CONFIG_EXT4_FS_XATTR
648 if (test_opt(sb, XATTR_USER))
649 seq_puts(seq, ",user_xattr");
650 if (!test_opt(sb, XATTR_USER) &&
651 (def_mount_opts & EXT4_DEFM_XATTR_USER)) {
652 seq_puts(seq, ",nouser_xattr");
653 }
654#endif
655#ifdef CONFIG_EXT4_FS_POSIX_ACL
656 if (test_opt(sb, POSIX_ACL))
657 seq_puts(seq, ",acl");
658 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL))
659 seq_puts(seq, ",noacl");
660#endif
661 if (!test_opt(sb, RESERVATION))
662 seq_puts(seq, ",noreservation");
663 if (sbi->s_commit_interval) {
664 seq_printf(seq, ",commit=%u",
665 (unsigned) (sbi->s_commit_interval / HZ));
666 }
667 if (test_opt(sb, BARRIER))
668 seq_puts(seq, ",barrier=1");
669 if (test_opt(sb, NOBH))
670 seq_puts(seq, ",nobh");
671 if (!test_opt(sb, EXTENTS))
672 seq_puts(seq, ",noextents");
602 673
603 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) 674 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
604 seq_puts(seq, ",data=journal"); 675 seq_puts(seq, ",data=journal");
@@ -1415,8 +1486,6 @@ static void ext4_orphan_cleanup (struct super_block * sb,
1415 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ 1486 sb->s_flags = s_flags; /* Restore MS_RDONLY status */
1416} 1487}
1417 1488
1418#define log2(n) ffz(~(n))
1419
1420/* 1489/*
1421 * Maximal file size. There is a direct, and {,double-,triple-}indirect 1490 * Maximal file size. There is a direct, and {,double-,triple-}indirect
1422 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. 1491 * 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)
1479 int needs_recovery; 1548 int needs_recovery;
1480 __le32 features; 1549 __le32 features;
1481 __u64 blocks_count; 1550 __u64 blocks_count;
1551 int err;
1482 1552
1483 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 1553 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
1484 if (!sbi) 1554 if (!sbi)
@@ -1487,6 +1557,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1487 sbi->s_mount_opt = 0; 1557 sbi->s_mount_opt = 0;
1488 sbi->s_resuid = EXT4_DEF_RESUID; 1558 sbi->s_resuid = EXT4_DEF_RESUID;
1489 sbi->s_resgid = EXT4_DEF_RESGID; 1559 sbi->s_resgid = EXT4_DEF_RESGID;
1560 sbi->s_sb_block = sb_block;
1490 1561
1491 unlock_kernel(); 1562 unlock_kernel();
1492 1563
@@ -1667,7 +1738,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1667 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { 1738 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
1668 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || 1739 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
1669 sbi->s_desc_size > EXT4_MAX_DESC_SIZE || 1740 sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||
1670 sbi->s_desc_size & (sbi->s_desc_size - 1)) { 1741 !is_power_of_2(sbi->s_desc_size)) {
1671 printk(KERN_ERR 1742 printk(KERN_ERR
1672 "EXT4-fs: unsupported descriptor size %lu\n", 1743 "EXT4-fs: unsupported descriptor size %lu\n",
1673 sbi->s_desc_size); 1744 sbi->s_desc_size);
@@ -1688,8 +1759,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1688 sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb); 1759 sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
1689 sbi->s_sbh = bh; 1760 sbi->s_sbh = bh;
1690 sbi->s_mount_state = le16_to_cpu(es->s_state); 1761 sbi->s_mount_state = le16_to_cpu(es->s_state);
1691 sbi->s_addr_per_block_bits = log2(EXT4_ADDR_PER_BLOCK(sb)); 1762 sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));
1692 sbi->s_desc_per_block_bits = log2(EXT4_DESC_PER_BLOCK(sb)); 1763 sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));
1693 for (i=0; i < 4; i++) 1764 for (i=0; i < 4; i++)
1694 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); 1765 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
1695 sbi->s_def_hash_version = es->s_def_hash_version; 1766 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)
1759 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 1830 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
1760 spin_lock_init(&sbi->s_next_gen_lock); 1831 spin_lock_init(&sbi->s_next_gen_lock);
1761 1832
1762 percpu_counter_init(&sbi->s_freeblocks_counter, 1833 err = percpu_counter_init(&sbi->s_freeblocks_counter,
1763 ext4_count_free_blocks(sb)); 1834 ext4_count_free_blocks(sb));
1764 percpu_counter_init(&sbi->s_freeinodes_counter, 1835 if (!err) {
1765 ext4_count_free_inodes(sb)); 1836 err = percpu_counter_init(&sbi->s_freeinodes_counter,
1766 percpu_counter_init(&sbi->s_dirs_counter, 1837 ext4_count_free_inodes(sb));
1767 ext4_count_dirs(sb)); 1838 }
1839 if (!err) {
1840 err = percpu_counter_init(&sbi->s_dirs_counter,
1841 ext4_count_dirs(sb));
1842 }
1843 if (err) {
1844 printk(KERN_ERR "EXT4-fs: insufficient memory\n");
1845 goto failed_mount3;
1846 }
1768 1847
1769 /* per fileystem reservation list head & lock */ 1848 /* per fileystem reservation list head & lock */
1770 spin_lock_init(&sbi->s_rsv_window_lock); 1849 spin_lock_init(&sbi->s_rsv_window_lock);
@@ -2592,13 +2671,13 @@ static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf)
2592 buf->f_type = EXT4_SUPER_MAGIC; 2671 buf->f_type = EXT4_SUPER_MAGIC;
2593 buf->f_bsize = sb->s_blocksize; 2672 buf->f_bsize = sb->s_blocksize;
2594 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last; 2673 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last;
2595 buf->f_bfree = percpu_counter_sum(&sbi->s_freeblocks_counter); 2674 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter);
2596 es->s_free_blocks_count = cpu_to_le32(buf->f_bfree); 2675 es->s_free_blocks_count = cpu_to_le32(buf->f_bfree);
2597 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es); 2676 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es);
2598 if (buf->f_bfree < ext4_r_blocks_count(es)) 2677 if (buf->f_bfree < ext4_r_blocks_count(es))
2599 buf->f_bavail = 0; 2678 buf->f_bavail = 0;
2600 buf->f_files = le32_to_cpu(es->s_inodes_count); 2679 buf->f_files = le32_to_cpu(es->s_inodes_count);
2601 buf->f_ffree = percpu_counter_sum(&sbi->s_freeinodes_counter); 2680 buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
2602 es->s_free_inodes_count = cpu_to_le32(buf->f_ffree); 2681 es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
2603 buf->f_namelen = EXT4_NAME_LEN; 2682 buf->f_namelen = EXT4_NAME_LEN;
2604 fsid = le64_to_cpup((void *)es->s_uuid) ^ 2683 fsid = le64_to_cpup((void *)es->s_uuid) ^
diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index be6f89b152ca..639b3b4f86d1 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -36,7 +36,7 @@ static inline int fat_max_cache(struct inode *inode)
36 36
37static struct kmem_cache *fat_cache_cachep; 37static struct kmem_cache *fat_cache_cachep;
38 38
39static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 39static void init_once(struct kmem_cache *cachep, void *foo)
40{ 40{
41 struct fat_cache *cache = (struct fat_cache *)foo; 41 struct fat_cache *cache = (struct fat_cache *)foo;
42 42
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 46b8a67f55c6..c0c5e9c55b58 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -501,7 +501,7 @@ static void fat_destroy_inode(struct inode *inode)
501 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode)); 501 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
502} 502}
503 503
504static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 504static void init_once(struct kmem_cache *cachep, void *foo)
505{ 505{
506 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo; 506 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;
507 507
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 78b2ff044054..c9db73fc5e3d 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -110,7 +110,7 @@ out:
110 return error; 110 return error;
111} 111}
112 112
113static int dupfd(struct file *file, unsigned int start) 113static int dupfd(struct file *file, unsigned int start, int cloexec)
114{ 114{
115 struct files_struct * files = current->files; 115 struct files_struct * files = current->files;
116 struct fdtable *fdt; 116 struct fdtable *fdt;
@@ -122,7 +122,10 @@ static int dupfd(struct file *file, unsigned int start)
122 /* locate_fd() may have expanded fdtable, load the ptr */ 122 /* locate_fd() may have expanded fdtable, load the ptr */
123 fdt = files_fdtable(files); 123 fdt = files_fdtable(files);
124 FD_SET(fd, fdt->open_fds); 124 FD_SET(fd, fdt->open_fds);
125 FD_CLR(fd, fdt->close_on_exec); 125 if (cloexec)
126 FD_SET(fd, fdt->close_on_exec);
127 else
128 FD_CLR(fd, fdt->close_on_exec);
126 spin_unlock(&files->file_lock); 129 spin_unlock(&files->file_lock);
127 fd_install(fd, file); 130 fd_install(fd, file);
128 } else { 131 } else {
@@ -195,7 +198,7 @@ asmlinkage long sys_dup(unsigned int fildes)
195 struct file * file = fget(fildes); 198 struct file * file = fget(fildes);
196 199
197 if (file) 200 if (file)
198 ret = dupfd(file, 0); 201 ret = dupfd(file, 0, 0);
199 return ret; 202 return ret;
200} 203}
201 204
@@ -319,8 +322,9 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
319 322
320 switch (cmd) { 323 switch (cmd) {
321 case F_DUPFD: 324 case F_DUPFD:
325 case F_DUPFD_CLOEXEC:
322 get_file(filp); 326 get_file(filp);
323 err = dupfd(filp, arg); 327 err = dupfd(filp, arg, cmd == F_DUPFD_CLOEXEC);
324 break; 328 break;
325 case F_GETFD: 329 case F_GETFD:
326 err = get_close_on_exec(fd) ? FD_CLOEXEC : 0; 330 err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
diff --git a/fs/file_table.c b/fs/file_table.c
index d17fd691b832..3176fefc92e1 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -98,16 +98,15 @@ struct file *get_empty_filp(void)
98 * percpu_counters are inaccurate. Do an expensive check before 98 * percpu_counters are inaccurate. Do an expensive check before
99 * we go and fail. 99 * we go and fail.
100 */ 100 */
101 if (percpu_counter_sum(&nr_files) >= files_stat.max_files) 101 if (percpu_counter_sum_positive(&nr_files) >= files_stat.max_files)
102 goto over; 102 goto over;
103 } 103 }
104 104
105 f = kmem_cache_alloc(filp_cachep, GFP_KERNEL); 105 f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL);
106 if (f == NULL) 106 if (f == NULL)
107 goto fail; 107 goto fail;
108 108
109 percpu_counter_inc(&nr_files); 109 percpu_counter_inc(&nr_files);
110 memset(f, 0, sizeof(*f));
111 if (security_file_alloc(f)) 110 if (security_file_alloc(f))
112 goto fail_sec; 111 goto fail_sec;
113 112
@@ -138,6 +137,66 @@ fail:
138 137
139EXPORT_SYMBOL(get_empty_filp); 138EXPORT_SYMBOL(get_empty_filp);
140 139
140/**
141 * alloc_file - allocate and initialize a 'struct file'
142 * @mnt: the vfsmount on which the file will reside
143 * @dentry: the dentry representing the new file
144 * @mode: the mode with which the new file will be opened
145 * @fop: the 'struct file_operations' for the new file
146 *
147 * Use this instead of get_empty_filp() to get a new
148 * 'struct file'. Do so because of the same initialization
149 * pitfalls reasons listed for init_file(). This is a
150 * preferred interface to using init_file().
151 *
152 * If all the callers of init_file() are eliminated, its
153 * code should be moved into this function.
154 */
155struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
156 mode_t mode, const struct file_operations *fop)
157{
158 struct file *file;
159 struct path;
160
161 file = get_empty_filp();
162 if (!file)
163 return NULL;
164
165 init_file(file, mnt, dentry, mode, fop);
166 return file;
167}
168EXPORT_SYMBOL(alloc_file);
169
170/**
171 * init_file - initialize a 'struct file'
172 * @file: the already allocated 'struct file' to initialized
173 * @mnt: the vfsmount on which the file resides
174 * @dentry: the dentry representing this file
175 * @mode: the mode the file is opened with
176 * @fop: the 'struct file_operations' for this file
177 *
178 * Use this instead of setting the members directly. Doing so
179 * avoids making mistakes like forgetting the mntget() or
180 * forgetting to take a write on the mnt.
181 *
182 * Note: This is a crappy interface. It is here to make
183 * merging with the existing users of get_empty_filp()
184 * who have complex failure logic easier. All users
185 * of this should be moving to alloc_file().
186 */
187int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
188 mode_t mode, const struct file_operations *fop)
189{
190 int error = 0;
191 file->f_path.dentry = dentry;
192 file->f_path.mnt = mntget(mnt);
193 file->f_mapping = dentry->d_inode->i_mapping;
194 file->f_mode = mode;
195 file->f_op = fop;
196 return error;
197}
198EXPORT_SYMBOL(init_file);
199
141void fastcall fput(struct file *file) 200void fastcall fput(struct file *file)
142{ 201{
143 if (atomic_dec_and_test(&file->f_count)) 202 if (atomic_dec_and_test(&file->f_count))
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 8d23b0b38717..686734ff973d 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -100,11 +100,11 @@ void __mark_inode_dirty(struct inode *inode, int flags)
100 inode->i_state |= flags; 100 inode->i_state |= flags;
101 101
102 /* 102 /*
103 * If the inode is locked, just update its dirty state. 103 * If the inode is being synced, just update its dirty state.
104 * The unlocker will place the inode on the appropriate 104 * The unlocker will place the inode on the appropriate
105 * superblock list, based upon its state. 105 * superblock list, based upon its state.
106 */ 106 */
107 if (inode->i_state & I_LOCK) 107 if (inode->i_state & I_SYNC)
108 goto out; 108 goto out;
109 109
110 /* 110 /*
@@ -119,7 +119,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
119 goto out; 119 goto out;
120 120
121 /* 121 /*
122 * If the inode was already on s_dirty or s_io, don't 122 * If the inode was already on s_dirty/s_io/s_more_io, don't
123 * reposition it (that would break s_dirty time-ordering). 123 * reposition it (that would break s_dirty time-ordering).
124 */ 124 */
125 if (!was_dirty) { 125 if (!was_dirty) {
@@ -141,6 +141,82 @@ static int write_inode(struct inode *inode, int sync)
141} 141}
142 142
143/* 143/*
144 * Redirty an inode: set its when-it-was dirtied timestamp and move it to the
145 * furthest end of its superblock's dirty-inode list.
146 *
147 * Before stamping the inode's ->dirtied_when, we check to see whether it is
148 * already the most-recently-dirtied inode on the s_dirty list. If that is
149 * the case then the inode must have been redirtied while it was being written
150 * out and we don't reset its dirtied_when.
151 */
152static void redirty_tail(struct inode *inode)
153{
154 struct super_block *sb = inode->i_sb;
155
156 if (!list_empty(&sb->s_dirty)) {
157 struct inode *tail_inode;
158
159 tail_inode = list_entry(sb->s_dirty.next, struct inode, i_list);
160 if (!time_after_eq(inode->dirtied_when,
161 tail_inode->dirtied_when))
162 inode->dirtied_when = jiffies;
163 }
164 list_move(&inode->i_list, &sb->s_dirty);
165}
166
167/*
168 * requeue inode for re-scanning after sb->s_io list is exhausted.
169 */
170static void requeue_io(struct inode *inode)
171{
172 list_move(&inode->i_list, &inode->i_sb->s_more_io);
173}
174
175static void inode_sync_complete(struct inode *inode)
176{
177 /*
178 * Prevent speculative execution through spin_unlock(&inode_lock);
179 */
180 smp_mb();
181 wake_up_bit(&inode->i_state, __I_SYNC);
182}
183
184/*
185 * Move expired dirty inodes from @delaying_queue to @dispatch_queue.
186 */
187static void move_expired_inodes(struct list_head *delaying_queue,
188 struct list_head *dispatch_queue,
189 unsigned long *older_than_this)
190{
191 while (!list_empty(delaying_queue)) {
192 struct inode *inode = list_entry(delaying_queue->prev,
193 struct inode, i_list);
194 if (older_than_this &&
195 time_after(inode->dirtied_when, *older_than_this))
196 break;
197 list_move(&inode->i_list, dispatch_queue);
198 }
199}
200
201/*
202 * Queue all expired dirty inodes for io, eldest first.
203 */
204static void queue_io(struct super_block *sb,
205 unsigned long *older_than_this)
206{
207 list_splice_init(&sb->s_more_io, sb->s_io.prev);
208 move_expired_inodes(&sb->s_dirty, &sb->s_io, older_than_this);
209}
210
211int sb_has_dirty_inodes(struct super_block *sb)
212{
213 return !list_empty(&sb->s_dirty) ||
214 !list_empty(&sb->s_io) ||
215 !list_empty(&sb->s_more_io);
216}
217EXPORT_SYMBOL(sb_has_dirty_inodes);
218
219/*
144 * Write a single inode's dirty pages and inode data out to disk. 220 * Write a single inode's dirty pages and inode data out to disk.
145 * If `wait' is set, wait on the writeout. 221 * If `wait' is set, wait on the writeout.
146 * 222 *
@@ -155,15 +231,14 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
155{ 231{
156 unsigned dirty; 232 unsigned dirty;
157 struct address_space *mapping = inode->i_mapping; 233 struct address_space *mapping = inode->i_mapping;
158 struct super_block *sb = inode->i_sb;
159 int wait = wbc->sync_mode == WB_SYNC_ALL; 234 int wait = wbc->sync_mode == WB_SYNC_ALL;
160 int ret; 235 int ret;
161 236
162 BUG_ON(inode->i_state & I_LOCK); 237 BUG_ON(inode->i_state & I_SYNC);
163 238
164 /* Set I_LOCK, reset I_DIRTY */ 239 /* Set I_SYNC, reset I_DIRTY */
165 dirty = inode->i_state & I_DIRTY; 240 dirty = inode->i_state & I_DIRTY;
166 inode->i_state |= I_LOCK; 241 inode->i_state |= I_SYNC;
167 inode->i_state &= ~I_DIRTY; 242 inode->i_state &= ~I_DIRTY;
168 243
169 spin_unlock(&inode_lock); 244 spin_unlock(&inode_lock);
@@ -184,24 +259,32 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
184 } 259 }
185 260
186 spin_lock(&inode_lock); 261 spin_lock(&inode_lock);
187 inode->i_state &= ~I_LOCK; 262 inode->i_state &= ~I_SYNC;
188 if (!(inode->i_state & I_FREEING)) { 263 if (!(inode->i_state & I_FREEING)) {
189 if (!(inode->i_state & I_DIRTY) && 264 if (!(inode->i_state & I_DIRTY) &&
190 mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { 265 mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
191 /* 266 /*
192 * We didn't write back all the pages. nfs_writepages() 267 * We didn't write back all the pages. nfs_writepages()
193 * sometimes bales out without doing anything. Redirty 268 * sometimes bales out without doing anything. Redirty
194 * the inode. It is still on sb->s_io. 269 * the inode; Move it from s_io onto s_more_io/s_dirty.
270 */
271 /*
272 * akpm: if the caller was the kupdate function we put
273 * this inode at the head of s_dirty so it gets first
274 * consideration. Otherwise, move it to the tail, for
275 * the reasons described there. I'm not really sure
276 * how much sense this makes. Presumably I had a good
277 * reasons for doing it this way, and I'd rather not
278 * muck with it at present.
195 */ 279 */
196 if (wbc->for_kupdate) { 280 if (wbc->for_kupdate) {
197 /* 281 /*
198 * For the kupdate function we leave the inode 282 * For the kupdate function we move the inode
199 * at the head of sb_dirty so it will get more 283 * to s_more_io so it will get more writeout as
200 * writeout as soon as the queue becomes 284 * soon as the queue becomes uncongested.
201 * uncongested.
202 */ 285 */
203 inode->i_state |= I_DIRTY_PAGES; 286 inode->i_state |= I_DIRTY_PAGES;
204 list_move_tail(&inode->i_list, &sb->s_dirty); 287 requeue_io(inode);
205 } else { 288 } else {
206 /* 289 /*
207 * Otherwise fully redirty the inode so that 290 * Otherwise fully redirty the inode so that
@@ -211,15 +294,14 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
211 * all the other files. 294 * all the other files.
212 */ 295 */
213 inode->i_state |= I_DIRTY_PAGES; 296 inode->i_state |= I_DIRTY_PAGES;
214 inode->dirtied_when = jiffies; 297 redirty_tail(inode);
215 list_move(&inode->i_list, &sb->s_dirty);
216 } 298 }
217 } else if (inode->i_state & I_DIRTY) { 299 } else if (inode->i_state & I_DIRTY) {
218 /* 300 /*
219 * Someone redirtied the inode while were writing back 301 * Someone redirtied the inode while were writing back
220 * the pages. 302 * the pages.
221 */ 303 */
222 list_move(&inode->i_list, &sb->s_dirty); 304 redirty_tail(inode);
223 } else if (atomic_read(&inode->i_count)) { 305 } else if (atomic_read(&inode->i_count)) {
224 /* 306 /*
225 * The inode is clean, inuse 307 * The inode is clean, inuse
@@ -232,7 +314,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
232 list_move(&inode->i_list, &inode_unused); 314 list_move(&inode->i_list, &inode_unused);
233 } 315 }
234 } 316 }
235 wake_up_inode(inode); 317 inode_sync_complete(inode);
236 return ret; 318 return ret;
237} 319}
238 320
@@ -251,11 +333,18 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
251 else 333 else
252 WARN_ON(inode->i_state & I_WILL_FREE); 334 WARN_ON(inode->i_state & I_WILL_FREE);
253 335
254 if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) { 336 if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_SYNC)) {
255 struct address_space *mapping = inode->i_mapping; 337 struct address_space *mapping = inode->i_mapping;
256 int ret; 338 int ret;
257 339
258 list_move(&inode->i_list, &inode->i_sb->s_dirty); 340 /*
341 * We're skipping this inode because it's locked, and we're not
342 * doing writeback-for-data-integrity. Move it to s_more_io so
343 * that writeback can proceed with the other inodes on s_io.
344 * We'll have another go at writing back this inode when we
345 * completed a full scan of s_io.
346 */
347 requeue_io(inode);
259 348
260 /* 349 /*
261 * Even if we don't actually write the inode itself here, 350 * 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)
270 /* 359 /*
271 * It's a data-integrity sync. We must wait. 360 * It's a data-integrity sync. We must wait.
272 */ 361 */
273 if (inode->i_state & I_LOCK) { 362 if (inode->i_state & I_SYNC) {
274 DEFINE_WAIT_BIT(wq, &inode->i_state, __I_LOCK); 363 DEFINE_WAIT_BIT(wq, &inode->i_state, __I_SYNC);
275 364
276 wqh = bit_waitqueue(&inode->i_state, __I_LOCK); 365 wqh = bit_waitqueue(&inode->i_state, __I_SYNC);
277 do { 366 do {
278 spin_unlock(&inode_lock); 367 spin_unlock(&inode_lock);
279 __wait_on_bit(wqh, &wq, inode_wait, 368 __wait_on_bit(wqh, &wq, inode_wait,
280 TASK_UNINTERRUPTIBLE); 369 TASK_UNINTERRUPTIBLE);
281 spin_lock(&inode_lock); 370 spin_lock(&inode_lock);
282 } while (inode->i_state & I_LOCK); 371 } while (inode->i_state & I_SYNC);
283 } 372 }
284 return __sync_single_inode(inode, wbc); 373 return __sync_single_inode(inode, wbc);
285} 374}
@@ -312,7 +401,7 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
312 * The inodes to be written are parked on sb->s_io. They are moved back onto 401 * The inodes to be written are parked on sb->s_io. They are moved back onto
313 * sb->s_dirty as they are selected for writing. This way, none can be missed 402 * sb->s_dirty as they are selected for writing. This way, none can be missed
314 * on the writer throttling path, and we get decent balancing between many 403 * on the writer throttling path, and we get decent balancing between many
315 * throttled threads: we don't want them all piling up on __wait_on_inode. 404 * throttled threads: we don't want them all piling up on inode_sync_wait.
316 */ 405 */
317static void 406static void
318sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc) 407sync_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)
320 const unsigned long start = jiffies; /* livelock avoidance */ 409 const unsigned long start = jiffies; /* livelock avoidance */
321 410
322 if (!wbc->for_kupdate || list_empty(&sb->s_io)) 411 if (!wbc->for_kupdate || list_empty(&sb->s_io))
323 list_splice_init(&sb->s_dirty, &sb->s_io); 412 queue_io(sb, wbc->older_than_this);
324 413
325 while (!list_empty(&sb->s_io)) { 414 while (!list_empty(&sb->s_io)) {
326 struct inode *inode = list_entry(sb->s_io.prev, 415 struct inode *inode = list_entry(sb->s_io.prev,
@@ -330,7 +419,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
330 long pages_skipped; 419 long pages_skipped;
331 420
332 if (!bdi_cap_writeback_dirty(bdi)) { 421 if (!bdi_cap_writeback_dirty(bdi)) {
333 list_move(&inode->i_list, &sb->s_dirty); 422 redirty_tail(inode);
334 if (sb_is_blkdev_sb(sb)) { 423 if (sb_is_blkdev_sb(sb)) {
335 /* 424 /*
336 * Dirty memory-backed blockdev: the ramdisk 425 * Dirty memory-backed blockdev: the ramdisk
@@ -350,14 +439,14 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
350 wbc->encountered_congestion = 1; 439 wbc->encountered_congestion = 1;
351 if (!sb_is_blkdev_sb(sb)) 440 if (!sb_is_blkdev_sb(sb))
352 break; /* Skip a congested fs */ 441 break; /* Skip a congested fs */
353 list_move(&inode->i_list, &sb->s_dirty); 442 requeue_io(inode);
354 continue; /* Skip a congested blockdev */ 443 continue; /* Skip a congested blockdev */
355 } 444 }
356 445
357 if (wbc->bdi && bdi != wbc->bdi) { 446 if (wbc->bdi && bdi != wbc->bdi) {
358 if (!sb_is_blkdev_sb(sb)) 447 if (!sb_is_blkdev_sb(sb))
359 break; /* fs has the wrong queue */ 448 break; /* fs has the wrong queue */
360 list_move(&inode->i_list, &sb->s_dirty); 449 requeue_io(inode);
361 continue; /* blockdev has wrong queue */ 450 continue; /* blockdev has wrong queue */
362 } 451 }
363 452
@@ -365,11 +454,6 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
365 if (time_after(inode->dirtied_when, start)) 454 if (time_after(inode->dirtied_when, start))
366 break; 455 break;
367 456
368 /* Was this inode dirtied too recently? */
369 if (wbc->older_than_this && time_after(inode->dirtied_when,
370 *wbc->older_than_this))
371 break;
372
373 /* Is another pdflush already flushing this queue? */ 457 /* Is another pdflush already flushing this queue? */
374 if (current_is_pdflush() && !writeback_acquire(bdi)) 458 if (current_is_pdflush() && !writeback_acquire(bdi))
375 break; 459 break;
@@ -389,7 +473,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
389 * writeback is not making progress due to locked 473 * writeback is not making progress due to locked
390 * buffers. Skip this inode for now. 474 * buffers. Skip this inode for now.
391 */ 475 */
392 list_move(&inode->i_list, &sb->s_dirty); 476 redirty_tail(inode);
393 } 477 }
394 spin_unlock(&inode_lock); 478 spin_unlock(&inode_lock);
395 iput(inode); 479 iput(inode);
@@ -398,6 +482,8 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
398 if (wbc->nr_to_write <= 0) 482 if (wbc->nr_to_write <= 0)
399 break; 483 break;
400 } 484 }
485 if (!list_empty(&sb->s_more_io))
486 wbc->more_io = 1;
401 return; /* Leave any unwritten inodes on s_io */ 487 return; /* Leave any unwritten inodes on s_io */
402} 488}
403 489
@@ -407,7 +493,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
407 * Note: 493 * Note:
408 * We don't need to grab a reference to superblock here. If it has non-empty 494 * We don't need to grab a reference to superblock here. If it has non-empty
409 * ->s_dirty it's hadn't been killed yet and kill_super() won't proceed 495 * ->s_dirty it's hadn't been killed yet and kill_super() won't proceed
410 * past sync_inodes_sb() until both the ->s_dirty and ->s_io lists are 496 * past sync_inodes_sb() until the ->s_dirty/s_io/s_more_io lists are all
411 * empty. Since __sync_single_inode() regains inode_lock before it finally moves 497 * empty. Since __sync_single_inode() regains inode_lock before it finally moves
412 * inode from superblock lists we are OK. 498 * inode from superblock lists we are OK.
413 * 499 *
@@ -430,7 +516,7 @@ writeback_inodes(struct writeback_control *wbc)
430restart: 516restart:
431 sb = sb_entry(super_blocks.prev); 517 sb = sb_entry(super_blocks.prev);
432 for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) { 518 for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
433 if (!list_empty(&sb->s_dirty) || !list_empty(&sb->s_io)) { 519 if (sb_has_dirty_inodes(sb)) {
434 /* we're making our own get_super here */ 520 /* we're making our own get_super here */
435 sb->s_count++; 521 sb->s_count++;
436 spin_unlock(&sb_lock); 522 spin_unlock(&sb_lock);
@@ -584,7 +670,7 @@ int write_inode_now(struct inode *inode, int sync)
584 ret = __writeback_single_inode(inode, &wbc); 670 ret = __writeback_single_inode(inode, &wbc);
585 spin_unlock(&inode_lock); 671 spin_unlock(&inode_lock);
586 if (sync) 672 if (sync)
587 wait_on_inode(inode); 673 inode_sync_wait(inode);
588 return ret; 674 return ret;
589} 675}
590EXPORT_SYMBOL(write_inode_now); 676EXPORT_SYMBOL(write_inode_now);
@@ -659,7 +745,7 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int
659 err = err2; 745 err = err2;
660 } 746 }
661 else 747 else
662 wait_on_inode(inode); 748 inode_sync_wait(inode);
663 749
664 return err; 750 return err;
665} 751}
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 3ad22beb24c2..db534bcde45f 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -129,7 +129,7 @@ static struct fuse_req *get_reserved_req(struct fuse_conn *fc,
129 struct fuse_file *ff = file->private_data; 129 struct fuse_file *ff = file->private_data;
130 130
131 do { 131 do {
132 wait_event(fc->blocked_waitq, ff->reserved_req); 132 wait_event(fc->reserved_req_waitq, ff->reserved_req);
133 spin_lock(&fc->lock); 133 spin_lock(&fc->lock);
134 if (ff->reserved_req) { 134 if (ff->reserved_req) {
135 req = ff->reserved_req; 135 req = ff->reserved_req;
@@ -155,7 +155,7 @@ static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req)
155 fuse_request_init(req); 155 fuse_request_init(req);
156 BUG_ON(ff->reserved_req); 156 BUG_ON(ff->reserved_req);
157 ff->reserved_req = req; 157 ff->reserved_req = req;
158 wake_up(&fc->blocked_waitq); 158 wake_up_all(&fc->reserved_req_waitq);
159 spin_unlock(&fc->lock); 159 spin_unlock(&fc->lock);
160 fput(file); 160 fput(file);
161} 161}
@@ -224,13 +224,13 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
224 fc->blocked = 0; 224 fc->blocked = 0;
225 wake_up_all(&fc->blocked_waitq); 225 wake_up_all(&fc->blocked_waitq);
226 } 226 }
227 if (fc->num_background == FUSE_CONGESTION_THRESHOLD) {
228 clear_bdi_congested(&fc->bdi, READ);
229 clear_bdi_congested(&fc->bdi, WRITE);
230 }
227 fc->num_background--; 231 fc->num_background--;
228 } 232 }
229 spin_unlock(&fc->lock); 233 spin_unlock(&fc->lock);
230 dput(req->dentry);
231 mntput(req->vfsmount);
232 if (req->file)
233 fput(req->file);
234 wake_up(&req->waitq); 234 wake_up(&req->waitq);
235 if (end) 235 if (end)
236 end(fc, req); 236 end(fc, req);
@@ -273,28 +273,41 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
273 queue_interrupt(fc, req); 273 queue_interrupt(fc, req);
274 } 274 }
275 275
276 if (req->force) { 276 if (!req->force) {
277 spin_unlock(&fc->lock);
278 wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
279 spin_lock(&fc->lock);
280 } else {
281 sigset_t oldset; 277 sigset_t oldset;
282 278
283 /* Only fatal signals may interrupt this */ 279 /* Only fatal signals may interrupt this */
284 block_sigs(&oldset); 280 block_sigs(&oldset);
285 wait_answer_interruptible(fc, req); 281 wait_answer_interruptible(fc, req);
286 restore_sigs(&oldset); 282 restore_sigs(&oldset);
283
284 if (req->aborted)
285 goto aborted;
286 if (req->state == FUSE_REQ_FINISHED)
287 return;
288
289 /* Request is not yet in userspace, bail out */
290 if (req->state == FUSE_REQ_PENDING) {
291 list_del(&req->list);
292 __fuse_put_request(req);
293 req->out.h.error = -EINTR;
294 return;
295 }
287 } 296 }
288 297
289 if (req->aborted) 298 /*
290 goto aborted; 299 * Either request is already in userspace, or it was forced.
291 if (req->state == FUSE_REQ_FINISHED) 300 * Wait it out.
292 return; 301 */
302 spin_unlock(&fc->lock);
303 wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
304 spin_lock(&fc->lock);
293 305
294 req->out.h.error = -EINTR; 306 if (!req->aborted)
295 req->aborted = 1; 307 return;
296 308
297 aborted: 309 aborted:
310 BUG_ON(req->state != FUSE_REQ_FINISHED);
298 if (req->locked) { 311 if (req->locked) {
299 /* This is uninterruptible sleep, because data is 312 /* This is uninterruptible sleep, because data is
300 being copied to/from the buffers of req. During 313 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)
305 wait_event(req->waitq, !req->locked); 318 wait_event(req->waitq, !req->locked);
306 spin_lock(&fc->lock); 319 spin_lock(&fc->lock);
307 } 320 }
308 if (req->state == FUSE_REQ_PENDING) {
309 list_del(&req->list);
310 __fuse_put_request(req);
311 } else if (req->state == FUSE_REQ_SENT) {
312 spin_unlock(&fc->lock);
313 wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
314 spin_lock(&fc->lock);
315 }
316} 321}
317 322
318static unsigned len_args(unsigned numargs, struct fuse_arg *args) 323static 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)
378 fc->num_background++; 383 fc->num_background++;
379 if (fc->num_background == FUSE_MAX_BACKGROUND) 384 if (fc->num_background == FUSE_MAX_BACKGROUND)
380 fc->blocked = 1; 385 fc->blocked = 1;
386 if (fc->num_background == FUSE_CONGESTION_THRESHOLD) {
387 set_bdi_congested(&fc->bdi, READ);
388 set_bdi_congested(&fc->bdi, WRITE);
389 }
381 390
382 queue_request(fc, req); 391 queue_request(fc, req);
383 spin_unlock(&fc->lock); 392 spin_unlock(&fc->lock);
@@ -738,11 +747,12 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov,
738 fuse_copy_finish(&cs); 747 fuse_copy_finish(&cs);
739 spin_lock(&fc->lock); 748 spin_lock(&fc->lock);
740 req->locked = 0; 749 req->locked = 0;
741 if (!err && req->aborted) 750 if (req->aborted) {
742 err = -ENOENT; 751 request_end(fc, req);
752 return -ENODEV;
753 }
743 if (err) { 754 if (err) {
744 if (!req->aborted) 755 req->out.h.error = -EIO;
745 req->out.h.error = -EIO;
746 request_end(fc, req); 756 request_end(fc, req);
747 return err; 757 return err;
748 } 758 }
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index bd5a772d8ccf..d1acab931330 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -288,12 +288,11 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
288static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff, 288static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff,
289 u64 nodeid, int flags) 289 u64 nodeid, int flags)
290{ 290{
291 struct fuse_req *req; 291 fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE);
292 292 ff->reserved_req->force = 1;
293 req = fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE); 293 request_send(fc, ff->reserved_req);
294 req->force = 1; 294 fuse_put_request(fc, ff->reserved_req);
295 request_send(fc, req); 295 kfree(ff);
296 fuse_put_request(fc, req);
297} 296}
298 297
299/* 298/*
@@ -664,7 +663,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
664 return err; 663 return err;
665} 664}
666 665
667int fuse_do_getattr(struct inode *inode) 666static int fuse_do_getattr(struct inode *inode)
668{ 667{
669 int err; 668 int err;
670 struct fuse_attr_out arg; 669 struct fuse_attr_out arg;
@@ -696,6 +695,20 @@ int fuse_do_getattr(struct inode *inode)
696} 695}
697 696
698/* 697/*
698 * Check if attributes are still valid, and if not send a GETATTR
699 * request to refresh them.
700 */
701static int fuse_refresh_attributes(struct inode *inode)
702{
703 struct fuse_inode *fi = get_fuse_inode(inode);
704
705 if (fi->i_time < get_jiffies_64())
706 return fuse_do_getattr(inode);
707 else
708 return 0;
709}
710
711/*
699 * Calling into a user-controlled filesystem gives the filesystem 712 * Calling into a user-controlled filesystem gives the filesystem
700 * daemon ptrace-like capabilities over the requester process. This 713 * daemon ptrace-like capabilities over the requester process. This
701 * means, that the filesystem daemon is able to record the exact 714 * means, that the filesystem daemon is able to record the exact
@@ -724,30 +737,6 @@ static int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
724 return 0; 737 return 0;
725} 738}
726 739
727/*
728 * Check whether the inode attributes are still valid
729 *
730 * If the attribute validity timeout has expired, then fetch the fresh
731 * attributes with a 'getattr' request
732 *
733 * I'm not sure why cached attributes are never returned for the root
734 * inode, this is probably being too cautious.
735 */
736static int fuse_revalidate(struct dentry *entry)
737{
738 struct inode *inode = entry->d_inode;
739 struct fuse_inode *fi = get_fuse_inode(inode);
740 struct fuse_conn *fc = get_fuse_conn(inode);
741
742 if (!fuse_allow_task(fc, current))
743 return -EACCES;
744 if (get_node_id(inode) != FUSE_ROOT_ID &&
745 fi->i_time >= get_jiffies_64())
746 return 0;
747
748 return fuse_do_getattr(inode);
749}
750
751static int fuse_access(struct inode *inode, int mask) 740static int fuse_access(struct inode *inode, int mask)
752{ 741{
753 struct fuse_conn *fc = get_fuse_conn(inode); 742 struct fuse_conn *fc = get_fuse_conn(inode);
@@ -795,16 +784,31 @@ static int fuse_access(struct inode *inode, int mask)
795static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) 784static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
796{ 785{
797 struct fuse_conn *fc = get_fuse_conn(inode); 786 struct fuse_conn *fc = get_fuse_conn(inode);
787 bool refreshed = false;
788 int err = 0;
798 789
799 if (!fuse_allow_task(fc, current)) 790 if (!fuse_allow_task(fc, current))
800 return -EACCES; 791 return -EACCES;
801 else if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 792
793 /*
794 * If attributes are needed, refresh them before proceeding
795 */
796 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) ||
797 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
798 err = fuse_refresh_attributes(inode);
799 if (err)
800 return err;
801
802 refreshed = true;
803 }
804
805 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
802 int err = generic_permission(inode, mask, NULL); 806 int err = generic_permission(inode, mask, NULL);
803 807
804 /* If permission is denied, try to refresh file 808 /* If permission is denied, try to refresh file
805 attributes. This is also needed, because the root 809 attributes. This is also needed, because the root
806 node will at first have no permissions */ 810 node will at first have no permissions */
807 if (err == -EACCES) { 811 if (err == -EACCES && !refreshed) {
808 err = fuse_do_getattr(inode); 812 err = fuse_do_getattr(inode);
809 if (!err) 813 if (!err)
810 err = generic_permission(inode, mask, NULL); 814 err = generic_permission(inode, mask, NULL);
@@ -814,17 +818,19 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
814 exist. So if permissions are revoked this won't be 818 exist. So if permissions are revoked this won't be
815 noticed immediately, only after the attribute 819 noticed immediately, only after the attribute
816 timeout has expired */ 820 timeout has expired */
817 821 } else if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR))) {
818 return err; 822 err = fuse_access(inode, mask);
819 } else { 823 } else if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) {
820 int mode = inode->i_mode; 824 if (!(inode->i_mode & S_IXUGO)) {
821 if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) 825 if (refreshed)
822 return -EACCES; 826 return -EACCES;
823 827
824 if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR))) 828 err = fuse_do_getattr(inode);
825 return fuse_access(inode, mask); 829 if (!err && !(inode->i_mode & S_IXUGO))
826 return 0; 830 return -EACCES;
831 }
827 } 832 }
833 return err;
828} 834}
829 835
830static int parse_dirfile(char *buf, size_t nbytes, struct file *file, 836static 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)
859 struct page *page; 865 struct page *page;
860 struct inode *inode = file->f_path.dentry->d_inode; 866 struct inode *inode = file->f_path.dentry->d_inode;
861 struct fuse_conn *fc = get_fuse_conn(inode); 867 struct fuse_conn *fc = get_fuse_conn(inode);
868 struct fuse_file *ff = file->private_data;
862 struct fuse_req *req; 869 struct fuse_req *req;
863 870
864 if (is_bad_inode(inode)) 871 if (is_bad_inode(inode))
@@ -875,7 +882,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
875 } 882 }
876 req->num_pages = 1; 883 req->num_pages = 1;
877 req->pages[0] = page; 884 req->pages[0] = page;
878 fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); 885 fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
879 request_send(fc, req); 886 request_send(fc, req);
880 nbytes = req->out.args[0].size; 887 nbytes = req->out.args[0].size;
881 err = req->out.h.error; 888 err = req->out.h.error;
@@ -980,23 +987,6 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
980 } 987 }
981} 988}
982 989
983static void fuse_vmtruncate(struct inode *inode, loff_t offset)
984{
985 struct fuse_conn *fc = get_fuse_conn(inode);
986 int need_trunc;
987
988 spin_lock(&fc->lock);
989 need_trunc = inode->i_size > offset;
990 i_size_write(inode, offset);
991 spin_unlock(&fc->lock);
992
993 if (need_trunc) {
994 struct address_space *mapping = inode->i_mapping;
995 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
996 truncate_inode_pages(mapping, offset);
997 }
998}
999
1000/* 990/*
1001 * Set attributes, and at the same time refresh them. 991 * Set attributes, and at the same time refresh them.
1002 * 992 *
@@ -1014,7 +1004,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1014 struct fuse_setattr_in inarg; 1004 struct fuse_setattr_in inarg;
1015 struct fuse_attr_out outarg; 1005 struct fuse_attr_out outarg;
1016 int err; 1006 int err;
1017 int is_truncate = 0;
1018 1007
1019 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 1008 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
1020 err = inode_change_ok(inode, attr); 1009 err = inode_change_ok(inode, attr);
@@ -1024,7 +1013,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1024 1013
1025 if (attr->ia_valid & ATTR_SIZE) { 1014 if (attr->ia_valid & ATTR_SIZE) {
1026 unsigned long limit; 1015 unsigned long limit;
1027 is_truncate = 1;
1028 if (IS_SWAPFILE(inode)) 1016 if (IS_SWAPFILE(inode))
1029 return -ETXTBSY; 1017 return -ETXTBSY;
1030 limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; 1018 limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
@@ -1051,30 +1039,38 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1051 request_send(fc, req); 1039 request_send(fc, req);
1052 err = req->out.h.error; 1040 err = req->out.h.error;
1053 fuse_put_request(fc, req); 1041 fuse_put_request(fc, req);
1054 if (!err) { 1042 if (err) {
1055 if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) { 1043 if (err == -EINTR)
1056 make_bad_inode(inode); 1044 fuse_invalidate_attr(inode);
1057 err = -EIO; 1045 return err;
1058 } else { 1046 }
1059 if (is_truncate)
1060 fuse_vmtruncate(inode, outarg.attr.size);
1061 fuse_change_attributes(inode, &outarg.attr);
1062 fi->i_time = time_to_jiffies(outarg.attr_valid,
1063 outarg.attr_valid_nsec);
1064 }
1065 } else if (err == -EINTR)
1066 fuse_invalidate_attr(inode);
1067 1047
1068 return err; 1048 if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
1049 make_bad_inode(inode);
1050 return -EIO;
1051 }
1052
1053 fuse_change_attributes(inode, &outarg.attr);
1054 fi->i_time = time_to_jiffies(outarg.attr_valid, outarg.attr_valid_nsec);
1055 return 0;
1069} 1056}
1070 1057
1071static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, 1058static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1072 struct kstat *stat) 1059 struct kstat *stat)
1073{ 1060{
1074 struct inode *inode = entry->d_inode; 1061 struct inode *inode = entry->d_inode;
1075 int err = fuse_revalidate(entry); 1062 struct fuse_inode *fi = get_fuse_inode(inode);
1076 if (!err) 1063 struct fuse_conn *fc = get_fuse_conn(inode);
1064 int err;
1065
1066 if (!fuse_allow_task(fc, current))
1067 return -EACCES;
1068
1069 err = fuse_refresh_attributes(inode);
1070 if (!err) {
1077 generic_fillattr(inode, stat); 1071 generic_fillattr(inode, stat);
1072 stat->mode = fi->orig_i_mode;
1073 }
1078 1074
1079 return err; 1075 return err;
1080} 1076}
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 11f22a3d728a..c4b98c03a46e 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -54,6 +54,7 @@ struct fuse_file *fuse_file_alloc(void)
54 kfree(ff); 54 kfree(ff);
55 ff = NULL; 55 ff = NULL;
56 } 56 }
57 atomic_set(&ff->count, 0);
57 } 58 }
58 return ff; 59 return ff;
59} 60}
@@ -64,15 +65,39 @@ void fuse_file_free(struct fuse_file *ff)
64 kfree(ff); 65 kfree(ff);
65} 66}
66 67
68static struct fuse_file *fuse_file_get(struct fuse_file *ff)
69{
70 atomic_inc(&ff->count);
71 return ff;
72}
73
74static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
75{
76 dput(req->dentry);
77 mntput(req->vfsmount);
78 fuse_put_request(fc, req);
79}
80
81static void fuse_file_put(struct fuse_file *ff)
82{
83 if (atomic_dec_and_test(&ff->count)) {
84 struct fuse_req *req = ff->reserved_req;
85 struct fuse_conn *fc = get_fuse_conn(req->dentry->d_inode);
86 req->end = fuse_release_end;
87 request_send_background(fc, req);
88 kfree(ff);
89 }
90}
91
67void fuse_finish_open(struct inode *inode, struct file *file, 92void fuse_finish_open(struct inode *inode, struct file *file,
68 struct fuse_file *ff, struct fuse_open_out *outarg) 93 struct fuse_file *ff, struct fuse_open_out *outarg)
69{ 94{
70 if (outarg->open_flags & FOPEN_DIRECT_IO) 95 if (outarg->open_flags & FOPEN_DIRECT_IO)
71 file->f_op = &fuse_direct_io_file_operations; 96 file->f_op = &fuse_direct_io_file_operations;
72 if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) 97 if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
73 invalidate_mapping_pages(inode->i_mapping, 0, -1); 98 invalidate_inode_pages2(inode->i_mapping);
74 ff->fh = outarg->fh; 99 ff->fh = outarg->fh;
75 file->private_data = ff; 100 file->private_data = fuse_file_get(ff);
76} 101}
77 102
78int fuse_open_common(struct inode *inode, struct file *file, int isdir) 103int 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)
89 if (err) 114 if (err)
90 return err; 115 return err;
91 116
92 /* If opening the root node, no lookup has been performed on
93 it, so the attributes must be refreshed */
94 if (get_node_id(inode) == FUSE_ROOT_ID) {
95 err = fuse_do_getattr(inode);
96 if (err)
97 return err;
98 }
99
100 ff = fuse_file_alloc(); 117 ff = fuse_file_alloc();
101 if (!ff) 118 if (!ff)
102 return -ENOMEM; 119 return -ENOMEM;
@@ -113,8 +130,7 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
113 return err; 130 return err;
114} 131}
115 132
116struct fuse_req *fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, 133void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode)
117 int opcode)
118{ 134{
119 struct fuse_req *req = ff->reserved_req; 135 struct fuse_req *req = ff->reserved_req;
120 struct fuse_release_in *inarg = &req->misc.release_in; 136 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,
126 req->in.numargs = 1; 142 req->in.numargs = 1;
127 req->in.args[0].size = sizeof(struct fuse_release_in); 143 req->in.args[0].size = sizeof(struct fuse_release_in);
128 req->in.args[0].value = inarg; 144 req->in.args[0].value = inarg;
129 kfree(ff);
130
131 return req;
132} 145}
133 146
134int fuse_release_common(struct inode *inode, struct file *file, int isdir) 147int fuse_release_common(struct inode *inode, struct file *file, int isdir)
135{ 148{
136 struct fuse_file *ff = file->private_data; 149 struct fuse_file *ff = file->private_data;
137 if (ff) { 150 if (ff) {
138 struct fuse_conn *fc = get_fuse_conn(inode); 151 fuse_release_fill(ff, get_node_id(inode), file->f_flags,
139 struct fuse_req *req; 152 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
140
141 req = fuse_release_fill(ff, get_node_id(inode), file->f_flags,
142 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
143 153
144 /* Hold vfsmount and dentry until release is finished */ 154 /* Hold vfsmount and dentry until release is finished */
145 req->vfsmount = mntget(file->f_path.mnt); 155 ff->reserved_req->vfsmount = mntget(file->f_path.mnt);
146 req->dentry = dget(file->f_path.dentry); 156 ff->reserved_req->dentry = dget(file->f_path.dentry);
147 request_send_background(fc, req); 157 /*
158 * Normally this will send the RELEASE request,
159 * however if some asynchronous READ or WRITE requests
160 * are outstanding, the sending will be delayed
161 */
162 fuse_file_put(ff);
148 } 163 }
149 164
150 /* Return value is ignored by VFS */ 165 /* Return value is ignored by VFS */
@@ -264,10 +279,9 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync)
264 return fuse_fsync_common(file, de, datasync, 0); 279 return fuse_fsync_common(file, de, datasync, 0);
265} 280}
266 281
267void fuse_read_fill(struct fuse_req *req, struct file *file, 282void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
268 struct inode *inode, loff_t pos, size_t count, int opcode) 283 struct inode *inode, loff_t pos, size_t count, int opcode)
269{ 284{
270 struct fuse_file *ff = file->private_data;
271 struct fuse_read_in *inarg = &req->misc.read_in; 285 struct fuse_read_in *inarg = &req->misc.read_in;
272 286
273 inarg->fh = ff->fh; 287 inarg->fh = ff->fh;
@@ -288,7 +302,8 @@ static size_t fuse_send_read(struct fuse_req *req, struct file *file,
288 struct inode *inode, loff_t pos, size_t count) 302 struct inode *inode, loff_t pos, size_t count)
289{ 303{
290 struct fuse_conn *fc = get_fuse_conn(inode); 304 struct fuse_conn *fc = get_fuse_conn(inode);
291 fuse_read_fill(req, file, inode, pos, count, FUSE_READ); 305 struct fuse_file *ff = file->private_data;
306 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ);
292 request_send(fc, req); 307 request_send(fc, req);
293 return req->out.args[0].size; 308 return req->out.args[0].size;
294} 309}
@@ -337,20 +352,21 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
337 SetPageError(page); 352 SetPageError(page);
338 unlock_page(page); 353 unlock_page(page);
339 } 354 }
355 if (req->ff)
356 fuse_file_put(req->ff);
340 fuse_put_request(fc, req); 357 fuse_put_request(fc, req);
341} 358}
342 359
343static void fuse_send_readpages(struct fuse_req *req, struct file *file, 360static void fuse_send_readpages(struct fuse_req *req, struct fuse_file *ff,
344 struct inode *inode) 361 struct inode *inode)
345{ 362{
346 struct fuse_conn *fc = get_fuse_conn(inode); 363 struct fuse_conn *fc = get_fuse_conn(inode);
347 loff_t pos = page_offset(req->pages[0]); 364 loff_t pos = page_offset(req->pages[0]);
348 size_t count = req->num_pages << PAGE_CACHE_SHIFT; 365 size_t count = req->num_pages << PAGE_CACHE_SHIFT;
349 req->out.page_zeroing = 1; 366 req->out.page_zeroing = 1;
350 fuse_read_fill(req, file, inode, pos, count, FUSE_READ); 367 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ);
351 if (fc->async_read) { 368 if (fc->async_read) {
352 get_file(file); 369 req->ff = fuse_file_get(ff);
353 req->file = file;
354 req->end = fuse_readpages_end; 370 req->end = fuse_readpages_end;
355 request_send_background(fc, req); 371 request_send_background(fc, req);
356 } else { 372 } else {
@@ -359,15 +375,15 @@ static void fuse_send_readpages(struct fuse_req *req, struct file *file,
359 } 375 }
360} 376}
361 377
362struct fuse_readpages_data { 378struct fuse_fill_data {
363 struct fuse_req *req; 379 struct fuse_req *req;
364 struct file *file; 380 struct fuse_file *ff;
365 struct inode *inode; 381 struct inode *inode;
366}; 382};
367 383
368static int fuse_readpages_fill(void *_data, struct page *page) 384static int fuse_readpages_fill(void *_data, struct page *page)
369{ 385{
370 struct fuse_readpages_data *data = _data; 386 struct fuse_fill_data *data = _data;
371 struct fuse_req *req = data->req; 387 struct fuse_req *req = data->req;
372 struct inode *inode = data->inode; 388 struct inode *inode = data->inode;
373 struct fuse_conn *fc = get_fuse_conn(inode); 389 struct fuse_conn *fc = get_fuse_conn(inode);
@@ -376,7 +392,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
376 (req->num_pages == FUSE_MAX_PAGES_PER_REQ || 392 (req->num_pages == FUSE_MAX_PAGES_PER_REQ ||
377 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read || 393 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read ||
378 req->pages[req->num_pages - 1]->index + 1 != page->index)) { 394 req->pages[req->num_pages - 1]->index + 1 != page->index)) {
379 fuse_send_readpages(req, data->file, inode); 395 fuse_send_readpages(req, data->ff, inode);
380 data->req = req = fuse_get_req(fc); 396 data->req = req = fuse_get_req(fc);
381 if (IS_ERR(req)) { 397 if (IS_ERR(req)) {
382 unlock_page(page); 398 unlock_page(page);
@@ -393,14 +409,14 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
393{ 409{
394 struct inode *inode = mapping->host; 410 struct inode *inode = mapping->host;
395 struct fuse_conn *fc = get_fuse_conn(inode); 411 struct fuse_conn *fc = get_fuse_conn(inode);
396 struct fuse_readpages_data data; 412 struct fuse_fill_data data;
397 int err; 413 int err;
398 414
399 err = -EIO; 415 err = -EIO;
400 if (is_bad_inode(inode)) 416 if (is_bad_inode(inode))
401 goto out; 417 goto out;
402 418
403 data.file = file; 419 data.ff = file->private_data;
404 data.inode = inode; 420 data.inode = inode;
405 data.req = fuse_get_req(fc); 421 data.req = fuse_get_req(fc);
406 err = PTR_ERR(data.req); 422 err = PTR_ERR(data.req);
@@ -410,7 +426,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
410 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); 426 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
411 if (!err) { 427 if (!err) {
412 if (data.req->num_pages) 428 if (data.req->num_pages)
413 fuse_send_readpages(data.req, file, inode); 429 fuse_send_readpages(data.req, data.ff, inode);
414 else 430 else
415 fuse_put_request(fc, data.req); 431 fuse_put_request(fc, data.req);
416 } 432 }
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 68ae87cbafab..1764506fdd11 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -20,7 +20,10 @@
20#define FUSE_MAX_PAGES_PER_REQ 32 20#define FUSE_MAX_PAGES_PER_REQ 32
21 21
22/** Maximum number of outstanding background requests */ 22/** Maximum number of outstanding background requests */
23#define FUSE_MAX_BACKGROUND 10 23#define FUSE_MAX_BACKGROUND 12
24
25/** Congestion starts at 75% of maximum */
26#define FUSE_CONGESTION_THRESHOLD (FUSE_MAX_BACKGROUND * 75 / 100)
24 27
25/** It could be as large as PATH_MAX, but would that have any uses? */ 28/** It could be as large as PATH_MAX, but would that have any uses? */
26#define FUSE_NAME_MAX 1024 29#define FUSE_NAME_MAX 1024
@@ -60,6 +63,10 @@ struct fuse_inode {
60 63
61 /** Time in jiffies until the file attributes are valid */ 64 /** Time in jiffies until the file attributes are valid */
62 u64 i_time; 65 u64 i_time;
66
67 /** The sticky bit in inode->i_mode may have been removed, so
68 preserve the original mode */
69 mode_t orig_i_mode;
63}; 70};
64 71
65/** FUSE specific file data */ 72/** FUSE specific file data */
@@ -69,6 +76,9 @@ struct fuse_file {
69 76
70 /** File handle used by userspace */ 77 /** File handle used by userspace */
71 u64 fh; 78 u64 fh;
79
80 /** Refcount */
81 atomic_t count;
72}; 82};
73 83
74/** One input argument of a request */ 84/** One input argument of a request */
@@ -213,7 +223,7 @@ struct fuse_req {
213 unsigned page_offset; 223 unsigned page_offset;
214 224
215 /** File used in the request (or NULL) */ 225 /** File used in the request (or NULL) */
216 struct file *file; 226 struct fuse_file *ff;
217 227
218 /** vfsmount used in release */ 228 /** vfsmount used in release */
219 struct vfsmount *vfsmount; 229 struct vfsmount *vfsmount;
@@ -286,6 +296,9 @@ struct fuse_conn {
286 /** waitq for blocked connection */ 296 /** waitq for blocked connection */
287 wait_queue_head_t blocked_waitq; 297 wait_queue_head_t blocked_waitq;
288 298
299 /** waitq for reserved requests */
300 wait_queue_head_t reserved_req_waitq;
301
289 /** The next unique request id */ 302 /** The next unique request id */
290 u64 reqctr; 303 u64 reqctr;
291 304
@@ -414,7 +427,7 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
414/** 427/**
415 * Initialize READ or READDIR request 428 * Initialize READ or READDIR request
416 */ 429 */
417void fuse_read_fill(struct fuse_req *req, struct file *file, 430void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
418 struct inode *inode, loff_t pos, size_t count, int opcode); 431 struct inode *inode, loff_t pos, size_t count, int opcode);
419 432
420/** 433/**
@@ -427,9 +440,9 @@ void fuse_file_free(struct fuse_file *ff);
427void fuse_finish_open(struct inode *inode, struct file *file, 440void fuse_finish_open(struct inode *inode, struct file *file,
428 struct fuse_file *ff, struct fuse_open_out *outarg); 441 struct fuse_file *ff, struct fuse_open_out *outarg);
429 442
430/** */ 443/** Fill in ff->reserved_req with a RELEASE request */
431struct fuse_req *fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, 444void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode);
432 int opcode); 445
433/** 446/**
434 * Send RELEASE or RELEASEDIR request 447 * Send RELEASE or RELEASEDIR request
435 */ 448 */
@@ -524,11 +537,6 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req);
524void fuse_abort_conn(struct fuse_conn *fc); 537void fuse_abort_conn(struct fuse_conn *fc);
525 538
526/** 539/**
527 * Get the attributes of a file
528 */
529int fuse_do_getattr(struct inode *inode);
530
531/**
532 * Invalidate inode attributes 540 * Invalidate inode attributes
533 */ 541 */
534void fuse_invalidate_attr(struct inode *inode); 542void fuse_invalidate_attr(struct inode *inode);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5448f625ab56..fd0735715c14 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -109,20 +109,25 @@ static int fuse_remount_fs(struct super_block *sb, int *flags, char *data)
109 return 0; 109 return 0;
110} 110}
111 111
112static void fuse_truncate(struct address_space *mapping, loff_t offset)
113{
114 /* See vmtruncate() */
115 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
116 truncate_inode_pages(mapping, offset);
117 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
118}
119
112void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr) 120void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
113{ 121{
114 struct fuse_conn *fc = get_fuse_conn(inode); 122 struct fuse_conn *fc = get_fuse_conn(inode);
115 if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size) 123 struct fuse_inode *fi = get_fuse_inode(inode);
116 invalidate_mapping_pages(inode->i_mapping, 0, -1); 124 loff_t oldsize;
117 125
118 inode->i_ino = attr->ino; 126 inode->i_ino = attr->ino;
119 inode->i_mode = (inode->i_mode & S_IFMT) + (attr->mode & 07777); 127 inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
120 inode->i_nlink = attr->nlink; 128 inode->i_nlink = attr->nlink;
121 inode->i_uid = attr->uid; 129 inode->i_uid = attr->uid;
122 inode->i_gid = attr->gid; 130 inode->i_gid = attr->gid;
123 spin_lock(&fc->lock);
124 i_size_write(inode, attr->size);
125 spin_unlock(&fc->lock);
126 inode->i_blocks = attr->blocks; 131 inode->i_blocks = attr->blocks;
127 inode->i_atime.tv_sec = attr->atime; 132 inode->i_atime.tv_sec = attr->atime;
128 inode->i_atime.tv_nsec = attr->atimensec; 133 inode->i_atime.tv_nsec = attr->atimensec;
@@ -130,6 +135,26 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
130 inode->i_mtime.tv_nsec = attr->mtimensec; 135 inode->i_mtime.tv_nsec = attr->mtimensec;
131 inode->i_ctime.tv_sec = attr->ctime; 136 inode->i_ctime.tv_sec = attr->ctime;
132 inode->i_ctime.tv_nsec = attr->ctimensec; 137 inode->i_ctime.tv_nsec = attr->ctimensec;
138
139 /*
140 * Don't set the sticky bit in i_mode, unless we want the VFS
141 * to check permissions. This prevents failures due to the
142 * check in may_delete().
143 */
144 fi->orig_i_mode = inode->i_mode;
145 if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
146 inode->i_mode &= ~S_ISVTX;
147
148 spin_lock(&fc->lock);
149 oldsize = inode->i_size;
150 i_size_write(inode, attr->size);
151 spin_unlock(&fc->lock);
152
153 if (S_ISREG(inode->i_mode) && oldsize != attr->size) {
154 if (attr->size < oldsize)
155 fuse_truncate(inode->i_mapping, attr->size);
156 invalidate_inode_pages2(inode->i_mapping);
157 }
133} 158}
134 159
135static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr) 160static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr)
@@ -232,6 +257,7 @@ static void fuse_put_super(struct super_block *sb)
232 kill_fasync(&fc->fasync, SIGIO, POLL_IN); 257 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
233 wake_up_all(&fc->waitq); 258 wake_up_all(&fc->waitq);
234 wake_up_all(&fc->blocked_waitq); 259 wake_up_all(&fc->blocked_waitq);
260 wake_up_all(&fc->reserved_req_waitq);
235 mutex_lock(&fuse_mutex); 261 mutex_lock(&fuse_mutex);
236 list_del(&fc->entry); 262 list_del(&fc->entry);
237 fuse_ctl_remove_conn(fc); 263 fuse_ctl_remove_conn(fc);
@@ -401,6 +427,7 @@ static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt)
401static struct fuse_conn *new_conn(void) 427static struct fuse_conn *new_conn(void)
402{ 428{
403 struct fuse_conn *fc; 429 struct fuse_conn *fc;
430 int err;
404 431
405 fc = kzalloc(sizeof(*fc), GFP_KERNEL); 432 fc = kzalloc(sizeof(*fc), GFP_KERNEL);
406 if (fc) { 433 if (fc) {
@@ -409,6 +436,7 @@ static struct fuse_conn *new_conn(void)
409 atomic_set(&fc->count, 1); 436 atomic_set(&fc->count, 1);
410 init_waitqueue_head(&fc->waitq); 437 init_waitqueue_head(&fc->waitq);
411 init_waitqueue_head(&fc->blocked_waitq); 438 init_waitqueue_head(&fc->blocked_waitq);
439 init_waitqueue_head(&fc->reserved_req_waitq);
412 INIT_LIST_HEAD(&fc->pending); 440 INIT_LIST_HEAD(&fc->pending);
413 INIT_LIST_HEAD(&fc->processing); 441 INIT_LIST_HEAD(&fc->processing);
414 INIT_LIST_HEAD(&fc->io); 442 INIT_LIST_HEAD(&fc->io);
@@ -416,10 +444,17 @@ static struct fuse_conn *new_conn(void)
416 atomic_set(&fc->num_waiting, 0); 444 atomic_set(&fc->num_waiting, 0);
417 fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 445 fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
418 fc->bdi.unplug_io_fn = default_unplug_io_fn; 446 fc->bdi.unplug_io_fn = default_unplug_io_fn;
447 err = bdi_init(&fc->bdi);
448 if (err) {
449 kfree(fc);
450 fc = NULL;
451 goto out;
452 }
419 fc->reqctr = 0; 453 fc->reqctr = 0;
420 fc->blocked = 1; 454 fc->blocked = 1;
421 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); 455 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
422 } 456 }
457out:
423 return fc; 458 return fc;
424} 459}
425 460
@@ -429,6 +464,7 @@ void fuse_conn_put(struct fuse_conn *fc)
429 if (fc->destroy_req) 464 if (fc->destroy_req)
430 fuse_request_free(fc->destroy_req); 465 fuse_request_free(fc->destroy_req);
431 mutex_destroy(&fc->inst_mutex); 466 mutex_destroy(&fc->inst_mutex);
467 bdi_destroy(&fc->bdi);
432 kfree(fc); 468 kfree(fc);
433 } 469 }
434} 470}
@@ -446,6 +482,7 @@ static struct inode *get_root_inode(struct super_block *sb, unsigned mode)
446 482
447 attr.mode = mode; 483 attr.mode = mode;
448 attr.ino = FUSE_ROOT_ID; 484 attr.ino = FUSE_ROOT_ID;
485 attr.nlink = 1;
449 return fuse_iget(sb, 1, 0, &attr); 486 return fuse_iget(sb, 1, 0, &attr);
450} 487}
451 488
@@ -683,8 +720,7 @@ static inline void unregister_fuseblk(void)
683static decl_subsys(fuse, NULL, NULL); 720static decl_subsys(fuse, NULL, NULL);
684static decl_subsys(connections, NULL, NULL); 721static decl_subsys(connections, NULL, NULL);
685 722
686static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep, 723static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
687 unsigned long flags)
688{ 724{
689 struct inode * inode = foo; 725 struct inode * inode = foo;
690 726
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 79c91fd8381b..7ecfe0d3a491 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -24,7 +24,7 @@
24#include "util.h" 24#include "util.h"
25#include "glock.h" 25#include "glock.h"
26 26
27static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 27static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo)
28{ 28{
29 struct gfs2_inode *ip = foo; 29 struct gfs2_inode *ip = foo;
30 30
@@ -34,7 +34,7 @@ static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned
34 memset(ip->i_cache, 0, sizeof(ip->i_cache)); 34 memset(ip->i_cache, 0, sizeof(ip->i_cache));
35} 35}
36 36
37static void gfs2_init_glock_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 37static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo)
38{ 38{
39 struct gfs2_glock *gl = foo; 39 struct gfs2_glock *gl = foo;
40 40
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 7eb4b280ac66..bb11fd6752d3 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -406,7 +406,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
406 406
407 if (!(file->f_flags & O_LARGEFILE) && 407 if (!(file->f_flags & O_LARGEFILE) &&
408 ip->i_di.di_size > MAX_NON_LFS) { 408 ip->i_di.di_size > MAX_NON_LFS) {
409 error = -EFBIG; 409 error = -EOVERFLOW;
410 goto fail_gunlock; 410 goto fail_gunlock;
411 } 411 }
412 412
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 6c5f92dfb500..16cbd902f8b9 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -430,7 +430,7 @@ static struct file_system_type hfs_fs_type = {
430 .fs_flags = FS_REQUIRES_DEV, 430 .fs_flags = FS_REQUIRES_DEV,
431}; 431};
432 432
433static void hfs_init_once(void *p, struct kmem_cache *cachep, unsigned long flags) 433static void hfs_init_once(struct kmem_cache *cachep, void *p)
434{ 434{
435 struct hfs_inode_info *i = p; 435 struct hfs_inode_info *i = p;
436 436
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 7b0f2e5a44e2..ecf70dafb643 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -466,7 +466,7 @@ static struct file_system_type hfsplus_fs_type = {
466 .fs_flags = FS_REQUIRES_DEV, 466 .fs_flags = FS_REQUIRES_DEV,
467}; 467};
468 468
469static void hfsplus_init_once(void *p, struct kmem_cache *cachep, unsigned long flags) 469static void hfsplus_init_once(struct kmem_cache *cachep, void *p)
470{ 470{
471 struct hfsplus_inode_info *i = p; 471 struct hfsplus_inode_info *i = p;
472 472
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 89612ee7c80d..00971d999964 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -173,7 +173,7 @@ static void hpfs_destroy_inode(struct inode *inode)
173 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode)); 173 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
174} 174}
175 175
176static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 176static void init_once(struct kmem_cache *cachep, void *foo)
177{ 177{
178 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; 178 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
179 179
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 04598e12c489..12aca8ed605f 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -384,7 +384,7 @@ static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock)
384 struct super_block *sb = inode->i_sb; 384 struct super_block *sb = inode->i_sb;
385 385
386 if (!hlist_unhashed(&inode->i_hash)) { 386 if (!hlist_unhashed(&inode->i_hash)) {
387 if (!(inode->i_state & (I_DIRTY|I_LOCK))) 387 if (!(inode->i_state & (I_DIRTY|I_SYNC)))
388 list_move(&inode->i_list, &inode_unused); 388 list_move(&inode->i_list, &inode_unused);
389 inodes_stat.nr_unused++; 389 inodes_stat.nr_unused++;
390 if (!sb || (sb->s_flags & MS_ACTIVE)) { 390 if (!sb || (sb->s_flags & MS_ACTIVE)) {
@@ -697,7 +697,7 @@ static const struct address_space_operations hugetlbfs_aops = {
697}; 697};
698 698
699 699
700static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 700static void init_once(struct kmem_cache *cachep, void *foo)
701{ 701{
702 struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; 702 struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;
703 703
@@ -933,16 +933,11 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
933 if (!dentry) 933 if (!dentry)
934 goto out_shm_unlock; 934 goto out_shm_unlock;
935 935
936 error = -ENFILE;
937 file = get_empty_filp();
938 if (!file)
939 goto out_dentry;
940
941 error = -ENOSPC; 936 error = -ENOSPC;
942 inode = hugetlbfs_get_inode(root->d_sb, current->fsuid, 937 inode = hugetlbfs_get_inode(root->d_sb, current->fsuid,
943 current->fsgid, S_IFREG | S_IRWXUGO, 0); 938 current->fsgid, S_IFREG | S_IRWXUGO, 0);
944 if (!inode) 939 if (!inode)
945 goto out_file; 940 goto out_dentry;
946 941
947 error = -ENOMEM; 942 error = -ENOMEM;
948 if (hugetlb_reserve_pages(inode, 0, size >> HPAGE_SHIFT)) 943 if (hugetlb_reserve_pages(inode, 0, size >> HPAGE_SHIFT))
@@ -951,17 +946,18 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
951 d_instantiate(dentry, inode); 946 d_instantiate(dentry, inode);
952 inode->i_size = size; 947 inode->i_size = size;
953 inode->i_nlink = 0; 948 inode->i_nlink = 0;
954 file->f_path.mnt = mntget(hugetlbfs_vfsmount); 949
955 file->f_path.dentry = dentry; 950 error = -ENFILE;
956 file->f_mapping = inode->i_mapping; 951 file = alloc_file(hugetlbfs_vfsmount, dentry,
957 file->f_op = &hugetlbfs_file_operations; 952 FMODE_WRITE | FMODE_READ,
958 file->f_mode = FMODE_WRITE | FMODE_READ; 953 &hugetlbfs_file_operations);
954 if (!file)
955 goto out_inode;
956
959 return file; 957 return file;
960 958
961out_inode: 959out_inode:
962 iput(inode); 960 iput(inode);
963out_file:
964 put_filp(file);
965out_dentry: 961out_dentry:
966 dput(dentry); 962 dput(dentry);
967out_shm_unlock: 963out_shm_unlock:
@@ -974,11 +970,15 @@ static int __init init_hugetlbfs_fs(void)
974 int error; 970 int error;
975 struct vfsmount *vfsmount; 971 struct vfsmount *vfsmount;
976 972
973 error = bdi_init(&hugetlbfs_backing_dev_info);
974 if (error)
975 return error;
976
977 hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache", 977 hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
978 sizeof(struct hugetlbfs_inode_info), 978 sizeof(struct hugetlbfs_inode_info),
979 0, 0, init_once); 979 0, 0, init_once);
980 if (hugetlbfs_inode_cachep == NULL) 980 if (hugetlbfs_inode_cachep == NULL)
981 return -ENOMEM; 981 goto out2;
982 982
983 error = register_filesystem(&hugetlbfs_fs_type); 983 error = register_filesystem(&hugetlbfs_fs_type);
984 if (error) 984 if (error)
@@ -996,6 +996,8 @@ static int __init init_hugetlbfs_fs(void)
996 out: 996 out:
997 if (error) 997 if (error)
998 kmem_cache_destroy(hugetlbfs_inode_cachep); 998 kmem_cache_destroy(hugetlbfs_inode_cachep);
999 out2:
1000 bdi_destroy(&hugetlbfs_backing_dev_info);
999 return error; 1001 return error;
1000} 1002}
1001 1003
@@ -1003,6 +1005,7 @@ static void __exit exit_hugetlbfs_fs(void)
1003{ 1005{
1004 kmem_cache_destroy(hugetlbfs_inode_cachep); 1006 kmem_cache_destroy(hugetlbfs_inode_cachep);
1005 unregister_filesystem(&hugetlbfs_fs_type); 1007 unregister_filesystem(&hugetlbfs_fs_type);
1008 bdi_destroy(&hugetlbfs_backing_dev_info);
1006} 1009}
1007 1010
1008module_init(init_hugetlbfs_fs) 1011module_init(init_hugetlbfs_fs)
diff --git a/fs/inode.c b/fs/inode.c
index 21dab18b2f18..ed35383d0b6c 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -99,6 +99,15 @@ struct inodes_stat_t inodes_stat;
99 99
100static struct kmem_cache * inode_cachep __read_mostly; 100static struct kmem_cache * inode_cachep __read_mostly;
101 101
102static void wake_up_inode(struct inode *inode)
103{
104 /*
105 * Prevent speculative execution through spin_unlock(&inode_lock);
106 */
107 smp_mb();
108 wake_up_bit(&inode->i_state, __I_LOCK);
109}
110
102static struct inode *alloc_inode(struct super_block *sb) 111static struct inode *alloc_inode(struct super_block *sb)
103{ 112{
104 static const struct address_space_operations empty_aops; 113 static const struct address_space_operations empty_aops;
@@ -215,7 +224,7 @@ void inode_init_once(struct inode *inode)
215 224
216EXPORT_SYMBOL(inode_init_once); 225EXPORT_SYMBOL(inode_init_once);
217 226
218static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 227static void init_once(struct kmem_cache * cachep, void *foo)
219{ 228{
220 struct inode * inode = (struct inode *) foo; 229 struct inode * inode = (struct inode *) foo;
221 230
@@ -232,7 +241,7 @@ void __iget(struct inode * inode)
232 return; 241 return;
233 } 242 }
234 atomic_inc(&inode->i_count); 243 atomic_inc(&inode->i_count);
235 if (!(inode->i_state & (I_DIRTY|I_LOCK))) 244 if (!(inode->i_state & (I_DIRTY|I_SYNC)))
236 list_move(&inode->i_list, &inode_in_use); 245 list_move(&inode->i_list, &inode_in_use);
237 inodes_stat.nr_unused--; 246 inodes_stat.nr_unused--;
238} 247}
@@ -253,7 +262,7 @@ void clear_inode(struct inode *inode)
253 BUG_ON(inode->i_data.nrpages); 262 BUG_ON(inode->i_data.nrpages);
254 BUG_ON(!(inode->i_state & I_FREEING)); 263 BUG_ON(!(inode->i_state & I_FREEING));
255 BUG_ON(inode->i_state & I_CLEAR); 264 BUG_ON(inode->i_state & I_CLEAR);
256 wait_on_inode(inode); 265 inode_sync_wait(inode);
257 DQUOT_DROP(inode); 266 DQUOT_DROP(inode);
258 if (inode->i_sb->s_op->clear_inode) 267 if (inode->i_sb->s_op->clear_inode)
259 inode->i_sb->s_op->clear_inode(inode); 268 inode->i_sb->s_op->clear_inode(inode);
@@ -1071,7 +1080,7 @@ static void generic_forget_inode(struct inode *inode)
1071 struct super_block *sb = inode->i_sb; 1080 struct super_block *sb = inode->i_sb;
1072 1081
1073 if (!hlist_unhashed(&inode->i_hash)) { 1082 if (!hlist_unhashed(&inode->i_hash)) {
1074 if (!(inode->i_state & (I_DIRTY|I_LOCK))) 1083 if (!(inode->i_state & (I_DIRTY|I_SYNC)))
1075 list_move(&inode->i_list, &inode_unused); 1084 list_move(&inode->i_list, &inode_unused);
1076 inodes_stat.nr_unused++; 1085 inodes_stat.nr_unused++;
1077 if (sb->s_flags & MS_ACTIVE) { 1086 if (sb->s_flags & MS_ACTIVE) {
@@ -1314,15 +1323,6 @@ static void __wait_on_freeing_inode(struct inode *inode)
1314 spin_lock(&inode_lock); 1323 spin_lock(&inode_lock);
1315} 1324}
1316 1325
1317void wake_up_inode(struct inode *inode)
1318{
1319 /*
1320 * Prevent speculative execution through spin_unlock(&inode_lock);
1321 */
1322 smp_mb();
1323 wake_up_bit(&inode->i_state, __I_LOCK);
1324}
1325
1326/* 1326/*
1327 * We rarely want to lock two inodes that do not have a parent/child 1327 * We rarely want to lock two inodes that do not have a parent/child
1328 * relationship (such as directory, child inode) simultaneously. The 1328 * relationship (such as directory, child inode) simultaneously. The
@@ -1396,7 +1396,7 @@ void __init inode_init_early(void)
1396 INIT_HLIST_HEAD(&inode_hashtable[loop]); 1396 INIT_HLIST_HEAD(&inode_hashtable[loop]);
1397} 1397}
1398 1398
1399void __init inode_init(unsigned long mempages) 1399void __init inode_init(void)
1400{ 1400{
1401 int loop; 1401 int loop;
1402 1402
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 9bf2f6c09df6..5e009331c01f 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -31,6 +31,7 @@
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/inotify.h> 32#include <linux/inotify.h>
33#include <linux/syscalls.h> 33#include <linux/syscalls.h>
34#include <linux/magic.h>
34 35
35#include <asm/ioctls.h> 36#include <asm/ioctls.h>
36 37
@@ -684,7 +685,8 @@ static int
684inotify_get_sb(struct file_system_type *fs_type, int flags, 685inotify_get_sb(struct file_system_type *fs_type, int flags,
685 const char *dev_name, void *data, struct vfsmount *mnt) 686 const char *dev_name, void *data, struct vfsmount *mnt)
686{ 687{
687 return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA, mnt); 688 return get_sb_pseudo(fs_type, "inotify", NULL,
689 INOTIFYFS_SUPER_MAGIC, mnt);
688} 690}
689 691
690static struct file_system_type inotify_fs_type = { 692static struct file_system_type inotify_fs_type = {
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 6bbbdb53581d..37dbd6404787 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -33,7 +33,7 @@ static char zisofs_sink_page[PAGE_CACHE_SIZE];
33 * allocation; this avoids failures at block-decompression time. 33 * allocation; this avoids failures at block-decompression time.
34 */ 34 */
35static void *zisofs_zlib_workspace; 35static void *zisofs_zlib_workspace;
36static struct semaphore zisofs_zlib_semaphore; 36static DEFINE_MUTEX(zisofs_zlib_lock);
37 37
38/* 38/*
39 * When decompressing, we typically obtain more than one page 39 * When decompressing, we typically obtain more than one page
@@ -180,9 +180,9 @@ static int zisofs_readpage(struct file *file, struct page *page)
180 180
181 /* First block is special since it may be fractional. 181 /* First block is special since it may be fractional.
182 We also wait for it before grabbing the zlib 182 We also wait for it before grabbing the zlib
183 semaphore; odds are that the subsequent blocks are 183 mutex; odds are that the subsequent blocks are
184 going to come in in short order so we don't hold 184 going to come in in short order so we don't hold
185 the zlib semaphore longer than necessary. */ 185 the zlib mutex longer than necessary. */
186 186
187 if ( !bh || (wait_on_buffer(bh), !buffer_uptodate(bh)) ) { 187 if ( !bh || (wait_on_buffer(bh), !buffer_uptodate(bh)) ) {
188 printk(KERN_DEBUG "zisofs: Hit null buffer, fpage = %d, xpage = %d, csize = %ld\n", 188 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)
194 csize -= stream.avail_in; 194 csize -= stream.avail_in;
195 195
196 stream.workspace = zisofs_zlib_workspace; 196 stream.workspace = zisofs_zlib_workspace;
197 down(&zisofs_zlib_semaphore); 197 mutex_lock(&zisofs_zlib_lock);
198 198
199 zerr = zlib_inflateInit(&stream); 199 zerr = zlib_inflateInit(&stream);
200 if ( zerr != Z_OK ) { 200 if ( zerr != Z_OK ) {
@@ -281,7 +281,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
281 zlib_inflateEnd(&stream); 281 zlib_inflateEnd(&stream);
282 282
283 z_eio: 283 z_eio:
284 up(&zisofs_zlib_semaphore); 284 mutex_unlock(&zisofs_zlib_lock);
285 285
286 b_eio: 286 b_eio:
287 for ( i = 0 ; i < haveblocks ; i++ ) { 287 for ( i = 0 ; i < haveblocks ; i++ ) {
@@ -317,31 +317,16 @@ const struct address_space_operations zisofs_aops = {
317 /* No bmap operation supported */ 317 /* No bmap operation supported */
318}; 318};
319 319
320static int initialized;
321
322int __init zisofs_init(void) 320int __init zisofs_init(void)
323{ 321{
324 if ( initialized ) {
325 printk("zisofs_init: called more than once\n");
326 return 0;
327 }
328
329 zisofs_zlib_workspace = vmalloc(zlib_inflate_workspacesize()); 322 zisofs_zlib_workspace = vmalloc(zlib_inflate_workspacesize());
330 if ( !zisofs_zlib_workspace ) 323 if ( !zisofs_zlib_workspace )
331 return -ENOMEM; 324 return -ENOMEM;
332 init_MUTEX(&zisofs_zlib_semaphore);
333 325
334 initialized = 1;
335 return 0; 326 return 0;
336} 327}
337 328
338void zisofs_cleanup(void) 329void zisofs_cleanup(void)
339{ 330{
340 if ( !initialized ) {
341 printk("zisofs_cleanup: called without initialization\n");
342 return;
343 }
344
345 vfree(zisofs_zlib_workspace); 331 vfree(zisofs_zlib_workspace);
346 initialized = 0;
347} 332}
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 043b470fd3b6..aa359a2e4ce6 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -73,7 +73,7 @@ static void isofs_destroy_inode(struct inode *inode)
73 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 73 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
74} 74}
75 75
76static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 76static void init_once(struct kmem_cache *cachep, void *foo)
77{ 77{
78 struct iso_inode_info *ei = foo; 78 struct iso_inode_info *ei = foo;
79 79
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index c8c7e5138a01..e2b4dad39ca9 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -158,7 +158,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
158struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 158struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
159{ 159{
160 int found; 160 int found;
161 unsigned long block, offset; 161 unsigned long uninitialized_var(block);
162 unsigned long uninitialized_var(offset);
162 struct inode *inode; 163 struct inode *inode;
163 struct page *page; 164 struct page *page;
164 165
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index be2b70c2ec16..ffa447511e6a 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -43,7 +43,7 @@ static void jffs2_destroy_inode(struct inode *inode)
43 kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); 43 kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
44} 44}
45 45
46static void jffs2_i_init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 46static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo)
47{ 47{
48 struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo; 48 struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo;
49 49
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 941369c1ac8d..f5cd8d38af7a 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -180,7 +180,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)
180 180
181#endif 181#endif
182 182
183static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 183static void init_once(struct kmem_cache *cachep, void *foo)
184{ 184{
185 struct metapage *mp = (struct metapage *)foo; 185 struct metapage *mp = (struct metapage *)foo;
186 186
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 7aa1f7004eaf..e7c60ae6b5b2 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1289,7 +1289,14 @@ int txCommit(tid_t tid, /* transaction identifier */
1289 * commit the transaction synchronously, so the last iput 1289 * commit the transaction synchronously, so the last iput
1290 * will be done by the calling thread (or later) 1290 * will be done by the calling thread (or later)
1291 */ 1291 */
1292 if (tblk->u.ip->i_state & I_LOCK) 1292 /*
1293 * I believe this code is no longer needed. Splitting I_LOCK
1294 * into two bits, I_LOCK and I_SYNC should prevent this
1295 * deadlock as well. But since I don't have a JFS testload
1296 * to verify this, only a trivial s/I_LOCK/I_SYNC/ was done.
1297 * Joern
1298 */
1299 if (tblk->u.ip->i_state & I_SYNC)
1293 tblk->xflag &= ~COMMIT_LAZY; 1300 tblk->xflag &= ~COMMIT_LAZY;
1294 } 1301 }
1295 1302
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 4b372f550652..cff60c171943 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -750,7 +750,7 @@ static struct file_system_type jfs_fs_type = {
750 .fs_flags = FS_REQUIRES_DEV, 750 .fs_flags = FS_REQUIRES_DEV,
751}; 751};
752 752
753static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags) 753static void init_once(struct kmem_cache *cachep, void *foo)
754{ 754{
755 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; 755 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
756 756
diff --git a/fs/libfs.c b/fs/libfs.c
index f2b32d3a9093..ae51481e45e5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -371,8 +371,8 @@ int simple_write_begin(struct file *file, struct address_space *mapping,
371 return simple_prepare_write(file, page, from, from+len); 371 return simple_prepare_write(file, page, from, from+len);
372} 372}
373 373
374int simple_commit_write(struct file *file, struct page *page, 374static int simple_commit_write(struct file *file, struct page *page,
375 unsigned from, unsigned to) 375 unsigned from, unsigned to)
376{ 376{
377 struct inode *inode = page->mapping->host; 377 struct inode *inode = page->mapping->host;
378 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; 378 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
@@ -686,7 +686,6 @@ EXPORT_SYMBOL(generic_read_dir);
686EXPORT_SYMBOL(get_sb_pseudo); 686EXPORT_SYMBOL(get_sb_pseudo);
687EXPORT_SYMBOL(simple_write_begin); 687EXPORT_SYMBOL(simple_write_begin);
688EXPORT_SYMBOL(simple_write_end); 688EXPORT_SYMBOL(simple_write_end);
689EXPORT_SYMBOL(simple_commit_write);
690EXPORT_SYMBOL(simple_dir_inode_operations); 689EXPORT_SYMBOL(simple_dir_inode_operations);
691EXPORT_SYMBOL(simple_dir_operations); 690EXPORT_SYMBOL(simple_dir_operations);
692EXPORT_SYMBOL(simple_empty); 691EXPORT_SYMBOL(simple_empty);
diff --git a/fs/locks.c b/fs/locks.c
index 7f9a3ea47418..0127a2846819 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(locks_init_lock);
199 * Initialises the fields of the file lock which are invariant for 199 * Initialises the fields of the file lock which are invariant for
200 * free file_locks. 200 * free file_locks.
201 */ 201 */
202static void init_once(void *foo, struct kmem_cache *cache, unsigned long flags) 202static void init_once(struct kmem_cache *cache, void *foo)
203{ 203{
204 struct file_lock *lock = (struct file_lock *) foo; 204 struct file_lock *lock = (struct file_lock *) foo;
205 205
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index 99a12f127769..703cc35e04b9 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -17,7 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19 19
20static int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 }; 20static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 };
21 21
22static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits) 22static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits)
23{ 23{
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index f4f3343b1800..bf4cd316af81 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -69,7 +69,7 @@ static void minix_destroy_inode(struct inode *inode)
69 kmem_cache_free(minix_inode_cachep, minix_i(inode)); 69 kmem_cache_free(minix_inode_cachep, minix_i(inode));
70} 70}
71 71
72static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 72static void init_once(struct kmem_cache * cachep, void *foo)
73{ 73{
74 struct minix_inode_info *ei = (struct minix_inode_info *) foo; 74 struct minix_inode_info *ei = (struct minix_inode_info *) foo;
75 75
diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c
index 1a5f3bf0bcec..82d6554b02fe 100644
--- a/fs/minix/itree_v1.c
+++ b/fs/minix/itree_v1.c
@@ -23,11 +23,16 @@ static inline block_t *i_data(struct inode *inode)
23static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) 23static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
24{ 24{
25 int n = 0; 25 int n = 0;
26 char b[BDEVNAME_SIZE];
26 27
27 if (block < 0) { 28 if (block < 0) {
28 printk("minix_bmap: block<0\n"); 29 printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
30 block, bdevname(inode->i_sb->s_bdev, b));
29 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { 31 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
30 printk("minix_bmap: block>big\n"); 32 if (printk_ratelimit())
33 printk("MINIX-fs: block_to_path: "
34 "block %ld too big on dev %s\n",
35 block, bdevname(inode->i_sb->s_bdev, b));
31 } else if (block < 7) { 36 } else if (block < 7) {
32 offsets[n++] = block; 37 offsets[n++] = block;
33 } else if ((block -= 7) < 512) { 38 } else if ((block -= 7) < 512) {
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c
index ad8f0dec4ef4..f23010969369 100644
--- a/fs/minix/itree_v2.c
+++ b/fs/minix/itree_v2.c
@@ -23,12 +23,17 @@ static inline block_t *i_data(struct inode *inode)
23static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) 23static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
24{ 24{
25 int n = 0; 25 int n = 0;
26 char b[BDEVNAME_SIZE];
26 struct super_block *sb = inode->i_sb; 27 struct super_block *sb = inode->i_sb;
27 28
28 if (block < 0) { 29 if (block < 0) {
29 printk("minix_bmap: block<0\n"); 30 printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
31 block, bdevname(sb->s_bdev, b));
30 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) { 32 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) {
31 printk("minix_bmap: block>big\n"); 33 if (printk_ratelimit())
34 printk("MINIX-fs: block_to_path: "
35 "block %ld too big on dev %s\n",
36 block, bdevname(sb->s_bdev, b));
32 } else if (block < 7) { 37 } else if (block < 7) {
33 offsets[n++] = block; 38 offsets[n++] = block;
34 } else if ((block -= 7) < 256) { 39 } else if ((block -= 7) < 256) {
diff --git a/fs/namei.c b/fs/namei.c
index b40b8084eefc..464eeccb675b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -30,7 +30,6 @@
30#include <linux/capability.h> 30#include <linux/capability.h>
31#include <linux/file.h> 31#include <linux/file.h>
32#include <linux/fcntl.h> 32#include <linux/fcntl.h>
33#include <linux/namei.h>
34#include <asm/namei.h> 33#include <asm/namei.h>
35#include <asm/uaccess.h> 34#include <asm/uaccess.h>
36 35
@@ -228,10 +227,14 @@ int generic_permission(struct inode *inode, int mask,
228 227
229int permission(struct inode *inode, int mask, struct nameidata *nd) 228int permission(struct inode *inode, int mask, struct nameidata *nd)
230{ 229{
231 umode_t mode = inode->i_mode;
232 int retval, submask; 230 int retval, submask;
231 struct vfsmount *mnt = NULL;
232
233 if (nd)
234 mnt = nd->mnt;
233 235
234 if (mask & MAY_WRITE) { 236 if (mask & MAY_WRITE) {
237 umode_t mode = inode->i_mode;
235 238
236 /* 239 /*
237 * Nobody gets write access to a read-only fs. 240 * Nobody gets write access to a read-only fs.
@@ -247,22 +250,34 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
247 return -EACCES; 250 return -EACCES;
248 } 251 }
249 252
250 253 if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) {
251 /* 254 /*
252 * MAY_EXEC on regular files requires special handling: We override 255 * MAY_EXEC on regular files is denied if the fs is mounted
253 * filesystem execute permissions if the mode bits aren't set or 256 * with the "noexec" flag.
254 * the fs is mounted with the "noexec" flag. 257 */
255 */ 258 if (mnt && (mnt->mnt_flags & MNT_NOEXEC))
256 if ((mask & MAY_EXEC) && S_ISREG(mode) && (!(mode & S_IXUGO) || 259 return -EACCES;
257 (nd && nd->mnt && (nd->mnt->mnt_flags & MNT_NOEXEC)))) 260 }
258 return -EACCES;
259 261
260 /* Ordinary permission routines do not understand MAY_APPEND. */ 262 /* Ordinary permission routines do not understand MAY_APPEND. */
261 submask = mask & ~MAY_APPEND; 263 submask = mask & ~MAY_APPEND;
262 if (inode->i_op && inode->i_op->permission) 264 if (inode->i_op && inode->i_op->permission) {
263 retval = inode->i_op->permission(inode, submask, nd); 265 retval = inode->i_op->permission(inode, submask, nd);
264 else 266 if (!retval) {
267 /*
268 * Exec permission on a regular file is denied if none
269 * of the execute bits are set.
270 *
271 * This check should be done by the ->permission()
272 * method.
273 */
274 if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode) &&
275 !(inode->i_mode & S_IXUGO))
276 return -EACCES;
277 }
278 } else {
265 retval = generic_permission(inode, submask, NULL); 279 retval = generic_permission(inode, submask, NULL);
280 }
266 if (retval) 281 if (retval)
267 return retval; 282 return retval;
268 283
@@ -1273,7 +1288,8 @@ int __user_path_lookup_open(const char __user *name, unsigned int lookup_flags,
1273 return err; 1288 return err;
1274} 1289}
1275 1290
1276static inline struct dentry *__lookup_hash_kern(struct qstr *name, struct dentry *base, struct nameidata *nd) 1291static struct dentry *__lookup_hash(struct qstr *name,
1292 struct dentry *base, struct nameidata *nd)
1277{ 1293{
1278 struct dentry *dentry; 1294 struct dentry *dentry;
1279 struct inode *inode; 1295 struct inode *inode;
@@ -1313,31 +1329,18 @@ out:
1313 * needs parent already locked. Doesn't follow mounts. 1329 * needs parent already locked. Doesn't follow mounts.
1314 * SMP-safe. 1330 * SMP-safe.
1315 */ 1331 */
1316static inline struct dentry * __lookup_hash(struct qstr *name, struct dentry *base, struct nameidata *nd) 1332static struct dentry *lookup_hash(struct nameidata *nd)
1317{ 1333{
1318 struct dentry *dentry;
1319 struct inode *inode;
1320 int err; 1334 int err;
1321 1335
1322 inode = base->d_inode; 1336 err = permission(nd->dentry->d_inode, MAY_EXEC, nd);
1323
1324 err = permission(inode, MAY_EXEC, nd);
1325 dentry = ERR_PTR(err);
1326 if (err) 1337 if (err)
1327 goto out; 1338 return ERR_PTR(err);
1328
1329 dentry = __lookup_hash_kern(name, base, nd);
1330out:
1331 return dentry;
1332}
1333
1334static struct dentry *lookup_hash(struct nameidata *nd)
1335{
1336 return __lookup_hash(&nd->last, nd->dentry, nd); 1339 return __lookup_hash(&nd->last, nd->dentry, nd);
1337} 1340}
1338 1341
1339/* SMP-safe */ 1342static int __lookup_one_len(const char *name, struct qstr *this,
1340static inline int __lookup_one_len(const char *name, struct qstr *this, struct dentry *base, int len) 1343 struct dentry *base, int len)
1341{ 1344{
1342 unsigned long hash; 1345 unsigned long hash;
1343 unsigned int c; 1346 unsigned int c;
@@ -1358,6 +1361,17 @@ static inline int __lookup_one_len(const char *name, struct qstr *this, struct d
1358 return 0; 1361 return 0;
1359} 1362}
1360 1363
1364/**
1365 * lookup_one_len: filesystem helper to lookup single pathname component
1366 * @name: pathname component to lookup
1367 * @base: base directory to lookup from
1368 * @len: maximum length @len should be interpreted to
1369 *
1370 * Note that this routine is purely a helper for filesystem useage and should
1371 * not be called by generic code. Also note that by using this function to
1372 * nameidata argument is passed to the filesystem methods and a filesystem
1373 * using this helper needs to be prepared for that.
1374 */
1361struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) 1375struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
1362{ 1376{
1363 int err; 1377 int err;
@@ -1366,18 +1380,33 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
1366 err = __lookup_one_len(name, &this, base, len); 1380 err = __lookup_one_len(name, &this, base, len);
1367 if (err) 1381 if (err)
1368 return ERR_PTR(err); 1382 return ERR_PTR(err);
1383
1384 err = permission(base->d_inode, MAY_EXEC, NULL);
1385 if (err)
1386 return ERR_PTR(err);
1369 return __lookup_hash(&this, base, NULL); 1387 return __lookup_hash(&this, base, NULL);
1370} 1388}
1371 1389
1372struct dentry *lookup_one_len_kern(const char *name, struct dentry *base, int len) 1390/**
1391 * lookup_one_noperm - bad hack for sysfs
1392 * @name: pathname component to lookup
1393 * @base: base directory to lookup from
1394 *
1395 * This is a variant of lookup_one_len that doesn't perform any permission
1396 * checks. It's a horrible hack to work around the braindead sysfs
1397 * architecture and should not be used anywhere else.
1398 *
1399 * DON'T USE THIS FUNCTION EVER, thanks.
1400 */
1401struct dentry *lookup_one_noperm(const char *name, struct dentry *base)
1373{ 1402{
1374 int err; 1403 int err;
1375 struct qstr this; 1404 struct qstr this;
1376 1405
1377 err = __lookup_one_len(name, &this, base, len); 1406 err = __lookup_one_len(name, &this, base, strlen(name));
1378 if (err) 1407 if (err)
1379 return ERR_PTR(err); 1408 return ERR_PTR(err);
1380 return __lookup_hash_kern(&this, base, NULL); 1409 return __lookup_hash(&this, base, NULL);
1381} 1410}
1382 1411
1383int fastcall __user_walk_fd(int dfd, const char __user *name, unsigned flags, 1412int 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)
1579 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) 1608 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
1580 return -EISDIR; 1609 return -EISDIR;
1581 1610
1582 error = vfs_permission(nd, acc_mode);
1583 if (error)
1584 return error;
1585
1586 /* 1611 /*
1587 * FIFO's, sockets and device files are special: they don't 1612 * FIFO's, sockets and device files are special: they don't
1588 * actually live on the filesystem itself, and as such you 1613 * 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)
1597 flag &= ~O_TRUNC; 1622 flag &= ~O_TRUNC;
1598 } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) 1623 } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
1599 return -EROFS; 1624 return -EROFS;
1625
1626 error = vfs_permission(nd, acc_mode);
1627 if (error)
1628 return error;
1600 /* 1629 /*
1601 * An append-only file must be opened in append mode for writing. 1630 * An append-only file must be opened in append mode for writing.
1602 */ 1631 */
diff --git a/fs/namespace.c b/fs/namespace.c
index ddbda13c2d31..07daa7972591 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1791,7 +1791,7 @@ static void __init init_mount_tree(void)
1791 set_fs_root(current->fs, ns->root, ns->root->mnt_root); 1791 set_fs_root(current->fs, ns->root, ns->root->mnt_root);
1792} 1792}
1793 1793
1794void __init mnt_init(unsigned long mempages) 1794void __init mnt_init(void)
1795{ 1795{
1796 struct list_head *d; 1796 struct list_head *d;
1797 unsigned int nr_hash; 1797 unsigned int nr_hash;
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 7f8536dbdedc..e1cb70c643f8 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -56,7 +56,7 @@ static void ncp_destroy_inode(struct inode *inode)
56 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode)); 56 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
57} 57}
58 58
59static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 59static void init_once(struct kmem_cache *cachep, void *foo)
60{ 60{
61 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo; 61 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
62 62
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index a532ee12740a..70587f383f10 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -627,6 +627,7 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *
627 if (server->rsize > NFS_MAX_FILE_IO_SIZE) 627 if (server->rsize > NFS_MAX_FILE_IO_SIZE)
628 server->rsize = NFS_MAX_FILE_IO_SIZE; 628 server->rsize = NFS_MAX_FILE_IO_SIZE;
629 server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 629 server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
630
630 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD; 631 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
631 632
632 if (server->wsize > max_rpc_payload) 633 if (server->wsize > max_rpc_payload)
@@ -677,6 +678,10 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
677 goto out_error; 678 goto out_error;
678 679
679 nfs_server_set_fsinfo(server, &fsinfo); 680 nfs_server_set_fsinfo(server, &fsinfo);
681 error = bdi_init(&server->backing_dev_info);
682 if (error)
683 goto out_error;
684
680 685
681 /* Get some general file system info */ 686 /* Get some general file system info */
682 if (server->namelen == 0) { 687 if (server->namelen == 0) {
@@ -756,6 +761,7 @@ void nfs_free_server(struct nfs_server *server)
756 nfs_put_client(server->nfs_client); 761 nfs_put_client(server->nfs_client);
757 762
758 nfs_free_iostats(server->io_stats); 763 nfs_free_iostats(server->io_stats);
764 bdi_destroy(&server->backing_dev_info);
759 kfree(server); 765 kfree(server);
760 nfs_release_automount_timer(); 766 nfs_release_automount_timer();
761 dprintk("<-- nfs_free_server()\n"); 767 dprintk("<-- nfs_free_server()\n");
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 035c769b715e..6c22453d77ae 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1154,7 +1154,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
1154#endif 1154#endif
1155} 1155}
1156 1156
1157static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 1157static void init_once(struct kmem_cache * cachep, void *foo)
1158{ 1158{
1159 struct nfs_inode *nfsi = (struct nfs_inode *) foo; 1159 struct nfs_inode *nfsi = (struct nfs_inode *) foo;
1160 1160
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index e2bb66c34406..0cf9d1cd9bd2 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -242,10 +242,8 @@ static void nfs_end_page_writeback(struct page *page)
242 struct nfs_server *nfss = NFS_SERVER(inode); 242 struct nfs_server *nfss = NFS_SERVER(inode);
243 243
244 end_page_writeback(page); 244 end_page_writeback(page);
245 if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) { 245 if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
246 clear_bdi_congested(&nfss->backing_dev_info, WRITE); 246 clear_bdi_congested(&nfss->backing_dev_info, WRITE);
247 congestion_end(WRITE);
248 }
249} 247}
250 248
251/* 249/*
@@ -449,6 +447,7 @@ nfs_mark_request_commit(struct nfs_page *req)
449 NFS_PAGE_TAG_COMMIT); 447 NFS_PAGE_TAG_COMMIT);
450 spin_unlock(&inode->i_lock); 448 spin_unlock(&inode->i_lock);
451 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 449 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
450 inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_RECLAIMABLE);
452 __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 451 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
453} 452}
454 453
@@ -535,6 +534,8 @@ static void nfs_cancel_commit_list(struct list_head *head)
535 while(!list_empty(head)) { 534 while(!list_empty(head)) {
536 req = nfs_list_entry(head->next); 535 req = nfs_list_entry(head->next);
537 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 536 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
537 dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
538 BDI_RECLAIMABLE);
538 nfs_list_remove_request(req); 539 nfs_list_remove_request(req);
539 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags); 540 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
540 nfs_inode_remove_request(req); 541 nfs_inode_remove_request(req);
@@ -1195,6 +1196,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
1195 nfs_list_remove_request(req); 1196 nfs_list_remove_request(req);
1196 nfs_mark_request_commit(req); 1197 nfs_mark_request_commit(req);
1197 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1198 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1199 dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
1200 BDI_RECLAIMABLE);
1198 nfs_clear_page_tag_locked(req); 1201 nfs_clear_page_tag_locked(req);
1199 } 1202 }
1200 return -ENOMEM; 1203 return -ENOMEM;
@@ -1220,6 +1223,8 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
1220 nfs_list_remove_request(req); 1223 nfs_list_remove_request(req);
1221 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags); 1224 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
1222 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1225 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1226 dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
1227 BDI_RECLAIMABLE);
1223 1228
1224 dprintk("NFS: commit (%s/%Ld %d@%Ld)", 1229 dprintk("NFS: commit (%s/%Ld %d@%Ld)",
1225 req->wb_context->path.dentry->d_inode->i_sb->s_id, 1230 req->wb_context->path.dentry->d_inode->i_sb->s_id,
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 2a8d665b134b..819545d21670 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -368,7 +368,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
368 368
369 /* Revoke setuid/setgid bit on chown/chgrp */ 369 /* Revoke setuid/setgid bit on chown/chgrp */
370 if ((iap->ia_valid & ATTR_UID) && iap->ia_uid != inode->i_uid) 370 if ((iap->ia_valid & ATTR_UID) && iap->ia_uid != inode->i_uid)
371 iap->ia_valid |= ATTR_KILL_SUID; 371 iap->ia_valid |= ATTR_KILL_SUID | ATTR_KILL_PRIV;
372 if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid) 372 if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid)
373 iap->ia_valid |= ATTR_KILL_SGID; 373 iap->ia_valid |= ATTR_KILL_SGID;
374 374
@@ -865,6 +865,15 @@ static int nfsd_direct_splice_actor(struct pipe_inode_info *pipe,
865 return __splice_from_pipe(pipe, sd, nfsd_splice_actor); 865 return __splice_from_pipe(pipe, sd, nfsd_splice_actor);
866} 866}
867 867
868static inline int svc_msnfs(struct svc_fh *ffhp)
869{
870#ifdef MSNFS
871 return (ffhp->fh_export->ex_flags & NFSEXP_MSNFS);
872#else
873 return 0;
874#endif
875}
876
868static __be32 877static __be32
869nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 878nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
870 loff_t offset, struct kvec *vec, int vlen, unsigned long *count) 879 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,
877 886
878 err = nfserr_perm; 887 err = nfserr_perm;
879 inode = file->f_path.dentry->d_inode; 888 inode = file->f_path.dentry->d_inode;
880#ifdef MSNFS 889
881 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && 890 if (svc_msnfs(fhp) && !lock_may_read(inode, offset, *count))
882 (!lock_may_read(inode, offset, *count)))
883 goto out; 891 goto out;
884#endif
885 892
886 /* Get readahead parameters */ 893 /* Get readahead parameters */
887 ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino); 894 ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino);
@@ -930,7 +937,7 @@ out:
930static void kill_suid(struct dentry *dentry) 937static void kill_suid(struct dentry *dentry)
931{ 938{
932 struct iattr ia; 939 struct iattr ia;
933 ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID; 940 ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
934 941
935 mutex_lock(&dentry->d_inode->i_mutex); 942 mutex_lock(&dentry->d_inode->i_mutex);
936 notify_change(dentry, &ia); 943 notify_change(dentry, &ia);
diff --git a/fs/nls/Kconfig b/fs/nls/Kconfig
index 976ecccd6f56..a39edc41becc 100644
--- a/fs/nls/Kconfig
+++ b/fs/nls/Kconfig
@@ -2,10 +2,8 @@
2# Native language support configuration 2# Native language support configuration
3# 3#
4 4
5menu "Native Language Support" 5menuconfig NLS
6 6 tristate "Native language support"
7config NLS
8 tristate "Base native language support"
9 ---help--- 7 ---help---
10 The base Native Language Support. A number of filesystems 8 The base Native Language Support. A number of filesystems
11 depend on it (e.g. FAT, JOLIET, NT, BEOS filesystems), as well 9 depend on it (e.g. FAT, JOLIET, NT, BEOS filesystems), as well
@@ -17,9 +15,10 @@ config NLS
17 To compile this code as a module, choose M here: the module 15 To compile this code as a module, choose M here: the module
18 will be called nls_base. 16 will be called nls_base.
19 17
18if NLS
19
20config NLS_DEFAULT 20config NLS_DEFAULT
21 string "Default NLS Option" 21 string "Default NLS Option"
22 depends on NLS
23 default "iso8859-1" 22 default "iso8859-1"
24 ---help--- 23 ---help---
25 The default NLS used when mounting file system. Note, that this is 24 The default NLS used when mounting file system. Note, that this is
@@ -39,7 +38,6 @@ config NLS_DEFAULT
39 38
40config NLS_CODEPAGE_437 39config NLS_CODEPAGE_437
41 tristate "Codepage 437 (United States, Canada)" 40 tristate "Codepage 437 (United States, Canada)"
42 depends on NLS
43 help 41 help
44 The Microsoft FAT file system family can deal with filenames in 42 The Microsoft FAT file system family can deal with filenames in
45 native language character sets. These character sets are stored 43 native language character sets. These character sets are stored
@@ -52,7 +50,6 @@ config NLS_CODEPAGE_437
52 50
53config NLS_CODEPAGE_737 51config NLS_CODEPAGE_737
54 tristate "Codepage 737 (Greek)" 52 tristate "Codepage 737 (Greek)"
55 depends on NLS
56 help 53 help
57 The Microsoft FAT file system family can deal with filenames in 54 The Microsoft FAT file system family can deal with filenames in
58 native language character sets. These character sets are stored 55 native language character sets. These character sets are stored
@@ -65,7 +62,6 @@ config NLS_CODEPAGE_737
65 62
66config NLS_CODEPAGE_775 63config NLS_CODEPAGE_775
67 tristate "Codepage 775 (Baltic Rim)" 64 tristate "Codepage 775 (Baltic Rim)"
68 depends on NLS
69 help 65 help
70 The Microsoft FAT file system family can deal with filenames in 66 The Microsoft FAT file system family can deal with filenames in
71 native language character sets. These character sets are stored 67 native language character sets. These character sets are stored
@@ -79,7 +75,6 @@ config NLS_CODEPAGE_775
79 75
80config NLS_CODEPAGE_850 76config NLS_CODEPAGE_850
81 tristate "Codepage 850 (Europe)" 77 tristate "Codepage 850 (Europe)"
82 depends on NLS
83 ---help--- 78 ---help---
84 The Microsoft FAT file system family can deal with filenames in 79 The Microsoft FAT file system family can deal with filenames in
85 native language character sets. These character sets are stored in 80 native language character sets. These character sets are stored in
@@ -96,7 +91,6 @@ config NLS_CODEPAGE_850
96 91
97config NLS_CODEPAGE_852 92config NLS_CODEPAGE_852
98 tristate "Codepage 852 (Central/Eastern Europe)" 93 tristate "Codepage 852 (Central/Eastern Europe)"
99 depends on NLS
100 ---help--- 94 ---help---
101 The Microsoft FAT file system family can deal with filenames in 95 The Microsoft FAT file system family can deal with filenames in
102 native language character sets. These character sets are stored in 96 native language character sets. These character sets are stored in
@@ -112,7 +106,6 @@ config NLS_CODEPAGE_852
112 106
113config NLS_CODEPAGE_855 107config NLS_CODEPAGE_855
114 tristate "Codepage 855 (Cyrillic)" 108 tristate "Codepage 855 (Cyrillic)"
115 depends on NLS
116 help 109 help
117 The Microsoft FAT file system family can deal with filenames in 110 The Microsoft FAT file system family can deal with filenames in
118 native language character sets. These character sets are stored in 111 native language character sets. These character sets are stored in
@@ -124,7 +117,6 @@ config NLS_CODEPAGE_855
124 117
125config NLS_CODEPAGE_857 118config NLS_CODEPAGE_857
126 tristate "Codepage 857 (Turkish)" 119 tristate "Codepage 857 (Turkish)"
127 depends on NLS
128 help 120 help
129 The Microsoft FAT file system family can deal with filenames in 121 The Microsoft FAT file system family can deal with filenames in
130 native language character sets. These character sets are stored in 122 native language character sets. These character sets are stored in
@@ -136,7 +128,6 @@ config NLS_CODEPAGE_857
136 128
137config NLS_CODEPAGE_860 129config NLS_CODEPAGE_860
138 tristate "Codepage 860 (Portuguese)" 130 tristate "Codepage 860 (Portuguese)"
139 depends on NLS
140 help 131 help
141 The Microsoft FAT file system family can deal with filenames in 132 The Microsoft FAT file system family can deal with filenames in
142 native language character sets. These character sets are stored in 133 native language character sets. These character sets are stored in
@@ -148,7 +139,6 @@ config NLS_CODEPAGE_860
148 139
149config NLS_CODEPAGE_861 140config NLS_CODEPAGE_861
150 tristate "Codepage 861 (Icelandic)" 141 tristate "Codepage 861 (Icelandic)"
151 depends on NLS
152 help 142 help
153 The Microsoft FAT file system family can deal with filenames in 143 The Microsoft FAT file system family can deal with filenames in
154 native language character sets. These character sets are stored in 144 native language character sets. These character sets are stored in
@@ -160,7 +150,6 @@ config NLS_CODEPAGE_861
160 150
161config NLS_CODEPAGE_862 151config NLS_CODEPAGE_862
162 tristate "Codepage 862 (Hebrew)" 152 tristate "Codepage 862 (Hebrew)"
163 depends on NLS
164 help 153 help
165 The Microsoft FAT file system family can deal with filenames in 154 The Microsoft FAT file system family can deal with filenames in
166 native language character sets. These character sets are stored in 155 native language character sets. These character sets are stored in
@@ -172,7 +161,6 @@ config NLS_CODEPAGE_862
172 161
173config NLS_CODEPAGE_863 162config NLS_CODEPAGE_863
174 tristate "Codepage 863 (Canadian French)" 163 tristate "Codepage 863 (Canadian French)"
175 depends on NLS
176 help 164 help
177 The Microsoft FAT file system family can deal with filenames in 165 The Microsoft FAT file system family can deal with filenames in
178 native language character sets. These character sets are stored in 166 native language character sets. These character sets are stored in
@@ -185,7 +173,6 @@ config NLS_CODEPAGE_863
185 173
186config NLS_CODEPAGE_864 174config NLS_CODEPAGE_864
187 tristate "Codepage 864 (Arabic)" 175 tristate "Codepage 864 (Arabic)"
188 depends on NLS
189 help 176 help
190 The Microsoft FAT file system family can deal with filenames in 177 The Microsoft FAT file system family can deal with filenames in
191 native language character sets. These character sets are stored in 178 native language character sets. These character sets are stored in
@@ -197,7 +184,6 @@ config NLS_CODEPAGE_864
197 184
198config NLS_CODEPAGE_865 185config NLS_CODEPAGE_865
199 tristate "Codepage 865 (Norwegian, Danish)" 186 tristate "Codepage 865 (Norwegian, Danish)"
200 depends on NLS
201 help 187 help
202 The Microsoft FAT file system family can deal with filenames in 188 The Microsoft FAT file system family can deal with filenames in
203 native language character sets. These character sets are stored in 189 native language character sets. These character sets are stored in
@@ -210,7 +196,6 @@ config NLS_CODEPAGE_865
210 196
211config NLS_CODEPAGE_866 197config NLS_CODEPAGE_866
212 tristate "Codepage 866 (Cyrillic/Russian)" 198 tristate "Codepage 866 (Cyrillic/Russian)"
213 depends on NLS
214 help 199 help
215 The Microsoft FAT file system family can deal with filenames in 200 The Microsoft FAT file system family can deal with filenames in
216 native language character sets. These character sets are stored in 201 native language character sets. These character sets are stored in
@@ -223,7 +208,6 @@ config NLS_CODEPAGE_866
223 208
224config NLS_CODEPAGE_869 209config NLS_CODEPAGE_869
225 tristate "Codepage 869 (Greek)" 210 tristate "Codepage 869 (Greek)"
226 depends on NLS
227 help 211 help
228 The Microsoft FAT file system family can deal with filenames in 212 The Microsoft FAT file system family can deal with filenames in
229 native language character sets. These character sets are stored in 213 native language character sets. These character sets are stored in
@@ -235,7 +219,6 @@ config NLS_CODEPAGE_869
235 219
236config NLS_CODEPAGE_936 220config NLS_CODEPAGE_936
237 tristate "Simplified Chinese charset (CP936, GB2312)" 221 tristate "Simplified Chinese charset (CP936, GB2312)"
238 depends on NLS
239 help 222 help
240 The Microsoft FAT file system family can deal with filenames in 223 The Microsoft FAT file system family can deal with filenames in
241 native language character sets. These character sets are stored in 224 native language character sets. These character sets are stored in
@@ -248,7 +231,6 @@ config NLS_CODEPAGE_936
248 231
249config NLS_CODEPAGE_950 232config NLS_CODEPAGE_950
250 tristate "Traditional Chinese charset (Big5)" 233 tristate "Traditional Chinese charset (Big5)"
251 depends on NLS
252 help 234 help
253 The Microsoft FAT file system family can deal with filenames in 235 The Microsoft FAT file system family can deal with filenames in
254 native language character sets. These character sets are stored in 236 native language character sets. These character sets are stored in
@@ -261,7 +243,6 @@ config NLS_CODEPAGE_950
261 243
262config NLS_CODEPAGE_932 244config NLS_CODEPAGE_932
263 tristate "Japanese charsets (Shift-JIS, EUC-JP)" 245 tristate "Japanese charsets (Shift-JIS, EUC-JP)"
264 depends on NLS
265 help 246 help
266 The Microsoft FAT file system family can deal with filenames in 247 The Microsoft FAT file system family can deal with filenames in
267 native language character sets. These character sets are stored in 248 native language character sets. These character sets are stored in
@@ -275,7 +256,6 @@ config NLS_CODEPAGE_932
275 256
276config NLS_CODEPAGE_949 257config NLS_CODEPAGE_949
277 tristate "Korean charset (CP949, EUC-KR)" 258 tristate "Korean charset (CP949, EUC-KR)"
278 depends on NLS
279 help 259 help
280 The Microsoft FAT file system family can deal with filenames in 260 The Microsoft FAT file system family can deal with filenames in
281 native language character sets. These character sets are stored in 261 native language character sets. These character sets are stored in
@@ -287,7 +267,6 @@ config NLS_CODEPAGE_949
287 267
288config NLS_CODEPAGE_874 268config NLS_CODEPAGE_874
289 tristate "Thai charset (CP874, TIS-620)" 269 tristate "Thai charset (CP874, TIS-620)"
290 depends on NLS
291 help 270 help
292 The Microsoft FAT file system family can deal with filenames in 271 The Microsoft FAT file system family can deal with filenames in
293 native language character sets. These character sets are stored in 272 native language character sets. These character sets are stored in
@@ -299,7 +278,6 @@ config NLS_CODEPAGE_874
299 278
300config NLS_ISO8859_8 279config NLS_ISO8859_8
301 tristate "Hebrew charsets (ISO-8859-8, CP1255)" 280 tristate "Hebrew charsets (ISO-8859-8, CP1255)"
302 depends on NLS
303 help 281 help
304 If you want to display filenames with native language characters 282 If you want to display filenames with native language characters
305 from the Microsoft FAT file system family or from JOLIET CD-ROMs 283 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -309,7 +287,6 @@ config NLS_ISO8859_8
309 287
310config NLS_CODEPAGE_1250 288config NLS_CODEPAGE_1250
311 tristate "Windows CP1250 (Slavic/Central European Languages)" 289 tristate "Windows CP1250 (Slavic/Central European Languages)"
312 depends on NLS
313 help 290 help
314 If you want to display filenames with native language characters 291 If you want to display filenames with native language characters
315 from the Microsoft FAT file system family or from JOLIET CDROMs 292 from the Microsoft FAT file system family or from JOLIET CDROMs
@@ -321,7 +298,6 @@ config NLS_CODEPAGE_1250
321 298
322config NLS_CODEPAGE_1251 299config NLS_CODEPAGE_1251
323 tristate "Windows CP1251 (Bulgarian, Belarusian)" 300 tristate "Windows CP1251 (Bulgarian, Belarusian)"
324 depends on NLS
325 help 301 help
326 The Microsoft FAT file system family can deal with filenames in 302 The Microsoft FAT file system family can deal with filenames in
327 native language character sets. These character sets are stored in 303 native language character sets. These character sets are stored in
@@ -334,7 +310,6 @@ config NLS_CODEPAGE_1251
334 310
335config NLS_ASCII 311config NLS_ASCII
336 tristate "ASCII (United States)" 312 tristate "ASCII (United States)"
337 depends on NLS
338 help 313 help
339 An ASCII NLS module is needed if you want to override the 314 An ASCII NLS module is needed if you want to override the
340 DEFAULT NLS with this very basic charset and don't want any 315 DEFAULT NLS with this very basic charset and don't want any
@@ -342,7 +317,6 @@ config NLS_ASCII
342 317
343config NLS_ISO8859_1 318config NLS_ISO8859_1
344 tristate "NLS ISO 8859-1 (Latin 1; Western European Languages)" 319 tristate "NLS ISO 8859-1 (Latin 1; Western European Languages)"
345 depends on NLS
346 help 320 help
347 If you want to display filenames with native language characters 321 If you want to display filenames with native language characters
348 from the Microsoft FAT file system family or from JOLIET CD-ROMs 322 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -355,7 +329,6 @@ config NLS_ISO8859_1
355 329
356config NLS_ISO8859_2 330config NLS_ISO8859_2
357 tristate "NLS ISO 8859-2 (Latin 2; Slavic/Central European Languages)" 331 tristate "NLS ISO 8859-2 (Latin 2; Slavic/Central European Languages)"
358 depends on NLS
359 help 332 help
360 If you want to display filenames with native language characters 333 If you want to display filenames with native language characters
361 from the Microsoft FAT file system family or from JOLIET CD-ROMs 334 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -367,7 +340,6 @@ config NLS_ISO8859_2
367 340
368config NLS_ISO8859_3 341config NLS_ISO8859_3
369 tristate "NLS ISO 8859-3 (Latin 3; Esperanto, Galician, Maltese, Turkish)" 342 tristate "NLS ISO 8859-3 (Latin 3; Esperanto, Galician, Maltese, Turkish)"
370 depends on NLS
371 help 343 help
372 If you want to display filenames with native language characters 344 If you want to display filenames with native language characters
373 from the Microsoft FAT file system family or from JOLIET CD-ROMs 345 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -378,7 +350,6 @@ config NLS_ISO8859_3
378 350
379config NLS_ISO8859_4 351config NLS_ISO8859_4
380 tristate "NLS ISO 8859-4 (Latin 4; old Baltic charset)" 352 tristate "NLS ISO 8859-4 (Latin 4; old Baltic charset)"
381 depends on NLS
382 help 353 help
383 If you want to display filenames with native language characters 354 If you want to display filenames with native language characters
384 from the Microsoft FAT file system family or from JOLIET CD-ROMs 355 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -389,7 +360,6 @@ config NLS_ISO8859_4
389 360
390config NLS_ISO8859_5 361config NLS_ISO8859_5
391 tristate "NLS ISO 8859-5 (Cyrillic)" 362 tristate "NLS ISO 8859-5 (Cyrillic)"
392 depends on NLS
393 help 363 help
394 If you want to display filenames with native language characters 364 If you want to display filenames with native language characters
395 from the Microsoft FAT file system family or from JOLIET CD-ROMs 365 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -401,7 +371,6 @@ config NLS_ISO8859_5
401 371
402config NLS_ISO8859_6 372config NLS_ISO8859_6
403 tristate "NLS ISO 8859-6 (Arabic)" 373 tristate "NLS ISO 8859-6 (Arabic)"
404 depends on NLS
405 help 374 help
406 If you want to display filenames with native language characters 375 If you want to display filenames with native language characters
407 from the Microsoft FAT file system family or from JOLIET CD-ROMs 376 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -411,7 +380,6 @@ config NLS_ISO8859_6
411 380
412config NLS_ISO8859_7 381config NLS_ISO8859_7
413 tristate "NLS ISO 8859-7 (Modern Greek)" 382 tristate "NLS ISO 8859-7 (Modern Greek)"
414 depends on NLS
415 help 383 help
416 If you want to display filenames with native language characters 384 If you want to display filenames with native language characters
417 from the Microsoft FAT file system family or from JOLIET CD-ROMs 385 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -421,7 +389,6 @@ config NLS_ISO8859_7
421 389
422config NLS_ISO8859_9 390config NLS_ISO8859_9
423 tristate "NLS ISO 8859-9 (Latin 5; Turkish)" 391 tristate "NLS ISO 8859-9 (Latin 5; Turkish)"
424 depends on NLS
425 help 392 help
426 If you want to display filenames with native language characters 393 If you want to display filenames with native language characters
427 from the Microsoft FAT file system family or from JOLIET CD-ROMs 394 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -432,7 +399,6 @@ config NLS_ISO8859_9
432 399
433config NLS_ISO8859_13 400config NLS_ISO8859_13
434 tristate "NLS ISO 8859-13 (Latin 7; Baltic)" 401 tristate "NLS ISO 8859-13 (Latin 7; Baltic)"
435 depends on NLS
436 help 402 help
437 If you want to display filenames with native language characters 403 If you want to display filenames with native language characters
438 from the Microsoft FAT file system family or from JOLIET CD-ROMs 404 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -443,7 +409,6 @@ config NLS_ISO8859_13
443 409
444config NLS_ISO8859_14 410config NLS_ISO8859_14
445 tristate "NLS ISO 8859-14 (Latin 8; Celtic)" 411 tristate "NLS ISO 8859-14 (Latin 8; Celtic)"
446 depends on NLS
447 help 412 help
448 If you want to display filenames with native language characters 413 If you want to display filenames with native language characters
449 from the Microsoft FAT file system family or from JOLIET CD-ROMs 414 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -455,7 +420,6 @@ config NLS_ISO8859_14
455 420
456config NLS_ISO8859_15 421config NLS_ISO8859_15
457 tristate "NLS ISO 8859-15 (Latin 9; Western European Languages with Euro)" 422 tristate "NLS ISO 8859-15 (Latin 9; Western European Languages with Euro)"
458 depends on NLS
459 ---help--- 423 ---help---
460 If you want to display filenames with native language characters 424 If you want to display filenames with native language characters
461 from the Microsoft FAT file system family or from JOLIET CD-ROMs 425 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -472,7 +436,6 @@ config NLS_ISO8859_15
472 436
473config NLS_KOI8_R 437config NLS_KOI8_R
474 tristate "NLS KOI8-R (Russian)" 438 tristate "NLS KOI8-R (Russian)"
475 depends on NLS
476 help 439 help
477 If you want to display filenames with native language characters 440 If you want to display filenames with native language characters
478 from the Microsoft FAT file system family or from JOLIET CD-ROMs 441 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -482,7 +445,6 @@ config NLS_KOI8_R
482 445
483config NLS_KOI8_U 446config NLS_KOI8_U
484 tristate "NLS KOI8-U/RU (Ukrainian, Belarusian)" 447 tristate "NLS KOI8-U/RU (Ukrainian, Belarusian)"
485 depends on NLS
486 help 448 help
487 If you want to display filenames with native language characters 449 If you want to display filenames with native language characters
488 from the Microsoft FAT file system family or from JOLIET CD-ROMs 450 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -492,7 +454,6 @@ config NLS_KOI8_U
492 454
493config NLS_UTF8 455config NLS_UTF8
494 tristate "NLS UTF-8" 456 tristate "NLS UTF-8"
495 depends on NLS
496 help 457 help
497 If you want to display filenames with native language characters 458 If you want to display filenames with native language characters
498 from the Microsoft FAT file system family or from JOLIET CD-ROMs 459 from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -500,5 +461,4 @@ config NLS_UTF8
500 input/output character sets. Say Y here for the UTF-8 encoding of 461 input/output character sets. Say Y here for the UTF-8 encoding of
501 the Unicode/ISO9646 universal character set. 462 the Unicode/ISO9646 universal character set.
502 463
503endmenu 464endif # NLS
504
diff --git a/fs/nls/nls_ascii.c b/fs/nls/nls_ascii.c
index 6993faea28ac..7020e940f74e 100644
--- a/fs/nls/nls_ascii.c
+++ b/fs/nls/nls_ascii.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -56,7 +56,7 @@ static wchar_t charset2uni[256] = {
56 0x007c, 0x007d, 0x007e, 0x007f, 56 0x007c, 0x007d, 0x007e, 0x007f,
57}; 57};
58 58
59static unsigned char page00[256] = { 59static const unsigned char page00[256] = {
60 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 60 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
61 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 61 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
62 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 62 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -75,11 +75,11 @@ static unsigned char page00[256] = {
75 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 75 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
76}; 76};
77 77
78static unsigned char *page_uni2charset[256] = { 78static const unsigned char *const page_uni2charset[256] = {
79 page00, 79 page00,
80}; 80};
81 81
82static unsigned char charset2lower[256] = { 82static const unsigned char charset2lower[256] = {
83 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 83 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
84 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 84 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
85 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 85 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -98,7 +98,7 @@ static unsigned char charset2lower[256] = {
98 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 98 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
99}; 99};
100 100
101static unsigned char charset2upper[256] = { 101static const unsigned char charset2upper[256] = {
102 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 102 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
103 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 103 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
104 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 104 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -119,7 +119,7 @@ static unsigned char charset2upper[256] = {
119 119
120static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 120static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
121{ 121{
122 unsigned char *uni2charset; 122 const unsigned char *uni2charset;
123 unsigned char cl = uni & 0x00ff; 123 unsigned char cl = uni & 0x00ff;
124 unsigned char ch = (uni & 0xff00) >> 8; 124 unsigned char ch = (uni & 0xff00) >> 8;
125 125
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 7dfdab98729b..e7905816c4ca 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -34,7 +34,7 @@ struct utf8_table {
34 long lval; 34 long lval;
35}; 35};
36 36
37static struct utf8_table utf8_table[] = 37static const struct utf8_table utf8_table[] =
38{ 38{
39 {0x80, 0x00, 0*6, 0x7F, 0, /* 1 byte sequence */}, 39 {0x80, 0x00, 0*6, 0x7F, 0, /* 1 byte sequence */},
40 {0xE0, 0xC0, 1*6, 0x7FF, 0x80, /* 2 byte sequence */}, 40 {0xE0, 0xC0, 1*6, 0x7FF, 0x80, /* 2 byte sequence */},
@@ -50,7 +50,7 @@ utf8_mbtowc(wchar_t *p, const __u8 *s, int n)
50{ 50{
51 long l; 51 long l;
52 int c0, c, nc; 52 int c0, c, nc;
53 struct utf8_table *t; 53 const struct utf8_table *t;
54 54
55 nc = 0; 55 nc = 0;
56 c0 = *s; 56 c0 = *s;
@@ -109,7 +109,7 @@ utf8_wctomb(__u8 *s, wchar_t wc, int maxlen)
109{ 109{
110 long l; 110 long l;
111 int c, nc; 111 int c, nc;
112 struct utf8_table *t; 112 const struct utf8_table *t;
113 113
114 if (s == 0) 114 if (s == 0)
115 return 0; 115 return 0;
@@ -240,7 +240,7 @@ void unload_nls(struct nls_table *nls)
240 module_put(nls->owner); 240 module_put(nls->owner);
241} 241}
242 242
243static wchar_t charset2uni[256] = { 243static const wchar_t charset2uni[256] = {
244 /* 0x00*/ 244 /* 0x00*/
245 0x0000, 0x0001, 0x0002, 0x0003, 245 0x0000, 0x0001, 0x0002, 0x0003,
246 0x0004, 0x0005, 0x0006, 0x0007, 246 0x0004, 0x0005, 0x0006, 0x0007,
@@ -323,7 +323,7 @@ static wchar_t charset2uni[256] = {
323 0x00fc, 0x00fd, 0x00fe, 0x00ff, 323 0x00fc, 0x00fd, 0x00fe, 0x00ff,
324}; 324};
325 325
326static unsigned char page00[256] = { 326static const unsigned char page00[256] = {
327 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 327 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
328 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 328 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
329 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 329 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -359,11 +359,11 @@ static unsigned char page00[256] = {
359 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 359 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
360}; 360};
361 361
362static unsigned char *page_uni2charset[256] = { 362static const unsigned char *const page_uni2charset[256] = {
363 page00 363 page00
364}; 364};
365 365
366static unsigned char charset2lower[256] = { 366static const unsigned char charset2lower[256] = {
367 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 367 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
368 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 368 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
369 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 369 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -399,7 +399,7 @@ static unsigned char charset2lower[256] = {
399 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 399 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
400}; 400};
401 401
402static unsigned char charset2upper[256] = { 402static const unsigned char charset2upper[256] = {
403 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 403 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
404 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 404 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
405 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 405 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -438,7 +438,7 @@ static unsigned char charset2upper[256] = {
438 438
439static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 439static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
440{ 440{
441 unsigned char *uni2charset; 441 const unsigned char *uni2charset;
442 unsigned char cl = uni & 0x00ff; 442 unsigned char cl = uni & 0x00ff;
443 unsigned char ch = (uni & 0xff00) >> 8; 443 unsigned char ch = (uni & 0xff00) >> 8;
444 444
diff --git a/fs/nls/nls_cp1250.c b/fs/nls/nls_cp1250.c
index 570aa69846a0..c8471fe78e4e 100644
--- a/fs/nls/nls_cp1250.c
+++ b/fs/nls/nls_cp1250.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00fc, 0x00fd, 0x0163, 0x02d9, 96 0x00fc, 0x00fd, 0x0163, 0x02d9,
97 }; 97 };
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
133 }; 133 };
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */ 136 0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */
138 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page01[256] = {
152 152
153 }; 153 };
154 154
155static unsigned char page02[256] = { 155static const unsigned char page02[256] = {
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page02[256] = {
184 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ 184 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */
185 }; 185 };
186 186
187static unsigned char page20[256] = { 187static const unsigned char page20[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -210,7 +210,7 @@ static unsigned char page20[256] = {
210 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 210 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
211 }; 211 };
212 212
213static unsigned char page21[256] = { 213static const unsigned char page21[256] = {
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -218,7 +218,7 @@ static unsigned char page21[256] = {
218 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 218 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
219 }; 219 };
220 220
221static unsigned char *page_uni2charset[256] = { 221static const unsigned char *const page_uni2charset[256] = {
222 page00, page01, page02, NULL, NULL, NULL, NULL, NULL, 222 page00, page01, page02, NULL, NULL, NULL, NULL, NULL,
223 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 223 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
224 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 224 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -226,7 +226,7 @@ static unsigned char *page_uni2charset[256] = {
226 page20, page21, NULL, NULL, NULL, NULL, NULL, NULL, 226 page20, page21, NULL, NULL, NULL, NULL, NULL, NULL,
227 }; 227 };
228 228
229static unsigned char charset2lower[256] = { 229static const unsigned char charset2lower[256] = {
230 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 230 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
231 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 231 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
232 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 232 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -262,7 +262,7 @@ static unsigned char charset2lower[256] = {
262 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 262 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
263 }; 263 };
264 264
265static unsigned char charset2upper[256] = { 265static const unsigned char charset2upper[256] = {
266 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 266 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
267 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 267 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
268 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 268 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -300,7 +300,7 @@ static unsigned char charset2upper[256] = {
300 300
301static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 301static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
302{ 302{
303 unsigned char *uni2charset; 303 const unsigned char *uni2charset;
304 unsigned char cl = uni & 0x00ff; 304 unsigned char cl = uni & 0x00ff;
305 unsigned char ch = (uni & 0xff00) >> 8; 305 unsigned char ch = (uni & 0xff00) >> 8;
306 306
diff --git a/fs/nls/nls_cp1251.c b/fs/nls/nls_cp1251.c
index f114afa069db..1939b46e772f 100644
--- a/fs/nls/nls_cp1251.c
+++ b/fs/nls/nls_cp1251.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x044c, 0x044d, 0x044e, 0x044f, 96 0x044c, 0x044d, 0x044e, 0x044f,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page04[256] = { 135static const unsigned char page04[256] = {
136 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ 136 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */
137 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */ 137 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */
138 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ 138 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page04[256] = {
155 0x00, 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page20[256] = { 158static const unsigned char page20[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -166,7 +166,7 @@ static unsigned char page20[256] = {
166 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 166 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
167}; 167};
168 168
169static unsigned char page21[256] = { 169static const unsigned char page21[256] = {
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */ 172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */
@@ -174,7 +174,7 @@ static unsigned char page21[256] = {
174 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 174 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
175}; 175};
176 176
177static unsigned char *page_uni2charset[256] = { 177static const unsigned char *const page_uni2charset[256] = {
178 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL, 178 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL,
179 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 179 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
180 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 180 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -182,7 +182,7 @@ static unsigned char *page_uni2charset[256] = {
182 page20, page21, NULL, NULL, NULL, NULL, NULL, NULL, 182 page20, page21, NULL, NULL, NULL, NULL, NULL, NULL,
183}; 183};
184 184
185static unsigned char charset2lower[256] = { 185static const unsigned char charset2lower[256] = {
186 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 186 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
187 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 187 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
188 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 188 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -217,7 +217,7 @@ static unsigned char charset2lower[256] = {
217 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 217 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
218}; 218};
219 219
220static unsigned char charset2upper[256] = { 220static const unsigned char charset2upper[256] = {
221 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 221 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
222 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 222 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
223 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 223 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -254,7 +254,7 @@ static unsigned char charset2upper[256] = {
254 254
255static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 255static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
256{ 256{
257 unsigned char *uni2charset; 257 const unsigned char *uni2charset;
258 unsigned char cl = uni & 0x00ff; 258 unsigned char cl = uni & 0x00ff;
259 unsigned char ch = (uni & 0xff00) >> 8; 259 unsigned char ch = (uni & 0xff00) >> 8;
260 260
diff --git a/fs/nls/nls_cp1255.c b/fs/nls/nls_cp1255.c
index e57f2cbf5bc0..8120ae2e091a 100644
--- a/fs/nls/nls_cp1255.c
+++ b/fs/nls/nls_cp1255.c
@@ -11,7 +11,7 @@
11#include <linux/nls.h> 11#include <linux/nls.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13 13
14static wchar_t charset2uni[256] = { 14static const wchar_t charset2uni[256] = {
15 /* 0x00*/ 15 /* 0x00*/
16 0x0000, 0x0001, 0x0002, 0x0003, 16 0x0000, 0x0001, 0x0002, 0x0003,
17 0x0004, 0x0005, 0x0006, 0x0007, 17 0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
94 0x0000, 0x0000, 0x0000, 0x0000, 94 0x0000, 0x0000, 0x0000, 0x0000,
95}; 95};
96 96
97static unsigned char page00[256] = { 97static const unsigned char page00[256] = {
98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -129,7 +129,7 @@ static unsigned char page00[256] = {
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ 129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */
130}; 130};
131 131
132static unsigned char page01[256] = { 132static const unsigned char page01[256] = {
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page01[256] = {
152 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 152 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
153}; 153};
154 154
155static unsigned char page02[256] = { 155static const unsigned char page02[256] = {
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page02[256] = {
184 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 184 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
185}; 185};
186 186
187static unsigned char page05[256] = { 187static const unsigned char page05[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -219,7 +219,7 @@ static unsigned char page05[256] = {
219 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ 219 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
220}; 220};
221 221
222static unsigned char page20[256] = { 222static const unsigned char page20[256] = {
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ 224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */
225 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 225 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -245,7 +245,7 @@ static unsigned char page20[256] = {
245 0x00, 0x00, 0xa4, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 245 0x00, 0x00, 0xa4, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
246}; 246};
247 247
248static unsigned char page21[256] = { 248static const unsigned char page21[256] = {
249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */ 251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */
@@ -253,7 +253,7 @@ static unsigned char page21[256] = {
253 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 253 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
254}; 254};
255 255
256static unsigned char *page_uni2charset[256] = { 256static const unsigned char *const page_uni2charset[256] = {
257 page00, page01, page02, NULL, NULL, page05, NULL, NULL, 257 page00, page01, page02, NULL, NULL, page05, NULL, NULL,
258 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 258 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
259 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 259 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -261,7 +261,7 @@ static unsigned char *page_uni2charset[256] = {
261 page20, page21, NULL, NULL, NULL, NULL, NULL, NULL, 261 page20, page21, NULL, NULL, NULL, NULL, NULL, NULL,
262}; 262};
263 263
264static unsigned char charset2lower[256] = { 264static const unsigned char charset2lower[256] = {
265 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 265 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
266 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 266 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
267 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 267 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -297,7 +297,7 @@ static unsigned char charset2lower[256] = {
297 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 297 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
298}; 298};
299 299
300static unsigned char charset2upper[256] = { 300static const unsigned char charset2upper[256] = {
301 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 301 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
302 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 302 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
303 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 303 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -335,7 +335,7 @@ static unsigned char charset2upper[256] = {
335 335
336static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 336static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
337{ 337{
338 unsigned char *uni2charset; 338 const unsigned char *uni2charset;
339 unsigned char cl = uni & 0x00ff; 339 unsigned char cl = uni & 0x00ff;
340 unsigned char ch = (uni & 0xff00) >> 8; 340 unsigned char ch = (uni & 0xff00) >> 8;
341 341
diff --git a/fs/nls/nls_cp437.c b/fs/nls/nls_cp437.c
index d41930ce4a44..ff37a4628ce4 100644
--- a/fs/nls/nls_cp437.c
+++ b/fs/nls/nls_cp437.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */ 132 0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page03[256] = { 158static const unsigned char page03[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */ 184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
185}; 185};
186 186
187static unsigned char page20[256] = { 187static const unsigned char page20[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page20[256] = {
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */ 209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
210}; 210};
211 211
212static unsigned char page22[256] = { 212static const unsigned char page22[256] = {
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char page22[256] = {
225 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 225 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
226}; 226};
227 227
228static unsigned char page23[256] = { 228static const unsigned char page23[256] = {
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
231 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 231 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -233,7 +233,7 @@ static unsigned char page23[256] = {
233 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 233 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
234}; 234};
235 235
236static unsigned char page25[256] = { 236static const unsigned char page25[256] = {
237 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 237 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
238 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 238 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
239 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 239 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char page25[256] = {
258 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 258 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
259}; 259};
260 260
261static unsigned char *page_uni2charset[256] = { 261static const unsigned char *const page_uni2charset[256] = {
262 page00, page01, NULL, page03, NULL, NULL, NULL, NULL, 262 page00, page01, NULL, page03, NULL, NULL, NULL, NULL,
263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
264 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 264 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -266,7 +266,7 @@ static unsigned char *page_uni2charset[256] = {
266 page20, NULL, page22, page23, NULL, page25, NULL, NULL, 266 page20, NULL, page22, page23, NULL, page25, NULL, NULL,
267}; 267};
268 268
269static unsigned char charset2lower[256] = { 269static const unsigned char charset2lower[256] = {
270 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 270 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
271 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 271 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
272 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 272 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -302,7 +302,7 @@ static unsigned char charset2lower[256] = {
302 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 302 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
303}; 303};
304 304
305static unsigned char charset2upper[256] = { 305static const unsigned char charset2upper[256] = {
306 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 306 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
307 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 307 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
308 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 308 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -340,7 +340,7 @@ static unsigned char charset2upper[256] = {
340 340
341static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 341static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
342{ 342{
343 unsigned char *uni2charset; 343 const unsigned char *uni2charset;
344 unsigned char cl = uni & 0x00ff; 344 unsigned char cl = uni & 0x00ff;
345 unsigned char ch = (uni & 0xff00) >> 8; 345 unsigned char ch = (uni & 0xff00) >> 8;
346 346
diff --git a/fs/nls/nls_cp737.c b/fs/nls/nls_cp737.c
index d21f8790aa19..f5576b8be1b9 100644
--- a/fs/nls/nls_cp737.c
+++ b/fs/nls/nls_cp737.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -131,7 +131,7 @@ static unsigned char page00[256] = {
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, /* 0xf0-0xf7 */ 131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, /* 0xf0-0xf7 */
132}; 132};
133 133
134static unsigned char page03[256] = { 134static const unsigned char page03[256] = {
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -161,7 +161,7 @@ static unsigned char page03[256] = {
161 0xaf, 0xe0, 0xe4, 0xe8, 0xe6, 0xe7, 0xe9, 0x00, /* 0xc8-0xcf */ 161 0xaf, 0xe0, 0xe4, 0xe8, 0xe6, 0xe7, 0xe9, 0x00, /* 0xc8-0xcf */
162}; 162};
163 163
164static unsigned char page20[256] = { 164static const unsigned char page20[256] = {
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -180,7 +180,7 @@ static unsigned char page20[256] = {
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x78-0x7f */ 180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x78-0x7f */
181}; 181};
182 182
183static unsigned char page22[256] = { 183static const unsigned char page22[256] = {
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -196,7 +196,7 @@ static unsigned char page22[256] = {
196 0x00, 0x00, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 196 0x00, 0x00, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
197}; 197};
198 198
199static unsigned char page25[256] = { 199static const unsigned char page25[256] = {
200 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 200 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
201 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 201 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
202 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 202 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -221,7 +221,7 @@ static unsigned char page25[256] = {
221 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 221 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
222}; 222};
223 223
224static unsigned char *page_uni2charset[256] = { 224static const unsigned char *const page_uni2charset[256] = {
225 page00, NULL, NULL, page03, NULL, NULL, NULL, NULL, 225 page00, NULL, NULL, page03, NULL, NULL, NULL, NULL,
226 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 226 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
227 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 227 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -229,7 +229,7 @@ static unsigned char *page_uni2charset[256] = {
229 page20, NULL, page22, NULL, NULL, page25, NULL, NULL, 229 page20, NULL, page22, NULL, NULL, page25, NULL, NULL,
230}; 230};
231 231
232static unsigned char charset2lower[256] = { 232static const unsigned char charset2lower[256] = {
233 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 233 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
234 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 234 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
235 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 235 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -265,7 +265,7 @@ static unsigned char charset2lower[256] = {
265 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 265 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
266}; 266};
267 267
268static unsigned char charset2upper[256] = { 268static const unsigned char charset2upper[256] = {
269 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 269 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
270 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 270 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
271 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 271 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -303,7 +303,7 @@ static unsigned char charset2upper[256] = {
303 303
304static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 304static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
305{ 305{
306 unsigned char *uni2charset; 306 const unsigned char *uni2charset;
307 unsigned char cl = uni & 0x00ff; 307 unsigned char cl = uni & 0x00ff;
308 unsigned char ch = (uni & 0xff00) >> 8; 308 unsigned char ch = (uni & 0xff00) >> 8;
309 309
diff --git a/fs/nls/nls_cp775.c b/fs/nls/nls_cp775.c
index c97714c38a90..4905635d1c00 100644
--- a/fs/nls/nls_cp775.c
+++ b/fs/nls/nls_cp775.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00b3, 0x00b2, 0x25a0, 0x00a0, 96 0x00b3, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x9b, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0x9b, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0xa0, 0x83, 0x00, 0x00, 0xb5, 0xd0, 0x80, 0x87, /* 0x00-0x07 */ 136 0xa0, 0x83, 0x00, 0x00, 0xb5, 0xd0, 0x80, 0x87, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0xb6, 0xd1, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0xb6, 0xd1, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0xed, 0x89, 0x00, 0x00, 0xb8, 0xd3, /* 0x10-0x17 */ 138 0x00, 0x00, 0xed, 0x89, 0x00, 0x00, 0xb8, 0xd3, /* 0x10-0x17 */
@@ -151,21 +151,21 @@ static unsigned char page01[256] = {
151 0x00, 0x8d, 0xa5, 0xa3, 0xa4, 0xcf, 0xd8, 0x00, /* 0x78-0x7f */ 151 0x00, 0x8d, 0xa5, 0xa3, 0xa4, 0xcf, 0xd8, 0x00, /* 0x78-0x7f */
152}; 152};
153 153
154static unsigned char page20[256] = { 154static const unsigned char page20[256] = {
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
158 0x00, 0xef, 0x00, 0x00, 0xf2, 0xa6, 0xf7, 0x00, /* 0x18-0x1f */ 158 0x00, 0xef, 0x00, 0x00, 0xf2, 0xa6, 0xf7, 0x00, /* 0x18-0x1f */
159}; 159};
160 160
161static unsigned char page22[256] = { 161static const unsigned char page22[256] = {
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
165 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 165 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
166}; 166};
167 167
168static unsigned char page25[256] = { 168static const unsigned char page25[256] = {
169 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 169 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
170 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 170 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
171 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 171 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -190,7 +190,7 @@ static unsigned char page25[256] = {
190 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 190 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
191}; 191};
192 192
193static unsigned char *page_uni2charset[256] = { 193static const unsigned char *const page_uni2charset[256] = {
194 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 194 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
195 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 195 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
196 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 196 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -198,7 +198,7 @@ static unsigned char *page_uni2charset[256] = {
198 page20, NULL, page22, NULL, NULL, page25, NULL, NULL, 198 page20, NULL, page22, NULL, NULL, page25, NULL, NULL,
199}; 199};
200 200
201static unsigned char charset2lower[256] = { 201static const unsigned char charset2lower[256] = {
202 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 202 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
203 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 203 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
204 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 204 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -234,7 +234,7 @@ static unsigned char charset2lower[256] = {
234 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 234 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
235}; 235};
236 236
237static unsigned char charset2upper[256] = { 237static const unsigned char charset2upper[256] = {
238 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 238 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
239 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 239 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
240 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 240 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -272,7 +272,7 @@ static unsigned char charset2upper[256] = {
272 272
273static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 273static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
274{ 274{
275 unsigned char *uni2charset; 275 const unsigned char *uni2charset;
276 unsigned char cl = uni & 0x00ff; 276 unsigned char cl = uni & 0x00ff;
277 unsigned char ch = (uni & 0xff00) >> 8; 277 unsigned char ch = (uni & 0xff00) >> 8;
278 278
diff --git a/fs/nls/nls_cp850.c b/fs/nls/nls_cp850.c
index 843b7d975ba2..fe5bdad50e2b 100644
--- a/fs/nls/nls_cp850.c
+++ b/fs/nls/nls_cp850.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00b3, 0x00b2, 0x25a0, 0x00a0, 96 0x00b3, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x9b, 0x97, 0xa3, 0x96, 0x81, 0xec, 0xe7, 0x98, /* 0xf8-0xff */ 132 0x9b, 0x97, 0xa3, 0x96, 0x81, 0xec, 0xe7, 0x98, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,13 +155,13 @@ static unsigned char page01[256] = {
155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page20[256] = { 158static const unsigned char page20[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, /* 0x10-0x17 */
162}; 162};
163 163
164static unsigned char page25[256] = { 164static const unsigned char page25[256] = {
165 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 165 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
166 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 166 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
167 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 167 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -186,7 +186,7 @@ static unsigned char page25[256] = {
186 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 186 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
187}; 187};
188 188
189static unsigned char *page_uni2charset[256] = { 189static const unsigned char *const page_uni2charset[256] = {
190 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 190 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
191 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 191 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
192 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 192 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -194,7 +194,7 @@ static unsigned char *page_uni2charset[256] = {
194 page20, NULL, NULL, NULL, NULL, page25, NULL, NULL, 194 page20, NULL, NULL, NULL, NULL, page25, NULL, NULL,
195}; 195};
196 196
197static unsigned char charset2lower[256] = { 197static const unsigned char charset2lower[256] = {
198 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 198 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
199 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 199 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
200 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 200 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -230,7 +230,7 @@ static unsigned char charset2lower[256] = {
230 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 230 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
231}; 231};
232 232
233static unsigned char charset2upper[256] = { 233static const unsigned char charset2upper[256] = {
234 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 234 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
235 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 235 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
236 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 236 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -268,7 +268,7 @@ static unsigned char charset2upper[256] = {
268 268
269static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 269static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
270{ 270{
271 unsigned char *uni2charset; 271 const unsigned char *uni2charset;
272 unsigned char cl = uni & 0x00ff; 272 unsigned char cl = uni & 0x00ff;
273 unsigned char ch = (uni & 0xff00) >> 8; 273 unsigned char ch = (uni & 0xff00) >> 8;
274 274
diff --git a/fs/nls/nls_cp852.c b/fs/nls/nls_cp852.c
index 83cfd844d5ca..ceb1c0166dd8 100644
--- a/fs/nls/nls_cp852.c
+++ b/fs/nls/nls_cp852.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x0158, 0x0159, 0x25a0, 0x00a0, 96 0x0158, 0x0159, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x00, 0xa3, 0x00, 0x81, 0xec, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x00, 0xa3, 0x00, 0x81, 0xec, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0xc6, 0xc7, 0xa4, 0xa5, 0x8f, 0x86, /* 0x00-0x07 */ 136 0x00, 0x00, 0xc6, 0xc7, 0xa4, 0xa5, 0x8f, 0x86, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0xac, 0x9f, 0xd2, 0xd4, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0xac, 0x9f, 0xd2, 0xd4, /* 0x08-0x0f */
138 0xd1, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0xd1, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
151 0x00, 0x8d, 0xab, 0xbd, 0xbe, 0xa6, 0xa7, 0x00, /* 0x78-0x7f */ 151 0x00, 0x8d, 0xab, 0xbd, 0xbe, 0xa6, 0xa7, 0x00, /* 0x78-0x7f */
152}; 152};
153 153
154static unsigned char page02[256] = { 154static const unsigned char page02[256] = {
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,7 +183,7 @@ static unsigned char page02[256] = {
183 0xf4, 0xfa, 0x00, 0xf2, 0x00, 0xf1, 0x00, 0x00, /* 0xd8-0xdf */ 183 0xf4, 0xfa, 0x00, 0xf2, 0x00, 0xf1, 0x00, 0x00, /* 0xd8-0xdf */
184}; 184};
185 185
186static unsigned char page25[256] = { 186static const unsigned char page25[256] = {
187 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 187 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
188 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 188 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
189 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 189 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -208,7 +208,7 @@ static unsigned char page25[256] = {
208 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 208 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
209}; 209};
210 210
211static unsigned char *page_uni2charset[256] = { 211static const unsigned char *const page_uni2charset[256] = {
212 page00, page01, page02, NULL, NULL, NULL, NULL, NULL, 212 page00, page01, page02, NULL, NULL, NULL, NULL, NULL,
213 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 213 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -216,7 +216,7 @@ static unsigned char *page_uni2charset[256] = {
216 NULL, NULL, NULL, NULL, NULL, page25, NULL, NULL, 216 NULL, NULL, NULL, NULL, NULL, page25, NULL, NULL,
217}; 217};
218 218
219static unsigned char charset2lower[256] = { 219static const unsigned char charset2lower[256] = {
220 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 220 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
221 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 221 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
222 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 222 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -252,7 +252,7 @@ static unsigned char charset2lower[256] = {
252 0xf8, 0xf9, 0xfa, 0xfb, 0xfd, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 252 0xf8, 0xf9, 0xfa, 0xfb, 0xfd, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
253}; 253};
254 254
255static unsigned char charset2upper[256] = { 255static const unsigned char charset2upper[256] = {
256 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 256 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
257 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 257 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
258 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 258 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -290,7 +290,7 @@ static unsigned char charset2upper[256] = {
290 290
291static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 291static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
292{ 292{
293 unsigned char *uni2charset; 293 const unsigned char *uni2charset;
294 unsigned char cl = uni & 0x00ff; 294 unsigned char cl = uni & 0x00ff;
295 unsigned char ch = (uni & 0xff00) >> 8; 295 unsigned char ch = (uni & 0xff00) >> 8;
296 296
diff --git a/fs/nls/nls_cp855.c b/fs/nls/nls_cp855.c
index 9190b7b574ff..cc7f5fb2e0c2 100644
--- a/fs/nls/nls_cp855.c
+++ b/fs/nls/nls_cp855.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x0427, 0x00a7, 0x25a0, 0x00a0, 96 0x0427, 0x00a7, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -124,7 +124,7 @@ static unsigned char page00[256] = {
124 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 124 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
125}; 125};
126 126
127static unsigned char page04[256] = { 127static const unsigned char page04[256] = {
128 0x00, 0x85, 0x81, 0x83, 0x87, 0x89, 0x8b, 0x8d, /* 0x00-0x07 */ 128 0x00, 0x85, 0x81, 0x83, 0x87, 0x89, 0x8b, 0x8d, /* 0x00-0x07 */
129 0x8f, 0x91, 0x93, 0x95, 0x97, 0x00, 0x99, 0x9b, /* 0x08-0x0f */ 129 0x8f, 0x91, 0x93, 0x95, 0x97, 0x00, 0x99, 0x9b, /* 0x08-0x0f */
130 0xa1, 0xa3, 0xec, 0xad, 0xa7, 0xa9, 0xea, 0xf4, /* 0x10-0x17 */ 130 0xa1, 0xa3, 0xec, 0xad, 0xa7, 0xa9, 0xea, 0xf4, /* 0x10-0x17 */
@@ -139,13 +139,13 @@ static unsigned char page04[256] = {
139 0x8e, 0x90, 0x92, 0x94, 0x96, 0x00, 0x98, 0x9a, /* 0x58-0x5f */ 139 0x8e, 0x90, 0x92, 0x94, 0x96, 0x00, 0x98, 0x9a, /* 0x58-0x5f */
140}; 140};
141 141
142static unsigned char page21[256] = { 142static const unsigned char page21[256] = {
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, /* 0x10-0x17 */ 145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, /* 0x10-0x17 */
146}; 146};
147 147
148static unsigned char page25[256] = { 148static const unsigned char page25[256] = {
149 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 149 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
150 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 150 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
151 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 151 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -170,7 +170,7 @@ static unsigned char page25[256] = {
170 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 170 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
171}; 171};
172 172
173static unsigned char *page_uni2charset[256] = { 173static const unsigned char *const page_uni2charset[256] = {
174 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL, 174 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL,
175 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 175 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
176 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 176 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -178,7 +178,7 @@ static unsigned char *page_uni2charset[256] = {
178 NULL, page21, NULL, NULL, NULL, page25, NULL, NULL, 178 NULL, page21, NULL, NULL, NULL, page25, NULL, NULL,
179}; 179};
180 180
181static unsigned char charset2lower[256] = { 181static const unsigned char charset2lower[256] = {
182 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 182 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
183 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 183 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
184 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 184 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -214,7 +214,7 @@ static unsigned char charset2lower[256] = {
214 0xf7, 0xf9, 0xf9, 0xfb, 0xfb, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 214 0xf7, 0xf9, 0xf9, 0xfb, 0xfb, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
215}; 215};
216 216
217static unsigned char charset2upper[256] = { 217static const unsigned char charset2upper[256] = {
218 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 218 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
219 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 219 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
220 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 220 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -252,7 +252,7 @@ static unsigned char charset2upper[256] = {
252 252
253static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 253static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
254{ 254{
255 unsigned char *uni2charset; 255 const unsigned char *uni2charset;
256 unsigned char cl = uni & 0x00ff; 256 unsigned char cl = uni & 0x00ff;
257 unsigned char ch = (uni & 0xff00) >> 8; 257 unsigned char ch = (uni & 0xff00) >> 8;
258 258
diff --git a/fs/nls/nls_cp857.c b/fs/nls/nls_cp857.c
index ef3d36db8082..e418e198e8d8 100644
--- a/fs/nls/nls_cp857.c
+++ b/fs/nls/nls_cp857.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00b3, 0x00b2, 0x25a0, 0x00a0, 96 0x00b3, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x9b, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0xed, /* 0xf8-0xff */ 132 0x9b, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0xed, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -147,7 +147,7 @@ static unsigned char page01[256] = {
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x9f, /* 0x58-0x5f */ 147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x9f, /* 0x58-0x5f */
148}; 148};
149 149
150static unsigned char page25[256] = { 150static const unsigned char page25[256] = {
151 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 151 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
152 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 152 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
153 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 153 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -172,7 +172,7 @@ static unsigned char page25[256] = {
172 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 172 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
173}; 173};
174 174
175static unsigned char *page_uni2charset[256] = { 175static const unsigned char *const page_uni2charset[256] = {
176 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 176 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
177 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 177 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
178 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 178 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -180,7 +180,7 @@ static unsigned char *page_uni2charset[256] = {
180 NULL, NULL, NULL, NULL, NULL, page25, NULL, NULL, 180 NULL, NULL, NULL, NULL, NULL, page25, NULL, NULL,
181}; 181};
182 182
183static unsigned char charset2lower[256] = { 183static const unsigned char charset2lower[256] = {
184 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 184 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
185 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 185 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
186 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 186 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -216,7 +216,7 @@ static unsigned char charset2lower[256] = {
216 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 216 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
217}; 217};
218 218
219static unsigned char charset2upper[256] = { 219static const unsigned char charset2upper[256] = {
220 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 220 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
221 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 221 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
222 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 222 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -254,7 +254,7 @@ static unsigned char charset2upper[256] = {
254 254
255static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 255static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
256{ 256{
257 unsigned char *uni2charset; 257 const unsigned char *uni2charset;
258 unsigned char cl = uni & 0x00ff; 258 unsigned char cl = uni & 0x00ff;
259 unsigned char ch = (uni & 0xff00) >> 8; 259 unsigned char ch = (uni & 0xff00) >> 8;
260 260
diff --git a/fs/nls/nls_cp860.c b/fs/nls/nls_cp860.c
index 7e2fb6645893..a86c97d1aa34 100644
--- a/fs/nls/nls_cp860.c
+++ b/fs/nls/nls_cp860.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x97, 0xa3, 0x00, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x97, 0xa3, 0x00, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page03[256] = { 135static const unsigned char page03[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -161,7 +161,7 @@ static unsigned char page03[256] = {
161 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */ 161 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
162}; 162};
163 163
164static unsigned char page20[256] = { 164static const unsigned char page20[256] = {
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -186,7 +186,7 @@ static unsigned char page20[256] = {
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */ 186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
187}; 187};
188 188
189static unsigned char page22[256] = { 189static const unsigned char page22[256] = {
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -202,7 +202,7 @@ static unsigned char page22[256] = {
202 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 202 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
203}; 203};
204 204
205static unsigned char page23[256] = { 205static const unsigned char page23[256] = {
206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -210,7 +210,7 @@ static unsigned char page23[256] = {
210 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 210 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
211}; 211};
212 212
213static unsigned char page25[256] = { 213static const unsigned char page25[256] = {
214 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 214 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
215 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 215 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
216 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 216 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -235,7 +235,7 @@ static unsigned char page25[256] = {
235 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 235 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
236}; 236};
237 237
238static unsigned char *page_uni2charset[256] = { 238static const unsigned char *const page_uni2charset[256] = {
239 page00, NULL, NULL, page03, NULL, NULL, NULL, NULL, 239 page00, NULL, NULL, page03, NULL, NULL, NULL, NULL,
240 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 240 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
241 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 241 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -243,7 +243,7 @@ static unsigned char *page_uni2charset[256] = {
243 page20, NULL, page22, page23, NULL, page25, NULL, NULL, 243 page20, NULL, page22, page23, NULL, page25, NULL, NULL,
244}; 244};
245 245
246static unsigned char charset2lower[256] = { 246static const unsigned char charset2lower[256] = {
247 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 247 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
248 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 248 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
249 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 249 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -279,7 +279,7 @@ static unsigned char charset2lower[256] = {
279 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 279 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
280}; 280};
281 281
282static unsigned char charset2upper[256] = { 282static const unsigned char charset2upper[256] = {
283 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 283 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
284 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 284 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
285 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 285 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -317,7 +317,7 @@ static unsigned char charset2upper[256] = {
317 317
318static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 318static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
319{ 319{
320 unsigned char *uni2charset; 320 const unsigned char *uni2charset;
321 unsigned char cl = uni & 0x00ff; 321 unsigned char cl = uni & 0x00ff;
322 unsigned char ch = (uni & 0xff00) >> 8; 322 unsigned char ch = (uni & 0xff00) >> 8;
323 323
diff --git a/fs/nls/nls_cp861.c b/fs/nls/nls_cp861.c
index 66d8d808ccf1..bd920227acdf 100644
--- a/fs/nls/nls_cp861.c
+++ b/fs/nls/nls_cp861.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x9b, 0x00, 0xa3, 0x96, 0x81, 0x98, 0x95, 0x00, /* 0xf8-0xff */ 132 0x9b, 0x00, 0xa3, 0x96, 0x81, 0x98, 0x95, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page03[256] = { 158static const unsigned char page03[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */ 184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
185}; 185};
186 186
187static unsigned char page20[256] = { 187static const unsigned char page20[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page20[256] = {
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */ 209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
210}; 210};
211 211
212static unsigned char page22[256] = { 212static const unsigned char page22[256] = {
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char page22[256] = {
225 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 225 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
226}; 226};
227 227
228static unsigned char page23[256] = { 228static const unsigned char page23[256] = {
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
231 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 231 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -233,7 +233,7 @@ static unsigned char page23[256] = {
233 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 233 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
234}; 234};
235 235
236static unsigned char page25[256] = { 236static const unsigned char page25[256] = {
237 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 237 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
238 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 238 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
239 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 239 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char page25[256] = {
258 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 258 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
259}; 259};
260 260
261static unsigned char *page_uni2charset[256] = { 261static const unsigned char *const page_uni2charset[256] = {
262 page00, page01, NULL, page03, NULL, NULL, NULL, NULL, 262 page00, page01, NULL, page03, NULL, NULL, NULL, NULL,
263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
264 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 264 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -266,7 +266,7 @@ static unsigned char *page_uni2charset[256] = {
266 page20, NULL, page22, page23, NULL, page25, NULL, NULL, 266 page20, NULL, page22, page23, NULL, page25, NULL, NULL,
267}; 267};
268 268
269static unsigned char charset2lower[256] = { 269static const unsigned char charset2lower[256] = {
270 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 270 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
271 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 271 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
272 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 272 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -302,7 +302,7 @@ static unsigned char charset2lower[256] = {
302 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 302 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
303}; 303};
304 304
305static unsigned char charset2upper[256] = { 305static const unsigned char charset2upper[256] = {
306 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 306 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
307 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 307 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
308 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 308 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -340,7 +340,7 @@ static unsigned char charset2upper[256] = {
340 340
341static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 341static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
342{ 342{
343 unsigned char *uni2charset; 343 const unsigned char *uni2charset;
344 unsigned char cl = uni & 0x00ff; 344 unsigned char cl = uni & 0x00ff;
345 unsigned char ch = (uni & 0xff00) >> 8; 345 unsigned char ch = (uni & 0xff00) >> 8;
346 346
diff --git a/fs/nls/nls_cp862.c b/fs/nls/nls_cp862.c
index 360ba388485f..e9b68eb3daf0 100644
--- a/fs/nls/nls_cp862.c
+++ b/fs/nls/nls_cp862.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page03[256] = { 158static const unsigned char page03[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */ 184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
185}; 185};
186 186
187static unsigned char page05[256] = { 187static const unsigned char page05[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -218,7 +218,7 @@ static unsigned char page05[256] = {
218 0x98, 0x99, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 218 0x98, 0x99, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
219}; 219};
220 220
221static unsigned char page20[256] = { 221static const unsigned char page20[256] = {
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -243,7 +243,7 @@ static unsigned char page20[256] = {
243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */ 243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
244}; 244};
245 245
246static unsigned char page22[256] = { 246static const unsigned char page22[256] = {
247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -259,7 +259,7 @@ static unsigned char page22[256] = {
259 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 259 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
260}; 260};
261 261
262static unsigned char page23[256] = { 262static const unsigned char page23[256] = {
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
265 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 265 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -267,7 +267,7 @@ static unsigned char page23[256] = {
267 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 267 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
268}; 268};
269 269
270static unsigned char page25[256] = { 270static const unsigned char page25[256] = {
271 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 271 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
272 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 272 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
273 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 273 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -292,7 +292,7 @@ static unsigned char page25[256] = {
292 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 292 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
293}; 293};
294 294
295static unsigned char *page_uni2charset[256] = { 295static const unsigned char *const page_uni2charset[256] = {
296 page00, page01, NULL, page03, NULL, page05, NULL, NULL, 296 page00, page01, NULL, page03, NULL, page05, NULL, NULL,
297 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 297 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
298 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 298 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -300,7 +300,7 @@ static unsigned char *page_uni2charset[256] = {
300 page20, NULL, page22, page23, NULL, page25, NULL, NULL, 300 page20, NULL, page22, page23, NULL, page25, NULL, NULL,
301}; 301};
302 302
303static unsigned char charset2lower[256] = { 303static const unsigned char charset2lower[256] = {
304 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 304 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
305 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 305 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
306 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 306 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -336,7 +336,7 @@ static unsigned char charset2lower[256] = {
336 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 336 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
337}; 337};
338 338
339static unsigned char charset2upper[256] = { 339static const unsigned char charset2upper[256] = {
340 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 340 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
341 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 341 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
342 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 342 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -374,7 +374,7 @@ static unsigned char charset2upper[256] = {
374 374
375static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 375static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
376{ 376{
377 unsigned char *uni2charset; 377 const unsigned char *uni2charset;
378 unsigned char cl = uni & 0x00ff; 378 unsigned char cl = uni & 0x00ff;
379 unsigned char ch = (uni & 0xff00) >> 8; 379 unsigned char ch = (uni & 0xff00) >> 8;
380 380
diff --git a/fs/nls/nls_cp863.c b/fs/nls/nls_cp863.c
index 656a93113e37..f8a9b07ab4e2 100644
--- a/fs/nls/nls_cp863.c
+++ b/fs/nls/nls_cp863.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page03[256] = { 158static const unsigned char page03[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */ 184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
185}; 185};
186 186
187static unsigned char page20[256] = { 187static const unsigned char page20[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, /* 0x10-0x17 */
@@ -203,7 +203,7 @@ static unsigned char page20[256] = {
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x78-0x7f */ 203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x78-0x7f */
204}; 204};
205 205
206static unsigned char page22[256] = { 206static const unsigned char page22[256] = {
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -219,7 +219,7 @@ static unsigned char page22[256] = {
219 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 219 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
220}; 220};
221 221
222static unsigned char page23[256] = { 222static const unsigned char page23[256] = {
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
225 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 225 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -227,7 +227,7 @@ static unsigned char page23[256] = {
227 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 227 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
228}; 228};
229 229
230static unsigned char page25[256] = { 230static const unsigned char page25[256] = {
231 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 231 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
232 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 232 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
233 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 233 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -252,7 +252,7 @@ static unsigned char page25[256] = {
252 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 252 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
253}; 253};
254 254
255static unsigned char *page_uni2charset[256] = { 255static const unsigned char *const page_uni2charset[256] = {
256 page00, page01, NULL, page03, NULL, NULL, NULL, NULL, 256 page00, page01, NULL, page03, NULL, NULL, NULL, NULL,
257 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 257 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
258 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 258 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -260,7 +260,7 @@ static unsigned char *page_uni2charset[256] = {
260 page20, NULL, page22, page23, NULL, page25, NULL, NULL, 260 page20, NULL, page22, page23, NULL, page25, NULL, NULL,
261}; 261};
262 262
263static unsigned char charset2lower[256] = { 263static const unsigned char charset2lower[256] = {
264 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 264 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
265 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 265 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
266 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 266 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -296,7 +296,7 @@ static unsigned char charset2lower[256] = {
296 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 296 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
297}; 297};
298 298
299static unsigned char charset2upper[256] = { 299static const unsigned char charset2upper[256] = {
300 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 300 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
301 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 301 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
302 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 302 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -334,7 +334,7 @@ static unsigned char charset2upper[256] = {
334 334
335static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 335static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
336{ 336{
337 unsigned char *uni2charset; 337 const unsigned char *uni2charset;
338 unsigned char cl = uni & 0x00ff; 338 unsigned char cl = uni & 0x00ff;
339 unsigned char ch = (uni & 0xff00) >> 8; 339 unsigned char ch = (uni & 0xff00) >> 8;
340 340
diff --git a/fs/nls/nls_cp864.c b/fs/nls/nls_cp864.c
index 01ca7309753e..8d31f435fc6f 100644
--- a/fs/nls/nls_cp864.c
+++ b/fs/nls/nls_cp864.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0xfed9, 0xfef1, 0x25a0, 0x0000, 96 0xfed9, 0xfef1, 0x25a0, 0x0000,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -131,7 +131,7 @@ static unsigned char page00[256] = {
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, /* 0xf0-0xf7 */ 131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, /* 0xf0-0xf7 */
132}; 132};
133 133
134static unsigned char page03[256] = { 134static const unsigned char page03[256] = {
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -160,7 +160,7 @@ static unsigned char page03[256] = {
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, /* 0xc0-0xc7 */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, /* 0xc0-0xc7 */
161}; 161};
162 162
163static unsigned char page06[256] = { 163static const unsigned char page06[256] = {
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
165 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 165 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -177,7 +177,7 @@ static unsigned char page06[256] = {
177 0xb8, 0xb9, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 177 0xb8, 0xb9, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
178}; 178};
179 179
180static unsigned char page22[256] = { 180static const unsigned char page22[256] = {
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
183 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 183 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -190,7 +190,7 @@ static unsigned char page22[256] = {
190 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 190 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
191}; 191};
192 192
193static unsigned char page25[256] = { 193static const unsigned char page25[256] = {
194 0x85, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 194 0x85, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
195 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 195 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, /* 0x08-0x0f */
196 0x8c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 196 0x8c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -215,7 +215,7 @@ static unsigned char page25[256] = {
215 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 215 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
216}; 216};
217 217
218static unsigned char pagefe[256] = { 218static const unsigned char pagefe[256] = {
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -251,7 +251,7 @@ static unsigned char pagefe[256] = {
251 0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 251 0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, 0x00, 0x00, /* 0xf8-0xff */
252}; 252};
253 253
254static unsigned char *page_uni2charset[256] = { 254static const unsigned char *const page_uni2charset[256] = {
255 page00, NULL, NULL, page03, NULL, NULL, page06, NULL, 255 page00, NULL, NULL, page03, NULL, NULL, page06, NULL,
256 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 256 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
257 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 257 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -286,7 +286,7 @@ static unsigned char *page_uni2charset[256] = {
286 NULL, NULL, NULL, NULL, NULL, NULL, pagefe, NULL, 286 NULL, NULL, NULL, NULL, NULL, NULL, pagefe, NULL,
287}; 287};
288 288
289static unsigned char charset2lower[256] = { 289static const unsigned char charset2lower[256] = {
290 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 290 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
291 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 291 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
292 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 292 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -322,7 +322,7 @@ static unsigned char charset2lower[256] = {
322 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ 322 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
323}; 323};
324 324
325static unsigned char charset2upper[256] = { 325static const unsigned char charset2upper[256] = {
326 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 326 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
327 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 327 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
328 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 328 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -360,7 +360,7 @@ static unsigned char charset2upper[256] = {
360 360
361static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 361static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
362{ 362{
363 unsigned char *uni2charset; 363 const unsigned char *uni2charset;
364 unsigned char cl = uni & 0x00ff; 364 unsigned char cl = uni & 0x00ff;
365 unsigned char ch = (uni & 0xff00) >> 8; 365 unsigned char ch = (uni & 0xff00) >> 8;
366 366
diff --git a/fs/nls/nls_cp865.c b/fs/nls/nls_cp865.c
index 5ba6ee13e109..4bd902fe3ec9 100644
--- a/fs/nls/nls_cp865.c
+++ b/fs/nls/nls_cp865.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x207f, 0x00b2, 0x25a0, 0x00a0, 96 0x207f, 0x00b2, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x9b, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */ 132 0x9b, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 155 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
156}; 156};
157 157
158static unsigned char page03[256] = { 158static const unsigned char page03[256] = {
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */ 184 0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
185}; 185};
186 186
187static unsigned char page20[256] = { 187static const unsigned char page20[256] = {
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page20[256] = {
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */ 209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
210}; 210};
211 211
212static unsigned char page22[256] = { 212static const unsigned char page22[256] = {
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char page22[256] = {
225 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */ 225 0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
226}; 226};
227 227
228static unsigned char page23[256] = { 228static const unsigned char page23[256] = {
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
231 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 231 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -233,7 +233,7 @@ static unsigned char page23[256] = {
233 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 233 0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
234}; 234};
235 235
236static unsigned char page25[256] = { 236static const unsigned char page25[256] = {
237 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 237 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
238 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 238 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
239 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 239 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char page25[256] = {
258 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 258 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
259}; 259};
260 260
261static unsigned char *page_uni2charset[256] = { 261static const unsigned char *const page_uni2charset[256] = {
262 page00, page01, NULL, page03, NULL, NULL, NULL, NULL, 262 page00, page01, NULL, page03, NULL, NULL, NULL, NULL,
263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
264 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 264 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -266,7 +266,7 @@ static unsigned char *page_uni2charset[256] = {
266 page20, NULL, page22, page23, NULL, page25, NULL, NULL, 266 page20, NULL, page22, page23, NULL, page25, NULL, NULL,
267}; 267};
268 268
269static unsigned char charset2lower[256] = { 269static const unsigned char charset2lower[256] = {
270 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 270 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
271 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 271 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
272 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 272 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -302,7 +302,7 @@ static unsigned char charset2lower[256] = {
302 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 302 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
303}; 303};
304 304
305static unsigned char charset2upper[256] = { 305static const unsigned char charset2upper[256] = {
306 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 306 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
307 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 307 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
308 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 308 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -340,7 +340,7 @@ static unsigned char charset2upper[256] = {
340 340
341static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 341static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
342{ 342{
343 unsigned char *uni2charset; 343 const unsigned char *uni2charset;
344 unsigned char cl = uni & 0x00ff; 344 unsigned char cl = uni & 0x00ff;
345 unsigned char ch = (uni & 0xff00) >> 8; 345 unsigned char ch = (uni & 0xff00) >> 8;
346 346
diff --git a/fs/nls/nls_cp866.c b/fs/nls/nls_cp866.c
index c5f82221c9fe..bdc7cb391398 100644
--- a/fs/nls/nls_cp866.c
+++ b/fs/nls/nls_cp866.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x2116, 0x00a4, 0x25a0, 0x00a0, 96 0x2116, 0x00a4, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -123,7 +123,7 @@ static unsigned char page00[256] = {
123 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, /* 0xb0-0xb7 */ 123 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, /* 0xb0-0xb7 */
124}; 124};
125 125
126static unsigned char page04[256] = { 126static const unsigned char page04[256] = {
127 0x00, 0xf0, 0x00, 0x00, 0xf2, 0x00, 0x00, 0xf4, /* 0x00-0x07 */ 127 0x00, 0xf0, 0x00, 0x00, 0xf2, 0x00, 0x00, 0xf4, /* 0x00-0x07 */
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x00, /* 0x08-0x0f */ 128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x00, /* 0x08-0x0f */
129 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x10-0x17 */ 129 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x10-0x17 */
@@ -138,20 +138,20 @@ static unsigned char page04[256] = {
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, /* 0x58-0x5f */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, /* 0x58-0x5f */
139}; 139};
140 140
141static unsigned char page21[256] = { 141static const unsigned char page21[256] = {
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, /* 0x10-0x17 */ 144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, /* 0x10-0x17 */
145}; 145};
146 146
147static unsigned char page22[256] = { 147static const unsigned char page22[256] = {
148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
151 0x00, 0xf9, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 151 0x00, 0xf9, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
152}; 152};
153 153
154static unsigned char page25[256] = { 154static const unsigned char page25[256] = {
155 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 155 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
156 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 156 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
157 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 157 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -176,7 +176,7 @@ static unsigned char page25[256] = {
176 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 176 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
177}; 177};
178 178
179static unsigned char *page_uni2charset[256] = { 179static const unsigned char *const page_uni2charset[256] = {
180 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL, 180 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL,
181 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 181 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
182 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 182 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -184,7 +184,7 @@ static unsigned char *page_uni2charset[256] = {
184 NULL, page21, page22, NULL, NULL, page25, NULL, NULL, 184 NULL, page21, page22, NULL, NULL, page25, NULL, NULL,
185}; 185};
186 186
187static unsigned char charset2lower[256] = { 187static const unsigned char charset2lower[256] = {
188 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 188 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
189 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 189 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
190 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 190 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -220,7 +220,7 @@ static unsigned char charset2lower[256] = {
220 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 220 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
221}; 221};
222 222
223static unsigned char charset2upper[256] = { 223static const unsigned char charset2upper[256] = {
224 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 224 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
225 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 225 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
226 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 226 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char charset2upper[256] = {
258 258
259static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 259static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
260{ 260{
261 unsigned char *uni2charset; 261 const unsigned char *uni2charset;
262 unsigned char cl = uni & 0x00ff; 262 unsigned char cl = uni & 0x00ff;
263 unsigned char ch = (uni & 0xff00) >> 8; 263 unsigned char ch = (uni & 0xff00) >> 8;
264 264
diff --git a/fs/nls/nls_cp869.c b/fs/nls/nls_cp869.c
index 8d4015124d11..9f283a2b151a 100644
--- a/fs/nls/nls_cp869.c
+++ b/fs/nls/nls_cp869.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x03b0, 0x03ce, 0x25a0, 0x00a0, 96 0x03b0, 0x03ce, 0x25a0, 0x00a0,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -124,7 +124,7 @@ static unsigned char page00[256] = {
124 0x00, 0x00, 0x00, 0xaf, 0x00, 0xab, 0x00, 0x00, /* 0xb8-0xbf */ 124 0x00, 0x00, 0x00, 0xaf, 0x00, 0xab, 0x00, 0x00, /* 0xb8-0xbf */
125}; 125};
126 126
127static unsigned char page03[256] = { 127static const unsigned char page03[256] = {
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -154,14 +154,14 @@ static unsigned char page03[256] = {
154 0xf6, 0xfa, 0xa0, 0xfb, 0xa2, 0xa3, 0xfd, 0x00, /* 0xc8-0xcf */ 154 0xf6, 0xfa, 0xa0, 0xfb, 0xa2, 0xa3, 0xfd, 0x00, /* 0xc8-0xcf */
155}; 155};
156 156
157static unsigned char page20[256] = { 157static const unsigned char page20[256] = {
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, /* 0x10-0x17 */ 160 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, /* 0x10-0x17 */
161 0x8b, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 161 0x8b, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
162}; 162};
163 163
164static unsigned char page25[256] = { 164static const unsigned char page25[256] = {
165 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 165 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
166 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 166 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
167 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 167 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -186,7 +186,7 @@ static unsigned char page25[256] = {
186 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 186 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
187}; 187};
188 188
189static unsigned char *page_uni2charset[256] = { 189static const unsigned char *const page_uni2charset[256] = {
190 page00, NULL, NULL, page03, NULL, NULL, NULL, NULL, 190 page00, NULL, NULL, page03, NULL, NULL, NULL, NULL,
191 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 191 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
192 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 192 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -194,7 +194,7 @@ static unsigned char *page_uni2charset[256] = {
194 page20, NULL, NULL, NULL, NULL, page25, NULL, NULL, 194 page20, NULL, NULL, NULL, NULL, page25, NULL, NULL,
195}; 195};
196 196
197static unsigned char charset2lower[256] = { 197static const unsigned char charset2lower[256] = {
198 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 198 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
199 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 199 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
200 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 200 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -230,7 +230,7 @@ static unsigned char charset2lower[256] = {
230 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 230 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
231}; 231};
232 232
233static unsigned char charset2upper[256] = { 233static const unsigned char charset2upper[256] = {
234 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 234 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
235 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 235 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
236 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 236 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -268,7 +268,7 @@ static unsigned char charset2upper[256] = {
268 268
269static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 269static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
270{ 270{
271 unsigned char *uni2charset; 271 const unsigned char *uni2charset;
272 unsigned char cl = uni & 0x00ff; 272 unsigned char cl = uni & 0x00ff;
273 unsigned char ch = (uni & 0xff00) >> 8; 273 unsigned char ch = (uni & 0xff00) >> 8;
274 274
diff --git a/fs/nls/nls_cp874.c b/fs/nls/nls_cp874.c
index df042052c2db..0b3c4886f8c0 100644
--- a/fs/nls/nls_cp874.c
+++ b/fs/nls/nls_cp874.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x0000, 0x0000, 0x0000, 0x0000, 96 0x0000, 0x0000, 0x0000, 0x0000,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -121,7 +121,7 @@ static unsigned char page00[256] = {
121 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 121 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
122}; 122};
123 123
124static unsigned char page0e[256] = { 124static const unsigned char page0e[256] = {
125 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 125 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */
126 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ 126 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */
127 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 127 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */
@@ -136,7 +136,7 @@ static unsigned char page0e[256] = {
136 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 136 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
137}; 137};
138 138
139static unsigned char page20[256] = { 139static const unsigned char page20[256] = {
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
142 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 142 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -144,7 +144,7 @@ static unsigned char page20[256] = {
144 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 144 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
145}; 145};
146 146
147static unsigned char *page_uni2charset[256] = { 147static const unsigned char *const page_uni2charset[256] = {
148 page00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 148 page00, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
149 NULL, NULL, NULL, NULL, NULL, NULL, page0e, NULL, 149 NULL, NULL, NULL, NULL, NULL, NULL, page0e, NULL,
150 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 150 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -152,7 +152,7 @@ static unsigned char *page_uni2charset[256] = {
152 page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 152 page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
153}; 153};
154 154
155static unsigned char charset2lower[256] = { 155static const unsigned char charset2lower[256] = {
156 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 156 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
157 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 157 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
158 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 158 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -188,7 +188,7 @@ static unsigned char charset2lower[256] = {
188 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 188 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
189}; 189};
190 190
191static unsigned char charset2upper[256] = { 191static const unsigned char charset2upper[256] = {
192 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 192 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
193 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 193 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
194 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 194 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -226,7 +226,7 @@ static unsigned char charset2upper[256] = {
226 226
227static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 227static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
228{ 228{
229 unsigned char *uni2charset; 229 const unsigned char *uni2charset;
230 unsigned char cl = uni & 0x00ff; 230 unsigned char cl = uni & 0x00ff;
231 unsigned char ch = (uni & 0xff00) >> 8; 231 unsigned char ch = (uni & 0xff00) >> 8;
232 232
diff --git a/fs/nls/nls_cp932.c b/fs/nls/nls_cp932.c
index 2a9ccf3bc7ef..0ffed6f1cebb 100644
--- a/fs/nls/nls_cp932.c
+++ b/fs/nls/nls_cp932.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t c2u_81[256] = { 16static const wchar_t c2u_81[256] = {
17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_81[256] = {
49 0x0000,0x0000,0x0000,0x0000,0x25EF,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 49 0x0000,0x0000,0x0000,0x0000,0x25EF,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
50}; 50};
51 51
52static wchar_t c2u_82[256] = { 52static const wchar_t c2u_82[256] = {
53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -84,7 +84,7 @@ static wchar_t c2u_82[256] = {
84 0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */ 84 0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
85}; 85};
86 86
87static wchar_t c2u_83[256] = { 87static const wchar_t c2u_83[256] = {
88 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 88 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -115,7 +115,7 @@ static wchar_t c2u_83[256] = {
115 0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,0x0000,/* 0xD0-0xD7 */ 115 0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,0x0000,/* 0xD0-0xD7 */
116}; 116};
117 117
118static wchar_t c2u_84[256] = { 118static const wchar_t c2u_84[256] = {
119 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 119 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
120 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 120 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
121 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 121 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -143,7 +143,7 @@ static wchar_t c2u_84[256] = {
143 0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542,0x0000,/* 0xB8-0xBF */ 143 0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542,0x0000,/* 0xB8-0xBF */
144}; 144};
145 145
146static wchar_t c2u_87[256] = { 146static const wchar_t c2u_87[256] = {
147 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 147 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
148 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 148 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -167,7 +167,7 @@ static wchar_t c2u_87[256] = {
167 0x221F,0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000,0x0000,/* 0x98-0x9F */ 167 0x221F,0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000,0x0000,/* 0x98-0x9F */
168}; 168};
169 169
170static wchar_t c2u_88[256] = { 170static const wchar_t c2u_88[256] = {
171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
172 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 172 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
173 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 173 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -203,7 +203,7 @@ static wchar_t c2u_88[256] = {
203 0x5F15,0x98F2,0x6DEB,0x80E4,0x852D,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 203 0x5F15,0x98F2,0x6DEB,0x80E4,0x852D,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
204}; 204};
205 205
206static wchar_t c2u_89[256] = { 206static const wchar_t c2u_89[256] = {
207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
208 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 208 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
209 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 209 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -239,7 +239,7 @@ static wchar_t c2u_89[256] = {
239 0x6062,0x61D0,0x6212,0x62D0,0x6539,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 239 0x6062,0x61D0,0x6212,0x62D0,0x6539,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
240}; 240};
241 241
242static wchar_t c2u_8A[256] = { 242static const wchar_t c2u_8A[256] = {
243 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 243 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
244 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 244 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
245 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 245 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -275,7 +275,7 @@ static wchar_t c2u_8A[256] = {
275 0x65D7,0x65E2,0x671F,0x68CB,0x68C4,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 275 0x65D7,0x65E2,0x671F,0x68CB,0x68C4,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
276}; 276};
277 277
278static wchar_t c2u_8B[256] = { 278static const wchar_t c2u_8B[256] = {
279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
280 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 280 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
281 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 281 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -311,7 +311,7 @@ static wchar_t c2u_8B[256] = {
311 0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 311 0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
312}; 312};
313 313
314static wchar_t c2u_8C[256] = { 314static const wchar_t c2u_8C[256] = {
315 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 315 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
316 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 316 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
317 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 317 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -347,7 +347,7 @@ static wchar_t c2u_8C[256] = {
347 0x52B9,0x52FE,0x539A,0x53E3,0x5411,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 347 0x52B9,0x52FE,0x539A,0x53E3,0x5411,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
348}; 348};
349 349
350static wchar_t c2u_8D[256] = { 350static const wchar_t c2u_8D[256] = {
351 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 351 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
352 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 352 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
353 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 353 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -383,7 +383,7 @@ static wchar_t c2u_8D[256] = {
383 0x9BAD,0x7B39,0x5319,0x518A,0x5237,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 383 0x9BAD,0x7B39,0x5319,0x518A,0x5237,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
384}; 384};
385 385
386static wchar_t c2u_8E[256] = { 386static const wchar_t c2u_8E[256] = {
387 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 387 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
388 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 388 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
389 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 389 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -419,7 +419,7 @@ static wchar_t c2u_8E[256] = {
419 0x7DAC,0x9700,0x56DA,0x53CE,0x5468,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 419 0x7DAC,0x9700,0x56DA,0x53CE,0x5468,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
420}; 420};
421 421
422static wchar_t c2u_8F[256] = { 422static const wchar_t c2u_8F[256] = {
423 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 423 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
424 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 424 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
425 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 425 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -455,7 +455,7 @@ static wchar_t c2u_8F[256] = {
455 0x91B8,0x9320,0x5631,0x57F4,0x98FE,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 455 0x91B8,0x9320,0x5631,0x57F4,0x98FE,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
456}; 456};
457 457
458static wchar_t c2u_90[256] = { 458static const wchar_t c2u_90[256] = {
459 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 459 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
460 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 460 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
461 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 461 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -491,7 +491,7 @@ static wchar_t c2u_90[256] = {
491 0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 491 0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
492}; 492};
493 493
494static wchar_t c2u_91[256] = { 494static const wchar_t c2u_91[256] = {
495 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 495 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
496 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 496 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
497 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 497 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -527,7 +527,7 @@ static wchar_t c2u_91[256] = {
527 0x8AFE,0x8338,0x51E7,0x86F8,0x53EA,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 527 0x8AFE,0x8338,0x51E7,0x86F8,0x53EA,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
528}; 528};
529 529
530static wchar_t c2u_92[256] = { 530static const wchar_t c2u_92[256] = {
531 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 531 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
532 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 532 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
533 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 533 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -563,7 +563,7 @@ static wchar_t c2u_92[256] = {
563 0x8247,0x8A02,0x8AE6,0x8E44,0x9013,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 563 0x8247,0x8A02,0x8AE6,0x8E44,0x9013,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
564}; 564};
565 565
566static wchar_t c2u_93[256] = { 566static const wchar_t c2u_93[256] = {
567 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 567 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
568 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 568 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
569 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 569 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -599,7 +599,7 @@ static wchar_t c2u_93[256] = {
599 0x8679,0x5EFF,0x65E5,0x4E73,0x5165,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 599 0x8679,0x5EFF,0x65E5,0x4E73,0x5165,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
600}; 600};
601 601
602static wchar_t c2u_94[256] = { 602static const wchar_t c2u_94[256] = {
603 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 603 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
604 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 604 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
605 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 605 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -635,7 +635,7 @@ static wchar_t c2u_94[256] = {
635 0x6787,0x6BD8,0x7435,0x7709,0x7F8E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 635 0x6787,0x6BD8,0x7435,0x7709,0x7F8E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
636}; 636};
637 637
638static wchar_t c2u_95[256] = { 638static const wchar_t c2u_95[256] = {
639 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 639 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
640 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 640 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
641 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 641 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -671,7 +671,7 @@ static wchar_t c2u_95[256] = {
671 0x62B1,0x6367,0x653E,0x65B9,0x670B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 671 0x62B1,0x6367,0x653E,0x65B9,0x670B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
672}; 672};
673 673
674static wchar_t c2u_96[256] = { 674static const wchar_t c2u_96[256] = {
675 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 675 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
676 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 676 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
677 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 677 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -707,7 +707,7 @@ static wchar_t c2u_96[256] = {
707 0x9453,0x6109,0x6108,0x6CB9,0x7652,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 707 0x9453,0x6109,0x6108,0x6CB9,0x7652,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
708}; 708};
709 709
710static wchar_t c2u_97[256] = { 710static const wchar_t c2u_97[256] = {
711 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 711 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
712 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 712 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
713 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 713 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -743,7 +743,7 @@ static wchar_t c2u_97[256] = {
743 0x6F23,0x7149,0x7C3E,0x7DF4,0x806F,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 743 0x6F23,0x7149,0x7C3E,0x7DF4,0x806F,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
744}; 744};
745 745
746static wchar_t c2u_98[256] = { 746static const wchar_t c2u_98[256] = {
747 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 747 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
748 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 748 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
749 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 749 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -779,7 +779,7 @@ static wchar_t c2u_98[256] = {
779 0x5080,0x509A,0x5085,0x50B4,0x50B2,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 779 0x5080,0x509A,0x5085,0x50B4,0x50B2,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
780}; 780};
781 781
782static wchar_t c2u_99[256] = { 782static const wchar_t c2u_99[256] = {
783 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 783 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
784 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 784 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
785 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 785 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -815,7 +815,7 @@ static wchar_t c2u_99[256] = {
815 0x54A5,0x54AC,0x54C4,0x54C8,0x54A8,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 815 0x54A5,0x54AC,0x54C4,0x54C8,0x54A8,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
816}; 816};
817 817
818static wchar_t c2u_9A[256] = { 818static const wchar_t c2u_9A[256] = {
819 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 819 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
820 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 820 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
821 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 821 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -851,7 +851,7 @@ static wchar_t c2u_9A[256] = {
851 0x5962,0x5960,0x5967,0x596C,0x5969,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 851 0x5962,0x5960,0x5967,0x596C,0x5969,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
852}; 852};
853 853
854static wchar_t c2u_9B[256] = { 854static const wchar_t c2u_9B[256] = {
855 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 855 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
856 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 856 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
857 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 857 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -887,7 +887,7 @@ static wchar_t c2u_9B[256] = {
887 0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 887 0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
888}; 888};
889 889
890static wchar_t c2u_9C[256] = { 890static const wchar_t c2u_9C[256] = {
891 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 891 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
892 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 892 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
893 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 893 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -923,7 +923,7 @@ static wchar_t c2u_9C[256] = {
923 0x6209,0x620D,0x620C,0x6214,0x621B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 923 0x6209,0x620D,0x620C,0x6214,0x621B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
924}; 924};
925 925
926static wchar_t c2u_9D[256] = { 926static const wchar_t c2u_9D[256] = {
927 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 927 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
928 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 928 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
929 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 929 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -959,7 +959,7 @@ static wchar_t c2u_9D[256] = {
959 0x66C1,0x66B9,0x66C9,0x66BE,0x66BC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 959 0x66C1,0x66B9,0x66C9,0x66BE,0x66BC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
960}; 960};
961 961
962static wchar_t c2u_9E[256] = { 962static const wchar_t c2u_9E[256] = {
963 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 963 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
964 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 964 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
965 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 965 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -995,7 +995,7 @@ static wchar_t c2u_9E[256] = {
995 0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 995 0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
996}; 996};
997 997
998static wchar_t c2u_9F[256] = { 998static const wchar_t c2u_9F[256] = {
999 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 999 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1000 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1000 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1001 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1001 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1031,7 +1031,7 @@ static wchar_t c2u_9F[256] = {
1031 0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1031 0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1032}; 1032};
1033 1033
1034static wchar_t c2u_E0[256] = { 1034static const wchar_t c2u_E0[256] = {
1035 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1035 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1036 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1036 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1037 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1037 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1067,7 +1067,7 @@ static wchar_t c2u_E0[256] = {
1067 0x74A7,0x74CA,0x74CF,0x74D4,0x73F1,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1067 0x74A7,0x74CA,0x74CF,0x74D4,0x73F1,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1068}; 1068};
1069 1069
1070static wchar_t c2u_E1[256] = { 1070static const wchar_t c2u_E1[256] = {
1071 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1071 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1072 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1072 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1073 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1073 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1103,7 +1103,7 @@ static wchar_t c2u_E1[256] = {
1103 0x78BE,0x78BC,0x78C5,0x78CA,0x78EC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1103 0x78BE,0x78BC,0x78C5,0x78CA,0x78EC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1104}; 1104};
1105 1105
1106static wchar_t c2u_E2[256] = { 1106static const wchar_t c2u_E2[256] = {
1107 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1107 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1108 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1108 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1109 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1109 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1139,7 +1139,7 @@ static wchar_t c2u_E2[256] = {
1139 0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1139 0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1140}; 1140};
1141 1141
1142static wchar_t c2u_E3[256] = { 1142static const wchar_t c2u_E3[256] = {
1143 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1143 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1144 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1144 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1145 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1145 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1175,7 +1175,7 @@ static wchar_t c2u_E3[256] = {
1175 0x811B,0x8129,0x8123,0x812F,0x814B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1175 0x811B,0x8129,0x8123,0x812F,0x814B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1176}; 1176};
1177 1177
1178static wchar_t c2u_E4[256] = { 1178static const wchar_t c2u_E4[256] = {
1179 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1179 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1180 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1180 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1181 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1181 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1211,7 +1211,7 @@ static wchar_t c2u_E4[256] = {
1211 0x84FC,0x8540,0x8563,0x8558,0x8548,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1211 0x84FC,0x8540,0x8563,0x8558,0x8548,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1212}; 1212};
1213 1213
1214static wchar_t c2u_E5[256] = { 1214static const wchar_t c2u_E5[256] = {
1215 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1215 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1216 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1216 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1217 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1217 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1247,7 +1247,7 @@ static wchar_t c2u_E5[256] = {
1247 0x8938,0x894C,0x891D,0x8960,0x895E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1247 0x8938,0x894C,0x891D,0x8960,0x895E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1248}; 1248};
1249 1249
1250static wchar_t c2u_E6[256] = { 1250static const wchar_t c2u_E6[256] = {
1251 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1251 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1252 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1252 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1253 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1253 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1283,7 +1283,7 @@ static wchar_t c2u_E6[256] = {
1283 0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1283 0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1284}; 1284};
1285 1285
1286static wchar_t c2u_E7[256] = { 1286static const wchar_t c2u_E7[256] = {
1287 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1287 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1288 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1288 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1289 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1289 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1319,7 +1319,7 @@ static wchar_t c2u_E7[256] = {
1319 0x92E9,0x930F,0x92FA,0x9344,0x932E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1319 0x92E9,0x930F,0x92FA,0x9344,0x932E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1320}; 1320};
1321 1321
1322static wchar_t c2u_E8[256] = { 1322static const wchar_t c2u_E8[256] = {
1323 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1323 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1324 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1324 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1325 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1325 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1355,7 +1355,7 @@ static wchar_t c2u_E8[256] = {
1355 0x984F,0x984B,0x986B,0x986F,0x9870,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1355 0x984F,0x984B,0x986B,0x986F,0x9870,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1356}; 1356};
1357 1357
1358static wchar_t c2u_E9[256] = { 1358static const wchar_t c2u_E9[256] = {
1359 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1359 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1360 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1360 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1361 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1361 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1391,7 +1391,7 @@ static wchar_t c2u_E9[256] = {
1391 0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1391 0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1392}; 1392};
1393 1393
1394static wchar_t c2u_EA[256] = { 1394static const wchar_t c2u_EA[256] = {
1395 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1395 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1396 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1396 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1397 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1397 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1416,7 +1416,7 @@ static wchar_t c2u_EA[256] = {
1416 0x69C7,0x9059,0x7464,0x51DC,0x7199,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1416 0x69C7,0x9059,0x7464,0x51DC,0x7199,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1417}; 1417};
1418 1418
1419static wchar_t c2u_ED[256] = { 1419static const wchar_t c2u_ED[256] = {
1420 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1420 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1421 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1421 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1422 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1422 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1452,7 +1452,7 @@ static wchar_t c2u_ED[256] = {
1452 0x7147,0xFA15,0x71C1,0x71FE,0x72B1,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1452 0x7147,0xFA15,0x71C1,0x71FE,0x72B1,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1453}; 1453};
1454 1454
1455static wchar_t c2u_EE[256] = { 1455static const wchar_t c2u_EE[256] = {
1456 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1456 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1457 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1457 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1458 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1458 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1488,7 +1488,7 @@ static wchar_t c2u_EE[256] = {
1488 0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1488 0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1489}; 1489};
1490 1490
1491static wchar_t c2u_FA[256] = { 1491static const wchar_t c2u_FA[256] = {
1492 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1492 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1493 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1493 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1494 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1494 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1524,7 +1524,7 @@ static wchar_t c2u_FA[256] = {
1524 0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1524 0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1525}; 1525};
1526 1526
1527static wchar_t c2u_FB[256] = { 1527static const wchar_t c2u_FB[256] = {
1528 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1528 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1529 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1529 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1530 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1530 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1560,7 +1560,7 @@ static wchar_t c2u_FB[256] = {
1560 0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1560 0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1561}; 1561};
1562 1562
1563static wchar_t c2u_FC[256] = { 1563static const wchar_t c2u_FC[256] = {
1564 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1564 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1565 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1565 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1566 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1566 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1573,7 +1573,7 @@ static wchar_t c2u_FC[256] = {
1573 0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000,0x0000,0x0000,/* 0x48-0x4F */ 1573 0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000,0x0000,0x0000,/* 0x48-0x4F */
1574}; 1574};
1575 1575
1576static wchar_t *page_charset2uni[256] = { 1576static const wchar_t *page_charset2uni[256] = {
1577 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1577 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1578 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1578 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1579 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1579 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -1608,7 +1608,7 @@ static wchar_t *page_charset2uni[256] = {
1608 NULL, NULL, c2u_FA, c2u_FB, c2u_FC, NULL, NULL, NULL, 1608 NULL, NULL, c2u_FA, c2u_FB, c2u_FC, NULL, NULL, NULL,
1609}; 1609};
1610 1610
1611static unsigned char u2c_00hi[256 - 0xA0][2] = { 1611static const unsigned char u2c_00hi[256 - 0xA0][2] = {
1612 {0x00, 0x00}, {0x00, 0x00}, {0x81, 0x91}, {0x81, 0x92},/* 0xA0-0xA3 */ 1612 {0x00, 0x00}, {0x00, 0x00}, {0x81, 0x91}, {0x81, 0x92},/* 0xA0-0xA3 */
1613 {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x81, 0x98},/* 0xA4-0xA7 */ 1613 {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x81, 0x98},/* 0xA4-0xA7 */
1614 {0x81, 0x4E}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00},/* 0xA8-0xAB */ 1614 {0x81, 0x4E}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00},/* 0xA8-0xAB */
@@ -1635,7 +1635,7 @@ static unsigned char u2c_00hi[256 - 0xA0][2] = {
1635 {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00},/* 0xFC-0xFF */ 1635 {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00},/* 0xFC-0xFF */
1636}; 1636};
1637 1637
1638static unsigned char u2c_03[512] = { 1638static const unsigned char u2c_03[512] = {
1639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 1639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
1640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1690,7 +1690,7 @@ static unsigned char u2c_03[512] = {
1690 0x83, 0xD5, 0x83, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */ 1690 0x83, 0xD5, 0x83, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
1691}; 1691};
1692 1692
1693static unsigned char u2c_04[512] = { 1693static const unsigned char u2c_04[512] = {
1694 0x00, 0x00, 0x84, 0x46, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 1694 0x00, 0x00, 0x84, 0x46, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
1695 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1695 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1696 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1696 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1714,7 +1714,7 @@ static unsigned char u2c_04[512] = {
1714 0x00, 0x00, 0x84, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */ 1714 0x00, 0x00, 0x84, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */
1715}; 1715};
1716 1716
1717static unsigned char u2c_20[512] = { 1717static const unsigned char u2c_20[512] = {
1718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 1718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
1719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1732,7 +1732,7 @@ static unsigned char u2c_20[512] = {
1732 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xA6, /* 0x38-0x3B */ 1732 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xA6, /* 0x38-0x3B */
1733}; 1733};
1734 1734
1735static unsigned char u2c_21[512] = { 1735static const unsigned char u2c_21[512] = {
1736 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x8E, /* 0x00-0x03 */ 1736 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x8E, /* 0x00-0x03 */
1737 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1737 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1738 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1738 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1790,7 +1790,7 @@ static unsigned char u2c_21[512] = {
1790 0x81, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */ 1790 0x81, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
1791}; 1791};
1792 1792
1793static unsigned char u2c_22[512] = { 1793static const unsigned char u2c_22[512] = {
1794 0x81, 0xCD, 0x00, 0x00, 0x81, 0xDD, 0x81, 0xCE, /* 0x00-0x03 */ 1794 0x81, 0xCD, 0x00, 0x00, 0x81, 0xDD, 0x81, 0xCE, /* 0x00-0x03 */
1795 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xDE, /* 0x04-0x07 */ 1795 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xDE, /* 0x04-0x07 */
1796 0x81, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x81, 0xB9, /* 0x08-0x0B */ 1796 0x81, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x81, 0xB9, /* 0x08-0x0B */
@@ -1842,7 +1842,7 @@ static unsigned char u2c_22[512] = {
1842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x99, /* 0xBC-0xBF */ 1842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x99, /* 0xBC-0xBF */
1843}; 1843};
1844 1844
1845static unsigned char u2c_23[512] = { 1845static const unsigned char u2c_23[512] = {
1846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 1846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
1847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1848 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1848 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1850,7 +1850,7 @@ static unsigned char u2c_23[512] = {
1850 0x00, 0x00, 0x00, 0x00, 0x81, 0xDC, 0x00, 0x00, /* 0x10-0x13 */ 1850 0x00, 0x00, 0x00, 0x00, 0x81, 0xDC, 0x00, 0x00, /* 0x10-0x13 */
1851}; 1851};
1852 1852
1853static unsigned char u2c_24[512] = { 1853static const unsigned char u2c_24[512] = {
1854 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 1854 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
1855 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1855 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1856 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1856 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1882,7 +1882,7 @@ static unsigned char u2c_24[512] = {
1882 0x87, 0x50, 0x87, 0x51, 0x87, 0x52, 0x87, 0x53, /* 0x70-0x73 */ 1882 0x87, 0x50, 0x87, 0x51, 0x87, 0x52, 0x87, 0x53, /* 0x70-0x73 */
1883}; 1883};
1884 1884
1885static unsigned char u2c_25[512] = { 1885static const unsigned char u2c_25[512] = {
1886 0x84, 0x9F, 0x84, 0xAA, 0x84, 0xA0, 0x84, 0xAB, /* 0x00-0x03 */ 1886 0x84, 0x9F, 0x84, 0xAA, 0x84, 0xA0, 0x84, 0xAB, /* 0x00-0x03 */
1887 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 1887 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
1888 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1888 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1946,7 +1946,7 @@ static unsigned char u2c_25[512] = {
1946 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFC, /* 0xEC-0xEF */ 1946 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFC, /* 0xEC-0xEF */
1947}; 1947};
1948 1948
1949static unsigned char u2c_26[512] = { 1949static const unsigned char u2c_26[512] = {
1950 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 1950 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
1951 0x00, 0x00, 0x81, 0x9A, 0x81, 0x99, 0x00, 0x00, /* 0x04-0x07 */ 1951 0x00, 0x00, 0x81, 0x9A, 0x81, 0x99, 0x00, 0x00, /* 0x04-0x07 */
1952 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 1952 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1977,7 +1977,7 @@ static unsigned char u2c_26[512] = {
1977 0x00, 0x00, 0x81, 0xF3, 0x00, 0x00, 0x81, 0xF2, /* 0x6C-0x6F */ 1977 0x00, 0x00, 0x81, 0xF3, 0x00, 0x00, 0x81, 0xF2, /* 0x6C-0x6F */
1978}; 1978};
1979 1979
1980static unsigned char u2c_30[512] = { 1980static const unsigned char u2c_30[512] = {
1981 0x81, 0x40, 0x81, 0x41, 0x81, 0x42, 0x81, 0x56, /* 0x00-0x03 */ 1981 0x81, 0x40, 0x81, 0x41, 0x81, 0x42, 0x81, 0x56, /* 0x00-0x03 */
1982 0x00, 0x00, 0x81, 0x58, 0x81, 0x59, 0x81, 0x5A, /* 0x04-0x07 */ 1982 0x00, 0x00, 0x81, 0x58, 0x81, 0x59, 0x81, 0x5A, /* 0x04-0x07 */
1983 0x81, 0x71, 0x81, 0x72, 0x81, 0x73, 0x81, 0x74, /* 0x08-0x0B */ 1983 0x81, 0x71, 0x81, 0x72, 0x81, 0x73, 0x81, 0x74, /* 0x08-0x0B */
@@ -2045,7 +2045,7 @@ static unsigned char u2c_30[512] = {
2045 0x81, 0x5B, 0x81, 0x52, 0x81, 0x53, 0x00, 0x00, /* 0xFC-0xFF */ 2045 0x81, 0x5B, 0x81, 0x52, 0x81, 0x53, 0x00, 0x00, /* 0xFC-0xFF */
2046}; 2046};
2047 2047
2048static unsigned char u2c_32[512] = { 2048static const unsigned char u2c_32[512] = {
2049 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 2049 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
2050 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2050 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2051 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2051 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2092,7 +2092,7 @@ static unsigned char u2c_32[512] = {
2092 0x87, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA8-0xAB */ 2092 0x87, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA8-0xAB */
2093}; 2093};
2094 2094
2095static unsigned char u2c_33[512] = { 2095static const unsigned char u2c_33[512] = {
2096 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x65, /* 0x00-0x03 */ 2096 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x65, /* 0x00-0x03 */
2097 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2097 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2098 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2098 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2148,7 +2148,7 @@ static unsigned char u2c_33[512] = {
2148 0x00, 0x00, 0x87, 0x83, 0x00, 0x00, 0x00, 0x00, /* 0xCC-0xCF */ 2148 0x00, 0x00, 0x87, 0x83, 0x00, 0x00, 0x00, 0x00, /* 0xCC-0xCF */
2149}; 2149};
2150 2150
2151static unsigned char u2c_4E[512] = { 2151static const unsigned char u2c_4E[512] = {
2152 0x88, 0xEA, 0x92, 0x9A, 0x00, 0x00, 0x8E, 0xB5, /* 0x00-0x03 */ 2152 0x88, 0xEA, 0x92, 0x9A, 0x00, 0x00, 0x8E, 0xB5, /* 0x00-0x03 */
2153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x9C, /* 0x04-0x07 */ 2153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x9C, /* 0x04-0x07 */
2154 0x8F, 0xE4, 0x8E, 0x4F, 0x8F, 0xE3, 0x89, 0xBA, /* 0x08-0x0B */ 2154 0x8F, 0xE4, 0x8E, 0x4F, 0x8F, 0xE3, 0x89, 0xBA, /* 0x08-0x0B */
@@ -2216,7 +2216,7 @@ static unsigned char u2c_4E[512] = {
2216 0xED, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 2216 0xED, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
2217}; 2217};
2218 2218
2219static unsigned char u2c_4F[512] = { 2219static const unsigned char u2c_4F[512] = {
2220 0xED, 0x4F, 0x8A, 0xE9, 0x00, 0x00, 0xED, 0x50, /* 0x00-0x03 */ 2220 0xED, 0x4F, 0x8A, 0xE9, 0x00, 0x00, 0xED, 0x50, /* 0x00-0x03 */
2221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2222 0x00, 0x00, 0x98, 0xC2, 0x88, 0xC9, 0x00, 0x00, /* 0x08-0x0B */ 2222 0x00, 0x00, 0x98, 0xC2, 0x88, 0xC9, 0x00, 0x00, /* 0x08-0x0B */
@@ -2284,7 +2284,7 @@ static unsigned char u2c_4F[512] = {
2284 0x00, 0x00, 0x00, 0x00, 0x98, 0xEA, 0xED, 0x5A, /* 0xFC-0xFF */ 2284 0x00, 0x00, 0x00, 0x00, 0x98, 0xEA, 0xED, 0x5A, /* 0xFC-0xFF */
2285}; 2285};
2286 2286
2287static unsigned char u2c_50[512] = { 2287static const unsigned char u2c_50[512] = {
2288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 2288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
2289 0x00, 0x00, 0x98, 0xE4, 0x98, 0xED, 0x00, 0x00, /* 0x04-0x07 */ 2289 0x00, 0x00, 0x98, 0xE4, 0x98, 0xED, 0x00, 0x00, /* 0x04-0x07 */
2290 0x00, 0x00, 0x91, 0x71, 0x00, 0x00, 0x8C, 0xC2, /* 0x08-0x0B */ 2290 0x00, 0x00, 0x91, 0x71, 0x00, 0x00, 0x8C, 0xC2, /* 0x08-0x0B */
@@ -2351,7 +2351,7 @@ static unsigned char u2c_50[512] = {
2351 0x00, 0x00, 0x99, 0x4A, 0x00, 0x00, 0x95, 0xC6, /* 0xF8-0xFB */ 2351 0x00, 0x00, 0x99, 0x4A, 0x00, 0x00, 0x95, 0xC6, /* 0xF8-0xFB */
2352}; 2352};
2353 2353
2354static unsigned char u2c_51[512] = { 2354static const unsigned char u2c_51[512] = {
2355 0x8B, 0x56, 0x99, 0x4D, 0x99, 0x4E, 0x00, 0x00, /* 0x00-0x03 */ 2355 0x8B, 0x56, 0x99, 0x4D, 0x99, 0x4E, 0x00, 0x00, /* 0x00-0x03 */
2356 0x89, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2356 0x89, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2357 0x00, 0x00, 0x99, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2357 0x00, 0x00, 0x99, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2419,7 +2419,7 @@ static unsigned char u2c_51[512] = {
2419 0x00, 0x00, 0x94, 0x9F, 0x99, 0x82, 0x00, 0x00, /* 0xFC-0xFF */ 2419 0x00, 0x00, 0x94, 0x9F, 0x99, 0x82, 0x00, 0x00, /* 0xFC-0xFF */
2420}; 2420};
2421 2421
2422static unsigned char u2c_52[512] = { 2422static const unsigned char u2c_52[512] = {
2423 0x93, 0x81, 0x00, 0x00, 0x00, 0x00, 0x90, 0x6E, /* 0x00-0x03 */ 2423 0x93, 0x81, 0x00, 0x00, 0x00, 0x00, 0x90, 0x6E, /* 0x00-0x03 */
2424 0x99, 0x83, 0x00, 0x00, 0x95, 0xAA, 0x90, 0xD8, /* 0x04-0x07 */ 2424 0x99, 0x83, 0x00, 0x00, 0x95, 0xAA, 0x90, 0xD8, /* 0x04-0x07 */
2425 0x8A, 0xA0, 0x00, 0x00, 0x8A, 0xA7, 0x99, 0x84, /* 0x08-0x0B */ 2425 0x8A, 0xA0, 0x00, 0x00, 0x8A, 0xA7, 0x99, 0x84, /* 0x08-0x0B */
@@ -2487,7 +2487,7 @@ static unsigned char u2c_52[512] = {
2487 0x00, 0x00, 0x00, 0x00, 0x8C, 0xF9, 0x96, 0xDC, /* 0xFC-0xFF */ 2487 0x00, 0x00, 0x00, 0x00, 0x8C, 0xF9, 0x96, 0xDC, /* 0xFC-0xFF */
2488}; 2488};
2489 2489
2490static unsigned char u2c_53[512] = { 2490static const unsigned char u2c_53[512] = {
2491 0xED, 0x6C, 0x96, 0xE6, 0x93, 0xF5, 0x00, 0x00, /* 0x00-0x03 */ 2491 0xED, 0x6C, 0x96, 0xE6, 0x93, 0xF5, 0x00, 0x00, /* 0x00-0x03 */
2492 0x00, 0x00, 0x95, 0xEF, 0x99, 0xB0, 0xED, 0x6D, /* 0x04-0x07 */ 2492 0x00, 0x00, 0x95, 0xEF, 0x99, 0xB0, 0xED, 0x6D, /* 0x04-0x07 */
2493 0x99, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2493 0x99, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2554,7 +2554,7 @@ static unsigned char u2c_53[512] = {
2554 0x8E, 0x69, 0x00, 0x00, 0x99, 0xDB, 0x00, 0x00, /* 0xF8-0xFB */ 2554 0x8E, 0x69, 0x00, 0x00, 0x99, 0xDB, 0x00, 0x00, /* 0xF8-0xFB */
2555}; 2555};
2556 2556
2557static unsigned char u2c_54[512] = { 2557static const unsigned char u2c_54[512] = {
2558 0x00, 0x00, 0x99, 0xDC, 0x00, 0x00, 0x8B, 0x68, /* 0x00-0x03 */ 2558 0x00, 0x00, 0x99, 0xDC, 0x00, 0x00, 0x8B, 0x68, /* 0x00-0x03 */
2559 0x8A, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2559 0x8A, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2560 0x8D, 0x87, 0x8B, 0x67, 0x92, 0xDD, 0x89, 0x44, /* 0x08-0x0B */ 2560 0x8D, 0x87, 0x8B, 0x67, 0x92, 0xDD, 0x89, 0x44, /* 0x08-0x0B */
@@ -2622,7 +2622,7 @@ static unsigned char u2c_54[512] = {
2622 0x00, 0x00, 0x9A, 0x4A, 0x00, 0x00, 0xED, 0x77, /* 0xFC-0xFF */ 2622 0x00, 0x00, 0x9A, 0x4A, 0x00, 0x00, 0xED, 0x77, /* 0xFC-0xFF */
2623}; 2623};
2624 2624
2625static unsigned char u2c_55[512] = { 2625static const unsigned char u2c_55[512] = {
2626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 2626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
2627 0x89, 0x53, 0x00, 0x00, 0x8D, 0xB4, 0x90, 0x4F, /* 0x04-0x07 */ 2627 0x89, 0x53, 0x00, 0x00, 0x8D, 0xB4, 0x90, 0x4F, /* 0x04-0x07 */
2628 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2628 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2690,7 +2690,7 @@ static unsigned char u2c_55[512] = {
2690 0x00, 0x00, 0x9A, 0x75, 0x9A, 0x74, 0x00, 0x00, /* 0xFC-0xFF */ 2690 0x00, 0x00, 0x9A, 0x75, 0x9A, 0x74, 0x00, 0x00, /* 0xFC-0xFF */
2691}; 2691};
2692 2692
2693static unsigned char u2c_56[512] = { 2693static const unsigned char u2c_56[512] = {
2694 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 2694 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
2695 0x00, 0x00, 0x00, 0x00, 0x92, 0x51, 0x00, 0x00, /* 0x04-0x07 */ 2695 0x00, 0x00, 0x00, 0x00, 0x92, 0x51, 0x00, 0x00, /* 0x04-0x07 */
2696 0x00, 0x00, 0x89, 0xC3, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2696 0x00, 0x00, 0x89, 0xC3, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2758,7 +2758,7 @@ static unsigned char u2c_56[512] = {
2758 0x00, 0x00, 0x8D, 0x91, 0x00, 0x00, 0x9A, 0x9C, /* 0xFC-0xFF */ 2758 0x00, 0x00, 0x8D, 0x91, 0x00, 0x00, 0x9A, 0x9C, /* 0xFC-0xFF */
2759}; 2759};
2760 2760
2761static unsigned char u2c_57[512] = { 2761static const unsigned char u2c_57[512] = {
2762 0x9A, 0x9B, 0x00, 0x00, 0x00, 0x00, 0x95, 0xDE, /* 0x00-0x03 */ 2762 0x9A, 0x9B, 0x00, 0x00, 0x00, 0x00, 0x95, 0xDE, /* 0x00-0x03 */
2763 0x9A, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2763 0x9A, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2764 0x9A, 0x9F, 0x9A, 0x9E, 0x00, 0x00, 0x9A, 0xA0, /* 0x08-0x0B */ 2764 0x9A, 0x9F, 0x9A, 0x9E, 0x00, 0x00, 0x9A, 0xA0, /* 0x08-0x0B */
@@ -2826,7 +2826,7 @@ static unsigned char u2c_57[512] = {
2826 0x8D, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 2826 0x8D, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
2827}; 2827};
2828 2828
2829static unsigned char u2c_58[512] = { 2829static const unsigned char u2c_58[512] = {
2830 0x96, 0x78, 0x00, 0x00, 0x93, 0xB0, 0x00, 0x00, /* 0x00-0x03 */ 2830 0x96, 0x78, 0x00, 0x00, 0x93, 0xB0, 0x00, 0x00, /* 0x00-0x03 */
2831 0x00, 0x00, 0x8C, 0x98, 0x91, 0xCD, 0x00, 0x00, /* 0x04-0x07 */ 2831 0x00, 0x00, 0x8C, 0x98, 0x91, 0xCD, 0x00, 0x00, /* 0x04-0x07 */
2832 0x00, 0x00, 0x00, 0x00, 0x9A, 0xBF, 0x9A, 0xC2, /* 0x08-0x0B */ 2832 0x00, 0x00, 0x00, 0x00, 0x9A, 0xBF, 0x9A, 0xC2, /* 0x08-0x0B */
@@ -2894,7 +2894,7 @@ static unsigned char u2c_58[512] = {
2894 0x9A, 0xE5, 0x9A, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 2894 0x9A, 0xE5, 0x9A, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
2895}; 2895};
2896 2896
2897static unsigned char u2c_59[512] = { 2897static const unsigned char u2c_59[512] = {
2898 0x00, 0x00, 0x00, 0x00, 0x9A, 0xE7, 0x00, 0x00, /* 0x00-0x03 */ 2898 0x00, 0x00, 0x00, 0x00, 0x9A, 0xE7, 0x00, 0x00, /* 0x00-0x03 */
2899 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2899 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2900 0x00, 0x00, 0x95, 0xCF, 0x9A, 0xE8, 0xED, 0x83, /* 0x08-0x0B */ 2900 0x00, 0x00, 0x95, 0xCF, 0x9A, 0xE8, 0xED, 0x83, /* 0x08-0x0B */
@@ -2962,7 +2962,7 @@ static unsigned char u2c_59[512] = {
2962 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x70, /* 0xFC-0xFF */ 2962 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x70, /* 0xFC-0xFF */
2963}; 2963};
2964 2964
2965static unsigned char u2c_5A[512] = { 2965static const unsigned char u2c_5A[512] = {
2966 0x00, 0x00, 0x88, 0xD0, 0x00, 0x00, 0x88, 0xA1, /* 0x00-0x03 */ 2966 0x00, 0x00, 0x88, 0xD0, 0x00, 0x00, 0x88, 0xA1, /* 0x00-0x03 */
2967 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 2967 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
2968 0x00, 0x00, 0x9B, 0x51, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 2968 0x00, 0x00, 0x9B, 0x51, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3029,7 +3029,7 @@ static unsigned char u2c_5A[512] = {
3029 0x00, 0x00, 0x00, 0x00, 0x9B, 0x65, 0x9B, 0x66, /* 0xF8-0xFB */ 3029 0x00, 0x00, 0x00, 0x00, 0x9B, 0x65, 0x9B, 0x66, /* 0xF8-0xFB */
3030}; 3030};
3031 3031
3032static unsigned char u2c_5B[512] = { 3032static const unsigned char u2c_5B[512] = {
3033 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3033 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3034 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3034 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3035 0x00, 0x00, 0x8A, 0xF0, 0x00, 0x00, 0x9B, 0x68, /* 0x08-0x0B */ 3035 0x00, 0x00, 0x8A, 0xF0, 0x00, 0x00, 0x9B, 0x68, /* 0x08-0x0B */
@@ -3097,7 +3097,7 @@ static unsigned char u2c_5B[512] = {
3097 0x00, 0x00, 0x00, 0x00, 0x91, 0xCE, 0x8E, 0xF5, /* 0xFC-0xFF */ 3097 0x00, 0x00, 0x00, 0x00, 0x91, 0xCE, 0x8E, 0xF5, /* 0xFC-0xFF */
3098}; 3098};
3099 3099
3100static unsigned char u2c_5C[512] = { 3100static const unsigned char u2c_5C[512] = {
3101 0x00, 0x00, 0x95, 0x95, 0x90, 0xEA, 0x00, 0x00, /* 0x00-0x03 */ 3101 0x00, 0x00, 0x95, 0x95, 0x90, 0xEA, 0x00, 0x00, /* 0x00-0x03 */
3102 0x8E, 0xCB, 0x9B, 0x91, 0x8F, 0xAB, 0x9B, 0x92, /* 0x04-0x07 */ 3102 0x8E, 0xCB, 0x9B, 0x91, 0x8F, 0xAB, 0x9B, 0x92, /* 0x04-0x07 */
3103 0x9B, 0x93, 0x88, 0xD1, 0x91, 0xB8, 0x90, 0x71, /* 0x08-0x0B */ 3103 0x9B, 0x93, 0x88, 0xD1, 0x91, 0xB8, 0x90, 0x71, /* 0x08-0x0B */
@@ -3165,7 +3165,7 @@ static unsigned char u2c_5C[512] = {
3165 0x00, 0x00, 0x9B, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 3165 0x00, 0x00, 0x9B, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
3166}; 3166};
3167 3167
3168static unsigned char u2c_5D[512] = { 3168static const unsigned char u2c_5D[512] = {
3169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x92, /* 0x04-0x07 */ 3170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x92, /* 0x04-0x07 */
3171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xBA, /* 0x08-0x0B */ 3171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xBA, /* 0x08-0x0B */
@@ -3233,7 +3233,7 @@ static unsigned char u2c_5D[512] = {
3233 0x00, 0x00, 0x92, 0x46, 0x8B, 0xD0, 0x00, 0x00, /* 0xFC-0xFF */ 3233 0x00, 0x00, 0x92, 0x46, 0x8B, 0xD0, 0x00, 0x00, /* 0xFC-0xFF */
3234}; 3234};
3235 3235
3236static unsigned char u2c_5E[512] = { 3236static const unsigned char u2c_5E[512] = {
3237 0x00, 0x00, 0x00, 0x00, 0x8E, 0x73, 0x95, 0x7A, /* 0x00-0x03 */ 3237 0x00, 0x00, 0x00, 0x00, 0x8E, 0x73, 0x95, 0x7A, /* 0x00-0x03 */
3238 0x00, 0x00, 0x00, 0x00, 0x94, 0xBF, 0x00, 0x00, /* 0x04-0x07 */ 3238 0x00, 0x00, 0x00, 0x00, 0x94, 0xBF, 0x00, 0x00, /* 0x04-0x07 */
3239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xE1, /* 0x08-0x0B */ 3239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xE1, /* 0x08-0x0B */
@@ -3301,7 +3301,7 @@ static unsigned char u2c_5E[512] = {
3301 0x94, 0x55, 0x00, 0x00, 0x9C, 0x4F, 0x93, 0xF9, /* 0xFC-0xFF */ 3301 0x94, 0x55, 0x00, 0x00, 0x9C, 0x4F, 0x93, 0xF9, /* 0xFC-0xFF */
3302}; 3302};
3303 3303
3304static unsigned char u2c_5F[512] = { 3304static const unsigned char u2c_5F[512] = {
3305 0x00, 0x00, 0x95, 0xD9, 0x00, 0x00, 0x9C, 0x50, /* 0x00-0x03 */ 3305 0x00, 0x00, 0x95, 0xD9, 0x00, 0x00, 0x9C, 0x50, /* 0x00-0x03 */
3306 0x98, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3306 0x98, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3307 0x00, 0x00, 0x9C, 0x51, 0x95, 0xBE, 0x9C, 0x54, /* 0x08-0x0B */ 3307 0x00, 0x00, 0x9C, 0x51, 0x95, 0xBE, 0x9C, 0x54, /* 0x08-0x0B */
@@ -3369,7 +3369,7 @@ static unsigned char u2c_5F[512] = {
3369 0x00, 0x00, 0x8D, 0x9A, 0x00, 0x00, 0x9C, 0x7C, /* 0xFC-0xFF */ 3369 0x00, 0x00, 0x8D, 0x9A, 0x00, 0x00, 0x9C, 0x7C, /* 0xFC-0xFF */
3370}; 3370};
3371 3371
3372static unsigned char u2c_60[512] = { 3372static const unsigned char u2c_60[512] = {
3373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3436,7 +3436,7 @@ static unsigned char u2c_60[512] = {
3436 0x00, 0x00, 0x8E, 0xE4, 0x9C, 0xB7, 0x9C, 0xBA, /* 0xF8-0xFB */ 3436 0x00, 0x00, 0x8E, 0xE4, 0x9C, 0xB7, 0x9C, 0xBA, /* 0xF8-0xFB */
3437}; 3437};
3438 3438
3439static unsigned char u2c_61[512] = { 3439static const unsigned char u2c_61[512] = {
3440 0x9C, 0xB5, 0x8F, 0x44, 0x00, 0x00, 0x9C, 0xB8, /* 0x00-0x03 */ 3440 0x9C, 0xB5, 0x8F, 0x44, 0x00, 0x00, 0x9C, 0xB8, /* 0x00-0x03 */
3441 0x00, 0x00, 0x00, 0x00, 0x9C, 0xB2, 0x00, 0x00, /* 0x04-0x07 */ 3441 0x00, 0x00, 0x00, 0x00, 0x9C, 0xB2, 0x00, 0x00, /* 0x04-0x07 */
3442 0x96, 0xFA, 0x96, 0xF9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3442 0x96, 0xFA, 0x96, 0xF9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3504,7 +3504,7 @@ static unsigned char u2c_61[512] = {
3504 0x9C, 0xF4, 0x9C, 0xF3, 0x9C, 0xF5, 0x9C, 0xF2, /* 0xFC-0xFF */ 3504 0x9C, 0xF4, 0x9C, 0xF3, 0x9C, 0xF5, 0x9C, 0xF2, /* 0xFC-0xFF */
3505}; 3505};
3506 3506
3507static unsigned char u2c_62[512] = { 3507static const unsigned char u2c_62[512] = {
3508 0x9C, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3508 0x9C, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3510 0x9C, 0xF7, 0x9C, 0xF8, 0x95, 0xE8, 0x00, 0x00, /* 0x08-0x0B */ 3510 0x9C, 0xF7, 0x9C, 0xF8, 0x95, 0xE8, 0x00, 0x00, /* 0x08-0x0B */
@@ -3572,7 +3572,7 @@ static unsigned char u2c_62[512] = {
3572 0x00, 0x00, 0x00, 0x00, 0x8F, 0x45, 0x9D, 0x5C, /* 0xFC-0xFF */ 3572 0x00, 0x00, 0x00, 0x00, 0x8F, 0x45, 0x9D, 0x5C, /* 0xFC-0xFF */
3573}; 3573};
3574 3574
3575static unsigned char u2c_63[512] = { 3575static const unsigned char u2c_63[512] = {
3576 0x00, 0x00, 0x8E, 0x9D, 0x9D, 0x6B, 0x00, 0x00, /* 0x00-0x03 */ 3576 0x00, 0x00, 0x8E, 0x9D, 0x9D, 0x6B, 0x00, 0x00, /* 0x00-0x03 */
3577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x77, /* 0x04-0x07 */ 3577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x77, /* 0x04-0x07 */
3578 0x9D, 0x6C, 0x88, 0xC2, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3578 0x9D, 0x6C, 0x88, 0xC2, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3639,7 +3639,7 @@ static unsigned char u2c_63[512] = {
3639 0x00, 0x00, 0x00, 0x00, 0x97, 0x68, 0x00, 0x00, /* 0xF8-0xFB */ 3639 0x00, 0x00, 0x00, 0x00, 0x97, 0x68, 0x00, 0x00, /* 0xF8-0xFB */
3640}; 3640};
3641 3641
3642static unsigned char u2c_64[512] = { 3642static const unsigned char u2c_64[512] = {
3643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3644 0x00, 0x00, 0x00, 0x00, 0x9D, 0x8C, 0x00, 0x00, /* 0x04-0x07 */ 3644 0x00, 0x00, 0x00, 0x00, 0x9D, 0x8C, 0x00, 0x00, /* 0x04-0x07 */
3645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3707,7 +3707,7 @@ static unsigned char u2c_64[512] = {
3707 0x00, 0x00, 0x9D, 0xB4, 0x8F, 0xEF, 0x00, 0x00, /* 0xFC-0xFF */ 3707 0x00, 0x00, 0x9D, 0xB4, 0x8F, 0xEF, 0x00, 0x00, /* 0xFC-0xFF */
3708}; 3708};
3709 3709
3710static unsigned char u2c_65[512] = { 3710static const unsigned char u2c_65[512] = {
3711 0x9D, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3711 0x9D, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3712 0x00, 0x00, 0x9D, 0xB7, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3712 0x00, 0x00, 0x9D, 0xB7, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3713 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3713 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3774,7 +3774,7 @@ static unsigned char u2c_65[512] = {
3774 0x00, 0x00, 0x00, 0x00, 0x89, 0xA0, 0x9D, 0xDF, /* 0xF8-0xFB */ 3774 0x00, 0x00, 0x00, 0x00, 0x89, 0xA0, 0x9D, 0xDF, /* 0xF8-0xFB */
3775}; 3775};
3776 3776
3777static unsigned char u2c_66[512] = { 3777static const unsigned char u2c_66[512] = {
3778 0xED, 0xB2, 0x00, 0x00, 0x8D, 0x56, 0x9D, 0xDE, /* 0x00-0x03 */ 3778 0xED, 0xB2, 0x00, 0x00, 0x8D, 0x56, 0x9D, 0xDE, /* 0x00-0x03 */
3779 0x00, 0x00, 0x00, 0x00, 0x8D, 0xA9, 0x8F, 0xB8, /* 0x04-0x07 */ 3779 0x00, 0x00, 0x00, 0x00, 0x8D, 0xA9, 0x8F, 0xB8, /* 0x04-0x07 */
3780 0x00, 0x00, 0xED, 0xB5, 0x9D, 0xDD, 0x00, 0x00, /* 0x08-0x0B */ 3780 0x00, 0x00, 0xED, 0xB5, 0x9D, 0xDD, 0x00, 0x00, /* 0x08-0x0B */
@@ -3842,7 +3842,7 @@ static unsigned char u2c_66[512] = {
3842 0x99, 0xD6, 0x91, 0x5D, 0x91, 0x5C, 0x91, 0xD6, /* 0xFC-0xFF */ 3842 0x99, 0xD6, 0x91, 0x5D, 0x91, 0x5C, 0x91, 0xD6, /* 0xFC-0xFF */
3843}; 3843};
3844 3844
3845static unsigned char u2c_67[512] = { 3845static const unsigned char u2c_67[512] = {
3846 0x8D, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x98, 0xF0, /* 0x00-0x03 */ 3846 0x8D, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x98, 0xF0, /* 0x00-0x03 */
3847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3848 0x8C, 0x8E, 0x97, 0x4C, 0x00, 0x00, 0x95, 0xFC, /* 0x08-0x0B */ 3848 0x8C, 0x8E, 0x97, 0x4C, 0x00, 0x00, 0x95, 0xFC, /* 0x08-0x0B */
@@ -3910,7 +3910,7 @@ static unsigned char u2c_67[512] = {
3910 0x00, 0x00, 0x00, 0x00, 0x96, 0x8F, 0x8A, 0x60, /* 0xFC-0xFF */ 3910 0x00, 0x00, 0x00, 0x00, 0x96, 0x8F, 0x8A, 0x60, /* 0xFC-0xFF */
3911}; 3911};
3912 3912
3913static unsigned char u2c_68[512] = { 3913static const unsigned char u2c_68[512] = {
3914 0x00, 0x00, 0xED, 0xC9, 0x92, 0xCC, 0x93, 0xC8, /* 0x00-0x03 */ 3914 0x00, 0x00, 0xED, 0xC9, 0x92, 0xCC, 0x93, 0xC8, /* 0x00-0x03 */
3915 0x89, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3915 0x89, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3916 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3916 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3977,7 +3977,7 @@ static unsigned char u2c_68[512] = {
3977 0x00, 0x00, 0x9E, 0xA8, 0x8A, 0xBB, 0x00, 0x00, /* 0xF8-0xFB */ 3977 0x00, 0x00, 0x9E, 0xA8, 0x8A, 0xBB, 0x00, 0x00, /* 0xF8-0xFB */
3978}; 3978};
3979 3979
3980static unsigned char u2c_69[512] = { 3980static const unsigned char u2c_69[512] = {
3981 0x98, 0x6F, 0x9E, 0x96, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3981 0x98, 0x6F, 0x9E, 0x96, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3982 0x9E, 0xA4, 0x88, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3982 0x9E, 0xA4, 0x88, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3983 0x9E, 0x98, 0x00, 0x00, 0x00, 0x00, 0x96, 0xB8, /* 0x08-0x0B */ 3983 0x9E, 0x98, 0x00, 0x00, 0x00, 0x00, 0x96, 0xB8, /* 0x08-0x0B */
@@ -4045,7 +4045,7 @@ static unsigned char u2c_69[512] = {
4045 0x00, 0x00, 0x91, 0x85, 0x00, 0x00, 0x9E, 0xDB, /* 0xFC-0xFF */ 4045 0x00, 0x00, 0x91, 0x85, 0x00, 0x00, 0x9E, 0xDB, /* 0xFC-0xFF */
4046}; 4046};
4047 4047
4048static unsigned char u2c_6A[512] = { 4048static const unsigned char u2c_6A[512] = {
4049 0x00, 0x00, 0x00, 0x00, 0x9E, 0xD9, 0x00, 0x00, /* 0x00-0x03 */ 4049 0x00, 0x00, 0x00, 0x00, 0x9E, 0xD9, 0x00, 0x00, /* 0x00-0x03 */
4050 0x00, 0x00, 0x9E, 0xE0, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4050 0x00, 0x00, 0x9E, 0xE0, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4051 0x00, 0x00, 0x00, 0x00, 0x9E, 0xE6, 0x94, 0xF3, /* 0x08-0x0B */ 4051 0x00, 0x00, 0x00, 0x00, 0x9E, 0xE6, 0x94, 0xF3, /* 0x08-0x0B */
@@ -4112,7 +4112,7 @@ static unsigned char u2c_6A[512] = {
4112 0x00, 0x00, 0x00, 0x00, 0x9F, 0x51, 0x9F, 0x4E, /* 0xF8-0xFB */ 4112 0x00, 0x00, 0x00, 0x00, 0x9F, 0x51, 0x9F, 0x4E, /* 0xF8-0xFB */
4113}; 4113};
4114 4114
4115static unsigned char u2c_6B[512] = { 4115static const unsigned char u2c_6B[512] = {
4116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4117 0x97, 0x93, 0x9F, 0x4F, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4117 0x97, 0x93, 0x9F, 0x4F, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4118 0x00, 0x00, 0x00, 0x00, 0x9E, 0xDC, 0x00, 0x00, /* 0x08-0x0B */ 4118 0x00, 0x00, 0x00, 0x00, 0x9E, 0xDC, 0x00, 0x00, /* 0x08-0x0B */
@@ -4177,7 +4177,7 @@ static unsigned char u2c_6B[512] = {
4177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9F, 0x7D, /* 0xF0-0xF3 */ 4177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9F, 0x7D, /* 0xF0-0xF3 */
4178}; 4178};
4179 4179
4180static unsigned char u2c_6C[512] = { 4180static const unsigned char u2c_6C[512] = {
4181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4183 0x9F, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4183 0x9F, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4242,7 +4242,7 @@ static unsigned char u2c_6C[512] = {
4242 0x91, 0xD7, 0x9F, 0x96, 0x00, 0x00, 0x89, 0x6A, /* 0xF0-0xF3 */ 4242 0x91, 0xD7, 0x9F, 0x96, 0x00, 0x00, 0x89, 0x6A, /* 0xF0-0xF3 */
4243}; 4243};
4244 4244
4245static unsigned char u2c_6D[512] = { 4245static const unsigned char u2c_6D[512] = {
4246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4247 0xED, 0xDE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4247 0xED, 0xDE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x6D, /* 0x08-0x0B */ 4248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x6D, /* 0x08-0x0B */
@@ -4310,7 +4310,7 @@ static unsigned char u2c_6D[512] = {
4310 0xED, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4310 0xED, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4311}; 4311};
4312 4312
4313static unsigned char u2c_6E[512] = { 4313static const unsigned char u2c_6E[512] = {
4314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4315 0x00, 0x00, 0x90, 0xB4, 0x00, 0x00, 0x8A, 0x89, /* 0x04-0x07 */ 4315 0x00, 0x00, 0x90, 0xB4, 0x00, 0x00, 0x8A, 0x89, /* 0x04-0x07 */
4316 0x8D, 0xCF, 0x8F, 0xC2, 0x9F, 0xBB, 0x8F, 0x61, /* 0x08-0x0B */ 4316 0x8D, 0xCF, 0x8F, 0xC2, 0x9F, 0xBB, 0x8F, 0x61, /* 0x08-0x0B */
@@ -4378,7 +4378,7 @@ static unsigned char u2c_6E[512] = {
4378 0x00, 0x00, 0x00, 0x00, 0x9F, 0xF6, 0x9F, 0xDE, /* 0xFC-0xFF */ 4378 0x00, 0x00, 0x00, 0x00, 0x9F, 0xF6, 0x9F, 0xDE, /* 0xFC-0xFF */
4379}; 4379};
4380 4380
4381static unsigned char u2c_6F[512] = { 4381static const unsigned char u2c_6F[512] = {
4382 0x00, 0x00, 0x8B, 0x99, 0x95, 0x59, 0x00, 0x00, /* 0x00-0x03 */ 4382 0x00, 0x00, 0x8B, 0x99, 0x95, 0x59, 0x00, 0x00, /* 0x00-0x03 */
4383 0x00, 0x00, 0x00, 0x00, 0x8E, 0xBD, 0x00, 0x00, /* 0x04-0x07 */ 4383 0x00, 0x00, 0x00, 0x00, 0x8E, 0xBD, 0x00, 0x00, /* 0x04-0x07 */
4384 0x00, 0x00, 0x8D, 0x97, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4384 0x00, 0x00, 0x8D, 0x97, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4446,7 +4446,7 @@ static unsigned char u2c_6F[512] = {
4446 0x00, 0x00, 0x00, 0x00, 0xE0, 0x68, 0x00, 0x00, /* 0xFC-0xFF */ 4446 0x00, 0x00, 0x00, 0x00, 0xE0, 0x68, 0x00, 0x00, /* 0xFC-0xFF */
4447}; 4447};
4448 4448
4449static unsigned char u2c_70[512] = { 4449static const unsigned char u2c_70[512] = {
4450 0x00, 0x00, 0xE0, 0x66, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4450 0x00, 0x00, 0xE0, 0x66, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4451 0x00, 0x00, 0xED, 0xEF, 0x00, 0x00, 0xED, 0xF0, /* 0x04-0x07 */ 4451 0x00, 0x00, 0xED, 0xEF, 0x00, 0x00, 0xED, 0xF0, /* 0x04-0x07 */
4452 0x00, 0x00, 0xE0, 0x62, 0x00, 0x00, 0xE0, 0x63, /* 0x08-0x0B */ 4452 0x00, 0x00, 0xE0, 0x62, 0x00, 0x00, 0xE0, 0x63, /* 0x08-0x0B */
@@ -4514,7 +4514,7 @@ static unsigned char u2c_70[512] = {
4514 0x00, 0x00, 0xE0, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4514 0x00, 0x00, 0xE0, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4515}; 4515};
4516 4516
4517static unsigned char u2c_71[512] = { 4517static const unsigned char u2c_71[512] = {
4518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4519 0xED, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4519 0xED, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4520 0x00, 0x00, 0xE0, 0x81, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4520 0x00, 0x00, 0xE0, 0x81, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4582,7 +4582,7 @@ static unsigned char u2c_71[512] = {
4582 0xE0, 0x9E, 0x00, 0x00, 0xED, 0xFB, 0xE0, 0xA0, /* 0xFC-0xFF */ 4582 0xE0, 0x9E, 0x00, 0x00, 0xED, 0xFB, 0xE0, 0xA0, /* 0xFC-0xFF */
4583}; 4583};
4584 4584
4585static unsigned char u2c_72[512] = { 4585static const unsigned char u2c_72[512] = {
4586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4587 0x00, 0x00, 0x00, 0x00, 0x94, 0x9A, 0x00, 0x00, /* 0x04-0x07 */ 4587 0x00, 0x00, 0x00, 0x00, 0x94, 0x9A, 0x00, 0x00, /* 0x04-0x07 */
4588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4650,7 +4650,7 @@ static unsigned char u2c_72[512] = {
4650 0x98, 0x54, 0x94, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4650 0x98, 0x54, 0x94, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4651}; 4651};
4652 4652
4653static unsigned char u2c_73[512] = { 4653static const unsigned char u2c_73[512] = {
4654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4656 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC7, 0x00, 0x00, /* 0x08-0x0B */ 4656 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC7, 0x00, 0x00, /* 0x08-0x0B */
@@ -4718,7 +4718,7 @@ static unsigned char u2c_73[512] = {
4718 0x00, 0x00, 0x00, 0x00, 0x8C, 0xBB, 0x00, 0x00, /* 0xFC-0xFF */ 4718 0x00, 0x00, 0x00, 0x00, 0x8C, 0xBB, 0x00, 0x00, /* 0xFC-0xFF */
4719}; 4719};
4720 4720
4721static unsigned char u2c_74[512] = { 4721static const unsigned char u2c_74[512] = {
4722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x85, /* 0x00-0x03 */ 4722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x85, /* 0x00-0x03 */
4723 0x00, 0x00, 0xE0, 0xE4, 0x97, 0x9D, 0xEE, 0x49, /* 0x04-0x07 */ 4723 0x00, 0x00, 0xE0, 0xE4, 0x97, 0x9D, 0xEE, 0x49, /* 0x04-0x07 */
4724 0x00, 0x00, 0x97, 0xAE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4724 0x00, 0x00, 0x97, 0xAE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4785,7 +4785,7 @@ static unsigned char u2c_74[512] = {
4785 0xE1, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 4785 0xE1, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
4786}; 4786};
4787 4787
4788static unsigned char u2c_75[512] = { 4788static const unsigned char u2c_75[512] = {
4789 0x00, 0x00, 0xEE, 0x52, 0x00, 0x00, 0xE1, 0x4B, /* 0x00-0x03 */ 4789 0x00, 0x00, 0xEE, 0x52, 0x00, 0x00, 0xE1, 0x4B, /* 0x00-0x03 */
4790 0xE1, 0x4A, 0xE1, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4790 0xE1, 0x4A, 0xE1, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4853,7 +4853,7 @@ static unsigned char u2c_75[512] = {
4853 0xE1, 0x80, 0x00, 0x00, 0xE1, 0x7D, 0xE1, 0x7E, /* 0xFC-0xFF */ 4853 0xE1, 0x80, 0x00, 0x00, 0xE1, 0x7D, 0xE1, 0x7E, /* 0xFC-0xFF */
4854}; 4854};
4855 4855
4856static unsigned char u2c_76[512] = { 4856static const unsigned char u2c_76[512] = {
4857 0x00, 0x00, 0xE1, 0x81, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4857 0x00, 0x00, 0xE1, 0x81, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4858 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4858 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4859 0x00, 0x00, 0xE1, 0x88, 0x00, 0x00, 0xE1, 0x86, /* 0x08-0x0B */ 4859 0x00, 0x00, 0xE1, 0x88, 0x00, 0x00, 0xE1, 0x86, /* 0x08-0x0B */
@@ -4921,7 +4921,7 @@ static unsigned char u2c_76[512] = {
4921 0x00, 0x00, 0x00, 0x00, 0x8F, 0x82, 0x00, 0x00, /* 0xFC-0xFF */ 4921 0x00, 0x00, 0x00, 0x00, 0x8F, 0x82, 0x00, 0x00, /* 0xFC-0xFF */
4922}; 4922};
4923 4923
4924static unsigned char u2c_77[512] = { 4924static const unsigned char u2c_77[512] = {
4925 0x00, 0x00, 0x8F, 0xC8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4925 0x00, 0x00, 0x8F, 0xC8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4926 0xE1, 0xBE, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xBD, /* 0x04-0x07 */ 4926 0xE1, 0xBE, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xBD, /* 0x04-0x07 */
4927 0xE1, 0xBC, 0x94, 0xFB, 0x00, 0x00, 0x8A, 0xC5, /* 0x08-0x0B */ 4927 0xE1, 0xBC, 0x94, 0xFB, 0x00, 0x00, 0x8A, 0xC5, /* 0x08-0x0B */
@@ -4989,7 +4989,7 @@ static unsigned char u2c_77[512] = {
4989 0xE1, 0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4989 0xE1, 0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4990}; 4990};
4991 4991
4992static unsigned char u2c_78[512] = { 4992static const unsigned char u2c_78[512] = {
4993 0x00, 0x00, 0x00, 0x00, 0x8D, 0xBB, 0x00, 0x00, /* 0x00-0x03 */ 4993 0x00, 0x00, 0x00, 0x00, 0x8D, 0xBB, 0x00, 0x00, /* 0x00-0x03 */
4994 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4994 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4995 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4995 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5057,7 +5057,7 @@ static unsigned char u2c_78[512] = {
5057 0x00, 0x00, 0xE2, 0x42, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5057 0x00, 0x00, 0xE2, 0x42, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5058}; 5058};
5059 5059
5060static unsigned char u2c_79[512] = { 5060static const unsigned char u2c_79[512] = {
5061 0x00, 0x00, 0x8F, 0xCA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5061 0x00, 0x00, 0x8F, 0xCA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5062 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0x44, /* 0x04-0x07 */ 5062 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0x44, /* 0x04-0x07 */
5063 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5063 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5124,7 +5124,7 @@ static unsigned char u2c_79[512] = {
5124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xDA, /* 0xF8-0xFB */ 5124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xDA, /* 0xF8-0xFB */
5125}; 5125};
5126 5126
5127static unsigned char u2c_7A[512] = { 5127static const unsigned char u2c_7A[512] = {
5128 0x8B, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5128 0x8B, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5130 0xE2, 0x62, 0x00, 0x00, 0x00, 0x00, 0x92, 0xF6, /* 0x08-0x0B */ 5130 0xE2, 0x62, 0x00, 0x00, 0x00, 0x00, 0x92, 0xF6, /* 0x08-0x0B */
@@ -5192,7 +5192,7 @@ static unsigned char u2c_7A[512] = {
5192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0xC6, /* 0xFC-0xFF */ 5192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0xC6, /* 0xFC-0xFF */
5193}; 5193};
5194 5194
5195static unsigned char u2c_7B[512] = { 5195static const unsigned char u2c_7B[512] = {
5196 0x00, 0x00, 0x00, 0x00, 0xE2, 0x93, 0x00, 0x00, /* 0x00-0x03 */ 5196 0x00, 0x00, 0x00, 0x00, 0xE2, 0x93, 0x00, 0x00, /* 0x00-0x03 */
5197 0xE2, 0xA0, 0x00, 0x00, 0xE2, 0x96, 0x00, 0x00, /* 0x04-0x07 */ 5197 0xE2, 0xA0, 0x00, 0x00, 0xE2, 0x96, 0x00, 0x00, /* 0x04-0x07 */
5198 0x8B, 0x88, 0x00, 0x00, 0xE2, 0x95, 0xE2, 0xA2, /* 0x08-0x0B */ 5198 0x8B, 0x88, 0x00, 0x00, 0xE2, 0x95, 0xE2, 0xA2, /* 0x08-0x0B */
@@ -5258,7 +5258,7 @@ static unsigned char u2c_7B[512] = {
5258 0x00, 0x00, 0x00, 0x00, 0xE2, 0xCC, 0xE2, 0xC9, /* 0xF4-0xF7 */ 5258 0x00, 0x00, 0x00, 0x00, 0xE2, 0xCC, 0xE2, 0xC9, /* 0xF4-0xF7 */
5259}; 5259};
5260 5260
5261static unsigned char u2c_7C[512] = { 5261static const unsigned char u2c_7C[512] = {
5262 0xE2, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5262 0xE2, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xC6, /* 0x04-0x07 */ 5263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xC6, /* 0x04-0x07 */
5264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5326,7 +5326,7 @@ static unsigned char u2c_7C[512] = {
5326 0x00, 0x00, 0x00, 0x00, 0x8B, 0x8A, 0x00, 0x00, /* 0xFC-0xFF */ 5326 0x00, 0x00, 0x00, 0x00, 0x8B, 0x8A, 0x00, 0x00, /* 0xFC-0xFF */
5327}; 5327};
5328 5328
5329static unsigned char u2c_7D[512] = { 5329static const unsigned char u2c_7D[512] = {
5330 0x8B, 0x49, 0x00, 0x00, 0xE3, 0x40, 0x00, 0x00, /* 0x00-0x03 */ 5330 0x8B, 0x49, 0x00, 0x00, 0xE3, 0x40, 0x00, 0x00, /* 0x00-0x03 */
5331 0x96, 0xF1, 0x8D, 0x67, 0xE2, 0xFC, 0x00, 0x00, /* 0x04-0x07 */ 5331 0x96, 0xF1, 0x8D, 0x67, 0xE2, 0xFC, 0x00, 0x00, /* 0x04-0x07 */
5332 0x00, 0x00, 0x00, 0x00, 0xE3, 0x43, 0x96, 0xE4, /* 0x08-0x0B */ 5332 0x00, 0x00, 0x00, 0x00, 0xE3, 0x43, 0x96, 0xE4, /* 0x08-0x0B */
@@ -5393,7 +5393,7 @@ static unsigned char u2c_7D[512] = {
5393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x6B, /* 0xF8-0xFB */ 5393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x6B, /* 0xF8-0xFB */
5394}; 5394};
5395 5395
5396static unsigned char u2c_7E[512] = { 5396static const unsigned char u2c_7E[512] = {
5397 0x00, 0x00, 0x89, 0x8F, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5397 0x00, 0x00, 0x89, 0x8F, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5398 0x93, 0xEA, 0xE3, 0x6E, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5398 0x93, 0xEA, 0xE3, 0x6E, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5399 0x00, 0x00, 0xE3, 0x75, 0xE3, 0x6F, 0xE3, 0x76, /* 0x08-0x0B */ 5399 0x00, 0x00, 0xE3, 0x75, 0xE3, 0x6F, 0xE3, 0x76, /* 0x08-0x0B */
@@ -5437,7 +5437,7 @@ static unsigned char u2c_7E[512] = {
5437 0xE3, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */ 5437 0xE3, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
5438}; 5438};
5439 5439
5440static unsigned char u2c_7F[512] = { 5440static const unsigned char u2c_7F[512] = {
5441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5505,7 +5505,7 @@ static unsigned char u2c_7F[512] = {
5505 0x97, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5505 0x97, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5506}; 5506};
5507 5507
5508static unsigned char u2c_80[512] = { 5508static const unsigned char u2c_80[512] = {
5509 0x97, 0x73, 0x98, 0x56, 0x00, 0x00, 0x8D, 0x6C, /* 0x00-0x03 */ 5509 0x97, 0x73, 0x98, 0x56, 0x00, 0x00, 0x8D, 0x6C, /* 0x00-0x03 */
5510 0xE3, 0xCC, 0x8E, 0xD2, 0xE3, 0xCB, 0x00, 0x00, /* 0x04-0x07 */ 5510 0xE3, 0xCC, 0x8E, 0xD2, 0xE3, 0xCB, 0x00, 0x00, /* 0x04-0x07 */
5511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0xCD, /* 0x08-0x0B */ 5511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0xCD, /* 0x08-0x0B */
@@ -5573,7 +5573,7 @@ static unsigned char u2c_80[512] = {
5573 0xE4, 0x45, 0x94, 0x5C, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5573 0xE4, 0x45, 0x94, 0x5C, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5574}; 5574};
5575 5575
5576static unsigned char u2c_81[512] = { 5576static const unsigned char u2c_81[512] = {
5577 0x00, 0x00, 0x00, 0x00, 0x8E, 0x89, 0x00, 0x00, /* 0x00-0x03 */ 5577 0x00, 0x00, 0x00, 0x00, 0x8E, 0x89, 0x00, 0x00, /* 0x00-0x03 */
5578 0x00, 0x00, 0x8B, 0xBA, 0x90, 0xC6, 0x98, 0x65, /* 0x04-0x07 */ 5578 0x00, 0x00, 0x8B, 0xBA, 0x90, 0xC6, 0x98, 0x65, /* 0x04-0x07 */
5579 0x96, 0xAC, 0xE3, 0xF5, 0x90, 0xD2, 0x00, 0x00, /* 0x08-0x0B */ 5579 0x96, 0xAC, 0xE3, 0xF5, 0x90, 0xD2, 0x00, 0x00, /* 0x08-0x0B */
@@ -5641,7 +5641,7 @@ static unsigned char u2c_81[512] = {
5641 0x89, 0x50, 0x00, 0x00, 0xE4, 0x6B, 0x00, 0x00, /* 0xFC-0xFF */ 5641 0x89, 0x50, 0x00, 0x00, 0xE4, 0x6B, 0x00, 0x00, /* 0xFC-0xFF */
5642}; 5642};
5643 5643
5644static unsigned char u2c_82[512] = { 5644static const unsigned char u2c_82[512] = {
5645 0x00, 0x00, 0xE4, 0x6C, 0xE4, 0x6D, 0x00, 0x00, /* 0x00-0x03 */ 5645 0x00, 0x00, 0xE4, 0x6C, 0xE4, 0x6D, 0x00, 0x00, /* 0x00-0x03 */
5646 0x00, 0x00, 0xE4, 0x6E, 0x00, 0x00, 0xE4, 0x6F, /* 0x04-0x07 */ 5646 0x00, 0x00, 0xE4, 0x6E, 0x00, 0x00, 0xE4, 0x6F, /* 0x04-0x07 */
5647 0x8B, 0xBB, 0x9D, 0xA8, 0xE4, 0x70, 0x00, 0x00, /* 0x08-0x0B */ 5647 0x8B, 0xBB, 0x9D, 0xA8, 0xE4, 0x70, 0x00, 0x00, /* 0x08-0x0B */
@@ -5708,7 +5708,7 @@ static unsigned char u2c_82[512] = {
5708 0x00, 0x00, 0xE4, 0x99, 0xE4, 0x95, 0xE4, 0x98, /* 0xF8-0xFB */ 5708 0x00, 0x00, 0xE4, 0x99, 0xE4, 0x95, 0xE4, 0x98, /* 0xF8-0xFB */
5709}; 5709};
5710 5710
5711static unsigned char u2c_83[512] = { 5711static const unsigned char u2c_83[512] = {
5712 0x00, 0x00, 0xEE, 0x76, 0x96, 0xCE, 0xE4, 0x97, /* 0x00-0x03 */ 5712 0x00, 0x00, 0xEE, 0x76, 0x96, 0xCE, 0xE4, 0x97, /* 0x00-0x03 */
5713 0x89, 0xD6, 0x8A, 0x9D, 0xE4, 0x9B, 0x00, 0x00, /* 0x04-0x07 */ 5713 0x89, 0xD6, 0x8A, 0x9D, 0xE4, 0x9B, 0x00, 0x00, /* 0x04-0x07 */
5714 0x00, 0x00, 0xE4, 0x9D, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5714 0x00, 0x00, 0xE4, 0x9D, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5776,7 +5776,7 @@ static unsigned char u2c_83[512] = {
5776 0x00, 0x00, 0xE4, 0xC1, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5776 0x00, 0x00, 0xE4, 0xC1, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5777}; 5777};
5778 5778
5779static unsigned char u2c_84[512] = { 5779static const unsigned char u2c_84[512] = {
5780 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC2, /* 0x00-0x03 */ 5780 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC2, /* 0x00-0x03 */
5781 0x93, 0xB8, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC7, /* 0x04-0x07 */ 5781 0x93, 0xB8, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC7, /* 0x04-0x07 */
5782 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC4, /* 0x08-0x0B */ 5782 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC4, /* 0x08-0x0B */
@@ -5844,7 +5844,7 @@ static unsigned char u2c_84[512] = {
5844 0xE4, 0xF8, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xF0, /* 0xFC-0xFF */ 5844 0xE4, 0xF8, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xF0, /* 0xFC-0xFF */
5845}; 5845};
5846 5846
5847static unsigned char u2c_85[512] = { 5847static const unsigned char u2c_85[512] = {
5848 0x8E, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5848 0x8E, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5849 0x00, 0x00, 0x00, 0x00, 0xE4, 0xCF, 0x00, 0x00, /* 0x04-0x07 */ 5849 0x00, 0x00, 0x00, 0x00, 0xE4, 0xCF, 0x00, 0x00, /* 0x04-0x07 */
5850 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5850 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5912,7 +5912,7 @@ static unsigned char u2c_85[512] = {
5912 0x00, 0x00, 0x00, 0x00, 0xE5, 0x60, 0x00, 0x00, /* 0xFC-0xFF */ 5912 0x00, 0x00, 0x00, 0x00, 0xE5, 0x60, 0x00, 0x00, /* 0xFC-0xFF */
5913}; 5913};
5914 5914
5915static unsigned char u2c_86[512] = { 5915static const unsigned char u2c_86[512] = {
5916 0x00, 0x00, 0x00, 0x00, 0xE5, 0x41, 0x00, 0x00, /* 0x00-0x03 */ 5916 0x00, 0x00, 0x00, 0x00, 0xE5, 0x41, 0x00, 0x00, /* 0x00-0x03 */
5917 0x00, 0x00, 0x00, 0x00, 0xE5, 0x62, 0x91, 0x68, /* 0x04-0x07 */ 5917 0x00, 0x00, 0x00, 0x00, 0xE5, 0x62, 0x91, 0x68, /* 0x04-0x07 */
5918 0x00, 0x00, 0x00, 0x00, 0xE5, 0x5D, 0xE5, 0x5F, /* 0x08-0x0B */ 5918 0x00, 0x00, 0x00, 0x00, 0xE5, 0x5D, 0xE5, 0x5F, /* 0x08-0x0B */
@@ -5980,7 +5980,7 @@ static unsigned char u2c_86[512] = {
5980 0x00, 0x00, 0x00, 0x00, 0x89, 0xE9, 0x00, 0x00, /* 0xFC-0xFF */ 5980 0x00, 0x00, 0x00, 0x00, 0x89, 0xE9, 0x00, 0x00, /* 0xFC-0xFF */
5981}; 5981};
5982 5982
5983static unsigned char u2c_87[512] = { 5983static const unsigned char u2c_87[512] = {
5984 0xE5, 0x86, 0x00, 0x00, 0x96, 0x49, 0xE5, 0x87, /* 0x00-0x03 */ 5984 0xE5, 0x86, 0x00, 0x00, 0x96, 0x49, 0xE5, 0x87, /* 0x00-0x03 */
5985 0x00, 0x00, 0x00, 0x00, 0xE5, 0x84, 0x00, 0x00, /* 0x04-0x07 */ 5985 0x00, 0x00, 0x00, 0x00, 0xE5, 0x84, 0x00, 0x00, /* 0x04-0x07 */
5986 0xE5, 0x85, 0xE5, 0x8A, 0xE5, 0x8D, 0x00, 0x00, /* 0x08-0x0B */ 5986 0xE5, 0x85, 0xE5, 0x8A, 0xE5, 0x8D, 0x00, 0x00, /* 0x08-0x0B */
@@ -6048,7 +6048,7 @@ static unsigned char u2c_87[512] = {
6048 0x00, 0x00, 0x00, 0x00, 0xE5, 0xB7, 0x00, 0x00, /* 0xFC-0xFF */ 6048 0x00, 0x00, 0x00, 0x00, 0xE5, 0xB7, 0x00, 0x00, /* 0xFC-0xFF */
6049}; 6049};
6050 6050
6051static unsigned char u2c_88[512] = { 6051static const unsigned char u2c_88[512] = {
6052 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6052 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6053 0x00, 0x00, 0xE5, 0xA2, 0x00, 0x00, 0xEE, 0x85, /* 0x04-0x07 */ 6053 0x00, 0x00, 0xE5, 0xA2, 0x00, 0x00, 0xEE, 0x85, /* 0x04-0x07 */
6054 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6054 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6116,7 +6116,7 @@ static unsigned char u2c_88[512] = {
6116 0xE5, 0xE7, 0x90, 0xBB, 0x90, 0x9E, 0x00, 0x00, /* 0xFC-0xFF */ 6116 0xE5, 0xE7, 0x90, 0xBB, 0x90, 0x9E, 0x00, 0x00, /* 0xFC-0xFF */
6117}; 6117};
6118 6118
6119static unsigned char u2c_89[512] = { 6119static const unsigned char u2c_89[512] = {
6120 0x00, 0x00, 0x00, 0x00, 0xE5, 0xE6, 0x00, 0x00, /* 0x00-0x03 */ 6120 0x00, 0x00, 0x00, 0x00, 0xE5, 0xE6, 0x00, 0x00, /* 0x00-0x03 */
6121 0xE5, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x95, 0xA1, /* 0x04-0x07 */ 6121 0xE5, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x95, 0xA1, /* 0x04-0x07 */
6122 0x00, 0x00, 0x00, 0x00, 0xE5, 0xED, 0x00, 0x00, /* 0x08-0x0B */ 6122 0x00, 0x00, 0x00, 0x00, 0xE5, 0xED, 0x00, 0x00, /* 0x08-0x0B */
@@ -6183,7 +6183,7 @@ static unsigned char u2c_89[512] = {
6183 0xE6, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 6183 0xE6, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
6184}; 6184};
6185 6185
6186static unsigned char u2c_8A[512] = { 6186static const unsigned char u2c_8A[512] = {
6187 0x8C, 0xBE, 0x00, 0x00, 0x92, 0xF9, 0xE6, 0x5D, /* 0x00-0x03 */ 6187 0x8C, 0xBE, 0x00, 0x00, 0x92, 0xF9, 0xE6, 0x5D, /* 0x00-0x03 */
6188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6189 0x8C, 0x76, 0x00, 0x00, 0x90, 0x75, 0x00, 0x00, /* 0x08-0x0B */ 6189 0x8C, 0x76, 0x00, 0x00, 0x90, 0x75, 0x00, 0x00, /* 0x08-0x0B */
@@ -6251,7 +6251,7 @@ static unsigned char u2c_8A[512] = {
6251 0x00, 0x00, 0x00, 0x00, 0x91, 0xF8, 0x00, 0x00, /* 0xFC-0xFF */ 6251 0x00, 0x00, 0x00, 0x00, 0x91, 0xF8, 0x00, 0x00, /* 0xFC-0xFF */
6252}; 6252};
6253 6253
6254static unsigned char u2c_8B[512] = { 6254static const unsigned char u2c_8B[512] = {
6255 0x96, 0x64, 0x89, 0x79, 0x88, 0xE0, 0x00, 0x00, /* 0x00-0x03 */ 6255 0x96, 0x64, 0x89, 0x79, 0x88, 0xE0, 0x00, 0x00, /* 0x00-0x03 */
6256 0x93, 0xA3, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x89, /* 0x04-0x07 */ 6256 0x93, 0xA3, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x89, /* 0x04-0x07 */
6257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6294,7 +6294,7 @@ static unsigned char u2c_8B[512] = {
6294 0x00, 0x00, 0xE6, 0xAA, 0xE6, 0xAB, 0x00, 0x00, /* 0x98-0x9B */ 6294 0x00, 0x00, 0xE6, 0xAA, 0xE6, 0xAB, 0x00, 0x00, /* 0x98-0x9B */
6295}; 6295};
6296 6296
6297static unsigned char u2c_8C[512] = { 6297static const unsigned char u2c_8C[512] = {
6298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6362,7 +6362,7 @@ static unsigned char u2c_8C[512] = {
6362 0x8D, 0x77, 0xE6, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 6362 0x8D, 0x77, 0xE6, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
6363}; 6363};
6364 6364
6365static unsigned char u2c_8D[512] = { 6365static const unsigned char u2c_8D[512] = {
6366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6367 0xE6, 0xD1, 0xE6, 0xD2, 0x00, 0x00, 0xE6, 0xD4, /* 0x04-0x07 */ 6367 0xE6, 0xD1, 0xE6, 0xD2, 0x00, 0x00, 0xE6, 0xD4, /* 0x04-0x07 */
6368 0x91, 0xA1, 0x00, 0x00, 0xE6, 0xD3, 0x8A, 0xE4, /* 0x08-0x0B */ 6368 0x91, 0xA1, 0x00, 0x00, 0xE6, 0xD3, 0x8A, 0xE4, /* 0x08-0x0B */
@@ -6430,7 +6430,7 @@ static unsigned char u2c_8D[512] = {
6430 0xE6, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xF3, /* 0xFC-0xFF */ 6430 0xE6, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xF3, /* 0xFC-0xFF */
6431}; 6431};
6432 6432
6433static unsigned char u2c_8E[512] = { 6433static const unsigned char u2c_8E[512] = {
6434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6435 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6435 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6436 0xE6, 0xF1, 0xE6, 0xF2, 0x97, 0x78, 0x00, 0x00, /* 0x08-0x0B */ 6436 0xE6, 0xF1, 0xE6, 0xF2, 0x97, 0x78, 0x00, 0x00, /* 0x08-0x0B */
@@ -6498,7 +6498,7 @@ static unsigned char u2c_8E[512] = {
6498 0xE7, 0x64, 0x8C, 0x79, 0xE7, 0x67, 0x00, 0x00, /* 0xFC-0xFF */ 6498 0xE7, 0x64, 0x8C, 0x79, 0xE7, 0x67, 0x00, 0x00, /* 0xFC-0xFF */
6499}; 6499};
6500 6500
6501static unsigned char u2c_8F[512] = { 6501static const unsigned char u2c_8F[512] = {
6502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x72, /* 0x00-0x03 */ 6502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x72, /* 0x00-0x03 */
6503 0x00, 0x00, 0xE7, 0x69, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6503 0x00, 0x00, 0xE7, 0x69, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6504 0x00, 0x00, 0x8D, 0xDA, 0xE7, 0x68, 0x00, 0x00, /* 0x08-0x0B */ 6504 0x00, 0x00, 0x8D, 0xDA, 0xE7, 0x68, 0x00, 0x00, /* 0x08-0x0B */
@@ -6566,7 +6566,7 @@ static unsigned char u2c_8F[512] = {
6566 0x00, 0x00, 0x92, 0xC7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 6566 0x00, 0x00, 0x92, 0xC7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
6567}; 6567};
6568 6568
6569static unsigned char u2c_90[512] = { 6569static const unsigned char u2c_90[512] = {
6570 0x91, 0xDE, 0x91, 0x97, 0x00, 0x00, 0x93, 0xA6, /* 0x00-0x03 */ 6570 0x91, 0xDE, 0x91, 0x97, 0x00, 0x00, 0x93, 0xA6, /* 0x00-0x03 */
6571 0x00, 0x00, 0xE7, 0x90, 0x8B, 0x74, 0x00, 0x00, /* 0x04-0x07 */ 6571 0x00, 0x00, 0xE7, 0x90, 0x8B, 0x74, 0x00, 0x00, /* 0x04-0x07 */
6572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x99, /* 0x08-0x0B */ 6572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x99, /* 0x08-0x0B */
@@ -6634,7 +6634,7 @@ static unsigned char u2c_90[512] = {
6634 0x00, 0x00, 0x93, 0x73, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 6634 0x00, 0x00, 0x93, 0x73, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
6635}; 6635};
6636 6636
6637static unsigned char u2c_91[512] = { 6637static const unsigned char u2c_91[512] = {
6638 0x00, 0x00, 0x00, 0x00, 0xE7, 0xBD, 0x00, 0x00, /* 0x00-0x03 */ 6638 0x00, 0x00, 0x00, 0x00, 0xE7, 0xBD, 0x00, 0x00, /* 0x00-0x03 */
6639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6702,7 +6702,7 @@ static unsigned char u2c_91[512] = {
6702 0xE7, 0xDD, 0x00, 0x00, 0x00, 0x00, 0xE7, 0xE1, /* 0xFC-0xFF */ 6702 0xE7, 0xDD, 0x00, 0x00, 0x00, 0x00, 0xE7, 0xE1, /* 0xFC-0xFF */
6703}; 6703};
6704 6704
6705static unsigned char u2c_92[512] = { 6705static const unsigned char u2c_92[512] = {
6706 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6706 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6707 0x00, 0x00, 0x00, 0x00, 0xEE, 0xA5, 0x00, 0x00, /* 0x04-0x07 */ 6707 0x00, 0x00, 0x00, 0x00, 0xEE, 0xA5, 0x00, 0x00, /* 0x04-0x07 */
6708 0x00, 0x00, 0x00, 0x00, 0xEE, 0xA7, 0x00, 0x00, /* 0x08-0x0B */ 6708 0x00, 0x00, 0x00, 0x00, 0xEE, 0xA7, 0x00, 0x00, /* 0x08-0x0B */
@@ -6770,7 +6770,7 @@ static unsigned char u2c_92[512] = {
6770 0x8D, 0x7C, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC0, /* 0xFC-0xFF */ 6770 0x8D, 0x7C, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC0, /* 0xFC-0xFF */
6771}; 6771};
6772 6772
6773static unsigned char u2c_93[512] = { 6773static const unsigned char u2c_93[512] = {
6774 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC2, 0x00, 0x00, /* 0x00-0x03 */ 6774 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC2, 0x00, 0x00, /* 0x00-0x03 */
6775 0x00, 0x00, 0x00, 0x00, 0x8E, 0x4B, 0x00, 0x00, /* 0x04-0x07 */ 6775 0x00, 0x00, 0x00, 0x00, 0x8E, 0x4B, 0x00, 0x00, /* 0x04-0x07 */
6776 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6776 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6837,7 +6837,7 @@ static unsigned char u2c_93[512] = {
6837 0xEE, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 6837 0xEE, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
6838}; 6838};
6839 6839
6840static unsigned char u2c_94[512] = { 6840static const unsigned char u2c_94[512] = {
6841 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x5E, /* 0x00-0x03 */ 6841 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x5E, /* 0x00-0x03 */
6842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x5F, /* 0x04-0x07 */ 6842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x5F, /* 0x04-0x07 */
6843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6874,7 +6874,7 @@ static unsigned char u2c_94[512] = {
6874 0x00, 0x00, 0xE8, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x83 */ 6874 0x00, 0x00, 0xE8, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x83 */
6875}; 6875};
6876 6876
6877static unsigned char u2c_95[512] = { 6877static const unsigned char u2c_95[512] = {
6878 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6878 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6880 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6880 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6936,7 +6936,7 @@ static unsigned char u2c_95[512] = {
6936 0x00, 0x00, 0xE8, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */ 6936 0x00, 0x00, 0xE8, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
6937}; 6937};
6938 6938
6939static unsigned char u2c_96[512] = { 6939static const unsigned char u2c_96[512] = {
6940 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6940 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6941 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6941 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6942 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6942 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7003,7 +7003,7 @@ static unsigned char u2c_96[512] = {
7003 0x00, 0x00, 0xE8, 0xB9, 0x00, 0x00, 0x93, 0x64, /* 0xF8-0xFB */ 7003 0x00, 0x00, 0xE8, 0xB9, 0x00, 0x00, 0x93, 0x64, /* 0xF8-0xFB */
7004}; 7004};
7005 7005
7006static unsigned char u2c_97[512] = { 7006static const unsigned char u2c_97[512] = {
7007 0x8E, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7007 0x8E, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7008 0xE8, 0xBA, 0x00, 0x00, 0xE8, 0xBB, 0x90, 0x6B, /* 0x04-0x07 */ 7008 0xE8, 0xBA, 0x00, 0x00, 0xE8, 0xBB, 0x90, 0x6B, /* 0x04-0x07 */
7009 0xE8, 0xBC, 0x00, 0x00, 0x97, 0xEC, 0x00, 0x00, /* 0x08-0x0B */ 7009 0xE8, 0xBC, 0x00, 0x00, 0x97, 0xEC, 0x00, 0x00, /* 0x08-0x0B */
@@ -7071,7 +7071,7 @@ static unsigned char u2c_97[512] = {
7071 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0xBF, /* 0xFC-0xFF */ 7071 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0xBF, /* 0xFC-0xFF */
7072}; 7072};
7073 7073
7074static unsigned char u2c_98[512] = { 7074static const unsigned char u2c_98[512] = {
7075 0x00, 0x00, 0x95, 0xC5, 0x92, 0xB8, 0x8D, 0xA0, /* 0x00-0x03 */ 7075 0x00, 0x00, 0x95, 0xC5, 0x92, 0xB8, 0x8D, 0xA0, /* 0x00-0x03 */
7076 0x00, 0x00, 0x8D, 0x80, 0x8F, 0x87, 0x00, 0x00, /* 0x04-0x07 */ 7076 0x00, 0x00, 0x8D, 0x80, 0x8F, 0x87, 0x00, 0x00, /* 0x04-0x07 */
7077 0x90, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7077 0x90, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7139,7 +7139,7 @@ static unsigned char u2c_98[512] = {
7139 0x8E, 0x94, 0x96, 0x4F, 0x8F, 0xFC, 0x00, 0x00, /* 0xFC-0xFF */ 7139 0x8E, 0x94, 0x96, 0x4F, 0x8F, 0xFC, 0x00, 0x00, /* 0xFC-0xFF */
7140}; 7140};
7141 7141
7142static unsigned char u2c_99[512] = { 7142static const unsigned char u2c_99[512] = {
7143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x4C, /* 0x00-0x03 */ 7143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x4C, /* 0x00-0x03 */
7144 0x00, 0x00, 0x96, 0xDD, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7144 0x00, 0x00, 0x96, 0xDD, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7145 0x00, 0x00, 0xE9, 0x4D, 0x97, 0x7B, 0x00, 0x00, /* 0x08-0x0B */ 7145 0x00, 0x00, 0xE9, 0x4D, 0x97, 0x7B, 0x00, 0x00, /* 0x08-0x0B */
@@ -7207,7 +7207,7 @@ static unsigned char u2c_99[512] = {
7207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x78, /* 0xFC-0xFF */ 7207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x78, /* 0xFC-0xFF */
7208}; 7208};
7209 7209
7210static unsigned char u2c_9A[512] = { 7210static const unsigned char u2c_9A[512] = {
7211 0x00, 0x00, 0xE9, 0x74, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7211 0x00, 0x00, 0xE9, 0x74, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7212 0x00, 0x00, 0xE9, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7212 0x00, 0x00, 0xE9, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7274,7 +7274,7 @@ static unsigned char u2c_9A[512] = {
7274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x9F, /* 0xF8-0xFB */ 7274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x9F, /* 0xF8-0xFB */
7275}; 7275};
7276 7276
7277static unsigned char u2c_9B[512] = { 7277static const unsigned char u2c_9B[512] = {
7278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7279 0x00, 0x00, 0x00, 0x00, 0xE9, 0xA0, 0x00, 0x00, /* 0x04-0x07 */ 7279 0x00, 0x00, 0x00, 0x00, 0xE9, 0xA0, 0x00, 0x00, /* 0x04-0x07 */
7280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7340,7 +7340,7 @@ static unsigned char u2c_9B[512] = {
7340 0x00, 0x00, 0x88, 0xB1, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */ 7340 0x00, 0x00, 0x88, 0xB1, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */
7341}; 7341};
7342 7342
7343static unsigned char u2c_9C[512] = { 7343static const unsigned char u2c_9C[512] = {
7344 0xEE, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7344 0xEE, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7345 0xE9, 0xD8, 0x00, 0x00, 0xE9, 0xD4, 0x00, 0x00, /* 0x04-0x07 */ 7345 0xE9, 0xD8, 0x00, 0x00, 0xE9, 0xD4, 0x00, 0x00, /* 0x04-0x07 */
7346 0xE9, 0xD5, 0xE9, 0xD1, 0xE9, 0xD7, 0x00, 0x00, /* 0x08-0x0B */ 7346 0xE9, 0xD5, 0xE9, 0xD1, 0xE9, 0xD7, 0x00, 0x00, /* 0x08-0x0B */
@@ -7406,7 +7406,7 @@ static unsigned char u2c_9C[512] = {
7406 0x96, 0xC2, 0x00, 0x00, 0x93, 0xCE, 0x00, 0x00, /* 0xF4-0xF7 */ 7406 0x96, 0xC2, 0x00, 0x00, 0x93, 0xCE, 0x00, 0x00, /* 0xF4-0xF7 */
7407}; 7407};
7408 7408
7409static unsigned char u2c_9D[512] = { 7409static const unsigned char u2c_9D[512] = {
7410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0xEE, /* 0x00-0x03 */ 7410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0xEE, /* 0x00-0x03 */
7411 0x00, 0x00, 0x00, 0x00, 0xE9, 0xEF, 0x93, 0xBC, /* 0x04-0x07 */ 7411 0x00, 0x00, 0x00, 0x00, 0xE9, 0xEF, 0x93, 0xBC, /* 0x04-0x07 */
7412 0xE9, 0xEC, 0xE9, 0xEB, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7412 0xE9, 0xEC, 0xE9, 0xEB, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7474,7 +7474,7 @@ static unsigned char u2c_9D[512] = {
7474 0x00, 0x00, 0xEA, 0x5E, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 7474 0x00, 0x00, 0xEA, 0x5E, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
7475}; 7475};
7476 7476
7477static unsigned char u2c_9E[512] = { 7477static const unsigned char u2c_9E[512] = {
7478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7542,7 +7542,7 @@ static unsigned char u2c_9E[512] = {
7542 0xEA, 0x85, 0xEA, 0x86, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 7542 0xEA, 0x85, 0xEA, 0x86, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
7543}; 7543};
7544 7544
7545static unsigned char u2c_9F[512] = { 7545static const unsigned char u2c_9F[512] = {
7546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x87, /* 0x04-0x07 */ 7547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x87, /* 0x04-0x07 */
7548 0xEA, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7548 0xEA, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7587,11 +7587,11 @@ static unsigned char u2c_9F[512] = {
7587 0xEA, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA0-0xA3 */ 7587 0xEA, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA0-0xA3 */
7588}; 7588};
7589 7589
7590static unsigned char u2c_DC[512] = { 7590static const unsigned char u2c_DC[512] = {
7591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7592}; 7592};
7593 7593
7594static unsigned char u2c_F9[512] = { 7594static const unsigned char u2c_F9[512] = {
7595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7596 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7596 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7597 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7597 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7651,7 +7651,7 @@ static unsigned char u2c_F9[512] = {
7651 0xEE, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */ 7651 0xEE, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
7652}; 7652};
7653 7653
7654static unsigned char u2c_FA[512] = { 7654static const unsigned char u2c_FA[512] = {
7655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7657 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7657 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7666,7 +7666,7 @@ static unsigned char u2c_FA[512] = {
7666 0xEE, 0xDD, 0xEE, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */ 7666 0xEE, 0xDD, 0xEE, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
7667}; 7667};
7668 7668
7669static unsigned char u2c_FF[512] = { 7669static const unsigned char u2c_FF[512] = {
7670 0x00, 0x00, 0x81, 0x49, 0xEE, 0xFC, 0x81, 0x94, /* 0x00-0x03 */ 7670 0x00, 0x00, 0x81, 0x49, 0xEE, 0xFC, 0x81, 0x94, /* 0x00-0x03 */
7671 0x81, 0x90, 0x81, 0x93, 0x81, 0x95, 0xEE, 0xFB, /* 0x04-0x07 */ 7671 0x81, 0x90, 0x81, 0x93, 0x81, 0x95, 0xEE, 0xFB, /* 0x04-0x07 */
7672 0x81, 0x69, 0x81, 0x6A, 0x81, 0x96, 0x81, 0x7B, /* 0x08-0x0B */ 7672 0x81, 0x69, 0x81, 0x6A, 0x81, 0x96, 0x81, 0x7B, /* 0x08-0x0B */
@@ -7728,7 +7728,7 @@ static unsigned char u2c_FF[512] = {
7728 0xEE, 0xFA, 0x81, 0x8F, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */ 7728 0xEE, 0xFA, 0x81, 0x8F, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
7729}; 7729};
7730 7730
7731static unsigned char *page_uni2charset[256] = { 7731static const unsigned char *const page_uni2charset[256] = {
7732 NULL, NULL, NULL, u2c_03, u2c_04, NULL, NULL, NULL, 7732 NULL, NULL, NULL, u2c_03, u2c_04, NULL, NULL, NULL,
7733 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 7733 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
7734 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 7734 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -7762,7 +7762,7 @@ static unsigned char *page_uni2charset[256] = {
7762 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 7762 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
7763 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, NULL, u2c_FF, }; 7763 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, NULL, u2c_FF, };
7764 7764
7765static unsigned char charset2lower[256] = { 7765static const unsigned char charset2lower[256] = {
7766 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 7766 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
7767 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 7767 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
7768 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 7768 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -7798,7 +7798,7 @@ static unsigned char charset2lower[256] = {
7798 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 7798 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
7799}; 7799};
7800 7800
7801static unsigned char charset2upper[256] = { 7801static const unsigned char charset2upper[256] = {
7802 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 7802 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
7803 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 7803 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
7804 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 7804 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -7837,7 +7837,7 @@ static unsigned char charset2upper[256] = {
7837static int uni2char(const wchar_t uni, 7837static int uni2char(const wchar_t uni,
7838 unsigned char *out, int boundlen) 7838 unsigned char *out, int boundlen)
7839{ 7839{
7840 unsigned char *uni2charset; 7840 const unsigned char *uni2charset;
7841 unsigned char cl = uni&0xFF; 7841 unsigned char cl = uni&0xFF;
7842 unsigned char ch = (uni>>8)&0xFF; 7842 unsigned char ch = (uni>>8)&0xFF;
7843 7843
@@ -7878,7 +7878,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
7878 wchar_t *uni) 7878 wchar_t *uni)
7879{ 7879{
7880 unsigned char ch, cl; 7880 unsigned char ch, cl;
7881 wchar_t *charset2uni; 7881 const wchar_t *charset2uni;
7882 7882
7883 if (boundlen <= 0) 7883 if (boundlen <= 0)
7884 return -ENAMETOOLONG; 7884 return -ENAMETOOLONG;
diff --git a/fs/nls/nls_cp936.c b/fs/nls/nls_cp936.c
index 65e640c61c8b..82770301bc3d 100644
--- a/fs/nls/nls_cp936.c
+++ b/fs/nls/nls_cp936.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t c2u_81[256] = { 16static const wchar_t c2u_81[256] = {
17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_81[256] = {
49 0x4F99,0x4F9A,0x4F9C,0x4F9E,0x4F9F,0x4FA1,0x4FA2,0x0000,/* 0xF8-0xFF */ 49 0x4F99,0x4F9A,0x4F9C,0x4F9E,0x4F9F,0x4FA1,0x4FA2,0x0000,/* 0xF8-0xFF */
50}; 50};
51 51
52static wchar_t c2u_82[256] = { 52static const wchar_t c2u_82[256] = {
53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -85,7 +85,7 @@ static wchar_t c2u_82[256] = {
85 0x50B4,0x50B5,0x50B6,0x50B7,0x50B8,0x50B9,0x50BC,0x0000,/* 0xF8-0xFF */ 85 0x50B4,0x50B5,0x50B6,0x50B7,0x50B8,0x50B9,0x50BC,0x0000,/* 0xF8-0xFF */
86}; 86};
87 87
88static wchar_t c2u_83[256] = { 88static const wchar_t c2u_83[256] = {
89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
91 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 91 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -121,7 +121,7 @@ static wchar_t c2u_83[256] = {
121 0x51D0,0x51D2,0x51D3,0x51D4,0x51D5,0x51D6,0x51D7,0x0000,/* 0xF8-0xFF */ 121 0x51D0,0x51D2,0x51D3,0x51D4,0x51D5,0x51D6,0x51D7,0x0000,/* 0xF8-0xFF */
122}; 122};
123 123
124static wchar_t c2u_84[256] = { 124static const wchar_t c2u_84[256] = {
125 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 125 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
126 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 126 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
127 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 127 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -157,7 +157,7 @@ static wchar_t c2u_84[256] = {
157 0x5304,0x5307,0x5309,0x530A,0x530B,0x530C,0x530E,0x0000,/* 0xF8-0xFF */ 157 0x5304,0x5307,0x5309,0x530A,0x530B,0x530C,0x530E,0x0000,/* 0xF8-0xFF */
158}; 158};
159 159
160static wchar_t c2u_85[256] = { 160static const wchar_t c2u_85[256] = {
161 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 161 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
162 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 162 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
163 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 163 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -193,7 +193,7 @@ static wchar_t c2u_85[256] = {
193 0x5497,0x5498,0x549C,0x549E,0x549F,0x54A0,0x54A1,0x0000,/* 0xF8-0xFF */ 193 0x5497,0x5498,0x549C,0x549E,0x549F,0x54A0,0x54A1,0x0000,/* 0xF8-0xFF */
194}; 194};
195 195
196static wchar_t c2u_86[256] = { 196static const wchar_t c2u_86[256] = {
197 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 197 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
198 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 198 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
199 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 199 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -229,7 +229,7 @@ static wchar_t c2u_86[256] = {
229 0x55FB,0x55FC,0x55FF,0x5602,0x5603,0x5604,0x5605,0x0000,/* 0xF8-0xFF */ 229 0x55FB,0x55FC,0x55FF,0x5602,0x5603,0x5604,0x5605,0x0000,/* 0xF8-0xFF */
230}; 230};
231 231
232static wchar_t c2u_87[256] = { 232static const wchar_t c2u_87[256] = {
233 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 233 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
234 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 234 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
235 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 235 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -265,7 +265,7 @@ static wchar_t c2u_87[256] = {
265 0x570B,0x570C,0x570D,0x570E,0x570F,0x5710,0x5711,0x0000,/* 0xF8-0xFF */ 265 0x570B,0x570C,0x570D,0x570E,0x570F,0x5710,0x5711,0x0000,/* 0xF8-0xFF */
266}; 266};
267 267
268static wchar_t c2u_88[256] = { 268static const wchar_t c2u_88[256] = {
269 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 269 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
270 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 270 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
271 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 271 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -301,7 +301,7 @@ static wchar_t c2u_88[256] = {
301 0x5837,0x5838,0x5839,0x583A,0x583B,0x583C,0x583D,0x0000,/* 0xF8-0xFF */ 301 0x5837,0x5838,0x5839,0x583A,0x583B,0x583C,0x583D,0x0000,/* 0xF8-0xFF */
302}; 302};
303 303
304static wchar_t c2u_89[256] = { 304static const wchar_t c2u_89[256] = {
305 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 305 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
306 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 306 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
307 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 307 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -337,7 +337,7 @@ static wchar_t c2u_89[256] = {
337 0x592C,0x5930,0x5932,0x5933,0x5935,0x5936,0x593B,0x0000,/* 0xF8-0xFF */ 337 0x592C,0x5930,0x5932,0x5933,0x5935,0x5936,0x593B,0x0000,/* 0xF8-0xFF */
338}; 338};
339 339
340static wchar_t c2u_8A[256] = { 340static const wchar_t c2u_8A[256] = {
341 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 341 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
342 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 342 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
343 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 343 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -373,7 +373,7 @@ static wchar_t c2u_8A[256] = {
373 0x5A59,0x5A5B,0x5A5C,0x5A5D,0x5A5E,0x5A5F,0x5A60,0x0000,/* 0xF8-0xFF */ 373 0x5A59,0x5A5B,0x5A5C,0x5A5D,0x5A5E,0x5A5F,0x5A60,0x0000,/* 0xF8-0xFF */
374}; 374};
375 375
376static wchar_t c2u_8B[256] = { 376static const wchar_t c2u_8B[256] = {
377 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 377 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
378 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 378 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -409,7 +409,7 @@ static wchar_t c2u_8B[256] = {
409 0x5B41,0x5B42,0x5B43,0x5B44,0x5B45,0x5B46,0x5B47,0x0000,/* 0xF8-0xFF */ 409 0x5B41,0x5B42,0x5B43,0x5B44,0x5B45,0x5B46,0x5B47,0x0000,/* 0xF8-0xFF */
410}; 410};
411 411
412static wchar_t c2u_8C[256] = { 412static const wchar_t c2u_8C[256] = {
413 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 413 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
414 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 414 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
415 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 415 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -445,7 +445,7 @@ static wchar_t c2u_8C[256] = {
445 0x5CA0,0x5CA1,0x5CA4,0x5CA5,0x5CA6,0x5CA7,0x5CA8,0x0000,/* 0xF8-0xFF */ 445 0x5CA0,0x5CA1,0x5CA4,0x5CA5,0x5CA6,0x5CA7,0x5CA8,0x0000,/* 0xF8-0xFF */
446}; 446};
447 447
448static wchar_t c2u_8D[256] = { 448static const wchar_t c2u_8D[256] = {
449 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 449 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
450 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 450 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -481,7 +481,7 @@ static wchar_t c2u_8D[256] = {
481 0x5D98,0x5D9A,0x5D9B,0x5D9C,0x5D9E,0x5D9F,0x5DA0,0x0000,/* 0xF8-0xFF */ 481 0x5D98,0x5D9A,0x5D9B,0x5D9C,0x5D9E,0x5D9F,0x5DA0,0x0000,/* 0xF8-0xFF */
482}; 482};
483 483
484static wchar_t c2u_8E[256] = { 484static const wchar_t c2u_8E[256] = {
485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -517,7 +517,7 @@ static wchar_t c2u_8E[256] = {
517 0x5EBF,0x5EC0,0x5EC1,0x5EC2,0x5EC3,0x5EC4,0x5EC5,0x0000,/* 0xF8-0xFF */ 517 0x5EBF,0x5EC0,0x5EC1,0x5EC2,0x5EC3,0x5EC4,0x5EC5,0x0000,/* 0xF8-0xFF */
518}; 518};
519 519
520static wchar_t c2u_8F[256] = { 520static const wchar_t c2u_8F[256] = {
521 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 521 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
522 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 522 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
523 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 523 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -553,7 +553,7 @@ static wchar_t c2u_8F[256] = {
553 0x5FF4,0x5FF6,0x5FF7,0x5FF9,0x5FFA,0x5FFC,0x6007,0x0000,/* 0xF8-0xFF */ 553 0x5FF4,0x5FF6,0x5FF7,0x5FF9,0x5FFA,0x5FFC,0x6007,0x0000,/* 0xF8-0xFF */
554}; 554};
555 555
556static wchar_t c2u_90[256] = { 556static const wchar_t c2u_90[256] = {
557 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 557 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
558 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 558 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
559 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 559 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -589,7 +589,7 @@ static wchar_t c2u_90[256] = {
589 0x6140,0x6141,0x6142,0x6143,0x6144,0x6145,0x6146,0x0000,/* 0xF8-0xFF */ 589 0x6140,0x6141,0x6142,0x6143,0x6144,0x6145,0x6146,0x0000,/* 0xF8-0xFF */
590}; 590};
591 591
592static wchar_t c2u_91[256] = { 592static const wchar_t c2u_91[256] = {
593 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 593 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
594 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 594 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
595 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 595 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -625,7 +625,7 @@ static wchar_t c2u_91[256] = {
625 0x623B,0x623C,0x6242,0x6244,0x6245,0x6246,0x624A,0x0000,/* 0xF8-0xFF */ 625 0x623B,0x623C,0x6242,0x6244,0x6245,0x6246,0x624A,0x0000,/* 0xF8-0xFF */
626}; 626};
627 627
628static wchar_t c2u_92[256] = { 628static const wchar_t c2u_92[256] = {
629 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 629 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
630 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 630 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
631 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 631 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -661,7 +661,7 @@ static wchar_t c2u_92[256] = {
661 0x63B5,0x63B6,0x63B9,0x63BB,0x63BD,0x63BF,0x63C0,0x0000,/* 0xF8-0xFF */ 661 0x63B5,0x63B6,0x63B9,0x63BB,0x63BD,0x63BF,0x63C0,0x0000,/* 0xF8-0xFF */
662}; 662};
663 663
664static wchar_t c2u_93[256] = { 664static const wchar_t c2u_93[256] = {
665 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 665 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
666 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 666 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
667 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 667 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -697,7 +697,7 @@ static wchar_t c2u_93[256] = {
697 0x64D1,0x64D3,0x64D4,0x64D5,0x64D6,0x64D9,0x64DA,0x0000,/* 0xF8-0xFF */ 697 0x64D1,0x64D3,0x64D4,0x64D5,0x64D6,0x64D9,0x64DA,0x0000,/* 0xF8-0xFF */
698}; 698};
699 699
700static wchar_t c2u_94[256] = { 700static const wchar_t c2u_94[256] = {
701 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 701 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
702 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 702 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
703 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 703 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -733,7 +733,7 @@ static wchar_t c2u_94[256] = {
733 0x65DE,0x65DF,0x65E1,0x65E3,0x65E4,0x65EA,0x65EB,0x0000,/* 0xF8-0xFF */ 733 0x65DE,0x65DF,0x65E1,0x65E3,0x65E4,0x65EA,0x65EB,0x0000,/* 0xF8-0xFF */
734}; 734};
735 735
736static wchar_t c2u_95[256] = { 736static const wchar_t c2u_95[256] = {
737 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 737 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
738 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 738 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
739 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 739 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -769,7 +769,7 @@ static wchar_t c2u_95[256] = {
769 0x66F8,0x66FA,0x66FB,0x66FD,0x6701,0x6702,0x6703,0x0000,/* 0xF8-0xFF */ 769 0x66F8,0x66FA,0x66FB,0x66FD,0x6701,0x6702,0x6703,0x0000,/* 0xF8-0xFF */
770}; 770};
771 771
772static wchar_t c2u_96[256] = { 772static const wchar_t c2u_96[256] = {
773 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 773 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
774 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 774 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
775 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 775 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -805,7 +805,7 @@ static wchar_t c2u_96[256] = {
805 0x6852,0x6856,0x6857,0x6858,0x6859,0x685A,0x685B,0x0000,/* 0xF8-0xFF */ 805 0x6852,0x6856,0x6857,0x6858,0x6859,0x685A,0x685B,0x0000,/* 0xF8-0xFF */
806}; 806};
807 807
808static wchar_t c2u_97[256] = { 808static const wchar_t c2u_97[256] = {
809 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 809 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
810 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 810 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
811 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 811 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -841,7 +841,7 @@ static wchar_t c2u_97[256] = {
841 0x6955,0x6956,0x6958,0x6959,0x695B,0x695C,0x695F,0x0000,/* 0xF8-0xFF */ 841 0x6955,0x6956,0x6958,0x6959,0x695B,0x695C,0x695F,0x0000,/* 0xF8-0xFF */
842}; 842};
843 843
844static wchar_t c2u_98[256] = { 844static const wchar_t c2u_98[256] = {
845 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 845 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
846 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 846 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
847 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 847 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -877,7 +877,7 @@ static wchar_t c2u_98[256] = {
877 0x6A52,0x6A53,0x6A54,0x6A55,0x6A56,0x6A57,0x6A5A,0x0000,/* 0xF8-0xFF */ 877 0x6A52,0x6A53,0x6A54,0x6A55,0x6A56,0x6A57,0x6A5A,0x0000,/* 0xF8-0xFF */
878}; 878};
879 879
880static wchar_t c2u_99[256] = { 880static const wchar_t c2u_99[256] = {
881 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 881 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
882 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 882 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
883 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 883 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -913,7 +913,7 @@ static wchar_t c2u_99[256] = {
913 0x6B28,0x6B29,0x6B2A,0x6B2B,0x6B2C,0x6B2D,0x6B2E,0x0000,/* 0xF8-0xFF */ 913 0x6B28,0x6B29,0x6B2A,0x6B2B,0x6B2C,0x6B2D,0x6B2E,0x0000,/* 0xF8-0xFF */
914}; 914};
915 915
916static wchar_t c2u_9A[256] = { 916static const wchar_t c2u_9A[256] = {
917 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 917 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
918 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 918 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
919 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 919 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -949,7 +949,7 @@ static wchar_t c2u_9A[256] = {
949 0x6C4E,0x6C4F,0x6C51,0x6C52,0x6C53,0x6C56,0x6C58,0x0000,/* 0xF8-0xFF */ 949 0x6C4E,0x6C4F,0x6C51,0x6C52,0x6C53,0x6C56,0x6C58,0x0000,/* 0xF8-0xFF */
950}; 950};
951 951
952static wchar_t c2u_9B[256] = { 952static const wchar_t c2u_9B[256] = {
953 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 953 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
954 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 954 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
955 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 955 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -985,7 +985,7 @@ static wchar_t c2u_9B[256] = {
985 0x6DBE,0x6DC1,0x6DC2,0x6DC3,0x6DC8,0x6DC9,0x6DCA,0x0000,/* 0xF8-0xFF */ 985 0x6DBE,0x6DC1,0x6DC2,0x6DC3,0x6DC8,0x6DC9,0x6DCA,0x0000,/* 0xF8-0xFF */
986}; 986};
987 987
988static wchar_t c2u_9C[256] = { 988static const wchar_t c2u_9C[256] = {
989 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 989 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
990 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 990 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
991 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 991 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1021,7 +1021,7 @@ static wchar_t c2u_9C[256] = {
1021 0x6EE7,0x6EEA,0x6EEB,0x6EEC,0x6EED,0x6EEE,0x6EEF,0x0000,/* 0xF8-0xFF */ 1021 0x6EE7,0x6EEA,0x6EEB,0x6EEC,0x6EED,0x6EEE,0x6EEF,0x0000,/* 0xF8-0xFF */
1022}; 1022};
1023 1023
1024static wchar_t c2u_9D[256] = { 1024static const wchar_t c2u_9D[256] = {
1025 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1025 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1026 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1026 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1027 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1027 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1057,7 +1057,7 @@ static wchar_t c2u_9D[256] = {
1057 0x6FDC,0x6FDD,0x6FDF,0x6FE2,0x6FE3,0x6FE4,0x6FE5,0x0000,/* 0xF8-0xFF */ 1057 0x6FDC,0x6FDD,0x6FDF,0x6FE2,0x6FE3,0x6FE4,0x6FE5,0x0000,/* 0xF8-0xFF */
1058}; 1058};
1059 1059
1060static wchar_t c2u_9E[256] = { 1060static const wchar_t c2u_9E[256] = {
1061 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1061 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1062 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1062 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1063 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1063 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1093,7 +1093,7 @@ static wchar_t c2u_9E[256] = {
1093 0x70D2,0x70D3,0x70D4,0x70D5,0x70D6,0x70D7,0x70DA,0x0000,/* 0xF8-0xFF */ 1093 0x70D2,0x70D3,0x70D4,0x70D5,0x70D6,0x70D7,0x70DA,0x0000,/* 0xF8-0xFF */
1094}; 1094};
1095 1095
1096static wchar_t c2u_9F[256] = { 1096static const wchar_t c2u_9F[256] = {
1097 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1097 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1098 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1098 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1099 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1099 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1129,7 +1129,7 @@ static wchar_t c2u_9F[256] = {
1129 0x71CC,0x71CD,0x71CF,0x71D0,0x71D1,0x71D2,0x71D3,0x0000,/* 0xF8-0xFF */ 1129 0x71CC,0x71CD,0x71CF,0x71D0,0x71D1,0x71D2,0x71D3,0x0000,/* 0xF8-0xFF */
1130}; 1130};
1131 1131
1132static wchar_t c2u_A0[256] = { 1132static const wchar_t c2u_A0[256] = {
1133 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1133 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1134 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1134 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1135 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1135 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1165,7 +1165,7 @@ static wchar_t c2u_A0[256] = {
1165 0x72D3,0x72D4,0x72D5,0x72D6,0x72D8,0x72DA,0x72DB,0x0000,/* 0xF8-0xFF */ 1165 0x72D3,0x72D4,0x72D5,0x72D6,0x72D8,0x72DA,0x72DB,0x0000,/* 0xF8-0xFF */
1166}; 1166};
1167 1167
1168static wchar_t c2u_A1[256] = { 1168static const wchar_t c2u_A1[256] = {
1169 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1169 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1170 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1170 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1201,7 +1201,7 @@ static wchar_t c2u_A1[256] = {
1201 0x25B2,0x203B,0x2192,0x2190,0x2191,0x2193,0x3013,0x0000,/* 0xF8-0xFF */ 1201 0x25B2,0x203B,0x2192,0x2190,0x2191,0x2193,0x3013,0x0000,/* 0xF8-0xFF */
1202}; 1202};
1203 1203
1204static wchar_t c2u_A2[256] = { 1204static const wchar_t c2u_A2[256] = {
1205 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1205 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1206 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1206 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1237,7 +1237,7 @@ static wchar_t c2u_A2[256] = {
1237 0x2167,0x2168,0x2169,0x216A,0x216B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1237 0x2167,0x2168,0x2169,0x216A,0x216B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1238}; 1238};
1239 1239
1240static wchar_t c2u_A3[256] = { 1240static const wchar_t c2u_A3[256] = {
1241 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1241 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1242 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1242 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1243 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1243 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1273,7 +1273,7 @@ static wchar_t c2u_A3[256] = {
1273 0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3,0x0000,/* 0xF8-0xFF */ 1273 0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3,0x0000,/* 0xF8-0xFF */
1274}; 1274};
1275 1275
1276static wchar_t c2u_A4[256] = { 1276static const wchar_t c2u_A4[256] = {
1277 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1277 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1278 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1278 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1308,7 +1308,7 @@ static wchar_t c2u_A4[256] = {
1308 0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */ 1308 0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
1309}; 1309};
1310 1310
1311static wchar_t c2u_A5[256] = { 1311static const wchar_t c2u_A5[256] = {
1312 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1312 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1313 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1313 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1314 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1314 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1343,7 +1343,7 @@ static wchar_t c2u_A5[256] = {
1343 0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,/* 0xF0-0xF7 */ 1343 0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,/* 0xF0-0xF7 */
1344}; 1344};
1345 1345
1346static wchar_t c2u_A6[256] = { 1346static const wchar_t c2u_A6[256] = {
1347 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1347 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1348 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1348 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1349 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1349 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1378,7 +1378,7 @@ static wchar_t c2u_A6[256] = {
1378 0xFE37,0xFE38,0xFE31,0x0000,0xFE33,0xFE34,0x0000,0x0000,/* 0xF0-0xF7 */ 1378 0xFE37,0xFE38,0xFE31,0x0000,0xFE33,0xFE34,0x0000,0x0000,/* 0xF0-0xF7 */
1379}; 1379};
1380 1380
1381static wchar_t c2u_A7[256] = { 1381static const wchar_t c2u_A7[256] = {
1382 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1382 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1383 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1383 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1384 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1384 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1413,7 +1413,7 @@ static wchar_t c2u_A7[256] = {
1413 0x044E,0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */ 1413 0x044E,0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
1414}; 1414};
1415 1415
1416static wchar_t c2u_A8[256] = { 1416static const wchar_t c2u_A8[256] = {
1417 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1417 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1418 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1418 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1419 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1419 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1447,7 +1447,7 @@ static wchar_t c2u_A8[256] = {
1447 0x3128,0x3129,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xE8-0xEF */ 1447 0x3128,0x3129,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xE8-0xEF */
1448}; 1448};
1449 1449
1450static wchar_t c2u_A9[256] = { 1450static const wchar_t c2u_A9[256] = {
1451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1452 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1452 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1453 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1453 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1481,7 +1481,7 @@ static wchar_t c2u_A9[256] = {
1481 0x2544,0x2545,0x2546,0x2547,0x2548,0x2549,0x254A,0x254B,/* 0xE8-0xEF */ 1481 0x2544,0x2545,0x2546,0x2547,0x2548,0x2549,0x254A,0x254B,/* 0xE8-0xEF */
1482}; 1482};
1483 1483
1484static wchar_t c2u_AA[256] = { 1484static const wchar_t c2u_AA[256] = {
1485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1506,7 +1506,7 @@ static wchar_t c2u_AA[256] = {
1506 0x7371,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1506 0x7371,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1507}; 1507};
1508 1508
1509static wchar_t c2u_AB[256] = { 1509static const wchar_t c2u_AB[256] = {
1510 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1510 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1511 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1511 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1512 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1512 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1531,7 +1531,7 @@ static wchar_t c2u_AB[256] = {
1531 0x73F7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1531 0x73F7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1532}; 1532};
1533 1533
1534static wchar_t c2u_AC[256] = { 1534static const wchar_t c2u_AC[256] = {
1535 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1535 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1536 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1536 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1537 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1537 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1556,7 +1556,7 @@ static wchar_t c2u_AC[256] = {
1556 0x747A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1556 0x747A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1557}; 1557};
1558 1558
1559static wchar_t c2u_AD[256] = { 1559static const wchar_t c2u_AD[256] = {
1560 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1560 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1561 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1561 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1562 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1562 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1581,7 +1581,7 @@ static wchar_t c2u_AD[256] = {
1581 0x74F2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1581 0x74F2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1582}; 1582};
1583 1583
1584static wchar_t c2u_AE[256] = { 1584static const wchar_t c2u_AE[256] = {
1585 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1585 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1586 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1586 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1587 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1587 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1606,7 +1606,7 @@ static wchar_t c2u_AE[256] = {
1606 0x7587,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1606 0x7587,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1607}; 1607};
1608 1608
1609static wchar_t c2u_AF[256] = { 1609static const wchar_t c2u_AF[256] = {
1610 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1610 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1611 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1611 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1612 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1612 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1631,7 +1631,7 @@ static wchar_t c2u_AF[256] = {
1631 0x7644,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1631 0x7644,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1632}; 1632};
1633 1633
1634static wchar_t c2u_B0[256] = { 1634static const wchar_t c2u_B0[256] = {
1635 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1635 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1636 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1636 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1637 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1637 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1667,7 +1667,7 @@ static wchar_t c2u_B0[256] = {
1667 0x508D,0x8C24,0x82DE,0x80DE,0x5305,0x8912,0x5265,0x0000,/* 0xF8-0xFF */ 1667 0x508D,0x8C24,0x82DE,0x80DE,0x5305,0x8912,0x5265,0x0000,/* 0xF8-0xFF */
1668}; 1668};
1669 1669
1670static wchar_t c2u_B1[256] = { 1670static const wchar_t c2u_B1[256] = {
1671 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1671 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1672 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1672 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1673 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1673 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1703,7 +1703,7 @@ static wchar_t c2u_B1[256] = {
1703 0x5175,0x51B0,0x67C4,0x4E19,0x79C9,0x997C,0x70B3,0x0000,/* 0xF8-0xFF */ 1703 0x5175,0x51B0,0x67C4,0x4E19,0x79C9,0x997C,0x70B3,0x0000,/* 0xF8-0xFF */
1704}; 1704};
1705 1705
1706static wchar_t c2u_B2[256] = { 1706static const wchar_t c2u_B2[256] = {
1707 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1707 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1708 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1708 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1709 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1709 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1739,7 +1739,7 @@ static wchar_t c2u_B2[256] = {
1739 0x7F20,0x94F2,0x4EA7,0x9610,0x98A4,0x660C,0x7316,0x0000,/* 0xF8-0xFF */ 1739 0x7F20,0x94F2,0x4EA7,0x9610,0x98A4,0x660C,0x7316,0x0000,/* 0xF8-0xFF */
1740}; 1740};
1741 1741
1742static wchar_t c2u_B3[256] = { 1742static const wchar_t c2u_B3[256] = {
1743 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1743 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1744 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1744 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1745 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1745 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1775,7 +1775,7 @@ static wchar_t c2u_B3[256] = {
1775 0x53A8,0x8E87,0x9504,0x96CF,0x6EC1,0x9664,0x695A,0x0000,/* 0xF8-0xFF */ 1775 0x53A8,0x8E87,0x9504,0x96CF,0x6EC1,0x9664,0x695A,0x0000,/* 0xF8-0xFF */
1776}; 1776};
1777 1777
1778static wchar_t c2u_B4[256] = { 1778static const wchar_t c2u_B4[256] = {
1779 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1779 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1780 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1780 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1781 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1781 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1811,7 +1811,7 @@ static wchar_t c2u_B4[256] = {
1811 0x5E26,0x6B86,0x4EE3,0x8D37,0x888B,0x5F85,0x902E,0x0000,/* 0xF8-0xFF */ 1811 0x5E26,0x6B86,0x4EE3,0x8D37,0x888B,0x5F85,0x902E,0x0000,/* 0xF8-0xFF */
1812}; 1812};
1813 1813
1814static wchar_t c2u_B5[256] = { 1814static const wchar_t c2u_B5[256] = {
1815 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1815 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1816 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1816 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1817 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1817 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1847,7 +1847,7 @@ static wchar_t c2u_B5[256] = {
1847 0x8DCC,0x7239,0x789F,0x8776,0x8FED,0x8C0D,0x53E0,0x0000,/* 0xF8-0xFF */ 1847 0x8DCC,0x7239,0x789F,0x8776,0x8FED,0x8C0D,0x53E0,0x0000,/* 0xF8-0xFF */
1848}; 1848};
1849 1849
1850static wchar_t c2u_B6[256] = { 1850static const wchar_t c2u_B6[256] = {
1851 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1851 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1852 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1852 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1853 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1853 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1883,7 +1883,7 @@ static wchar_t c2u_B6[256] = {
1883 0x800C,0x513F,0x8033,0x5C14,0x9975,0x6D31,0x4E8C,0x0000,/* 0xF8-0xFF */ 1883 0x800C,0x513F,0x8033,0x5C14,0x9975,0x6D31,0x4E8C,0x0000,/* 0xF8-0xFF */
1884}; 1884};
1885 1885
1886static wchar_t c2u_B7[256] = { 1886static const wchar_t c2u_B7[256] = {
1887 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1887 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1888 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1888 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1889 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1889 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1919,7 +1919,7 @@ static wchar_t c2u_B7[256] = {
1919 0x8F90,0x5E45,0x6C1F,0x7B26,0x4F0F,0x4FD8,0x670D,0x0000,/* 0xF8-0xFF */ 1919 0x8F90,0x5E45,0x6C1F,0x7B26,0x4F0F,0x4FD8,0x670D,0x0000,/* 0xF8-0xFF */
1920}; 1920};
1921 1921
1922static wchar_t c2u_B8[256] = { 1922static const wchar_t c2u_B8[256] = {
1923 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1923 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1924 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1924 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1925 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1925 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1955,7 +1955,7 @@ static wchar_t c2u_B8[256] = {
1955 0x7ED9,0x6839,0x8DDF,0x8015,0x66F4,0x5E9A,0x7FB9,0x0000,/* 0xF8-0xFF */ 1955 0x7ED9,0x6839,0x8DDF,0x8015,0x66F4,0x5E9A,0x7FB9,0x0000,/* 0xF8-0xFF */
1956}; 1956};
1957 1957
1958static wchar_t c2u_B9[256] = { 1958static const wchar_t c2u_B9[256] = {
1959 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1959 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1960 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1960 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1961 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1961 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1991,7 +1991,7 @@ static wchar_t c2u_B9[256] = {
1991 0x9505,0x90ED,0x56FD,0x679C,0x88F9,0x8FC7,0x54C8,0x0000,/* 0xF8-0xFF */ 1991 0x9505,0x90ED,0x56FD,0x679C,0x88F9,0x8FC7,0x54C8,0x0000,/* 0xF8-0xFF */
1992}; 1992};
1993 1993
1994static wchar_t c2u_BA[256] = { 1994static const wchar_t c2u_BA[256] = {
1995 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1995 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1996 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1996 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1997 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1997 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2027,7 +2027,7 @@ static wchar_t c2u_BA[256] = {
2027 0x58F6,0x846B,0x80E1,0x8774,0x72D0,0x7CCA,0x6E56,0x0000,/* 0xF8-0xFF */ 2027 0x58F6,0x846B,0x80E1,0x8774,0x72D0,0x7CCA,0x6E56,0x0000,/* 0xF8-0xFF */
2028}; 2028};
2029 2029
2030static wchar_t c2u_BB[256] = { 2030static const wchar_t c2u_BB[256] = {
2031 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2031 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2032 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2032 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2033 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2033 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2063,7 +2063,7 @@ static wchar_t c2u_BB[256] = {
2063 0x573E,0x57FA,0x673A,0x7578,0x7A3D,0x79EF,0x7B95,0x0000,/* 0xF8-0xFF */ 2063 0x573E,0x57FA,0x673A,0x7578,0x7A3D,0x79EF,0x7B95,0x0000,/* 0xF8-0xFF */
2064}; 2064};
2065 2065
2066static wchar_t c2u_BC[256] = { 2066static const wchar_t c2u_BC[256] = {
2067 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2067 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2068 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2068 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2069 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2069 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2099,7 +2099,7 @@ static wchar_t c2u_BC[256] = {
2099 0x9274,0x8DF5,0x8D31,0x89C1,0x952E,0x7BAD,0x4EF6,0x0000,/* 0xF8-0xFF */ 2099 0x9274,0x8DF5,0x8D31,0x89C1,0x952E,0x7BAD,0x4EF6,0x0000,/* 0xF8-0xFF */
2100}; 2100};
2101 2101
2102static wchar_t c2u_BD[256] = { 2102static const wchar_t c2u_BD[256] = {
2103 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2103 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2104 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2104 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2105 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2105 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2135,7 +2135,7 @@ static wchar_t c2u_BD[256] = {
2135 0x8FDB,0x9773,0x664B,0x7981,0x8FD1,0x70EC,0x6D78,0x0000,/* 0xF8-0xFF */ 2135 0x8FDB,0x9773,0x664B,0x7981,0x8FD1,0x70EC,0x6D78,0x0000,/* 0xF8-0xFF */
2136}; 2136};
2137 2137
2138static wchar_t c2u_BE[256] = { 2138static const wchar_t c2u_BE[256] = {
2139 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2139 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2140 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2140 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2141 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2141 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2171,7 +2171,7 @@ static wchar_t c2u_BE[256] = {
2171 0x7EDD,0x5747,0x83CC,0x94A7,0x519B,0x541B,0x5CFB,0x0000,/* 0xF8-0xFF */ 2171 0x7EDD,0x5747,0x83CC,0x94A7,0x519B,0x541B,0x5CFB,0x0000,/* 0xF8-0xFF */
2172}; 2172};
2173 2173
2174static wchar_t c2u_BF[256] = { 2174static const wchar_t c2u_BF[256] = {
2175 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2175 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2176 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2176 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2177 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2177 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2207,7 +2207,7 @@ static wchar_t c2u_BF[256] = {
2207 0x76D4,0x5CBF,0x7AA5,0x8475,0x594E,0x9B41,0x5080,0x0000,/* 0xF8-0xFF */ 2207 0x76D4,0x5CBF,0x7AA5,0x8475,0x594E,0x9B41,0x5080,0x0000,/* 0xF8-0xFF */
2208}; 2208};
2209 2209
2210static wchar_t c2u_C0[256] = { 2210static const wchar_t c2u_C0[256] = {
2211 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2211 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2212 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2212 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2213 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2213 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2243,7 +2243,7 @@ static wchar_t c2u_C0[256] = {
2243 0x52B1,0x783E,0x5386,0x5229,0x5088,0x4F8B,0x4FD0,0x0000,/* 0xF8-0xFF */ 2243 0x52B1,0x783E,0x5386,0x5229,0x5088,0x4F8B,0x4FD0,0x0000,/* 0xF8-0xFF */
2244}; 2244};
2245 2245
2246static wchar_t c2u_C1[256] = { 2246static const wchar_t c2u_C1[256] = {
2247 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2247 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2248 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2248 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2249 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2249 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2279,7 +2279,7 @@ static wchar_t c2u_C1[256] = {
2279 0x67F3,0x516D,0x9F99,0x804B,0x5499,0x7B3C,0x7ABF,0x0000,/* 0xF8-0xFF */ 2279 0x67F3,0x516D,0x9F99,0x804B,0x5499,0x7B3C,0x7ABF,0x0000,/* 0xF8-0xFF */
2280}; 2280};
2281 2281
2282static wchar_t c2u_C2[256] = { 2282static const wchar_t c2u_C2[256] = {
2283 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2283 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2284 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2284 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2285 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2285 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2315,7 +2315,7 @@ static wchar_t c2u_C2[256] = {
2315 0x9992,0x86EE,0x6EE1,0x8513,0x66FC,0x6162,0x6F2B,0x0000,/* 0xF8-0xFF */ 2315 0x9992,0x86EE,0x6EE1,0x8513,0x66FC,0x6162,0x6F2B,0x0000,/* 0xF8-0xFF */
2316}; 2316};
2317 2317
2318static wchar_t c2u_C3[256] = { 2318static const wchar_t c2u_C3[256] = {
2319 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2319 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2320 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2320 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2321 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2321 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2351,7 +2351,7 @@ static wchar_t c2u_C3[256] = {
2351 0x879F,0x9E23,0x94ED,0x540D,0x547D,0x8C2C,0x6478,0x0000,/* 0xF8-0xFF */ 2351 0x879F,0x9E23,0x94ED,0x540D,0x547D,0x8C2C,0x6478,0x0000,/* 0xF8-0xFF */
2352}; 2352};
2353 2353
2354static wchar_t c2u_C4[256] = { 2354static const wchar_t c2u_C4[256] = {
2355 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2355 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2356 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2356 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2357 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2357 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2387,7 +2387,7 @@ static wchar_t c2u_C4[256] = {
2387 0x954D,0x6D85,0x60A8,0x67E0,0x72DE,0x51DD,0x5B81,0x0000,/* 0xF8-0xFF */ 2387 0x954D,0x6D85,0x60A8,0x67E0,0x72DE,0x51DD,0x5B81,0x0000,/* 0xF8-0xFF */
2388}; 2388};
2389 2389
2390static wchar_t c2u_C5[256] = { 2390static const wchar_t c2u_C5[256] = {
2391 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2391 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2392 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2392 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2393 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2393 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2423,7 +2423,7 @@ static wchar_t c2u_C5[256] = {
2423 0x7812,0x9739,0x6279,0x62AB,0x5288,0x7435,0x6BD7,0x0000,/* 0xF8-0xFF */ 2423 0x7812,0x9739,0x6279,0x62AB,0x5288,0x7435,0x6BD7,0x0000,/* 0xF8-0xFF */
2424}; 2424};
2425 2425
2426static wchar_t c2u_C6[256] = { 2426static const wchar_t c2u_C6[256] = {
2427 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2427 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2428 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2428 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2429 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2429 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2459,7 +2459,7 @@ static wchar_t c2u_C6[256] = {
2459 0x6C14,0x8FC4,0x5F03,0x6C7D,0x6CE3,0x8BAB,0x6390,0x0000,/* 0xF8-0xFF */ 2459 0x6C14,0x8FC4,0x5F03,0x6C7D,0x6CE3,0x8BAB,0x6390,0x0000,/* 0xF8-0xFF */
2460}; 2460};
2461 2461
2462static wchar_t c2u_C7[256] = { 2462static const wchar_t c2u_C7[256] = {
2463 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2463 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2464 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2464 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2465 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2465 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2495,7 +2495,7 @@ static wchar_t c2u_C7[256] = {
2495 0x533A,0x86C6,0x66F2,0x8EAF,0x5C48,0x9A71,0x6E20,0x0000,/* 0xF8-0xFF */ 2495 0x533A,0x86C6,0x66F2,0x8EAF,0x5C48,0x9A71,0x6E20,0x0000,/* 0xF8-0xFF */
2496}; 2496};
2497 2497
2498static wchar_t c2u_C8[256] = { 2498static const wchar_t c2u_C8[256] = {
2499 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2499 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2500 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2500 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2501 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2501 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2531,7 +2531,7 @@ static wchar_t c2u_C8[256] = {
2531 0x8428,0x816E,0x9CC3,0x585E,0x8D5B,0x4E09,0x53C1,0x0000,/* 0xF8-0xFF */ 2531 0x8428,0x816E,0x9CC3,0x585E,0x8D5B,0x4E09,0x53C1,0x0000,/* 0xF8-0xFF */
2532}; 2532};
2533 2533
2534static wchar_t c2u_C9[256] = { 2534static const wchar_t c2u_C9[256] = {
2535 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2535 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2536 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2536 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2537 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2537 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2567,7 +2567,7 @@ static wchar_t c2u_C9[256] = {
2567 0x6E17,0x58F0,0x751F,0x7525,0x7272,0x5347,0x7EF3,0x0000,/* 0xF8-0xFF */ 2567 0x6E17,0x58F0,0x751F,0x7525,0x7272,0x5347,0x7EF3,0x0000,/* 0xF8-0xFF */
2568}; 2568};
2569 2569
2570static wchar_t c2u_CA[256] = { 2570static const wchar_t c2u_CA[256] = {
2571 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2571 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2572 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2572 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2573 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2573 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2603,7 +2603,7 @@ static wchar_t c2u_CA[256] = {
2603 0x675F,0x620D,0x7AD6,0x5885,0x5EB6,0x6570,0x6F31,0x0000,/* 0xF8-0xFF */ 2603 0x675F,0x620D,0x7AD6,0x5885,0x5EB6,0x6570,0x6F31,0x0000,/* 0xF8-0xFF */
2604}; 2604};
2605 2605
2606static wchar_t c2u_CB[256] = { 2606static const wchar_t c2u_CB[256] = {
2607 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2607 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2608 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2608 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2609 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2609 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2639,7 +2639,7 @@ static wchar_t c2u_CB[256] = {
2639 0x9501,0x6240,0x584C,0x4ED6,0x5B83,0x5979,0x5854,0x0000,/* 0xF8-0xFF */ 2639 0x9501,0x6240,0x584C,0x4ED6,0x5B83,0x5979,0x5854,0x0000,/* 0xF8-0xFF */
2640}; 2640};
2641 2641
2642static wchar_t c2u_CC[256] = { 2642static const wchar_t c2u_CC[256] = {
2643 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2643 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2644 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2644 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2645 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2645 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2675,7 +2675,7 @@ static wchar_t c2u_CC[256] = {
2675 0x8DF3,0x8D34,0x94C1,0x5E16,0x5385,0x542C,0x70C3,0x0000,/* 0xF8-0xFF */ 2675 0x8DF3,0x8D34,0x94C1,0x5E16,0x5385,0x542C,0x70C3,0x0000,/* 0xF8-0xFF */
2676}; 2676};
2677 2677
2678static wchar_t c2u_CD[256] = { 2678static const wchar_t c2u_CD[256] = {
2679 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2679 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2680 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2680 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2681 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2681 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2711,7 +2711,7 @@ static wchar_t c2u_CD[256] = {
2711 0x7F51,0x5F80,0x65FA,0x671B,0x5FD8,0x5984,0x5A01,0x0000,/* 0xF8-0xFF */ 2711 0x7F51,0x5F80,0x65FA,0x671B,0x5FD8,0x5984,0x5A01,0x0000,/* 0xF8-0xFF */
2712}; 2712};
2713 2713
2714static wchar_t c2u_CE[256] = { 2714static const wchar_t c2u_CE[256] = {
2715 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2715 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2716 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2716 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2717 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2717 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2747,7 +2747,7 @@ static wchar_t c2u_CE[256] = {
2747 0x7852,0x77FD,0x6670,0x563B,0x5438,0x9521,0x727A,0x0000,/* 0xF8-0xFF */ 2747 0x7852,0x77FD,0x6670,0x563B,0x5438,0x9521,0x727A,0x0000,/* 0xF8-0xFF */
2748}; 2748};
2749 2749
2750static wchar_t c2u_CF[256] = { 2750static const wchar_t c2u_CF[256] = {
2751 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2751 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2752 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2752 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2753 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2753 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2783,7 +2783,7 @@ static wchar_t c2u_CF[256] = {
2783 0x54EE,0x56A3,0x9500,0x6D88,0x5BB5,0x6DC6,0x6653,0x0000,/* 0xF8-0xFF */ 2783 0x54EE,0x56A3,0x9500,0x6D88,0x5BB5,0x6DC6,0x6653,0x0000,/* 0xF8-0xFF */
2784}; 2784};
2785 2785
2786static wchar_t c2u_D0[256] = { 2786static const wchar_t c2u_D0[256] = {
2787 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2787 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2788 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2788 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2789 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2789 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2819,7 +2819,7 @@ static wchar_t c2u_D0[256] = {
2819 0x7EED,0x8F69,0x55A7,0x5BA3,0x60AC,0x65CB,0x7384,0x0000,/* 0xF8-0xFF */ 2819 0x7EED,0x8F69,0x55A7,0x5BA3,0x60AC,0x65CB,0x7384,0x0000,/* 0xF8-0xFF */
2820}; 2820};
2821 2821
2822static wchar_t c2u_D1[256] = { 2822static const wchar_t c2u_D1[256] = {
2823 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2823 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2824 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2824 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2825 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2825 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2855,7 +2855,7 @@ static wchar_t c2u_D1[256] = {
2855 0x517B,0x6837,0x6F3E,0x9080,0x8170,0x5996,0x7476,0x0000,/* 0xF8-0xFF */ 2855 0x517B,0x6837,0x6F3E,0x9080,0x8170,0x5996,0x7476,0x0000,/* 0xF8-0xFF */
2856}; 2856};
2857 2857
2858static wchar_t c2u_D2[256] = { 2858static const wchar_t c2u_D2[256] = {
2859 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2859 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2860 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2860 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2861 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2861 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2891,7 +2891,7 @@ static wchar_t c2u_D2[256] = {
2891 0x94F6,0x6DEB,0x5BC5,0x996E,0x5C39,0x5F15,0x9690,0x0000,/* 0xF8-0xFF */ 2891 0x94F6,0x6DEB,0x5BC5,0x996E,0x5C39,0x5F15,0x9690,0x0000,/* 0xF8-0xFF */
2892}; 2892};
2893 2893
2894static wchar_t c2u_D3[256] = { 2894static const wchar_t c2u_D3[256] = {
2895 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2895 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2896 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2896 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2897 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2897 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2927,7 +2927,7 @@ static wchar_t c2u_D3[256] = {
2927 0x5CEA,0x5FA1,0x6108,0x6B32,0x72F1,0x80B2,0x8A89,0x0000,/* 0xF8-0xFF */ 2927 0x5CEA,0x5FA1,0x6108,0x6B32,0x72F1,0x80B2,0x8A89,0x0000,/* 0xF8-0xFF */
2928}; 2928};
2929 2929
2930static wchar_t c2u_D4[256] = { 2930static const wchar_t c2u_D4[256] = {
2931 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2931 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2932 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2932 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2933 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2933 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2963,7 +2963,7 @@ static wchar_t c2u_D4[256] = {
2963 0x66FE,0x8D60,0x624E,0x55B3,0x6E23,0x672D,0x8F67,0x0000,/* 0xF8-0xFF */ 2963 0x66FE,0x8D60,0x624E,0x55B3,0x6E23,0x672D,0x8F67,0x0000,/* 0xF8-0xFF */
2964}; 2964};
2965 2965
2966static wchar_t c2u_D5[256] = { 2966static const wchar_t c2u_D5[256] = {
2967 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2967 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2968 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2968 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2969 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2969 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2999,7 +2999,7 @@ static wchar_t c2u_D5[256] = {
2999 0x72F0,0x4E89,0x6014,0x6574,0x62EF,0x6B63,0x653F,0x0000,/* 0xF8-0xFF */ 2999 0x72F0,0x4E89,0x6014,0x6574,0x62EF,0x6B63,0x653F,0x0000,/* 0xF8-0xFF */
3000}; 3000};
3001 3001
3002static wchar_t c2u_D6[256] = { 3002static const wchar_t c2u_D6[256] = {
3003 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3003 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3004 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3004 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3005 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3005 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3035,7 +3035,7 @@ static wchar_t c2u_D6[256] = {
3035 0x8457,0x67F1,0x52A9,0x86C0,0x8D2E,0x94F8,0x7B51,0x0000,/* 0xF8-0xFF */ 3035 0x8457,0x67F1,0x52A9,0x86C0,0x8D2E,0x94F8,0x7B51,0x0000,/* 0xF8-0xFF */
3036}; 3036};
3037 3037
3038static wchar_t c2u_D7[256] = { 3038static const wchar_t c2u_D7[256] = {
3039 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3039 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3040 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3040 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3041 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3041 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3071,7 +3071,7 @@ static wchar_t c2u_D7[256] = {
3071 0x5750,0x5EA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 3071 0x5750,0x5EA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
3072}; 3072};
3073 3073
3074static wchar_t c2u_D8[256] = { 3074static const wchar_t c2u_D8[256] = {
3075 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3075 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3076 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3076 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3077 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3077 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3107,7 +3107,7 @@ static wchar_t c2u_D8[256] = {
3107 0x4F09,0x4F2B,0x4F5E,0x4F67,0x6538,0x4F5A,0x4F5D,0x0000,/* 0xF8-0xFF */ 3107 0x4F09,0x4F2B,0x4F5E,0x4F67,0x6538,0x4F5A,0x4F5D,0x0000,/* 0xF8-0xFF */
3108}; 3108};
3109 3109
3110static wchar_t c2u_D9[256] = { 3110static const wchar_t c2u_D9[256] = {
3111 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3111 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3112 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3112 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3113 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3113 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3143,7 +3143,7 @@ static wchar_t c2u_D9[256] = {
3143 0x5B34,0x8803,0x7FB8,0x51AB,0x51B1,0x51BD,0x51BC,0x0000,/* 0xF8-0xFF */ 3143 0x5B34,0x8803,0x7FB8,0x51AB,0x51B1,0x51BD,0x51BC,0x0000,/* 0xF8-0xFF */
3144}; 3144};
3145 3145
3146static wchar_t c2u_DA[256] = { 3146static const wchar_t c2u_DA[256] = {
3147 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3147 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3148 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3148 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3179,7 +3179,7 @@ static wchar_t c2u_DA[256] = {
3179 0x9099,0x90AC,0x90A1,0x90B4,0x90B3,0x90B6,0x90BA,0x0000,/* 0xF8-0xFF */ 3179 0x9099,0x90AC,0x90A1,0x90B4,0x90B3,0x90B6,0x90BA,0x0000,/* 0xF8-0xFF */
3180}; 3180};
3181 3181
3182static wchar_t c2u_DB[256] = { 3182static const wchar_t c2u_DB[256] = {
3183 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3183 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3184 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3184 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3185 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3185 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3215,7 +3215,7 @@ static wchar_t c2u_DB[256] = {
3215 0x57D2,0x57B8,0x57F4,0x57EF,0x57F8,0x57E4,0x57DD,0x0000,/* 0xF8-0xFF */ 3215 0x57D2,0x57B8,0x57F4,0x57EF,0x57F8,0x57E4,0x57DD,0x0000,/* 0xF8-0xFF */
3216}; 3216};
3217 3217
3218static wchar_t c2u_DC[256] = { 3218static const wchar_t c2u_DC[256] = {
3219 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3219 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3220 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3220 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3221 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3221 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3251,7 +3251,7 @@ static wchar_t c2u_DC[256] = {
3251 0x8317,0x8360,0x832D,0x833A,0x8333,0x8366,0x8365,0x0000,/* 0xF8-0xFF */ 3251 0x8317,0x8360,0x832D,0x833A,0x8333,0x8366,0x8365,0x0000,/* 0xF8-0xFF */
3252}; 3252};
3253 3253
3254static wchar_t c2u_DD[256] = { 3254static const wchar_t c2u_DD[256] = {
3255 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3255 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3256 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3256 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3257 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3257 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3287,7 +3287,7 @@ static wchar_t c2u_DD[256] = {
3287 0x850C,0x750D,0x8538,0x84F0,0x8539,0x851F,0x853A,0x0000,/* 0xF8-0xFF */ 3287 0x850C,0x750D,0x8538,0x84F0,0x8539,0x851F,0x853A,0x0000,/* 0xF8-0xFF */
3288}; 3288};
3289 3289
3290static wchar_t c2u_DE[256] = { 3290static const wchar_t c2u_DE[256] = {
3291 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3291 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3292 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3292 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3293 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3293 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3323,7 +3323,7 @@ static wchar_t c2u_DE[256] = {
3323 0x640C,0x6426,0x6421,0x645E,0x6484,0x646D,0x6496,0x0000,/* 0xF8-0xFF */ 3323 0x640C,0x6426,0x6421,0x645E,0x6484,0x646D,0x6496,0x0000,/* 0xF8-0xFF */
3324}; 3324};
3325 3325
3326static wchar_t c2u_DF[256] = { 3326static const wchar_t c2u_DF[256] = {
3327 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3327 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3328 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3328 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3329 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3329 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3359,7 +3359,7 @@ static wchar_t c2u_DF[256] = {
3359 0x5549,0x556D,0x5541,0x5555,0x553F,0x5550,0x553C,0x0000,/* 0xF8-0xFF */ 3359 0x5549,0x556D,0x5541,0x5555,0x553F,0x5550,0x553C,0x0000,/* 0xF8-0xFF */
3360}; 3360};
3361 3361
3362static wchar_t c2u_E0[256] = { 3362static const wchar_t c2u_E0[256] = {
3363 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3363 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3364 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3364 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3365 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3365 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3395,7 +3395,7 @@ static wchar_t c2u_E0[256] = {
3395 0x5E0F,0x5E19,0x5E14,0x5E11,0x5E31,0x5E3B,0x5E3C,0x0000,/* 0xF8-0xFF */ 3395 0x5E0F,0x5E19,0x5E14,0x5E11,0x5E31,0x5E3B,0x5E3C,0x0000,/* 0xF8-0xFF */
3396}; 3396};
3397 3397
3398static wchar_t c2u_E1[256] = { 3398static const wchar_t c2u_E1[256] = {
3399 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3399 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3400 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3400 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3401 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3401 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3431,7 +3431,7 @@ static wchar_t c2u_E1[256] = {
3431 0x72F2,0x72F4,0x72F7,0x7301,0x72F3,0x7303,0x72FA,0x0000,/* 0xF8-0xFF */ 3431 0x72F2,0x72F4,0x72F7,0x7301,0x72F3,0x7303,0x72FA,0x0000,/* 0xF8-0xFF */
3432}; 3432};
3433 3433
3434static wchar_t c2u_E2[256] = { 3434static const wchar_t c2u_E2[256] = {
3435 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3435 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3436 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3436 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3437 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3437 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3467,7 +3467,7 @@ static wchar_t c2u_E2[256] = {
3467 0x603F,0x6021,0x6078,0x6079,0x607B,0x607A,0x6042,0x0000,/* 0xF8-0xFF */ 3467 0x603F,0x6021,0x6078,0x6079,0x607B,0x607A,0x6042,0x0000,/* 0xF8-0xFF */
3468}; 3468};
3469 3469
3470static wchar_t c2u_E3[256] = { 3470static const wchar_t c2u_E3[256] = {
3471 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3471 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3472 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3472 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3473 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3473 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3503,7 +3503,7 @@ static wchar_t c2u_E3[256] = {
3503 0x6CFA,0x6CEB,0x6CEE,0x6CB1,0x6CD3,0x6CEF,0x6CFE,0x0000,/* 0xF8-0xFF */ 3503 0x6CFA,0x6CEB,0x6CEE,0x6CB1,0x6CD3,0x6CEF,0x6CFE,0x0000,/* 0xF8-0xFF */
3504}; 3504};
3505 3505
3506static wchar_t c2u_E4[256] = { 3506static const wchar_t c2u_E4[256] = {
3507 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3507 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3508 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3508 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3509 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3509 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3539,7 +3539,7 @@ static wchar_t c2u_E4[256] = {
3539 0x6F8D,0x6F8C,0x6F78,0x6F72,0x6F7C,0x6F7A,0x6FD1,0x0000,/* 0xF8-0xFF */ 3539 0x6F8D,0x6F8C,0x6F78,0x6F72,0x6F7C,0x6F7A,0x6FD1,0x0000,/* 0xF8-0xFF */
3540}; 3540};
3541 3541
3542static wchar_t c2u_E5[256] = { 3542static const wchar_t c2u_E5[256] = {
3543 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3543 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3544 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3544 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3545 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3545 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3575,7 +3575,7 @@ static wchar_t c2u_E5[256] = {
3575 0x5C6E,0x5981,0x5983,0x598D,0x59A9,0x59AA,0x59A3,0x0000,/* 0xF8-0xFF */ 3575 0x5C6E,0x5981,0x5983,0x598D,0x59A9,0x59AA,0x59A3,0x0000,/* 0xF8-0xFF */
3576}; 3576};
3577 3577
3578static wchar_t c2u_E6[256] = { 3578static const wchar_t c2u_E6[256] = {
3579 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3579 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3580 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3580 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3581 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3581 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3611,7 +3611,7 @@ static wchar_t c2u_E6[256] = {
3611 0x9AA7,0x7E9F,0x7EA1,0x7EA3,0x7EA5,0x7EA8,0x7EA9,0x0000,/* 0xF8-0xFF */ 3611 0x9AA7,0x7E9F,0x7EA1,0x7EA3,0x7EA5,0x7EA8,0x7EA9,0x0000,/* 0xF8-0xFF */
3612}; 3612};
3613 3613
3614static wchar_t c2u_E7[256] = { 3614static const wchar_t c2u_E7[256] = {
3615 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3615 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3616 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3616 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3617 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3617 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3647,7 +3647,7 @@ static wchar_t c2u_E7[256] = {
3647 0x745B,0x7426,0x7425,0x7428,0x7430,0x742E,0x742C,0x0000,/* 0xF8-0xFF */ 3647 0x745B,0x7426,0x7425,0x7428,0x7430,0x742E,0x742C,0x0000,/* 0xF8-0xFF */
3648}; 3648};
3649 3649
3650static wchar_t c2u_E8[256] = { 3650static const wchar_t c2u_E8[256] = {
3651 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3651 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3652 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3652 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3653 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3653 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3683,7 +3683,7 @@ static wchar_t c2u_E8[256] = {
3683 0x686B,0x68C2,0x696E,0x68FC,0x691F,0x6920,0x68F9,0x0000,/* 0xF8-0xFF */ 3683 0x686B,0x68C2,0x696E,0x68FC,0x691F,0x6920,0x68F9,0x0000,/* 0xF8-0xFF */
3684}; 3684};
3685 3685
3686static wchar_t c2u_E9[256] = { 3686static const wchar_t c2u_E9[256] = {
3687 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3687 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3688 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3688 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3689 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3689 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3719,7 +3719,7 @@ static wchar_t c2u_E9[256] = {
3719 0x8F7C,0x8F7E,0x8F81,0x8F82,0x8F84,0x8F87,0x8F8B,0x0000,/* 0xF8-0xFF */ 3719 0x8F7C,0x8F7E,0x8F81,0x8F82,0x8F84,0x8F87,0x8F8B,0x0000,/* 0xF8-0xFF */
3720}; 3720};
3721 3721
3722static wchar_t c2u_EA[256] = { 3722static const wchar_t c2u_EA[256] = {
3723 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3723 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3724 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3724 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3725 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3725 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3755,7 +3755,7 @@ static wchar_t c2u_EA[256] = {
3755 0x728B,0x728D,0x728F,0x7292,0x6308,0x6332,0x63B0,0x0000,/* 0xF8-0xFF */ 3755 0x728B,0x728D,0x728F,0x7292,0x6308,0x6332,0x63B0,0x0000,/* 0xF8-0xFF */
3756}; 3756};
3757 3757
3758static wchar_t c2u_EB[256] = { 3758static const wchar_t c2u_EB[256] = {
3759 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3759 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3760 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3760 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3761 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3761 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3791,7 +3791,7 @@ static wchar_t c2u_EB[256] = {
3791 0x6ED5,0x81A3,0x81AA,0x81CC,0x6726,0x81CA,0x81BB,0x0000,/* 0xF8-0xFF */ 3791 0x6ED5,0x81A3,0x81AA,0x81CC,0x6726,0x81CA,0x81BB,0x0000,/* 0xF8-0xFF */
3792}; 3792};
3793 3793
3794static wchar_t c2u_EC[256] = { 3794static const wchar_t c2u_EC[256] = {
3795 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3795 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3796 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3796 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3797 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3797 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3827,7 +3827,7 @@ static wchar_t c2u_EC[256] = {
3827 0x7985,0x798A,0x799A,0x79A7,0x79B3,0x5FD1,0x5FD0,0x0000,/* 0xF8-0xFF */ 3827 0x7985,0x798A,0x799A,0x79A7,0x79B3,0x5FD1,0x5FD0,0x0000,/* 0xF8-0xFF */
3828}; 3828};
3829 3829
3830static wchar_t c2u_ED[256] = { 3830static const wchar_t c2u_ED[256] = {
3831 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3831 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3832 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3832 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3833 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3833 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3863,7 +3863,7 @@ static wchar_t c2u_ED[256] = {
3863 0x7738,0x7750,0x7751,0x7747,0x7743,0x775A,0x7768,0x0000,/* 0xF8-0xFF */ 3863 0x7738,0x7750,0x7751,0x7747,0x7743,0x775A,0x7768,0x0000,/* 0xF8-0xFF */
3864}; 3864};
3865 3865
3866static wchar_t c2u_EE[256] = { 3866static const wchar_t c2u_EE[256] = {
3867 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3867 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3868 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3868 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3869 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3869 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3899,7 +3899,7 @@ static wchar_t c2u_EE[256] = {
3899 0x94E0,0x94E2,0x94E4,0x94E5,0x94E7,0x94E8,0x94EA,0x0000,/* 0xF8-0xFF */ 3899 0x94E0,0x94E2,0x94E4,0x94E5,0x94E7,0x94E8,0x94EA,0x0000,/* 0xF8-0xFF */
3900}; 3900};
3901 3901
3902static wchar_t c2u_EF[256] = { 3902static const wchar_t c2u_EF[256] = {
3903 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3903 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3904 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3904 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3905 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3905 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3935,7 +3935,7 @@ static wchar_t c2u_EF[256] = {
3935 0x79EB,0x7A06,0x5D47,0x7A03,0x7A02,0x7A1E,0x7A14,0x0000,/* 0xF8-0xFF */ 3935 0x79EB,0x7A06,0x5D47,0x7A03,0x7A02,0x7A1E,0x7A14,0x0000,/* 0xF8-0xFF */
3936}; 3936};
3937 3937
3938static wchar_t c2u_F0[256] = { 3938static const wchar_t c2u_F0[256] = {
3939 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3939 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3940 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3940 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3941 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3941 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3971,7 +3971,7 @@ static wchar_t c2u_F0[256] = {
3971 0x760C,0x7617,0x760A,0x7625,0x7618,0x7615,0x7619,0x0000,/* 0xF8-0xFF */ 3971 0x760C,0x7617,0x760A,0x7625,0x7618,0x7615,0x7619,0x0000,/* 0xF8-0xFF */
3972}; 3972};
3973 3973
3974static wchar_t c2u_F1[256] = { 3974static const wchar_t c2u_F1[256] = {
3975 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3975 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3976 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3976 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3977 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3977 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4007,7 +4007,7 @@ static wchar_t c2u_F1[256] = {
4007 0x8052,0x8069,0x8071,0x8983,0x9878,0x9880,0x9883,0x0000,/* 0xF8-0xFF */ 4007 0x8052,0x8069,0x8071,0x8983,0x9878,0x9880,0x9883,0x0000,/* 0xF8-0xFF */
4008}; 4008};
4009 4009
4010static wchar_t c2u_F2[256] = { 4010static const wchar_t c2u_F2[256] = {
4011 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4011 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4012 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4012 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4013 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4013 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4043,7 +4043,7 @@ static wchar_t c2u_F2[256] = {
4043 0x8764,0x8759,0x8765,0x8793,0x87AF,0x87A8,0x87D2,0x0000,/* 0xF8-0xFF */ 4043 0x8764,0x8759,0x8765,0x8793,0x87AF,0x87A8,0x87D2,0x0000,/* 0xF8-0xFF */
4044}; 4044};
4045 4045
4046static wchar_t c2u_F3[256] = { 4046static const wchar_t c2u_F3[256] = {
4047 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4047 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4048 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4048 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4049 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4049 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4079,7 +4079,7 @@ static wchar_t c2u_F3[256] = {
4079 0x7BEA,0x7C0C,0x7BFE,0x7BFC,0x7C0F,0x7C16,0x7C0B,0x0000,/* 0xF8-0xFF */ 4079 0x7BEA,0x7C0C,0x7BFE,0x7BFC,0x7C0F,0x7C16,0x7C0B,0x0000,/* 0xF8-0xFF */
4080}; 4080};
4081 4081
4082static wchar_t c2u_F4[256] = { 4082static const wchar_t c2u_F4[256] = {
4083 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4083 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4084 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4084 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4085 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4085 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4115,7 +4115,7 @@ static wchar_t c2u_F4[256] = {
4115 0x8C47,0x8C49,0x914A,0x9150,0x914E,0x914F,0x9164,0x0000,/* 0xF8-0xFF */ 4115 0x8C47,0x8C49,0x914A,0x9150,0x914E,0x914F,0x9164,0x0000,/* 0xF8-0xFF */
4116}; 4116};
4117 4117
4118static wchar_t c2u_F5[256] = { 4118static const wchar_t c2u_F5[256] = {
4119 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4119 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4120 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4120 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4121 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4121 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4151,7 +4151,7 @@ static wchar_t c2u_F5[256] = {
4151 0x8C98,0x8C94,0x659B,0x89D6,0x89DE,0x89DA,0x89DC,0x0000,/* 0xF8-0xFF */ 4151 0x8C98,0x8C94,0x659B,0x89D6,0x89DE,0x89DA,0x89DC,0x0000,/* 0xF8-0xFF */
4152}; 4152};
4153 4153
4154static wchar_t c2u_F6[256] = { 4154static const wchar_t c2u_F6[256] = {
4155 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4155 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4156 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4156 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4157 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4157 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4187,7 +4187,7 @@ static wchar_t c2u_F6[256] = {
4187 0x9CBD,0x9CC4,0x9CC5,0x9CC6,0x9CC7,0x9CCA,0x9CCB,0x0000,/* 0xF8-0xFF */ 4187 0x9CBD,0x9CC4,0x9CC5,0x9CC6,0x9CC7,0x9CCA,0x9CCB,0x0000,/* 0xF8-0xFF */
4188}; 4188};
4189 4189
4190static wchar_t c2u_F7[256] = { 4190static const wchar_t c2u_F7[256] = {
4191 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4191 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4192 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4192 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4193 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4193 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4223,7 +4223,7 @@ static wchar_t c2u_F7[256] = {
4223 0x9F2C,0x9F2F,0x9F39,0x9F37,0x9F3D,0x9F3E,0x9F44,0x0000,/* 0xF8-0xFF */ 4223 0x9F2C,0x9F2F,0x9F39,0x9F37,0x9F3D,0x9F3E,0x9F44,0x0000,/* 0xF8-0xFF */
4224}; 4224};
4225 4225
4226static wchar_t c2u_F8[256] = { 4226static const wchar_t c2u_F8[256] = {
4227 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4227 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4228 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4228 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4229 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4229 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4248,7 +4248,7 @@ static wchar_t c2u_F8[256] = {
4248 0x9D42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 4248 0x9D42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
4249}; 4249};
4250 4250
4251static wchar_t c2u_F9[256] = { 4251static const wchar_t c2u_F9[256] = {
4252 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4252 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4253 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4253 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4254 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4254 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4273,7 +4273,7 @@ static wchar_t c2u_F9[256] = {
4273 0x9DA2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 4273 0x9DA2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
4274}; 4274};
4275 4275
4276static wchar_t c2u_FA[256] = { 4276static const wchar_t c2u_FA[256] = {
4277 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4277 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4278 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4278 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4298,7 +4298,7 @@ static wchar_t c2u_FA[256] = {
4298 0x9E02,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 4298 0x9E02,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
4299}; 4299};
4300 4300
4301static wchar_t c2u_FB[256] = { 4301static const wchar_t c2u_FB[256] = {
4302 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4302 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4303 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4303 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4304 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4304 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4323,7 +4323,7 @@ static wchar_t c2u_FB[256] = {
4323 0x9EAA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 4323 0x9EAA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
4324}; 4324};
4325 4325
4326static wchar_t c2u_FC[256] = { 4326static const wchar_t c2u_FC[256] = {
4327 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4327 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4328 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4328 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4329 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4329 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4348,7 +4348,7 @@ static wchar_t c2u_FC[256] = {
4348 0x9F31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 4348 0x9F31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
4349}; 4349};
4350 4350
4351static wchar_t c2u_FD[256] = { 4351static const wchar_t c2u_FD[256] = {
4352 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4352 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4353 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4353 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4354 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4354 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4373,7 +4373,7 @@ static wchar_t c2u_FD[256] = {
4373 0xF9F1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 4373 0xF9F1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
4374}; 4374};
4375 4375
4376static wchar_t c2u_FE[256] = { 4376static const wchar_t c2u_FE[256] = {
4377 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4377 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4378 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4378 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4386,7 +4386,7 @@ static wchar_t c2u_FE[256] = {
4386 0xFA1F,0xFA20,0xFA21,0xFA23,0xFA24,0xFA27,0xFA28,0xFA29,/* 0x48-0x4F */ 4386 0xFA1F,0xFA20,0xFA21,0xFA23,0xFA24,0xFA27,0xFA28,0xFA29,/* 0x48-0x4F */
4387}; 4387};
4388 4388
4389static wchar_t *page_charset2uni[256] = { 4389static const wchar_t *page_charset2uni[256] = {
4390 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4390 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4391 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4391 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4392 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4392 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -4421,7 +4421,7 @@ static wchar_t *page_charset2uni[256] = {
4421 c2u_F8, c2u_F9, c2u_FA, c2u_FB, c2u_FC, c2u_FD, c2u_FE, NULL, 4421 c2u_F8, c2u_F9, c2u_FA, c2u_FB, c2u_FC, c2u_FD, c2u_FE, NULL,
4422}; 4422};
4423 4423
4424static unsigned char u2c_00[512] = { 4424static const unsigned char u2c_00[512] = {
4425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4427 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4427 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4488,7 +4488,7 @@ static unsigned char u2c_00[512] = {
4488 0xA8, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4488 0xA8, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4489}; 4489};
4490 4490
4491static unsigned char u2c_01[512] = { 4491static const unsigned char u2c_01[512] = {
4492 0xA8, 0xA1, 0xA8, 0xA1, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4492 0xA8, 0xA1, 0xA8, 0xA1, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4548,7 +4548,7 @@ static unsigned char u2c_01[512] = {
4548 0xA8, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */ 4548 0xA8, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
4549}; 4549};
4550 4550
4551static unsigned char u2c_02[512] = { 4551static const unsigned char u2c_02[512] = {
4552 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4552 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4607,7 +4607,7 @@ static unsigned char u2c_02[512] = {
4607 0x00, 0x00, 0xA8, 0x42, 0x00, 0x00, 0x00, 0x00, /* 0xD8-0xDB */ 4607 0x00, 0x00, 0xA8, 0x42, 0x00, 0x00, 0x00, 0x00, /* 0xD8-0xDB */
4608}; 4608};
4609 4609
4610static unsigned char u2c_03[512] = { 4610static const unsigned char u2c_03[512] = {
4611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4662,7 +4662,7 @@ static unsigned char u2c_03[512] = {
4662 0xA6, 0xD7, 0xA6, 0xD8, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */ 4662 0xA6, 0xD7, 0xA6, 0xD8, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
4663}; 4663};
4664 4664
4665static unsigned char u2c_04[512] = { 4665static const unsigned char u2c_04[512] = {
4666 0x00, 0x00, 0xA7, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4666 0x00, 0x00, 0xA7, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4686,7 +4686,7 @@ static unsigned char u2c_04[512] = {
4686 0x00, 0x00, 0xA7, 0xD7, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */ 4686 0x00, 0x00, 0xA7, 0xD7, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */
4687}; 4687};
4688 4688
4689static unsigned char u2c_20[512] = { 4689static const unsigned char u2c_20[512] = {
4690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4705,7 +4705,7 @@ static unsigned char u2c_20[512] = {
4705 0x00, 0x00, 0x00, 0x00, 0xA3, 0xFE, 0x00, 0x00, /* 0x3C-0x3F */ 4705 0x00, 0x00, 0x00, 0x00, 0xA3, 0xFE, 0x00, 0x00, /* 0x3C-0x3F */
4706}; 4706};
4707 4707
4708static unsigned char u2c_21[512] = { 4708static const unsigned char u2c_21[512] = {
4709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xE6, /* 0x00-0x03 */ 4709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xE6, /* 0x00-0x03 */
4710 0x00, 0x00, 0xA8, 0x47, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4710 0x00, 0x00, 0xA8, 0x47, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4711 0x00, 0x00, 0xA8, 0x48, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4711 0x00, 0x00, 0xA8, 0x48, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4748,7 +4748,7 @@ static unsigned char u2c_21[512] = {
4748 0xA8, 0x4B, 0xA8, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9B */ 4748 0xA8, 0x4B, 0xA8, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9B */
4749}; 4749};
4750 4750
4751static unsigned char u2c_22[512] = { 4751static const unsigned char u2c_22[512] = {
4752 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4752 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4753 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4753 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4754 0xA1, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4754 0xA1, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4800,7 +4800,7 @@ static unsigned char u2c_22[512] = {
4800 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x53, /* 0xBC-0xBF */ 4800 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x53, /* 0xBC-0xBF */
4801}; 4801};
4802 4802
4803static unsigned char u2c_23[512] = { 4803static const unsigned char u2c_23[512] = {
4804 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4804 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4805 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4805 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4806 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4806 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4808,7 +4808,7 @@ static unsigned char u2c_23[512] = {
4808 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD0, 0x00, 0x00, /* 0x10-0x13 */ 4808 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD0, 0x00, 0x00, /* 0x10-0x13 */
4809}; 4809};
4810 4810
4811static unsigned char u2c_24[512] = { 4811static const unsigned char u2c_24[512] = {
4812 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4812 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4814 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4814 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4851,7 +4851,7 @@ static unsigned char u2c_24[512] = {
4851 0xA2, 0xC1, 0xA2, 0xC2, 0xA2, 0xC3, 0xA2, 0xC4, /* 0x98-0x9B */ 4851 0xA2, 0xC1, 0xA2, 0xC2, 0xA2, 0xC3, 0xA2, 0xC4, /* 0x98-0x9B */
4852}; 4852};
4853 4853
4854static unsigned char u2c_25[512] = { 4854static const unsigned char u2c_25[512] = {
4855 0xA9, 0xA4, 0xA9, 0xA5, 0xA9, 0xA6, 0xA9, 0xA7, /* 0x00-0x03 */ 4855 0xA9, 0xA4, 0xA9, 0xA5, 0xA9, 0xA6, 0xA9, 0xA7, /* 0x00-0x03 */
4856 0xA9, 0xA8, 0xA9, 0xA9, 0xA9, 0xAA, 0xA9, 0xAB, /* 0x04-0x07 */ 4856 0xA9, 0xA8, 0xA9, 0xA9, 0xA9, 0xAA, 0xA9, 0xAB, /* 0x04-0x07 */
4857 0xA9, 0xAC, 0xA9, 0xAD, 0xA9, 0xAE, 0xA9, 0xAF, /* 0x08-0x0B */ 4857 0xA9, 0xAC, 0xA9, 0xAD, 0xA9, 0xAE, 0xA9, 0xAF, /* 0x08-0x0B */
@@ -4919,7 +4919,7 @@ static unsigned char u2c_25[512] = {
4919 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4919 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4920}; 4920};
4921 4921
4922static unsigned char u2c_26[512] = { 4922static const unsigned char u2c_26[512] = {
4923 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4923 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4924 0x00, 0x00, 0xA1, 0xEF, 0xA1, 0xEE, 0x00, 0x00, /* 0x04-0x07 */ 4924 0x00, 0x00, 0xA1, 0xEF, 0xA1, 0xEE, 0x00, 0x00, /* 0x04-0x07 */
4925 0x00, 0x00, 0xA8, 0x91, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4925 0x00, 0x00, 0xA8, 0x91, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4939,7 +4939,7 @@ static unsigned char u2c_26[512] = {
4939 0xA1, 0xE2, 0x00, 0x00, 0xA1, 0xE1, 0x00, 0x00, /* 0x40-0x43 */ 4939 0xA1, 0xE2, 0x00, 0x00, 0xA1, 0xE1, 0x00, 0x00, /* 0x40-0x43 */
4940}; 4940};
4941 4941
4942static unsigned char u2c_30[512] = { 4942static const unsigned char u2c_30[512] = {
4943 0xA1, 0xA1, 0xA1, 0xA2, 0xA1, 0xA3, 0xA1, 0xA8, /* 0x00-0x03 */ 4943 0xA1, 0xA1, 0xA1, 0xA2, 0xA1, 0xA3, 0xA1, 0xA8, /* 0x00-0x03 */
4944 0x00, 0x00, 0xA1, 0xA9, 0xA9, 0x65, 0xA9, 0x96, /* 0x04-0x07 */ 4944 0x00, 0x00, 0xA1, 0xA9, 0xA9, 0x65, 0xA9, 0x96, /* 0x04-0x07 */
4945 0xA1, 0xB4, 0xA1, 0xB5, 0xA1, 0xB6, 0xA1, 0xB7, /* 0x08-0x0B */ 4945 0xA1, 0xB4, 0xA1, 0xB5, 0xA1, 0xB6, 0xA1, 0xB7, /* 0x08-0x0B */
@@ -5007,7 +5007,7 @@ static unsigned char u2c_30[512] = {
5007 0xA9, 0x60, 0xA9, 0x63, 0xA9, 0x64, 0x00, 0x00, /* 0xFC-0xFF */ 5007 0xA9, 0x60, 0xA9, 0x63, 0xA9, 0x64, 0x00, 0x00, /* 0xFC-0xFF */
5008}; 5008};
5009 5009
5010static unsigned char u2c_31[512] = { 5010static const unsigned char u2c_31[512] = {
5011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5012 0x00, 0x00, 0xA8, 0xC5, 0xA8, 0xC6, 0xA8, 0xC7, /* 0x04-0x07 */ 5012 0x00, 0x00, 0xA8, 0xC5, 0xA8, 0xC6, 0xA8, 0xC7, /* 0x04-0x07 */
5013 0xA8, 0xC8, 0xA8, 0xC9, 0xA8, 0xCA, 0xA8, 0xCB, /* 0x08-0x0B */ 5013 0xA8, 0xC8, 0xA8, 0xC9, 0xA8, 0xCA, 0xA8, 0xCB, /* 0x08-0x0B */
@@ -5051,7 +5051,7 @@ static unsigned char u2c_31[512] = {
5051 0xB6, 0xA1, 0xCC, 0xEC, 0xB5, 0xD8, 0xC8, 0xCB, /* 0x9C-0x9F */ 5051 0xB6, 0xA1, 0xCC, 0xEC, 0xB5, 0xD8, 0xC8, 0xCB, /* 0x9C-0x9F */
5052}; 5052};
5053 5053
5054static unsigned char u2c_32[512] = { 5054static const unsigned char u2c_32[512] = {
5055 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5055 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5057 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5057 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5100,7 +5100,7 @@ static unsigned char u2c_32[512] = {
5100 0xD2, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */ 5100 0xD2, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */
5101}; 5101};
5102 5102
5103static unsigned char u2c_33[512] = { 5103static const unsigned char u2c_33[512] = {
5104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5158,7 +5158,7 @@ static unsigned char u2c_33[512] = {
5158 0x00, 0x00, 0xA9, 0x54, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */ 5158 0x00, 0x00, 0xA9, 0x54, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
5159}; 5159};
5160 5160
5161static unsigned char u2c_4E[512] = { 5161static const unsigned char u2c_4E[512] = {
5162 0xD2, 0xBB, 0xB6, 0xA1, 0x81, 0x40, 0xC6, 0xDF, /* 0x00-0x03 */ 5162 0xD2, 0xBB, 0xB6, 0xA1, 0x81, 0x40, 0xC6, 0xDF, /* 0x00-0x03 */
5163 0x81, 0x41, 0x81, 0x42, 0x81, 0x43, 0xCD, 0xF2, /* 0x04-0x07 */ 5163 0x81, 0x41, 0x81, 0x42, 0x81, 0x43, 0xCD, 0xF2, /* 0x04-0x07 */
5164 0xD5, 0xC9, 0xC8, 0xFD, 0xC9, 0xCF, 0xCF, 0xC2, /* 0x08-0x0B */ 5164 0xD5, 0xC9, 0xC8, 0xFD, 0xC9, 0xCF, 0xCF, 0xC2, /* 0x08-0x0B */
@@ -5226,7 +5226,7 @@ static unsigned char u2c_4E[512] = {
5226 0x81, 0xA9, 0xB7, 0xDD, 0x81, 0xAA, 0xB7, 0xC2, /* 0xFC-0xFF */ 5226 0x81, 0xA9, 0xB7, 0xDD, 0x81, 0xAA, 0xB7, 0xC2, /* 0xFC-0xFF */
5227}; 5227};
5228 5228
5229static unsigned char u2c_4F[512] = { 5229static const unsigned char u2c_4F[512] = {
5230 0x81, 0xAB, 0xC6, 0xF3, 0x81, 0xAC, 0x81, 0xAD, /* 0x00-0x03 */ 5230 0x81, 0xAB, 0xC6, 0xF3, 0x81, 0xAC, 0x81, 0xAD, /* 0x00-0x03 */
5231 0x81, 0xAE, 0x81, 0xAF, 0x81, 0xB0, 0x81, 0xB1, /* 0x04-0x07 */ 5231 0x81, 0xAE, 0x81, 0xAF, 0x81, 0xB0, 0x81, 0xB1, /* 0x04-0x07 */
5232 0x81, 0xB2, 0xD8, 0xF8, 0xD2, 0xC1, 0x81, 0xB3, /* 0x08-0x0B */ 5232 0x81, 0xB2, 0xD8, 0xF8, 0xD2, 0xC1, 0x81, 0xB3, /* 0x08-0x0B */
@@ -5294,7 +5294,7 @@ static unsigned char u2c_4F[512] = {
5294 0x82, 0x71, 0x82, 0x72, 0xD9, 0xC2, 0x82, 0x73, /* 0xFC-0xFF */ 5294 0x82, 0x71, 0x82, 0x72, 0xD9, 0xC2, 0x82, 0x73, /* 0xFC-0xFF */
5295}; 5295};
5296 5296
5297static unsigned char u2c_50[512] = { 5297static const unsigned char u2c_50[512] = {
5298 0x82, 0x74, 0x82, 0x75, 0x82, 0x76, 0x82, 0x77, /* 0x00-0x03 */ 5298 0x82, 0x74, 0x82, 0x75, 0x82, 0x76, 0x82, 0x77, /* 0x00-0x03 */
5299 0x82, 0x78, 0x82, 0x79, 0x82, 0x7A, 0x82, 0x7B, /* 0x04-0x07 */ 5299 0x82, 0x78, 0x82, 0x79, 0x82, 0x7A, 0x82, 0x7B, /* 0x04-0x07 */
5300 0x82, 0x7C, 0x82, 0x7D, 0x82, 0x7E, 0x82, 0x80, /* 0x08-0x0B */ 5300 0x82, 0x7C, 0x82, 0x7D, 0x82, 0x7E, 0x82, 0x80, /* 0x08-0x0B */
@@ -5362,7 +5362,7 @@ static unsigned char u2c_50[512] = {
5362 0x83, 0x74, 0x83, 0x75, 0x83, 0x76, 0x83, 0x77, /* 0xFC-0xFF */ 5362 0x83, 0x74, 0x83, 0x75, 0x83, 0x76, 0x83, 0x77, /* 0xFC-0xFF */
5363}; 5363};
5364 5364
5365static unsigned char u2c_51[512] = { 5365static const unsigned char u2c_51[512] = {
5366 0x83, 0x78, 0x83, 0x79, 0x83, 0x7A, 0x83, 0x7B, /* 0x00-0x03 */ 5366 0x83, 0x78, 0x83, 0x79, 0x83, 0x7A, 0x83, 0x7B, /* 0x00-0x03 */
5367 0x83, 0x7C, 0x83, 0x7D, 0xD9, 0xD3, 0xD9, 0xD8, /* 0x04-0x07 */ 5367 0x83, 0x7C, 0x83, 0x7D, 0xD9, 0xD3, 0xD9, 0xD8, /* 0x04-0x07 */
5368 0x83, 0x7E, 0x83, 0x80, 0x83, 0x81, 0xD9, 0xD9, /* 0x08-0x0B */ 5368 0x83, 0x7E, 0x83, 0x80, 0x83, 0x81, 0xD9, 0xD9, /* 0x08-0x0B */
@@ -5430,7 +5430,7 @@ static unsigned char u2c_51[512] = {
5430 0xDB, 0xCA, 0xBA, 0xAF, 0x84, 0x54, 0xD4, 0xE4, /* 0xFC-0xFF */ 5430 0xDB, 0xCA, 0xBA, 0xAF, 0x84, 0x54, 0xD4, 0xE4, /* 0xFC-0xFF */
5431}; 5431};
5432 5432
5433static unsigned char u2c_52[512] = { 5433static const unsigned char u2c_52[512] = {
5434 0xB5, 0xB6, 0xB5, 0xF3, 0xD8, 0xD6, 0xC8, 0xD0, /* 0x00-0x03 */ 5434 0xB5, 0xB6, 0xB5, 0xF3, 0xD8, 0xD6, 0xC8, 0xD0, /* 0x00-0x03 */
5435 0x84, 0x55, 0x84, 0x56, 0xB7, 0xD6, 0xC7, 0xD0, /* 0x04-0x07 */ 5435 0x84, 0x55, 0x84, 0x56, 0xB7, 0xD6, 0xC7, 0xD0, /* 0x04-0x07 */
5436 0xD8, 0xD7, 0x84, 0x57, 0xBF, 0xAF, 0x84, 0x58, /* 0x08-0x0B */ 5436 0xD8, 0xD7, 0x84, 0x57, 0xBF, 0xAF, 0x84, 0x58, /* 0x08-0x0B */
@@ -5498,7 +5498,7 @@ static unsigned char u2c_52[512] = {
5498 0x84, 0xF3, 0x84, 0xF4, 0xB9, 0xB4, 0xCE, 0xF0, /* 0xFC-0xFF */ 5498 0x84, 0xF3, 0x84, 0xF4, 0xB9, 0xB4, 0xCE, 0xF0, /* 0xFC-0xFF */
5499}; 5499};
5500 5500
5501static unsigned char u2c_53[512] = { 5501static const unsigned char u2c_53[512] = {
5502 0xD4, 0xC8, 0x84, 0xF5, 0x84, 0xF6, 0x84, 0xF7, /* 0x00-0x03 */ 5502 0xD4, 0xC8, 0x84, 0xF5, 0x84, 0xF6, 0x84, 0xF7, /* 0x00-0x03 */
5503 0x84, 0xF8, 0xB0, 0xFC, 0xB4, 0xD2, 0x84, 0xF9, /* 0x04-0x07 */ 5503 0x84, 0xF8, 0xB0, 0xFC, 0xB4, 0xD2, 0x84, 0xF9, /* 0x04-0x07 */
5504 0xD0, 0xD9, 0x84, 0xFA, 0x84, 0xFB, 0x84, 0xFC, /* 0x08-0x0B */ 5504 0xD0, 0xD9, 0x84, 0xFA, 0x84, 0xFB, 0x84, 0xFC, /* 0x08-0x0B */
@@ -5566,7 +5566,7 @@ static unsigned char u2c_53[512] = {
5566 0xB5, 0xF0, 0xDF, 0xB4, 0x85, 0xB6, 0x85, 0xB7, /* 0xFC-0xFF */ 5566 0xB5, 0xF0, 0xDF, 0xB4, 0x85, 0xB6, 0x85, 0xB7, /* 0xFC-0xFF */
5567}; 5567};
5568 5568
5569static unsigned char u2c_54[512] = { 5569static const unsigned char u2c_54[512] = {
5570 0x85, 0xB8, 0xD3, 0xF5, 0x85, 0xB9, 0xB3, 0xD4, /* 0x00-0x03 */ 5570 0x85, 0xB8, 0xD3, 0xF5, 0x85, 0xB9, 0xB3, 0xD4, /* 0x00-0x03 */
5571 0xB8, 0xF7, 0x85, 0xBA, 0xDF, 0xBA, 0x85, 0xBB, /* 0x04-0x07 */ 5571 0xB8, 0xF7, 0x85, 0xBA, 0xDF, 0xBA, 0x85, 0xBB, /* 0x04-0x07 */
5572 0xBA, 0xCF, 0xBC, 0xAA, 0xB5, 0xF5, 0x85, 0xBC, /* 0x08-0x0B */ 5572 0xBA, 0xCF, 0xBC, 0xAA, 0xB5, 0xF5, 0x85, 0xBC, /* 0x08-0x0B */
@@ -5634,7 +5634,7 @@ static unsigned char u2c_54[512] = {
5634 0xBA, 0xDF, 0xDF, 0xEC, 0x86, 0x64, 0xDB, 0xC1, /* 0xFC-0xFF */ 5634 0xBA, 0xDF, 0xDF, 0xEC, 0x86, 0x64, 0xDB, 0xC1, /* 0xFC-0xFF */
5635}; 5635};
5636 5636
5637static unsigned char u2c_55[512] = { 5637static const unsigned char u2c_55[512] = {
5638 0x86, 0x65, 0xD1, 0xE4, 0x86, 0x66, 0x86, 0x67, /* 0x00-0x03 */ 5638 0x86, 0x65, 0xD1, 0xE4, 0x86, 0x66, 0x86, 0x67, /* 0x00-0x03 */
5639 0x86, 0x68, 0x86, 0x69, 0xCB, 0xF4, 0xB4, 0xBD, /* 0x04-0x07 */ 5639 0x86, 0x68, 0x86, 0x69, 0xCB, 0xF4, 0xB4, 0xBD, /* 0x04-0x07 */
5640 0x86, 0x6A, 0xB0, 0xA6, 0x86, 0x6B, 0x86, 0x6C, /* 0x08-0x0B */ 5640 0x86, 0x6A, 0xB0, 0xA6, 0x86, 0x6B, 0x86, 0x6C, /* 0x08-0x0B */
@@ -5702,7 +5702,7 @@ static unsigned char u2c_55[512] = {
5702 0x86, 0xF9, 0xCB, 0xD4, 0xE0, 0xD5, 0x86, 0xFA, /* 0xFC-0xFF */ 5702 0x86, 0xF9, 0xCB, 0xD4, 0xE0, 0xD5, 0x86, 0xFA, /* 0xFC-0xFF */
5703}; 5703};
5704 5704
5705static unsigned char u2c_56[512] = { 5705static const unsigned char u2c_56[512] = {
5706 0xE0, 0xD6, 0xE0, 0xD2, 0x86, 0xFB, 0x86, 0xFC, /* 0x00-0x03 */ 5706 0xE0, 0xD6, 0xE0, 0xD2, 0x86, 0xFB, 0x86, 0xFC, /* 0x00-0x03 */
5707 0x86, 0xFD, 0x86, 0xFE, 0x87, 0x40, 0x87, 0x41, /* 0x04-0x07 */ 5707 0x86, 0xFD, 0x86, 0xFE, 0x87, 0x40, 0x87, 0x41, /* 0x04-0x07 */
5708 0xE0, 0xD0, 0xBC, 0xCE, 0x87, 0x42, 0x87, 0x43, /* 0x08-0x0B */ 5708 0xE0, 0xD0, 0xBC, 0xCE, 0x87, 0x42, 0x87, 0x43, /* 0x08-0x0B */
@@ -5770,7 +5770,7 @@ static unsigned char u2c_56[512] = {
5770 0x87, 0xF2, 0xB9, 0xFA, 0xCD, 0xBC, 0xE0, 0xF3, /* 0xFC-0xFF */ 5770 0x87, 0xF2, 0xB9, 0xFA, 0xCD, 0xBC, 0xE0, 0xF3, /* 0xFC-0xFF */
5771}; 5771};
5772 5772
5773static unsigned char u2c_57[512] = { 5773static const unsigned char u2c_57[512] = {
5774 0x87, 0xF3, 0x87, 0xF4, 0x87, 0xF5, 0xC6, 0xD4, /* 0x00-0x03 */ 5774 0x87, 0xF3, 0x87, 0xF4, 0x87, 0xF5, 0xC6, 0xD4, /* 0x00-0x03 */
5775 0xE0, 0xF4, 0x87, 0xF6, 0xD4, 0xB2, 0x87, 0xF7, /* 0x04-0x07 */ 5775 0xE0, 0xF4, 0x87, 0xF6, 0xD4, 0xB2, 0x87, 0xF7, /* 0x04-0x07 */
5776 0xC8, 0xA6, 0xE0, 0xF6, 0xE0, 0xF5, 0x87, 0xF8, /* 0x08-0x0B */ 5776 0xC8, 0xA6, 0xE0, 0xF6, 0xE0, 0xF5, 0x87, 0xF8, /* 0x08-0x0B */
@@ -5838,7 +5838,7 @@ static unsigned char u2c_57[512] = {
5838 0x88, 0xCE, 0xDC, 0xA3, 0x88, 0xCF, 0x88, 0xD0, /* 0xFC-0xFF */ 5838 0x88, 0xCE, 0xDC, 0xA3, 0x88, 0xCF, 0x88, 0xD0, /* 0xFC-0xFF */
5839}; 5839};
5840 5840
5841static unsigned char u2c_58[512] = { 5841static const unsigned char u2c_58[512] = {
5842 0xDC, 0xA5, 0x88, 0xD1, 0xCC, 0xC3, 0x88, 0xD2, /* 0x00-0x03 */ 5842 0xDC, 0xA5, 0x88, 0xD1, 0xCC, 0xC3, 0x88, 0xD2, /* 0x00-0x03 */
5843 0x88, 0xD3, 0x88, 0xD4, 0xB6, 0xD1, 0xDD, 0xC0, /* 0x04-0x07 */ 5843 0x88, 0xD3, 0x88, 0xD4, 0xB6, 0xD1, 0xDD, 0xC0, /* 0x04-0x07 */
5844 0x88, 0xD5, 0x88, 0xD6, 0x88, 0xD7, 0xDC, 0xA1, /* 0x08-0x0B */ 5844 0x88, 0xD5, 0x88, 0xD6, 0x88, 0xD7, 0xDC, 0xA1, /* 0x08-0x0B */
@@ -5906,7 +5906,7 @@ static unsigned char u2c_58[512] = {
5906 0x89, 0xDA, 0x89, 0xDB, 0x89, 0xDC, 0x89, 0xDD, /* 0xFC-0xFF */ 5906 0x89, 0xDA, 0x89, 0xDB, 0x89, 0xDC, 0x89, 0xDD, /* 0xFC-0xFF */
5907}; 5907};
5908 5908
5909static unsigned char u2c_59[512] = { 5909static const unsigned char u2c_59[512] = {
5910 0x89, 0xDE, 0x89, 0xDF, 0xE2, 0xBA, 0x89, 0xE0, /* 0x00-0x03 */ 5910 0x89, 0xDE, 0x89, 0xDF, 0xE2, 0xBA, 0x89, 0xE0, /* 0x00-0x03 */
5911 0xB4, 0xA6, 0x89, 0xE1, 0x89, 0xE2, 0xB1, 0xB8, /* 0x04-0x07 */ 5911 0xB4, 0xA6, 0x89, 0xE1, 0x89, 0xE2, 0xB1, 0xB8, /* 0x04-0x07 */
5912 0x89, 0xE3, 0x89, 0xE4, 0x89, 0xE5, 0x89, 0xE6, /* 0x08-0x0B */ 5912 0x89, 0xE3, 0x89, 0xE4, 0x89, 0xE5, 0x89, 0xE6, /* 0x08-0x0B */
@@ -5974,7 +5974,7 @@ static unsigned char u2c_59[512] = {
5974 0x8A, 0xB8, 0x8A, 0xB9, 0x8A, 0xBA, 0xD7, 0xCB, /* 0xFC-0xFF */ 5974 0x8A, 0xB8, 0x8A, 0xB9, 0x8A, 0xBA, 0xD7, 0xCB, /* 0xFC-0xFF */
5975}; 5975};
5976 5976
5977static unsigned char u2c_5A[512] = { 5977static const unsigned char u2c_5A[512] = {
5978 0x8A, 0xBB, 0xCD, 0xFE, 0x8A, 0xBC, 0xCD, 0xDE, /* 0x00-0x03 */ 5978 0x8A, 0xBB, 0xCD, 0xFE, 0x8A, 0xBC, 0xCD, 0xDE, /* 0x00-0x03 */
5979 0xC2, 0xA6, 0xE6, 0xAB, 0xE6, 0xAC, 0xBD, 0xBF, /* 0x04-0x07 */ 5979 0xC2, 0xA6, 0xE6, 0xAB, 0xE6, 0xAC, 0xBD, 0xBF, /* 0x04-0x07 */
5980 0xE6, 0xAE, 0xE6, 0xB3, 0x8A, 0xBD, 0x8A, 0xBE, /* 0x08-0x0B */ 5980 0xE6, 0xAE, 0xE6, 0xB3, 0x8A, 0xBD, 0x8A, 0xBE, /* 0x08-0x0B */
@@ -6042,7 +6042,7 @@ static unsigned char u2c_5A[512] = {
6042 0x8B, 0xBA, 0x8B, 0xBB, 0x8B, 0xBC, 0x8B, 0xBD, /* 0xFC-0xFF */ 6042 0x8B, 0xBA, 0x8B, 0xBB, 0x8B, 0xBC, 0x8B, 0xBD, /* 0xFC-0xFF */
6043}; 6043};
6044 6044
6045static unsigned char u2c_5B[512] = { 6045static const unsigned char u2c_5B[512] = {
6046 0x8B, 0xBE, 0x8B, 0xBF, 0x8B, 0xC0, 0x8B, 0xC1, /* 0x00-0x03 */ 6046 0x8B, 0xBE, 0x8B, 0xBF, 0x8B, 0xC0, 0x8B, 0xC1, /* 0x00-0x03 */
6047 0x8B, 0xC2, 0x8B, 0xC3, 0x8B, 0xC4, 0x8B, 0xC5, /* 0x04-0x07 */ 6047 0x8B, 0xC2, 0x8B, 0xC3, 0x8B, 0xC4, 0x8B, 0xC5, /* 0x04-0x07 */
6048 0x8B, 0xC6, 0xE6, 0xD2, 0x8B, 0xC7, 0x8B, 0xC8, /* 0x08-0x0B */ 6048 0x8B, 0xC6, 0xE6, 0xD2, 0x8B, 0xC7, 0x8B, 0xC8, /* 0x08-0x0B */
@@ -6110,7 +6110,7 @@ static unsigned char u2c_5B[512] = {
6110 0xB5, 0xBC, 0x8C, 0x9C, 0x8C, 0x9D, 0xCA, 0xD9, /* 0xFC-0xFF */ 6110 0xB5, 0xBC, 0x8C, 0x9C, 0x8C, 0x9D, 0xCA, 0xD9, /* 0xFC-0xFF */
6111}; 6111};
6112 6112
6113static unsigned char u2c_5C[512] = { 6113static const unsigned char u2c_5C[512] = {
6114 0x8C, 0x9E, 0xB7, 0xE2, 0x8C, 0x9F, 0x8C, 0xA0, /* 0x00-0x03 */ 6114 0x8C, 0x9E, 0xB7, 0xE2, 0x8C, 0x9F, 0x8C, 0xA0, /* 0x00-0x03 */
6115 0xC9, 0xE4, 0x8C, 0xA1, 0xBD, 0xAB, 0x8C, 0xA2, /* 0x04-0x07 */ 6115 0xC9, 0xE4, 0x8C, 0xA1, 0xBD, 0xAB, 0x8C, 0xA2, /* 0x04-0x07 */
6116 0x8C, 0xA3, 0xCE, 0xBE, 0xD7, 0xF0, 0x8C, 0xA4, /* 0x08-0x0B */ 6116 0x8C, 0xA3, 0xCE, 0xBE, 0xD7, 0xF0, 0x8C, 0xA4, /* 0x08-0x0B */
@@ -6178,7 +6178,7 @@ static unsigned char u2c_5C[512] = {
6178 0x8D, 0x7A, 0x8D, 0x7B, 0x8D, 0x7C, 0x8D, 0x7D, /* 0xFC-0xFF */ 6178 0x8D, 0x7A, 0x8D, 0x7B, 0x8D, 0x7C, 0x8D, 0x7D, /* 0xFC-0xFF */
6179}; 6179};
6180 6180
6181static unsigned char u2c_5D[512] = { 6181static const unsigned char u2c_5D[512] = {
6182 0x8D, 0x7E, 0x8D, 0x80, 0xE1, 0xC0, 0xE1, 0xC1, /* 0x00-0x03 */ 6182 0x8D, 0x7E, 0x8D, 0x80, 0xE1, 0xC0, 0xE1, 0xC1, /* 0x00-0x03 */
6183 0x8D, 0x81, 0x8D, 0x82, 0xE1, 0xC7, 0xB3, 0xE7, /* 0x04-0x07 */ 6183 0x8D, 0x81, 0x8D, 0x82, 0xE1, 0xC7, 0xB3, 0xE7, /* 0x04-0x07 */
6184 0x8D, 0x83, 0x8D, 0x84, 0x8D, 0x85, 0x8D, 0x86, /* 0x08-0x0B */ 6184 0x8D, 0x83, 0x8D, 0x84, 0x8D, 0x85, 0x8D, 0x86, /* 0x08-0x0B */
@@ -6246,7 +6246,7 @@ static unsigned char u2c_5D[512] = {
6246 0x8E, 0x87, 0xD9, 0xE3, 0xBD, 0xED, 0x8E, 0x88, /* 0xFC-0xFF */ 6246 0x8E, 0x87, 0xD9, 0xE3, 0xBD, 0xED, 0x8E, 0x88, /* 0xFC-0xFF */
6247}; 6247};
6248 6248
6249static unsigned char u2c_5E[512] = { 6249static const unsigned char u2c_5E[512] = {
6250 0x8E, 0x89, 0xB1, 0xD2, 0xCA, 0xD0, 0xB2, 0xBC, /* 0x00-0x03 */ 6250 0x8E, 0x89, 0xB1, 0xD2, 0xCA, 0xD0, 0xB2, 0xBC, /* 0x00-0x03 */
6251 0x8E, 0x8A, 0xCB, 0xA7, 0xB7, 0xAB, 0x8E, 0x8B, /* 0x04-0x07 */ 6251 0x8E, 0x8A, 0xCB, 0xA7, 0xB7, 0xAB, 0x8E, 0x8B, /* 0x04-0x07 */
6252 0xCA, 0xA6, 0x8E, 0x8C, 0x8E, 0x8D, 0x8E, 0x8E, /* 0x08-0x0B */ 6252 0xCA, 0xA6, 0x8E, 0x8C, 0x8E, 0x8D, 0x8E, 0x8E, /* 0x08-0x0B */
@@ -6314,7 +6314,7 @@ static unsigned char u2c_5E[512] = {
6314 0x8F, 0x69, 0x8F, 0x6A, 0xDE, 0xC3, 0xD8, 0xA5, /* 0xFC-0xFF */ 6314 0x8F, 0x69, 0x8F, 0x6A, 0xDE, 0xC3, 0xD8, 0xA5, /* 0xFC-0xFF */
6315}; 6315};
6316 6316
6317static unsigned char u2c_5F[512] = { 6317static const unsigned char u2c_5F[512] = {
6318 0xBF, 0xAA, 0xDB, 0xCD, 0xD2, 0xEC, 0xC6, 0xFA, /* 0x00-0x03 */ 6318 0xBF, 0xAA, 0xDB, 0xCD, 0xD2, 0xEC, 0xC6, 0xFA, /* 0x00-0x03 */
6319 0xC5, 0xAA, 0x8F, 0x6B, 0x8F, 0x6C, 0x8F, 0x6D, /* 0x04-0x07 */ 6319 0xC5, 0xAA, 0x8F, 0x6B, 0x8F, 0x6C, 0x8F, 0x6D, /* 0x04-0x07 */
6320 0xDE, 0xC4, 0x8F, 0x6E, 0xB1, 0xD7, 0xDF, 0xAE, /* 0x08-0x0B */ 6320 0xDE, 0xC4, 0x8F, 0x6E, 0xB1, 0xD7, 0xDF, 0xAE, /* 0x08-0x0B */
@@ -6382,7 +6382,7 @@ static unsigned char u2c_5F[512] = {
6382 0x8F, 0xFD, 0xBA, 0xF6, 0xE2, 0xE9, 0xB7, 0xDE, /* 0xFC-0xFF */ 6382 0x8F, 0xFD, 0xBA, 0xF6, 0xE2, 0xE9, 0xB7, 0xDE, /* 0xFC-0xFF */
6383}; 6383};
6384 6384
6385static unsigned char u2c_60[512] = { 6385static const unsigned char u2c_60[512] = {
6386 0xBB, 0xB3, 0xCC, 0xAC, 0xCB, 0xCB, 0xE2, 0xE4, /* 0x00-0x03 */ 6386 0xBB, 0xB3, 0xCC, 0xAC, 0xCB, 0xCB, 0xE2, 0xE4, /* 0x00-0x03 */
6387 0xE2, 0xE6, 0xE2, 0xEA, 0xE2, 0xEB, 0x8F, 0xFE, /* 0x04-0x07 */ 6387 0xE2, 0xE6, 0xE2, 0xEA, 0xE2, 0xEB, 0x8F, 0xFE, /* 0x04-0x07 */
6388 0x90, 0x40, 0x90, 0x41, 0xE2, 0xF7, 0x90, 0x42, /* 0x08-0x0B */ 6388 0x90, 0x40, 0x90, 0x41, 0xE2, 0xF7, 0x90, 0x42, /* 0x08-0x0B */
@@ -6450,7 +6450,7 @@ static unsigned char u2c_60[512] = {
6450 0x90, 0xC6, 0x90, 0xC7, 0x90, 0xC8, 0x90, 0xC9, /* 0xFC-0xFF */ 6450 0x90, 0xC6, 0x90, 0xC7, 0x90, 0xC8, 0x90, 0xC9, /* 0xFC-0xFF */
6451}; 6451};
6452 6452
6453static unsigned char u2c_61[512] = { 6453static const unsigned char u2c_61[512] = {
6454 0xE3, 0xB8, 0xB3, 0xEE, 0x90, 0xCA, 0x90, 0xCB, /* 0x00-0x03 */ 6454 0xE3, 0xB8, 0xB3, 0xEE, 0x90, 0xCA, 0x90, 0xCB, /* 0x00-0x03 */
6455 0x90, 0xCC, 0x90, 0xCD, 0xED, 0xA9, 0x90, 0xCE, /* 0x04-0x07 */ 6455 0x90, 0xCC, 0x90, 0xCD, 0xED, 0xA9, 0x90, 0xCE, /* 0x04-0x07 */
6456 0xD3, 0xFA, 0xD3, 0xE4, 0x90, 0xCF, 0x90, 0xD0, /* 0x08-0x0B */ 6456 0xD3, 0xFA, 0xD3, 0xE4, 0x90, 0xCF, 0x90, 0xD0, /* 0x08-0x0B */
@@ -6518,7 +6518,7 @@ static unsigned char u2c_61[512] = {
6518 0x91, 0xD6, 0x91, 0xD7, 0x91, 0xD8, 0xDC, 0xB2, /* 0xFC-0xFF */ 6518 0x91, 0xD6, 0x91, 0xD7, 0x91, 0xD8, 0xDC, 0xB2, /* 0xFC-0xFF */
6519}; 6519};
6520 6520
6521static unsigned char u2c_62[512] = { 6521static const unsigned char u2c_62[512] = {
6522 0x91, 0xD9, 0x91, 0xDA, 0x91, 0xDB, 0x91, 0xDC, /* 0x00-0x03 */ 6522 0x91, 0xD9, 0x91, 0xDA, 0x91, 0xDB, 0x91, 0xDC, /* 0x00-0x03 */
6523 0x91, 0xDD, 0x91, 0xDE, 0xED, 0xB0, 0x91, 0xDF, /* 0x04-0x07 */ 6523 0x91, 0xDD, 0x91, 0xDE, 0xED, 0xB0, 0x91, 0xDF, /* 0x04-0x07 */
6524 0xB8, 0xEA, 0x91, 0xE0, 0xCE, 0xEC, 0xEA, 0xA7, /* 0x08-0x0B */ 6524 0xB8, 0xEA, 0x91, 0xE0, 0xCE, 0xEC, 0xEA, 0xA7, /* 0x08-0x0B */
@@ -6586,7 +6586,7 @@ static unsigned char u2c_62[512] = {
6586 0xC6, 0xB4, 0xD7, 0xA7, 0xCA, 0xB0, 0xC4, 0xC3, /* 0xFC-0xFF */ 6586 0xC6, 0xB4, 0xD7, 0xA7, 0xCA, 0xB0, 0xC4, 0xC3, /* 0xFC-0xFF */
6587}; 6587};
6588 6588
6589static unsigned char u2c_63[512] = { 6589static const unsigned char u2c_63[512] = {
6590 0x92, 0x93, 0xB3, 0xD6, 0xB9, 0xD2, 0x92, 0x94, /* 0x00-0x03 */ 6590 0x92, 0x93, 0xB3, 0xD6, 0xB9, 0xD2, 0x92, 0x94, /* 0x00-0x03 */
6591 0x92, 0x95, 0x92, 0x96, 0x92, 0x97, 0xD6, 0xB8, /* 0x04-0x07 */ 6591 0x92, 0x95, 0x92, 0x96, 0x92, 0x97, 0xD6, 0xB8, /* 0x04-0x07 */
6592 0xEA, 0xFC, 0xB0, 0xB4, 0x92, 0x98, 0x92, 0x99, /* 0x08-0x0B */ 6592 0xEA, 0xFC, 0xB0, 0xB4, 0x92, 0x98, 0x92, 0x99, /* 0x08-0x0B */
@@ -6654,7 +6654,7 @@ static unsigned char u2c_63[512] = {
6654 0x93, 0x67, 0xC0, 0xBF, 0x93, 0x68, 0xDE, 0xEC, /* 0xFC-0xFF */ 6654 0x93, 0x67, 0xC0, 0xBF, 0x93, 0x68, 0xDE, 0xEC, /* 0xFC-0xFF */
6655}; 6655};
6656 6656
6657static unsigned char u2c_64[512] = { 6657static const unsigned char u2c_64[512] = {
6658 0xB2, 0xF3, 0xB8, 0xE9, 0xC2, 0xA7, 0x93, 0x69, /* 0x00-0x03 */ 6658 0xB2, 0xF3, 0xB8, 0xE9, 0xC2, 0xA7, 0x93, 0x69, /* 0x00-0x03 */
6659 0x93, 0x6A, 0xBD, 0xC1, 0x93, 0x6B, 0x93, 0x6C, /* 0x04-0x07 */ 6659 0x93, 0x6A, 0xBD, 0xC1, 0x93, 0x6B, 0x93, 0x6C, /* 0x04-0x07 */
6660 0x93, 0x6D, 0x93, 0x6E, 0x93, 0x6F, 0xDE, 0xF5, /* 0x08-0x0B */ 6660 0x93, 0x6D, 0x93, 0x6E, 0x93, 0x6F, 0xDE, 0xF5, /* 0x08-0x0B */
@@ -6722,7 +6722,7 @@ static unsigned char u2c_64[512] = {
6722 0x94, 0x5D, 0x94, 0x5E, 0x94, 0x5F, 0x94, 0x60, /* 0xFC-0xFF */ 6722 0x94, 0x5D, 0x94, 0x5E, 0x94, 0x5F, 0x94, 0x60, /* 0xFC-0xFF */
6723}; 6723};
6724 6724
6725static unsigned char u2c_65[512] = { 6725static const unsigned char u2c_65[512] = {
6726 0xC5, 0xCA, 0x94, 0x61, 0x94, 0x62, 0x94, 0x63, /* 0x00-0x03 */ 6726 0xC5, 0xCA, 0x94, 0x61, 0x94, 0x62, 0x94, 0x63, /* 0x00-0x03 */
6727 0x94, 0x64, 0x94, 0x65, 0x94, 0x66, 0x94, 0x67, /* 0x04-0x07 */ 6727 0x94, 0x64, 0x94, 0x65, 0x94, 0x66, 0x94, 0x67, /* 0x04-0x07 */
6728 0x94, 0x68, 0xDF, 0xAB, 0x94, 0x69, 0x94, 0x6A, /* 0x08-0x0B */ 6728 0x94, 0x68, 0xDF, 0xAB, 0x94, 0x69, 0x94, 0x6A, /* 0x08-0x0B */
@@ -6790,7 +6790,7 @@ static unsigned char u2c_65[512] = {
6790 0x95, 0x47, 0x95, 0x48, 0x95, 0x49, 0x95, 0x4A, /* 0xFC-0xFF */ 6790 0x95, 0x47, 0x95, 0x48, 0x95, 0x49, 0x95, 0x4A, /* 0xFC-0xFF */
6791}; 6791};
6792 6792
6793static unsigned char u2c_66[512] = { 6793static const unsigned char u2c_66[512] = {
6794 0xEA, 0xC0, 0x95, 0x4B, 0xB0, 0xBA, 0xEA, 0xBE, /* 0x00-0x03 */ 6794 0xEA, 0xC0, 0x95, 0x4B, 0xB0, 0xBA, 0xEA, 0xBE, /* 0x00-0x03 */
6795 0x95, 0x4C, 0x95, 0x4D, 0xC0, 0xA5, 0x95, 0x4E, /* 0x04-0x07 */ 6795 0x95, 0x4C, 0x95, 0x4D, 0xC0, 0xA5, 0x95, 0x4E, /* 0x04-0x07 */
6796 0x95, 0x4F, 0x95, 0x50, 0xEA, 0xBB, 0x95, 0x51, /* 0x08-0x0B */ 6796 0x95, 0x4F, 0x95, 0x50, 0xEA, 0xBB, 0x95, 0x51, /* 0x08-0x0B */
@@ -6858,7 +6858,7 @@ static unsigned char u2c_66[512] = {
6858 0xC2, 0xFC, 0x95, 0xFB, 0xD4, 0xF8, 0xCC, 0xE6, /* 0xFC-0xFF */ 6858 0xC2, 0xFC, 0x95, 0xFB, 0xD4, 0xF8, 0xCC, 0xE6, /* 0xFC-0xFF */
6859}; 6859};
6860 6860
6861static unsigned char u2c_67[512] = { 6861static const unsigned char u2c_67[512] = {
6862 0xD7, 0xEE, 0x95, 0xFC, 0x95, 0xFD, 0x95, 0xFE, /* 0x00-0x03 */ 6862 0xD7, 0xEE, 0x95, 0xFC, 0x95, 0xFD, 0x95, 0xFE, /* 0x00-0x03 */
6863 0x96, 0x40, 0x96, 0x41, 0x96, 0x42, 0x96, 0x43, /* 0x04-0x07 */ 6863 0x96, 0x40, 0x96, 0x41, 0x96, 0x42, 0x96, 0x43, /* 0x04-0x07 */
6864 0xD4, 0xC2, 0xD3, 0xD0, 0xEB, 0xC3, 0xC5, 0xF3, /* 0x08-0x0B */ 6864 0xD4, 0xC2, 0xD3, 0xD0, 0xEB, 0xC3, 0xC5, 0xF3, /* 0x08-0x0B */
@@ -6926,7 +6926,7 @@ static unsigned char u2c_67[512] = {
6926 0x96, 0xCC, 0xE8, 0xDF, 0x96, 0xCD, 0xCA, 0xC1, /* 0xFC-0xFF */ 6926 0x96, 0xCC, 0xE8, 0xDF, 0x96, 0xCD, 0xCA, 0xC1, /* 0xFC-0xFF */
6927}; 6927};
6928 6928
6929static unsigned char u2c_68[512] = { 6929static const unsigned char u2c_68[512] = {
6930 0xE8, 0xD9, 0x96, 0xCE, 0x96, 0xCF, 0x96, 0xD0, /* 0x00-0x03 */ 6930 0xE8, 0xD9, 0x96, 0xCE, 0x96, 0xCF, 0x96, 0xD0, /* 0x00-0x03 */
6931 0x96, 0xD1, 0xD5, 0xA4, 0x96, 0xD2, 0xB1, 0xEA, /* 0x04-0x07 */ 6931 0x96, 0xD1, 0xD5, 0xA4, 0x96, 0xD2, 0xB1, 0xEA, /* 0x04-0x07 */
6932 0xD5, 0xBB, 0xE8, 0xCE, 0xE8, 0xD0, 0xB6, 0xB0, /* 0x08-0x0B */ 6932 0xD5, 0xBB, 0xE8, 0xCE, 0xE8, 0xD0, 0xB6, 0xB0, /* 0x08-0x0B */
@@ -6994,7 +6994,7 @@ static unsigned char u2c_68[512] = {
6994 0xE8, 0xFB, 0x97, 0xB2, 0x97, 0xB3, 0x97, 0xB4, /* 0xFC-0xFF */ 6994 0xE8, 0xFB, 0x97, 0xB2, 0x97, 0xB3, 0x97, 0xB4, /* 0xFC-0xFF */
6995}; 6995};
6996 6996
6997static unsigned char u2c_69[512] = { 6997static const unsigned char u2c_69[512] = {
6998 0x97, 0xB5, 0xE9, 0xA4, 0x97, 0xB6, 0x97, 0xB7, /* 0x00-0x03 */ 6998 0x97, 0xB5, 0xE9, 0xA4, 0x97, 0xB6, 0x97, 0xB7, /* 0x00-0x03 */
6999 0x97, 0xB8, 0xD2, 0xCE, 0x97, 0xB9, 0x97, 0xBA, /* 0x04-0x07 */ 6999 0x97, 0xB8, 0xD2, 0xCE, 0x97, 0xB9, 0x97, 0xBA, /* 0x04-0x07 */
7000 0x97, 0xBB, 0x97, 0xBC, 0x97, 0xBD, 0xE9, 0xA3, /* 0x08-0x0B */ 7000 0x97, 0xBB, 0x97, 0xBC, 0x97, 0xBD, 0xE9, 0xA3, /* 0x08-0x0B */
@@ -7062,7 +7062,7 @@ static unsigned char u2c_69[512] = {
7062 0x98, 0xB3, 0xB2, 0xDB, 0x98, 0xB4, 0xE9, 0xC8, /* 0xFC-0xFF */ 7062 0x98, 0xB3, 0xB2, 0xDB, 0x98, 0xB4, 0xE9, 0xC8, /* 0xFC-0xFF */
7063}; 7063};
7064 7064
7065static unsigned char u2c_6A[512] = { 7065static const unsigned char u2c_6A[512] = {
7066 0x98, 0xB5, 0x98, 0xB6, 0x98, 0xB7, 0x98, 0xB8, /* 0x00-0x03 */ 7066 0x98, 0xB5, 0x98, 0xB6, 0x98, 0xB7, 0x98, 0xB8, /* 0x00-0x03 */
7067 0x98, 0xB9, 0x98, 0xBA, 0x98, 0xBB, 0x98, 0xBC, /* 0x04-0x07 */ 7067 0x98, 0xB9, 0x98, 0xBA, 0x98, 0xBB, 0x98, 0xBC, /* 0x04-0x07 */
7068 0x98, 0xBD, 0x98, 0xBE, 0xB7, 0xAE, 0x98, 0xBF, /* 0x08-0x0B */ 7068 0x98, 0xBD, 0x98, 0xBE, 0xB7, 0xAE, 0x98, 0xBF, /* 0x08-0x0B */
@@ -7130,7 +7130,7 @@ static unsigned char u2c_6A[512] = {
7130 0x99, 0xD2, 0x99, 0xD3, 0x99, 0xD4, 0x99, 0xD5, /* 0xFC-0xFF */ 7130 0x99, 0xD2, 0x99, 0xD3, 0x99, 0xD4, 0x99, 0xD5, /* 0xFC-0xFF */
7131}; 7131};
7132 7132
7133static unsigned char u2c_6B[512] = { 7133static const unsigned char u2c_6B[512] = {
7134 0x99, 0xD6, 0x99, 0xD7, 0x99, 0xD8, 0x99, 0xD9, /* 0x00-0x03 */ 7134 0x99, 0xD6, 0x99, 0xD7, 0x99, 0xD8, 0x99, 0xD9, /* 0x00-0x03 */
7135 0x99, 0xDA, 0x99, 0xDB, 0x99, 0xDC, 0x99, 0xDD, /* 0x04-0x07 */ 7135 0x99, 0xDA, 0x99, 0xDB, 0x99, 0xDC, 0x99, 0xDD, /* 0x04-0x07 */
7136 0x99, 0xDE, 0x99, 0xDF, 0x99, 0xE0, 0x99, 0xE1, /* 0x08-0x0B */ 7136 0x99, 0xDE, 0x99, 0xDF, 0x99, 0xE0, 0x99, 0xE1, /* 0x08-0x0B */
@@ -7198,7 +7198,7 @@ static unsigned char u2c_6B[512] = {
7198 0x9A, 0xCE, 0xEB, 0xA6, 0x9A, 0xCF, 0x9A, 0xD0, /* 0xFC-0xFF */ 7198 0x9A, 0xCE, 0xEB, 0xA6, 0x9A, 0xCF, 0x9A, 0xD0, /* 0xFC-0xFF */
7199}; 7199};
7200 7200
7201static unsigned char u2c_6C[512] = { 7201static const unsigned char u2c_6C[512] = {
7202 0x9A, 0xD1, 0x9A, 0xD2, 0x9A, 0xD3, 0x9A, 0xD4, /* 0x00-0x03 */ 7202 0x9A, 0xD1, 0x9A, 0xD2, 0x9A, 0xD3, 0x9A, 0xD4, /* 0x00-0x03 */
7203 0x9A, 0xD5, 0xEB, 0xA9, 0xEB, 0xAB, 0xEB, 0xAA, /* 0x04-0x07 */ 7203 0x9A, 0xD5, 0xEB, 0xA9, 0xEB, 0xAB, 0xEB, 0xAA, /* 0x04-0x07 */
7204 0x9A, 0xD6, 0x9A, 0xD7, 0x9A, 0xD8, 0x9A, 0xD9, /* 0x08-0x0B */ 7204 0x9A, 0xD6, 0x9A, 0xD7, 0x9A, 0xD8, 0x9A, 0xD9, /* 0x08-0x0B */
@@ -7266,7 +7266,7 @@ static unsigned char u2c_6C[512] = {
7266 0xC6, 0xC3, 0xD4, 0xF3, 0xE3, 0xFE, 0x9B, 0x8E, /* 0xFC-0xFF */ 7266 0xC6, 0xC3, 0xD4, 0xF3, 0xE3, 0xFE, 0x9B, 0x8E, /* 0xFC-0xFF */
7267}; 7267};
7268 7268
7269static unsigned char u2c_6D[512] = { 7269static const unsigned char u2c_6D[512] = {
7270 0x9B, 0x8F, 0xBD, 0xE0, 0x9B, 0x90, 0x9B, 0x91, /* 0x00-0x03 */ 7270 0x9B, 0x8F, 0xBD, 0xE0, 0x9B, 0x90, 0x9B, 0x91, /* 0x00-0x03 */
7271 0xE4, 0xA7, 0x9B, 0x92, 0x9B, 0x93, 0xE4, 0xA6, /* 0x04-0x07 */ 7271 0xE4, 0xA7, 0x9B, 0x92, 0x9B, 0x93, 0xE4, 0xA6, /* 0x04-0x07 */
7272 0x9B, 0x94, 0x9B, 0x95, 0x9B, 0x96, 0xD1, 0xF3, /* 0x08-0x0B */ 7272 0x9B, 0x94, 0x9B, 0x95, 0x9B, 0x96, 0xD1, 0xF3, /* 0x08-0x0B */
@@ -7334,7 +7334,7 @@ static unsigned char u2c_6D[512] = {
7334 0xED, 0xB5, 0x9C, 0x5D, 0x9C, 0x5E, 0x9C, 0x5F, /* 0xFC-0xFF */ 7334 0xED, 0xB5, 0x9C, 0x5D, 0x9C, 0x5E, 0x9C, 0x5F, /* 0xFC-0xFF */
7335}; 7335};
7336 7336
7337static unsigned char u2c_6E[512] = { 7337static const unsigned char u2c_6E[512] = {
7338 0x9C, 0x60, 0x9C, 0x61, 0x9C, 0x62, 0x9C, 0x63, /* 0x00-0x03 */ 7338 0x9C, 0x60, 0x9C, 0x61, 0x9C, 0x62, 0x9C, 0x63, /* 0x00-0x03 */
7339 0x9C, 0x64, 0xC7, 0xE5, 0x9C, 0x65, 0x9C, 0x66, /* 0x04-0x07 */ 7339 0x9C, 0x64, 0xC7, 0xE5, 0x9C, 0x65, 0x9C, 0x66, /* 0x04-0x07 */
7340 0x9C, 0x67, 0x9C, 0x68, 0xD4, 0xA8, 0x9C, 0x69, /* 0x08-0x0B */ 7340 0x9C, 0x67, 0x9C, 0x68, 0xD4, 0xA8, 0x9C, 0x69, /* 0x08-0x0B */
@@ -7402,7 +7402,7 @@ static unsigned char u2c_6E[512] = {
7402 0x9D, 0x4A, 0x9D, 0x4B, 0x9D, 0x4C, 0x9D, 0x4D, /* 0xFC-0xFF */ 7402 0x9D, 0x4A, 0x9D, 0x4B, 0x9D, 0x4C, 0x9D, 0x4D, /* 0xFC-0xFF */
7403}; 7403};
7404 7404
7405static unsigned char u2c_6F[512] = { 7405static const unsigned char u2c_6F[512] = {
7406 0x9D, 0x4E, 0x9D, 0x4F, 0xC6, 0xAF, 0x9D, 0x50, /* 0x00-0x03 */ 7406 0x9D, 0x4E, 0x9D, 0x4F, 0xC6, 0xAF, 0x9D, 0x50, /* 0x00-0x03 */
7407 0x9D, 0x51, 0x9D, 0x52, 0xC6, 0xE1, 0x9D, 0x53, /* 0x04-0x07 */ 7407 0x9D, 0x51, 0x9D, 0x52, 0xC6, 0xE1, 0x9D, 0x53, /* 0x04-0x07 */
7408 0x9D, 0x54, 0xE4, 0xF5, 0x9D, 0x55, 0x9D, 0x56, /* 0x08-0x0B */ 7408 0x9D, 0x54, 0xE4, 0xF5, 0x9D, 0x55, 0x9D, 0x56, /* 0x08-0x0B */
@@ -7470,7 +7470,7 @@ static unsigned char u2c_6F[512] = {
7470 0x9E, 0x54, 0x9E, 0x55, 0x9E, 0x56, 0x9E, 0x57, /* 0xFC-0xFF */ 7470 0x9E, 0x54, 0x9E, 0x55, 0x9E, 0x56, 0x9E, 0x57, /* 0xFC-0xFF */
7471}; 7471};
7472 7472
7473static unsigned char u2c_70[512] = { 7473static const unsigned char u2c_70[512] = {
7474 0x9E, 0x58, 0x9E, 0x59, 0x9E, 0x5A, 0x9E, 0x5B, /* 0x00-0x03 */ 7474 0x9E, 0x58, 0x9E, 0x59, 0x9E, 0x5A, 0x9E, 0x5B, /* 0x00-0x03 */
7475 0x9E, 0x5C, 0x9E, 0x5D, 0x9E, 0x5E, 0x9E, 0x5F, /* 0x04-0x07 */ 7475 0x9E, 0x5C, 0x9E, 0x5D, 0x9E, 0x5E, 0x9E, 0x5F, /* 0x04-0x07 */
7476 0x9E, 0x60, 0x9E, 0x61, 0x9E, 0x62, 0x9E, 0x63, /* 0x08-0x0B */ 7476 0x9E, 0x60, 0x9E, 0x61, 0x9E, 0x62, 0x9E, 0x63, /* 0x08-0x0B */
@@ -7538,7 +7538,7 @@ static unsigned char u2c_70[512] = {
7538 0x9F, 0x54, 0xB7, 0xE9, 0x9F, 0x55, 0x9F, 0x56, /* 0xFC-0xFF */ 7538 0x9F, 0x54, 0xB7, 0xE9, 0x9F, 0x55, 0x9F, 0x56, /* 0xFC-0xFF */
7539}; 7539};
7540 7540
7541static unsigned char u2c_71[512] = { 7541static const unsigned char u2c_71[512] = {
7542 0x9F, 0x57, 0x9F, 0x58, 0x9F, 0x59, 0x9F, 0x5A, /* 0x00-0x03 */ 7542 0x9F, 0x57, 0x9F, 0x58, 0x9F, 0x59, 0x9F, 0x5A, /* 0x00-0x03 */
7543 0x9F, 0x5B, 0x9F, 0x5C, 0x9F, 0x5D, 0x9F, 0x5E, /* 0x04-0x07 */ 7543 0x9F, 0x5B, 0x9F, 0x5C, 0x9F, 0x5D, 0x9F, 0x5E, /* 0x04-0x07 */
7544 0x9F, 0x5F, 0xD1, 0xC9, 0xBA, 0xB8, 0x9F, 0x60, /* 0x08-0x0B */ 7544 0x9F, 0x5F, 0xD1, 0xC9, 0xBA, 0xB8, 0x9F, 0x60, /* 0x08-0x0B */
@@ -7606,7 +7606,7 @@ static unsigned char u2c_71[512] = {
7606 0xA0, 0x61, 0xA0, 0x62, 0xA0, 0x63, 0xA0, 0x64, /* 0xFC-0xFF */ 7606 0xA0, 0x61, 0xA0, 0x62, 0xA0, 0x63, 0xA0, 0x64, /* 0xFC-0xFF */
7607}; 7607};
7608 7608
7609static unsigned char u2c_72[512] = { 7609static const unsigned char u2c_72[512] = {
7610 0xA0, 0x65, 0xA0, 0x66, 0xA0, 0x67, 0xA0, 0x68, /* 0x00-0x03 */ 7610 0xA0, 0x65, 0xA0, 0x66, 0xA0, 0x67, 0xA0, 0x68, /* 0x00-0x03 */
7611 0xA0, 0x69, 0xA0, 0x6A, 0xB1, 0xAC, 0xA0, 0x6B, /* 0x04-0x07 */ 7611 0xA0, 0x69, 0xA0, 0x6A, 0xB1, 0xAC, 0xA0, 0x6B, /* 0x04-0x07 */
7612 0xA0, 0x6C, 0xA0, 0x6D, 0xA0, 0x6E, 0xA0, 0x6F, /* 0x08-0x0B */ 7612 0xA0, 0x6C, 0xA0, 0x6D, 0xA0, 0x6E, 0xA0, 0x6F, /* 0x08-0x0B */
@@ -7674,7 +7674,7 @@ static unsigned char u2c_72[512] = {
7674 0xC0, 0xC7, 0xAA, 0x4E, 0xAA, 0x4F, 0xAA, 0x50, /* 0xFC-0xFF */ 7674 0xC0, 0xC7, 0xAA, 0x4E, 0xAA, 0x4F, 0xAA, 0x50, /* 0xFC-0xFF */
7675}; 7675};
7676 7676
7677static unsigned char u2c_73[512] = { 7677static const unsigned char u2c_73[512] = {
7678 0xAA, 0x51, 0xE1, 0xFB, 0xAA, 0x52, 0xE1, 0xFD, /* 0x00-0x03 */ 7678 0xAA, 0x51, 0xE1, 0xFB, 0xAA, 0x52, 0xE1, 0xFD, /* 0x00-0x03 */
7679 0xAA, 0x53, 0xAA, 0x54, 0xAA, 0x55, 0xAA, 0x56, /* 0x04-0x07 */ 7679 0xAA, 0x53, 0xAA, 0x54, 0xAA, 0x55, 0xAA, 0x56, /* 0x04-0x07 */
7680 0xAA, 0x57, 0xAA, 0x58, 0xE2, 0xA5, 0xAA, 0x59, /* 0x08-0x0B */ 7680 0xAA, 0x57, 0xAA, 0x58, 0xE2, 0xA5, 0xAA, 0x59, /* 0x08-0x0B */
@@ -7742,7 +7742,7 @@ static unsigned char u2c_73[512] = {
7742 0xAC, 0x44, 0xAC, 0x45, 0xAC, 0x46, 0xAC, 0x47, /* 0xFC-0xFF */ 7742 0xAC, 0x44, 0xAC, 0x45, 0xAC, 0x46, 0xAC, 0x47, /* 0xFC-0xFF */
7743}; 7743};
7744 7744
7745static unsigned char u2c_74[512] = { 7745static const unsigned char u2c_74[512] = {
7746 0xAC, 0x48, 0xAC, 0x49, 0xAC, 0x4A, 0xC7, 0xF2, /* 0x00-0x03 */ 7746 0xAC, 0x48, 0xAC, 0x49, 0xAC, 0x4A, 0xC7, 0xF2, /* 0x00-0x03 */
7747 0xAC, 0x4B, 0xC0, 0xC5, 0xC0, 0xED, 0xAC, 0x4C, /* 0x04-0x07 */ 7747 0xAC, 0x4B, 0xC0, 0xC5, 0xC0, 0xED, 0xAC, 0x4C, /* 0x04-0x07 */
7748 0xAC, 0x4D, 0xC1, 0xF0, 0xE7, 0xF0, 0xAC, 0x4E, /* 0x08-0x0B */ 7748 0xAC, 0x4D, 0xC1, 0xF0, 0xE7, 0xF0, 0xAC, 0x4E, /* 0x08-0x0B */
@@ -7810,7 +7810,7 @@ static unsigned char u2c_74[512] = {
7810 0xAE, 0x46, 0xAE, 0x47, 0xAE, 0x48, 0xEA, 0xB3, /* 0xFC-0xFF */ 7810 0xAE, 0x46, 0xAE, 0x47, 0xAE, 0x48, 0xEA, 0xB3, /* 0xFC-0xFF */
7811}; 7811};
7812 7812
7813static unsigned char u2c_75[512] = { 7813static const unsigned char u2c_75[512] = {
7814 0xAE, 0x49, 0xAE, 0x4A, 0xAE, 0x4B, 0xAE, 0x4C, /* 0x00-0x03 */ 7814 0xAE, 0x49, 0xAE, 0x4A, 0xAE, 0x4B, 0xAE, 0x4C, /* 0x00-0x03 */
7815 0xD5, 0xE7, 0xAE, 0x4D, 0xAE, 0x4E, 0xAE, 0x4F, /* 0x04-0x07 */ 7815 0xD5, 0xE7, 0xAE, 0x4D, 0xAE, 0x4E, 0xAE, 0x4F, /* 0x04-0x07 */
7816 0xAE, 0x50, 0xAE, 0x51, 0xAE, 0x52, 0xAE, 0x53, /* 0x08-0x0B */ 7816 0xAE, 0x50, 0xAE, 0x51, 0xAE, 0x52, 0xAE, 0x53, /* 0x08-0x0B */
@@ -7878,7 +7878,7 @@ static unsigned char u2c_75[512] = {
7878 0xF0, 0xF3, 0xAF, 0x79, 0xAF, 0x7A, 0xF0, 0xF4, /* 0xFC-0xFF */ 7878 0xF0, 0xF3, 0xAF, 0x79, 0xAF, 0x7A, 0xF0, 0xF4, /* 0xFC-0xFF */
7879}; 7879};
7880 7880
7881static unsigned char u2c_76[512] = { 7881static const unsigned char u2c_76[512] = {
7882 0xF0, 0xF6, 0xB4, 0xE1, 0xAF, 0x7B, 0xF0, 0xF1, /* 0x00-0x03 */ 7882 0xF0, 0xF6, 0xB4, 0xE1, 0xAF, 0x7B, 0xF0, 0xF1, /* 0x00-0x03 */
7883 0xAF, 0x7C, 0xF0, 0xF7, 0xAF, 0x7D, 0xAF, 0x7E, /* 0x04-0x07 */ 7883 0xAF, 0x7C, 0xF0, 0xF7, 0xAF, 0x7D, 0xAF, 0x7E, /* 0x04-0x07 */
7884 0xAF, 0x80, 0xAF, 0x81, 0xF0, 0xFA, 0xAF, 0x82, /* 0x08-0x0B */ 7884 0xAF, 0x80, 0xAF, 0x81, 0xF0, 0xFA, 0xAF, 0x82, /* 0x08-0x0B */
@@ -7946,7 +7946,7 @@ static unsigned char u2c_76[512] = {
7946 0xC5, 0xCE, 0xB1, 0x60, 0xB6, 0xDC, 0xB1, 0x61, /* 0xFC-0xFF */ 7946 0xC5, 0xCE, 0xB1, 0x60, 0xB6, 0xDC, 0xB1, 0x61, /* 0xFC-0xFF */
7947}; 7947};
7948 7948
7949static unsigned char u2c_77[512] = { 7949static const unsigned char u2c_77[512] = {
7950 0xB1, 0x62, 0xCA, 0xA1, 0xB1, 0x63, 0xB1, 0x64, /* 0x00-0x03 */ 7950 0xB1, 0x62, 0xCA, 0xA1, 0xB1, 0x63, 0xB1, 0x64, /* 0x00-0x03 */
7951 0xED, 0xED, 0xB1, 0x65, 0xB1, 0x66, 0xED, 0xF0, /* 0x04-0x07 */ 7951 0xED, 0xED, 0xB1, 0x65, 0xB1, 0x66, 0xED, 0xF0, /* 0x04-0x07 */
7952 0xED, 0xF1, 0xC3, 0xBC, 0xB1, 0x67, 0xBF, 0xB4, /* 0x08-0x0B */ 7952 0xED, 0xF1, 0xC3, 0xBC, 0xB1, 0x67, 0xBF, 0xB4, /* 0x08-0x0B */
@@ -8014,7 +8014,7 @@ static unsigned char u2c_77[512] = {
8014 0xB3, 0x4D, 0xCE, 0xF9, 0xB7, 0xAF, 0xBF, 0xF3, /* 0xFC-0xFF */ 8014 0xB3, 0x4D, 0xCE, 0xF9, 0xB7, 0xAF, 0xBF, 0xF3, /* 0xFC-0xFF */
8015}; 8015};
8016 8016
8017static unsigned char u2c_78[512] = { 8017static const unsigned char u2c_78[512] = {
8018 0xED, 0xB8, 0xC2, 0xEB, 0xC9, 0xB0, 0xB3, 0x4E, /* 0x00-0x03 */ 8018 0xED, 0xB8, 0xC2, 0xEB, 0xC9, 0xB0, 0xB3, 0x4E, /* 0x00-0x03 */
8019 0xB3, 0x4F, 0xB3, 0x50, 0xB3, 0x51, 0xB3, 0x52, /* 0x04-0x07 */ 8019 0xB3, 0x4F, 0xB3, 0x50, 0xB3, 0x51, 0xB3, 0x52, /* 0x04-0x07 */
8020 0xB3, 0x53, 0xED, 0xB9, 0xB3, 0x54, 0xB3, 0x55, /* 0x08-0x0B */ 8020 0xB3, 0x53, 0xED, 0xB9, 0xB3, 0x54, 0xB3, 0x55, /* 0x08-0x0B */
@@ -8082,7 +8082,7 @@ static unsigned char u2c_78[512] = {
8082 0xB4, 0x92, 0xB4, 0x93, 0xB4, 0x94, 0xB4, 0x95, /* 0xFC-0xFF */ 8082 0xB4, 0x92, 0xB4, 0x93, 0xB4, 0x94, 0xB4, 0x95, /* 0xFC-0xFF */
8083}; 8083};
8084 8084
8085static unsigned char u2c_79[512] = { 8085static const unsigned char u2c_79[512] = {
8086 0xB4, 0x96, 0xBD, 0xB8, 0xB4, 0x97, 0xB4, 0x98, /* 0x00-0x03 */ 8086 0xB4, 0x96, 0xBD, 0xB8, 0xB4, 0x97, 0xB4, 0x98, /* 0x00-0x03 */
8087 0xB4, 0x99, 0xED, 0xE2, 0xB4, 0x9A, 0xB4, 0x9B, /* 0x04-0x07 */ 8087 0xB4, 0x99, 0xED, 0xE2, 0xB4, 0x9A, 0xB4, 0x9B, /* 0x04-0x07 */
8088 0xB4, 0x9C, 0xB4, 0x9D, 0xB4, 0x9E, 0xB4, 0x9F, /* 0x08-0x0B */ 8088 0xB4, 0x9C, 0xB4, 0x9D, 0xB4, 0x9E, 0xB4, 0x9F, /* 0x08-0x0B */
@@ -8150,7 +8150,7 @@ static unsigned char u2c_79[512] = {
8150 0xB6, 0x8B, 0xBB, 0xE0, 0xB6, 0x8C, 0xB6, 0x8D, /* 0xFC-0xFF */ 8150 0xB6, 0x8B, 0xBB, 0xE0, 0xB6, 0x8C, 0xB6, 0x8D, /* 0xFC-0xFF */
8151}; 8151};
8152 8152
8153static unsigned char u2c_7A[512] = { 8153static const unsigned char u2c_7A[512] = {
8154 0xCF, 0xA1, 0xB6, 0x8E, 0xEF, 0xFC, 0xEF, 0xFB, /* 0x00-0x03 */ 8154 0xCF, 0xA1, 0xB6, 0x8E, 0xEF, 0xFC, 0xEF, 0xFB, /* 0x00-0x03 */
8155 0xB6, 0x8F, 0xB6, 0x90, 0xEF, 0xF9, 0xB6, 0x91, /* 0x04-0x07 */ 8155 0xB6, 0x8F, 0xB6, 0x90, 0xEF, 0xF9, 0xB6, 0x91, /* 0x04-0x07 */
8156 0xB6, 0x92, 0xB6, 0x93, 0xB6, 0x94, 0xB3, 0xCC, /* 0x08-0x0B */ 8156 0xB6, 0x92, 0xB6, 0x93, 0xB6, 0x94, 0xB3, 0xCC, /* 0x08-0x0B */
@@ -8218,7 +8218,7 @@ static unsigned char u2c_7A[512] = {
8218 0xB8, 0x86, 0xF3, 0xC4, 0xB8, 0x87, 0xB8, 0xCD, /* 0xFC-0xFF */ 8218 0xB8, 0x86, 0xF3, 0xC4, 0xB8, 0x87, 0xB8, 0xCD, /* 0xFC-0xFF */
8219}; 8219};
8220 8220
8221static unsigned char u2c_7B[512] = { 8221static const unsigned char u2c_7B[512] = {
8222 0xB8, 0x88, 0xB8, 0x89, 0xB8, 0x8A, 0xF3, 0xC6, /* 0x00-0x03 */ 8222 0xB8, 0x88, 0xB8, 0x89, 0xB8, 0x8A, 0xF3, 0xC6, /* 0x00-0x03 */
8223 0xF3, 0xC7, 0xB8, 0x8B, 0xB0, 0xCA, 0xB8, 0x8C, /* 0x04-0x07 */ 8223 0xF3, 0xC7, 0xB8, 0x8B, 0xB0, 0xCA, 0xB8, 0x8C, /* 0x04-0x07 */
8224 0xF3, 0xC5, 0xB8, 0x8D, 0xF3, 0xC9, 0xCB, 0xF1, /* 0x08-0x0B */ 8224 0xF3, 0xC5, 0xB8, 0x8D, 0xF3, 0xC9, 0xCB, 0xF1, /* 0x08-0x0B */
@@ -8286,7 +8286,7 @@ static unsigned char u2c_7B[512] = {
8286 0xF3, 0xFB, 0xBA, 0x68, 0xF3, 0xFA, 0xBA, 0x69, /* 0xFC-0xFF */ 8286 0xF3, 0xFB, 0xBA, 0x68, 0xF3, 0xFA, 0xBA, 0x69, /* 0xFC-0xFF */
8287}; 8287};
8288 8288
8289static unsigned char u2c_7C[512] = { 8289static const unsigned char u2c_7C[512] = {
8290 0xBA, 0x6A, 0xBA, 0x6B, 0xBA, 0x6C, 0xBA, 0x6D, /* 0x00-0x03 */ 8290 0xBA, 0x6A, 0xBA, 0x6B, 0xBA, 0x6C, 0xBA, 0x6D, /* 0x00-0x03 */
8291 0xBA, 0x6E, 0xBA, 0x6F, 0xBA, 0x70, 0xB4, 0xD8, /* 0x04-0x07 */ 8291 0xBA, 0x6E, 0xBA, 0x6F, 0xBA, 0x70, 0xB4, 0xD8, /* 0x04-0x07 */
8292 0xBA, 0x71, 0xBA, 0x72, 0xBA, 0x73, 0xF3, 0xFE, /* 0x08-0x0B */ 8292 0xBA, 0x71, 0xBA, 0x72, 0xBA, 0x73, 0xF3, 0xFE, /* 0x08-0x0B */
@@ -8354,7 +8354,7 @@ static unsigned char u2c_7C[512] = {
8354 0xBC, 0x6B, 0xBC, 0x6C, 0xBC, 0x6D, 0xBC, 0x6E, /* 0xFC-0xFF */ 8354 0xBC, 0x6B, 0xBC, 0x6C, 0xBC, 0x6D, 0xBC, 0x6E, /* 0xFC-0xFF */
8355}; 8355};
8356 8356
8357static unsigned char u2c_7D[512] = { 8357static const unsigned char u2c_7D[512] = {
8358 0xBC, 0x6F, 0xBC, 0x70, 0xBC, 0x71, 0xBC, 0x72, /* 0x00-0x03 */ 8358 0xBC, 0x6F, 0xBC, 0x70, 0xBC, 0x71, 0xBC, 0x72, /* 0x00-0x03 */
8359 0xBC, 0x73, 0xBC, 0x74, 0xBC, 0x75, 0xBC, 0x76, /* 0x04-0x07 */ 8359 0xBC, 0x73, 0xBC, 0x74, 0xBC, 0x75, 0xBC, 0x76, /* 0x04-0x07 */
8360 0xBC, 0x77, 0xBC, 0x78, 0xCE, 0xC9, 0xBC, 0x79, /* 0x08-0x0B */ 8360 0xBC, 0x77, 0xBC, 0x78, 0xCE, 0xC9, 0xBC, 0x79, /* 0x08-0x0B */
@@ -8422,7 +8422,7 @@ static unsigned char u2c_7D[512] = {
8422 0xBF, 0x41, 0xBF, 0x42, 0xBF, 0x43, 0xBF, 0x44, /* 0xFC-0xFF */ 8422 0xBF, 0x41, 0xBF, 0x42, 0xBF, 0x43, 0xBF, 0x44, /* 0xFC-0xFF */
8423}; 8423};
8424 8424
8425static unsigned char u2c_7E[512] = { 8425static const unsigned char u2c_7E[512] = {
8426 0xBF, 0x45, 0xBF, 0x46, 0xBF, 0x47, 0xBF, 0x48, /* 0x00-0x03 */ 8426 0xBF, 0x45, 0xBF, 0x46, 0xBF, 0x47, 0xBF, 0x48, /* 0x00-0x03 */
8427 0xBF, 0x49, 0xBF, 0x4A, 0xBF, 0x4B, 0xBF, 0x4C, /* 0x04-0x07 */ 8427 0xBF, 0x49, 0xBF, 0x4A, 0xBF, 0x4B, 0xBF, 0x4C, /* 0x04-0x07 */
8428 0xBF, 0x4D, 0xBF, 0x4E, 0xBF, 0x4F, 0xBF, 0x50, /* 0x08-0x0B */ 8428 0xBF, 0x4D, 0xBF, 0x4E, 0xBF, 0x4F, 0xBF, 0x50, /* 0x08-0x0B */
@@ -8490,7 +8490,7 @@ static unsigned char u2c_7E[512] = {
8490 0xD7, 0xDB, 0xD5, 0xC0, 0xE7, 0xBA, 0xC2, 0xCC, /* 0xFC-0xFF */ 8490 0xD7, 0xDB, 0xD5, 0xC0, 0xE7, 0xBA, 0xC2, 0xCC, /* 0xFC-0xFF */
8491}; 8491};
8492 8492
8493static unsigned char u2c_7F[512] = { 8493static const unsigned char u2c_7F[512] = {
8494 0xD7, 0xBA, 0xE7, 0xBB, 0xE7, 0xBC, 0xE7, 0xBD, /* 0x00-0x03 */ 8494 0xD7, 0xBA, 0xE7, 0xBB, 0xE7, 0xBC, 0xE7, 0xBD, /* 0x00-0x03 */
8495 0xBC, 0xEA, 0xC3, 0xE5, 0xC0, 0xC2, 0xE7, 0xBE, /* 0x04-0x07 */ 8495 0xBC, 0xEA, 0xC3, 0xE5, 0xC0, 0xC2, 0xE7, 0xBE, /* 0x04-0x07 */
8496 0xE7, 0xBF, 0xBC, 0xA9, 0xC0, 0x88, 0xE7, 0xC0, /* 0x08-0x0B */ 8496 0xE7, 0xBF, 0xBC, 0xA9, 0xC0, 0x88, 0xE7, 0xC0, /* 0x08-0x0B */
@@ -8558,7 +8558,7 @@ static unsigned char u2c_7F[512] = {
8558 0xD2, 0xED, 0xC2, 0x50, 0xC2, 0x51, 0xC2, 0x52, /* 0xFC-0xFF */ 8558 0xD2, 0xED, 0xC2, 0x50, 0xC2, 0x51, 0xC2, 0x52, /* 0xFC-0xFF */
8559}; 8559};
8560 8560
8561static unsigned char u2c_80[512] = { 8561static const unsigned char u2c_80[512] = {
8562 0xD2, 0xAB, 0xC0, 0xCF, 0xC2, 0x53, 0xBF, 0xBC, /* 0x00-0x03 */ 8562 0xD2, 0xAB, 0xC0, 0xCF, 0xC2, 0x53, 0xBF, 0xBC, /* 0x00-0x03 */
8563 0xEB, 0xA3, 0xD5, 0xDF, 0xEA, 0xC8, 0xC2, 0x54, /* 0x04-0x07 */ 8563 0xEB, 0xA3, 0xD5, 0xDF, 0xEA, 0xC8, 0xC2, 0x54, /* 0x04-0x07 */
8564 0xC2, 0x55, 0xC2, 0x56, 0xC2, 0x57, 0xF1, 0xF3, /* 0x08-0x0B */ 8564 0xC2, 0x55, 0xC2, 0x56, 0xC2, 0x57, 0xF1, 0xF3, /* 0x08-0x0B */
@@ -8626,7 +8626,7 @@ static unsigned char u2c_80[512] = {
8626 0xEB, 0xDD, 0xC4, 0xDC, 0xC3, 0x75, 0xC3, 0x76, /* 0xFC-0xFF */ 8626 0xEB, 0xDD, 0xC4, 0xDC, 0xC3, 0x75, 0xC3, 0x76, /* 0xFC-0xFF */
8627}; 8627};
8628 8628
8629static unsigned char u2c_81[512] = { 8629static const unsigned char u2c_81[512] = {
8630 0xC3, 0x77, 0xC3, 0x78, 0xD6, 0xAC, 0xC3, 0x79, /* 0x00-0x03 */ 8630 0xC3, 0x77, 0xC3, 0x78, 0xD6, 0xAC, 0xC3, 0x79, /* 0x00-0x03 */
8631 0xC3, 0x7A, 0xC3, 0x7B, 0xB4, 0xE0, 0xC3, 0x7C, /* 0x04-0x07 */ 8631 0xC3, 0x7A, 0xC3, 0x7B, 0xB4, 0xE0, 0xC3, 0x7C, /* 0x04-0x07 */
8632 0xC3, 0x7D, 0xC2, 0xF6, 0xBC, 0xB9, 0xC3, 0x7E, /* 0x08-0x0B */ 8632 0xC3, 0x7D, 0xC2, 0xF6, 0xBC, 0xB9, 0xC3, 0x7E, /* 0x08-0x0B */
@@ -8694,7 +8694,7 @@ static unsigned char u2c_81[512] = {
8694 0xBE, 0xCA, 0xC5, 0x60, 0xF4, 0xA7, 0xC5, 0x61, /* 0xFC-0xFF */ 8694 0xBE, 0xCA, 0xC5, 0x60, 0xF4, 0xA7, 0xC5, 0x61, /* 0xFC-0xFF */
8695}; 8695};
8696 8696
8697static unsigned char u2c_82[512] = { 8697static const unsigned char u2c_82[512] = {
8698 0xD2, 0xA8, 0xF4, 0xA8, 0xF4, 0xA9, 0xC5, 0x62, /* 0x00-0x03 */ 8698 0xD2, 0xA8, 0xF4, 0xA8, 0xF4, 0xA9, 0xC5, 0x62, /* 0x00-0x03 */
8699 0xF4, 0xAA, 0xBE, 0xCB, 0xD3, 0xDF, 0xC5, 0x63, /* 0x04-0x07 */ 8699 0xF4, 0xAA, 0xBE, 0xCB, 0xD3, 0xDF, 0xC5, 0x63, /* 0x04-0x07 */
8700 0xC5, 0x64, 0xC5, 0x65, 0xC5, 0x66, 0xC5, 0x67, /* 0x08-0x0B */ 8700 0xC5, 0x64, 0xC5, 0x65, 0xC5, 0x66, 0xC5, 0x67, /* 0x08-0x0B */
@@ -8762,7 +8762,7 @@ static unsigned char u2c_82[512] = {
8762 0xC6, 0x81, 0xC6, 0x82, 0xC6, 0x83, 0xC6, 0x84, /* 0xFC-0xFF */ 8762 0xC6, 0x81, 0xC6, 0x82, 0xC6, 0x83, 0xC6, 0x84, /* 0xFC-0xFF */
8763}; 8763};
8764 8764
8765static unsigned char u2c_83[512] = { 8765static const unsigned char u2c_83[512] = {
8766 0xC6, 0x85, 0xD7, 0xC2, 0xC3, 0xAF, 0xB7, 0xB6, /* 0x00-0x03 */ 8766 0xC6, 0x85, 0xD7, 0xC2, 0xC3, 0xAF, 0xB7, 0xB6, /* 0x00-0x03 */
8767 0xC7, 0xD1, 0xC3, 0xA9, 0xDC, 0xE2, 0xDC, 0xD8, /* 0x04-0x07 */ 8767 0xC7, 0xD1, 0xC3, 0xA9, 0xDC, 0xE2, 0xDC, 0xD8, /* 0x04-0x07 */
8768 0xDC, 0xEB, 0xDC, 0xD4, 0xC6, 0x86, 0xC6, 0x87, /* 0x08-0x0B */ 8768 0xDC, 0xEB, 0xDC, 0xD4, 0xC6, 0x86, 0xC6, 0x87, /* 0x08-0x0B */
@@ -8830,7 +8830,7 @@ static unsigned char u2c_83[512] = {
8830 0xC8, 0x49, 0xDD, 0xC4, 0xC8, 0x4A, 0xC8, 0x4B, /* 0xFC-0xFF */ 8830 0xC8, 0x49, 0xDD, 0xC4, 0xC8, 0x4A, 0xC8, 0x4B, /* 0xFC-0xFF */
8831}; 8831};
8832 8832
8833static unsigned char u2c_84[512] = { 8833static const unsigned char u2c_84[512] = {
8834 0xC8, 0x4C, 0xDD, 0xBD, 0xC8, 0x4D, 0xDD, 0xCD, /* 0x00-0x03 */ 8834 0xC8, 0x4C, 0xDD, 0xBD, 0xC8, 0x4D, 0xDD, 0xCD, /* 0x00-0x03 */
8835 0xCC, 0xD1, 0xC8, 0x4E, 0xDD, 0xC9, 0xC8, 0x4F, /* 0x04-0x07 */ 8835 0xCC, 0xD1, 0xC8, 0x4E, 0xDD, 0xC9, 0xC8, 0x4F, /* 0x04-0x07 */
8836 0xC8, 0x50, 0xC8, 0x51, 0xC8, 0x52, 0xDD, 0xC2, /* 0x08-0x0B */ 8836 0xC8, 0x50, 0xC8, 0x51, 0xC8, 0x52, 0xDD, 0xC2, /* 0x08-0x0B */
@@ -8898,7 +8898,7 @@ static unsigned char u2c_84[512] = {
8898 0xDE, 0xA4, 0xC9, 0x9C, 0xC9, 0x9D, 0xDE, 0xA3, /* 0xFC-0xFF */ 8898 0xDE, 0xA4, 0xC9, 0x9C, 0xC9, 0x9D, 0xDE, 0xA3, /* 0xFC-0xFF */
8899}; 8899};
8900 8900
8901static unsigned char u2c_85[512] = { 8901static const unsigned char u2c_85[512] = {
8902 0xC9, 0x9E, 0xC9, 0x9F, 0xC9, 0xA0, 0xCA, 0x40, /* 0x00-0x03 */ 8902 0xC9, 0x9E, 0xC9, 0x9F, 0xC9, 0xA0, 0xCA, 0x40, /* 0x00-0x03 */
8903 0xCA, 0x41, 0xCA, 0x42, 0xCA, 0x43, 0xCA, 0x44, /* 0x04-0x07 */ 8903 0xCA, 0x41, 0xCA, 0x42, 0xCA, 0x43, 0xCA, 0x44, /* 0x04-0x07 */
8904 0xCA, 0x45, 0xCA, 0x46, 0xCA, 0x47, 0xCA, 0x48, /* 0x08-0x0B */ 8904 0xCA, 0x45, 0xCA, 0x46, 0xCA, 0x47, 0xCA, 0x48, /* 0x08-0x0B */
@@ -8966,7 +8966,7 @@ static unsigned char u2c_85[512] = {
8966 0xCC, 0x42, 0xCC, 0x43, 0xCC, 0x44, 0xDE, 0xBD, /* 0xFC-0xFF */ 8966 0xCC, 0x42, 0xCC, 0x43, 0xCC, 0x44, 0xDE, 0xBD, /* 0xFC-0xFF */
8967}; 8967};
8968 8968
8969static unsigned char u2c_86[512] = { 8969static const unsigned char u2c_86[512] = {
8970 0xCC, 0x45, 0xCC, 0x46, 0xCC, 0x47, 0xCC, 0x48, /* 0x00-0x03 */ 8970 0xCC, 0x45, 0xCC, 0x46, 0xCC, 0x47, 0xCC, 0x48, /* 0x00-0x03 */
8971 0xCC, 0x49, 0xDE, 0xBF, 0xCC, 0x4A, 0xCC, 0x4B, /* 0x04-0x07 */ 8971 0xCC, 0x49, 0xDE, 0xBF, 0xCC, 0x4A, 0xCC, 0x4B, /* 0x04-0x07 */
8972 0xCC, 0x4C, 0xCC, 0x4D, 0xCC, 0x4E, 0xCC, 0x4F, /* 0x08-0x0B */ 8972 0xCC, 0x4C, 0xCC, 0x4D, 0xCC, 0x4E, 0xCC, 0x4F, /* 0x08-0x0B */
@@ -9034,7 +9034,7 @@ static unsigned char u2c_86[512] = {
9034 0xCD, 0x92, 0xCD, 0x93, 0xB6, 0xEA, 0xCD, 0x94, /* 0xFC-0xFF */ 9034 0xCD, 0x92, 0xCD, 0x93, 0xB6, 0xEA, 0xCD, 0x94, /* 0xFC-0xFF */
9035}; 9035};
9036 9036
9037static unsigned char u2c_87[512] = { 9037static const unsigned char u2c_87[512] = {
9038 0xCA, 0xF1, 0xCD, 0x95, 0xB7, 0xE4, 0xF2, 0xD7, /* 0x00-0x03 */ 9038 0xCA, 0xF1, 0xCD, 0x95, 0xB7, 0xE4, 0xF2, 0xD7, /* 0x00-0x03 */
9039 0xCD, 0x96, 0xCD, 0x97, 0xCD, 0x98, 0xF2, 0xD8, /* 0x04-0x07 */ 9039 0xCD, 0x96, 0xCD, 0x97, 0xCD, 0x98, 0xF2, 0xD8, /* 0x04-0x07 */
9040 0xF2, 0xDA, 0xF2, 0xDD, 0xF2, 0xDB, 0xCD, 0x99, /* 0x08-0x0B */ 9040 0xF2, 0xDA, 0xF2, 0xDD, 0xF2, 0xDB, 0xCD, 0x99, /* 0x08-0x0B */
@@ -9102,7 +9102,7 @@ static unsigned char u2c_87[512] = {
9102 0xCF, 0x82, 0xCF, 0x83, 0xF3, 0xB8, 0xCF, 0x84, /* 0xFC-0xFF */ 9102 0xCF, 0x82, 0xCF, 0x83, 0xF3, 0xB8, 0xCF, 0x84, /* 0xFC-0xFF */
9103}; 9103};
9104 9104
9105static unsigned char u2c_88[512] = { 9105static const unsigned char u2c_88[512] = {
9106 0xCF, 0x85, 0xCF, 0x86, 0xCF, 0x87, 0xD9, 0xF9, /* 0x00-0x03 */ 9106 0xCF, 0x85, 0xCF, 0x86, 0xCF, 0x87, 0xD9, 0xF9, /* 0x00-0x03 */
9107 0xCF, 0x88, 0xCF, 0x89, 0xCF, 0x8A, 0xCF, 0x8B, /* 0x04-0x07 */ 9107 0xCF, 0x88, 0xCF, 0x89, 0xCF, 0x8A, 0xCF, 0x8B, /* 0x04-0x07 */
9108 0xCF, 0x8C, 0xCF, 0x8D, 0xF3, 0xB9, 0xCF, 0x8E, /* 0x08-0x0B */ 9108 0xCF, 0x8C, 0xCF, 0x8D, 0xF3, 0xB9, 0xCF, 0x8E, /* 0x08-0x0B */
@@ -9170,7 +9170,7 @@ static unsigned char u2c_88[512] = {
9170 0xF1, 0xD3, 0xD1, 0x75, 0xF1, 0xD5, 0xD1, 0x76, /* 0xFC-0xFF */ 9170 0xF1, 0xD3, 0xD1, 0x75, 0xF1, 0xD5, 0xD1, 0x76, /* 0xFC-0xFF */
9171}; 9171};
9172 9172
9173static unsigned char u2c_89[512] = { 9173static const unsigned char u2c_89[512] = {
9174 0xD1, 0x77, 0xD1, 0x78, 0xB9, 0xD3, 0xD1, 0x79, /* 0x00-0x03 */ 9174 0xD1, 0x77, 0xD1, 0x78, 0xB9, 0xD3, 0xD1, 0x79, /* 0x00-0x03 */
9175 0xD1, 0x7A, 0xD1, 0x7B, 0xD1, 0x7C, 0xD1, 0x7D, /* 0x04-0x07 */ 9175 0xD1, 0x7A, 0xD1, 0x7B, 0xD1, 0x7C, 0xD1, 0x7D, /* 0x04-0x07 */
9176 0xD1, 0x7E, 0xD1, 0x80, 0xF1, 0xDB, 0xD1, 0x81, /* 0x08-0x0B */ 9176 0xD1, 0x7E, 0xD1, 0x80, 0xF1, 0xDB, 0xD1, 0x81, /* 0x08-0x0B */
@@ -9238,7 +9238,7 @@ static unsigned char u2c_89[512] = {
9238 0xD3, 0x81, 0xD3, 0x82, 0xD3, 0x83, 0xD3, 0x84, /* 0xFC-0xFF */ 9238 0xD3, 0x81, 0xD3, 0x82, 0xD3, 0x83, 0xD3, 0x84, /* 0xFC-0xFF */
9239}; 9239};
9240 9240
9241static unsigned char u2c_8A[512] = { 9241static const unsigned char u2c_8A[512] = {
9242 0xD1, 0xD4, 0xD3, 0x85, 0xD3, 0x86, 0xD3, 0x87, /* 0x00-0x03 */ 9242 0xD1, 0xD4, 0xD3, 0x85, 0xD3, 0x86, 0xD3, 0x87, /* 0x00-0x03 */
9243 0xD3, 0x88, 0xD3, 0x89, 0xD3, 0x8A, 0xD9, 0xEA, /* 0x04-0x07 */ 9243 0xD3, 0x88, 0xD3, 0x89, 0xD3, 0x8A, 0xD9, 0xEA, /* 0x04-0x07 */
9244 0xD3, 0x8B, 0xD3, 0x8C, 0xD3, 0x8D, 0xD3, 0x8E, /* 0x08-0x0B */ 9244 0xD3, 0x8B, 0xD3, 0x8C, 0xD3, 0x8D, 0xD3, 0x8E, /* 0x08-0x0B */
@@ -9306,7 +9306,7 @@ static unsigned char u2c_8A[512] = {
9306 0xD6, 0x58, 0xD6, 0x59, 0xD6, 0x5A, 0xD6, 0x5B, /* 0xFC-0xFF */ 9306 0xD6, 0x58, 0xD6, 0x59, 0xD6, 0x5A, 0xD6, 0x5B, /* 0xFC-0xFF */
9307}; 9307};
9308 9308
9309static unsigned char u2c_8B[512] = { 9309static const unsigned char u2c_8B[512] = {
9310 0xD6, 0x5C, 0xD6, 0x5D, 0xD6, 0x5E, 0xD6, 0x5F, /* 0x00-0x03 */ 9310 0xD6, 0x5C, 0xD6, 0x5D, 0xD6, 0x5E, 0xD6, 0x5F, /* 0x00-0x03 */
9311 0xD6, 0x60, 0xD6, 0x61, 0xD6, 0x62, 0xE5, 0xC0, /* 0x04-0x07 */ 9311 0xD6, 0x60, 0xD6, 0x61, 0xD6, 0x62, 0xE5, 0xC0, /* 0x04-0x07 */
9312 0xD6, 0x63, 0xD6, 0x64, 0xD6, 0x65, 0xD6, 0x66, /* 0x08-0x0B */ 9312 0xD6, 0x63, 0xD6, 0x64, 0xD6, 0x65, 0xD6, 0x66, /* 0x08-0x0B */
@@ -9374,7 +9374,7 @@ static unsigned char u2c_8B[512] = {
9374 0xDA, 0xC2, 0xB7, 0xCC, 0xBF, 0xCE, 0xDA, 0xC3, /* 0xFC-0xFF */ 9374 0xDA, 0xC2, 0xB7, 0xCC, 0xBF, 0xCE, 0xDA, 0xC3, /* 0xFC-0xFF */
9375}; 9375};
9376 9376
9377static unsigned char u2c_8C[512] = { 9377static const unsigned char u2c_8C[512] = {
9378 0xDA, 0xC4, 0xCB, 0xAD, 0xDA, 0xC5, 0xB5, 0xF7, /* 0x00-0x03 */ 9378 0xDA, 0xC4, 0xCB, 0xAD, 0xDA, 0xC5, 0xB5, 0xF7, /* 0x00-0x03 */
9379 0xDA, 0xC6, 0xC1, 0xC2, 0xD7, 0xBB, 0xDA, 0xC7, /* 0x04-0x07 */ 9379 0xDA, 0xC6, 0xC1, 0xC2, 0xD7, 0xBB, 0xDA, 0xC7, /* 0x04-0x07 */
9380 0xCC, 0xB8, 0xD7, 0x9F, 0xD2, 0xEA, 0xC4, 0xB1, /* 0x08-0x0B */ 9380 0xCC, 0xB8, 0xD7, 0x9F, 0xD2, 0xEA, 0xC4, 0xB1, /* 0x08-0x0B */
@@ -9442,7 +9442,7 @@ static unsigned char u2c_8C[512] = {
9442 0xD9, 0x8F, 0xD9, 0x90, 0xD9, 0x91, 0xD9, 0x92, /* 0xFC-0xFF */ 9442 0xD9, 0x8F, 0xD9, 0x90, 0xD9, 0x91, 0xD9, 0x92, /* 0xFC-0xFF */
9443}; 9443};
9444 9444
9445static unsigned char u2c_8D[512] = { 9445static const unsigned char u2c_8D[512] = {
9446 0xD9, 0x93, 0xD9, 0x94, 0xD9, 0x95, 0xD9, 0x96, /* 0x00-0x03 */ 9446 0xD9, 0x93, 0xD9, 0x94, 0xD9, 0x95, 0xD9, 0x96, /* 0x00-0x03 */
9447 0xD9, 0x97, 0xD9, 0x98, 0xD9, 0x99, 0xD9, 0x9A, /* 0x04-0x07 */ 9447 0xD9, 0x97, 0xD9, 0x98, 0xD9, 0x99, 0xD9, 0x9A, /* 0x04-0x07 */
9448 0xD9, 0x9B, 0xD9, 0x9C, 0xD9, 0x9D, 0xD9, 0x9E, /* 0x08-0x0B */ 9448 0xD9, 0x9B, 0xD9, 0x9C, 0xD9, 0x9D, 0xD9, 0x9E, /* 0x08-0x0B */
@@ -9510,7 +9510,7 @@ static unsigned char u2c_8D[512] = {
9510 0xDB, 0x52, 0xF5, 0xD5, 0xDB, 0x53, 0xDB, 0x54, /* 0xFC-0xFF */ 9510 0xDB, 0x52, 0xF5, 0xD5, 0xDB, 0x53, 0xDB, 0x54, /* 0xFC-0xFF */
9511}; 9511};
9512 9512
9513static unsigned char u2c_8E[512] = { 9513static const unsigned char u2c_8E[512] = {
9514 0xDB, 0x55, 0xDB, 0x56, 0xDB, 0x57, 0xDB, 0x58, /* 0x00-0x03 */ 9514 0xDB, 0x55, 0xDB, 0x56, 0xDB, 0x57, 0xDB, 0x58, /* 0x00-0x03 */
9515 0xDB, 0x59, 0xF5, 0xBD, 0xDB, 0x5A, 0xDB, 0x5B, /* 0x04-0x07 */ 9515 0xDB, 0x59, 0xF5, 0xBD, 0xDB, 0x5A, 0xDB, 0x5B, /* 0x04-0x07 */
9516 0xDB, 0x5C, 0xF5, 0xD4, 0xD3, 0xBB, 0xDB, 0x5D, /* 0x08-0x0B */ 9516 0xDB, 0x5C, 0xF5, 0xD4, 0xD3, 0xBB, 0xDB, 0x5D, /* 0x08-0x0B */
@@ -9578,7 +9578,7 @@ static unsigned char u2c_8E[512] = {
9578 0xDD, 0x57, 0xDD, 0x58, 0xDD, 0x59, 0xDD, 0x5A, /* 0xFC-0xFF */ 9578 0xDD, 0x57, 0xDD, 0x58, 0xDD, 0x59, 0xDD, 0x5A, /* 0xFC-0xFF */
9579}; 9579};
9580 9580
9581static unsigned char u2c_8F[512] = { 9581static const unsigned char u2c_8F[512] = {
9582 0xDD, 0x5B, 0xDD, 0x5C, 0xDD, 0x5D, 0xDD, 0x5E, /* 0x00-0x03 */ 9582 0xDD, 0x5B, 0xDD, 0x5C, 0xDD, 0x5D, 0xDD, 0x5E, /* 0x00-0x03 */
9583 0xDD, 0x5F, 0xDD, 0x60, 0xDD, 0x61, 0xDD, 0x62, /* 0x04-0x07 */ 9583 0xDD, 0x5F, 0xDD, 0x60, 0xDD, 0x61, 0xDD, 0x62, /* 0x04-0x07 */
9584 0xDD, 0x63, 0xDD, 0x64, 0xDD, 0x65, 0xDD, 0x66, /* 0x08-0x0B */ 9584 0xDD, 0x63, 0xDD, 0x64, 0xDD, 0x65, 0xDD, 0x66, /* 0x08-0x0B */
@@ -9646,7 +9646,7 @@ static unsigned char u2c_8F[512] = {
9646 0xDE, 0x97, 0xD7, 0xB7, 0xDE, 0x98, 0xDE, 0x99, /* 0xFC-0xFF */ 9646 0xDE, 0x97, 0xD7, 0xB7, 0xDE, 0x98, 0xDE, 0x99, /* 0xFC-0xFF */
9647}; 9647};
9648 9648
9649static unsigned char u2c_90[512] = { 9649static const unsigned char u2c_90[512] = {
9650 0xCD, 0xCB, 0xCB, 0xCD, 0xCA, 0xCA, 0xCC, 0xD3, /* 0x00-0x03 */ 9650 0xCD, 0xCB, 0xCB, 0xCD, 0xCA, 0xCA, 0xCC, 0xD3, /* 0x00-0x03 */
9651 0xE5, 0xCC, 0xE5, 0xCB, 0xC4, 0xE6, 0xDE, 0x9A, /* 0x04-0x07 */ 9651 0xE5, 0xCC, 0xE5, 0xCB, 0xC4, 0xE6, 0xDE, 0x9A, /* 0x04-0x07 */
9652 0xDE, 0x9B, 0xD1, 0xA1, 0xD1, 0xB7, 0xE5, 0xCD, /* 0x08-0x0B */ 9652 0xDE, 0x9B, 0xD1, 0xA1, 0xD1, 0xB7, 0xE5, 0xCD, /* 0x08-0x0B */
@@ -9714,7 +9714,7 @@ static unsigned char u2c_90[512] = {
9714 0xE0, 0x63, 0xB6, 0xBC, 0xDB, 0xB1, 0xE0, 0x64, /* 0xFC-0xFF */ 9714 0xE0, 0x63, 0xB6, 0xBC, 0xDB, 0xB1, 0xE0, 0x64, /* 0xFC-0xFF */
9715}; 9715};
9716 9716
9717static unsigned char u2c_91[512] = { 9717static const unsigned char u2c_91[512] = {
9718 0xE0, 0x65, 0xE0, 0x66, 0xB6, 0xF5, 0xE0, 0x67, /* 0x00-0x03 */ 9718 0xE0, 0x65, 0xE0, 0x66, 0xB6, 0xF5, 0xE0, 0x67, /* 0x00-0x03 */
9719 0xDB, 0xB2, 0xE0, 0x68, 0xE0, 0x69, 0xE0, 0x6A, /* 0x04-0x07 */ 9719 0xDB, 0xB2, 0xE0, 0x68, 0xE0, 0x69, 0xE0, 0x6A, /* 0x04-0x07 */
9720 0xE0, 0x6B, 0xE0, 0x6C, 0xE0, 0x6D, 0xE0, 0x6E, /* 0x08-0x0B */ 9720 0xE0, 0x6B, 0xE0, 0x6C, 0xE0, 0x6D, 0xE0, 0x6E, /* 0x08-0x0B */
@@ -9782,7 +9782,7 @@ static unsigned char u2c_91[512] = {
9782 0xE2, 0x56, 0xE2, 0x57, 0xE2, 0x58, 0xE2, 0x59, /* 0xFC-0xFF */ 9782 0xE2, 0x56, 0xE2, 0x57, 0xE2, 0x58, 0xE2, 0x59, /* 0xFC-0xFF */
9783}; 9783};
9784 9784
9785static unsigned char u2c_92[512] = { 9785static const unsigned char u2c_92[512] = {
9786 0xE2, 0x5A, 0xE2, 0x5B, 0xE2, 0x5C, 0xE2, 0x5D, /* 0x00-0x03 */ 9786 0xE2, 0x5A, 0xE2, 0x5B, 0xE2, 0x5C, 0xE2, 0x5D, /* 0x00-0x03 */
9787 0xE2, 0x5E, 0xE2, 0x5F, 0xE2, 0x60, 0xE2, 0x61, /* 0x04-0x07 */ 9787 0xE2, 0x5E, 0xE2, 0x5F, 0xE2, 0x60, 0xE2, 0x61, /* 0x04-0x07 */
9788 0xE2, 0x62, 0xE2, 0x63, 0xE2, 0x64, 0xE2, 0x65, /* 0x08-0x0B */ 9788 0xE2, 0x62, 0xE2, 0x63, 0xE2, 0x64, 0xE2, 0x65, /* 0x08-0x0B */
@@ -9850,7 +9850,7 @@ static unsigned char u2c_92[512] = {
9850 0xE4, 0x93, 0xE4, 0x94, 0xE4, 0x95, 0xE4, 0x96, /* 0xFC-0xFF */ 9850 0xE4, 0x93, 0xE4, 0x94, 0xE4, 0x95, 0xE4, 0x96, /* 0xFC-0xFF */
9851}; 9851};
9852 9852
9853static unsigned char u2c_93[512] = { 9853static const unsigned char u2c_93[512] = {
9854 0xE4, 0x97, 0xE4, 0x98, 0xE4, 0x99, 0xE4, 0x9A, /* 0x00-0x03 */ 9854 0xE4, 0x97, 0xE4, 0x98, 0xE4, 0x99, 0xE4, 0x9A, /* 0x00-0x03 */
9855 0xE4, 0x9B, 0xE4, 0x9C, 0xE4, 0x9D, 0xE4, 0x9E, /* 0x04-0x07 */ 9855 0xE4, 0x9B, 0xE4, 0x9C, 0xE4, 0x9D, 0xE4, 0x9E, /* 0x04-0x07 */
9856 0xE4, 0x9F, 0xE4, 0xA0, 0xE5, 0x40, 0xE5, 0x41, /* 0x08-0x0B */ 9856 0xE4, 0x9F, 0xE4, 0xA0, 0xE5, 0x40, 0xE5, 0x41, /* 0x08-0x0B */
@@ -9918,7 +9918,7 @@ static unsigned char u2c_93[512] = {
9918 0xE7, 0x6D, 0xE7, 0x6E, 0xE7, 0x6F, 0xE7, 0x70, /* 0xFC-0xFF */ 9918 0xE7, 0x6D, 0xE7, 0x6E, 0xE7, 0x6F, 0xE7, 0x70, /* 0xFC-0xFF */
9919}; 9919};
9920 9920
9921static unsigned char u2c_94[512] = { 9921static const unsigned char u2c_94[512] = {
9922 0xE7, 0x71, 0xE7, 0x72, 0xE7, 0x73, 0xE7, 0x74, /* 0x00-0x03 */ 9922 0xE7, 0x71, 0xE7, 0x72, 0xE7, 0x73, 0xE7, 0x74, /* 0x00-0x03 */
9923 0xE7, 0x75, 0xE7, 0x76, 0xE7, 0x77, 0xE7, 0x78, /* 0x04-0x07 */ 9923 0xE7, 0x75, 0xE7, 0x76, 0xE7, 0x77, 0xE7, 0x78, /* 0x04-0x07 */
9924 0xE7, 0x79, 0xE7, 0x7A, 0xE7, 0x7B, 0xE7, 0x7C, /* 0x08-0x0B */ 9924 0xE7, 0x79, 0xE7, 0x7A, 0xE7, 0x7B, 0xE7, 0x7C, /* 0x08-0x0B */
@@ -9986,7 +9986,7 @@ static unsigned char u2c_94[512] = {
9986 0xEF, 0xAA, 0xEF, 0xAB, 0xC1, 0xB4, 0xEF, 0xAC, /* 0xFC-0xFF */ 9986 0xEF, 0xAA, 0xEF, 0xAB, 0xC1, 0xB4, 0xEF, 0xAC, /* 0xFC-0xFF */
9987}; 9987};
9988 9988
9989static unsigned char u2c_95[512] = { 9989static const unsigned char u2c_95[512] = {
9990 0xCF, 0xFA, 0xCB, 0xF8, 0xEF, 0xAE, 0xEF, 0xAD, /* 0x00-0x03 */ 9990 0xCF, 0xFA, 0xCB, 0xF8, 0xEF, 0xAE, 0xEF, 0xAD, /* 0x00-0x03 */
9991 0xB3, 0xFA, 0xB9, 0xF8, 0xEF, 0xAF, 0xEF, 0xB0, /* 0x04-0x07 */ 9991 0xB3, 0xFA, 0xB9, 0xF8, 0xEF, 0xAF, 0xEF, 0xB0, /* 0x04-0x07 */
9992 0xD0, 0xE2, 0xEF, 0xB1, 0xEF, 0xB2, 0xB7, 0xE6, /* 0x08-0x0B */ 9992 0xD0, 0xE2, 0xEF, 0xB1, 0xEF, 0xB2, 0xB7, 0xE6, /* 0x08-0x0B */
@@ -10054,7 +10054,7 @@ static unsigned char u2c_95[512] = {
10054 0xE3, 0xCB, 0xC3, 0xF6, 0xE3, 0xCC, 0xEA, 0x5D, /* 0xFC-0xFF */ 10054 0xE3, 0xCB, 0xC3, 0xF6, 0xE3, 0xCC, 0xEA, 0x5D, /* 0xFC-0xFF */
10055}; 10055};
10056 10056
10057static unsigned char u2c_96[512] = { 10057static const unsigned char u2c_96[512] = {
10058 0xB7, 0xA7, 0xB8, 0xF3, 0xBA, 0xD2, 0xE3, 0xCD, /* 0x00-0x03 */ 10058 0xB7, 0xA7, 0xB8, 0xF3, 0xBA, 0xD2, 0xE3, 0xCD, /* 0x00-0x03 */
10059 0xE3, 0xCE, 0xD4, 0xC4, 0xE3, 0xCF, 0xEA, 0x5E, /* 0x04-0x07 */ 10059 0xE3, 0xCE, 0xD4, 0xC4, 0xE3, 0xCF, 0xEA, 0x5E, /* 0x04-0x07 */
10060 0xE3, 0xD0, 0xD1, 0xCB, 0xE3, 0xD1, 0xE3, 0xD2, /* 0x08-0x0B */ 10060 0xE3, 0xD0, 0xD1, 0xCB, 0xE3, 0xD1, 0xE3, 0xD2, /* 0x08-0x0B */
@@ -10122,7 +10122,7 @@ static unsigned char u2c_96[512] = {
10122 0xEB, 0x8B, 0xEB, 0x8C, 0xCE, 0xED, 0xEB, 0x8D, /* 0xFC-0xFF */ 10122 0xEB, 0x8B, 0xEB, 0x8C, 0xCE, 0xED, 0xEB, 0x8D, /* 0xFC-0xFF */
10123}; 10123};
10124 10124
10125static unsigned char u2c_97[512] = { 10125static const unsigned char u2c_97[512] = {
10126 0xD0, 0xE8, 0xF6, 0xAB, 0xEB, 0x8E, 0xEB, 0x8F, /* 0x00-0x03 */ 10126 0xD0, 0xE8, 0xF6, 0xAB, 0xEB, 0x8E, 0xEB, 0x8F, /* 0x00-0x03 */
10127 0xCF, 0xF6, 0xEB, 0x90, 0xF6, 0xAA, 0xD5, 0xF0, /* 0x04-0x07 */ 10127 0xCF, 0xF6, 0xEB, 0x90, 0xF6, 0xAA, 0xD5, 0xF0, /* 0x04-0x07 */
10128 0xF6, 0xAC, 0xC3, 0xB9, 0xEB, 0x91, 0xEB, 0x92, /* 0x08-0x0B */ 10128 0xF6, 0xAC, 0xC3, 0xB9, 0xEB, 0x91, 0xEB, 0x92, /* 0x08-0x0B */
@@ -10190,7 +10190,7 @@ static unsigned char u2c_97[512] = {
10190 0xED, 0x8E, 0xED, 0x8F, 0xED, 0x90, 0xED, 0x91, /* 0xFC-0xFF */ 10190 0xED, 0x8E, 0xED, 0x8F, 0xED, 0x90, 0xED, 0x91, /* 0xFC-0xFF */
10191}; 10191};
10192 10192
10193static unsigned char u2c_98[512] = { 10193static const unsigned char u2c_98[512] = {
10194 0xED, 0x92, 0xED, 0x93, 0xED, 0x94, 0xED, 0x95, /* 0x00-0x03 */ 10194 0xED, 0x92, 0xED, 0x93, 0xED, 0x94, 0xED, 0x95, /* 0x00-0x03 */
10195 0xED, 0x96, 0xED, 0x97, 0xED, 0x98, 0xED, 0x99, /* 0x04-0x07 */ 10195 0xED, 0x96, 0xED, 0x97, 0xED, 0x98, 0xED, 0x99, /* 0x04-0x07 */
10196 0xED, 0x9A, 0xED, 0x9B, 0xED, 0x9C, 0xED, 0x9D, /* 0x08-0x0B */ 10196 0xED, 0x9A, 0xED, 0x9B, 0xED, 0x9C, 0xED, 0x9D, /* 0x08-0x0B */
@@ -10258,7 +10258,7 @@ static unsigned char u2c_98[512] = {
10258 0xEF, 0x95, 0xEF, 0x96, 0xEF, 0x97, 0xEF, 0x98, /* 0xFC-0xFF */ 10258 0xEF, 0x95, 0xEF, 0x96, 0xEF, 0x97, 0xEF, 0x98, /* 0xFC-0xFF */
10259}; 10259};
10260 10260
10261static unsigned char u2c_99[512] = { 10261static const unsigned char u2c_99[512] = {
10262 0xEF, 0x99, 0xEF, 0x9A, 0xEF, 0x9B, 0xEF, 0x9C, /* 0x00-0x03 */ 10262 0xEF, 0x99, 0xEF, 0x9A, 0xEF, 0x9B, 0xEF, 0x9C, /* 0x00-0x03 */
10263 0xEF, 0x9D, 0xEF, 0x9E, 0xEF, 0x9F, 0xEF, 0xA0, /* 0x04-0x07 */ 10263 0xEF, 0x9D, 0xEF, 0x9E, 0xEF, 0x9F, 0xEF, 0xA0, /* 0x04-0x07 */
10264 0xF0, 0x40, 0xF0, 0x41, 0xF0, 0x42, 0xF0, 0x43, /* 0x08-0x0B */ 10264 0xF0, 0x40, 0xF0, 0x41, 0xF0, 0x42, 0xF0, 0x43, /* 0x08-0x0B */
@@ -10326,7 +10326,7 @@ static unsigned char u2c_99[512] = {
10326 0xF2, 0x42, 0xF2, 0x43, 0xF2, 0x44, 0xF2, 0x45, /* 0xFC-0xFF */ 10326 0xF2, 0x42, 0xF2, 0x43, 0xF2, 0x44, 0xF2, 0x45, /* 0xFC-0xFF */
10327}; 10327};
10328 10328
10329static unsigned char u2c_9A[512] = { 10329static const unsigned char u2c_9A[512] = {
10330 0xF2, 0x46, 0xF2, 0x47, 0xF2, 0x48, 0xF2, 0x49, /* 0x00-0x03 */ 10330 0xF2, 0x46, 0xF2, 0x47, 0xF2, 0x48, 0xF2, 0x49, /* 0x00-0x03 */
10331 0xF2, 0x4A, 0xF2, 0x4B, 0xF2, 0x4C, 0xF2, 0x4D, /* 0x04-0x07 */ 10331 0xF2, 0x4A, 0xF2, 0x4B, 0xF2, 0x4C, 0xF2, 0x4D, /* 0x04-0x07 */
10332 0xF2, 0x4E, 0xF2, 0x4F, 0xF2, 0x50, 0xF2, 0x51, /* 0x08-0x0B */ 10332 0xF2, 0x4E, 0xF2, 0x4F, 0xF2, 0x50, 0xF2, 0x51, /* 0x08-0x0B */
@@ -10394,7 +10394,7 @@ static unsigned char u2c_9A[512] = {
10394 0xF3, 0x97, 0xF3, 0x98, 0xF3, 0x99, 0xF3, 0x9A, /* 0xFC-0xFF */ 10394 0xF3, 0x97, 0xF3, 0x98, 0xF3, 0x99, 0xF3, 0x9A, /* 0xFC-0xFF */
10395}; 10395};
10396 10396
10397static unsigned char u2c_9B[512] = { 10397static const unsigned char u2c_9B[512] = {
10398 0xF3, 0x9B, 0xF3, 0x9C, 0xF3, 0x9D, 0xD7, 0xD7, /* 0x00-0x03 */ 10398 0xF3, 0x9B, 0xF3, 0x9C, 0xF3, 0x9D, 0xD7, 0xD7, /* 0x00-0x03 */
10399 0xF3, 0x9E, 0xF3, 0x9F, 0xF3, 0xA0, 0xF4, 0x40, /* 0x04-0x07 */ 10399 0xF3, 0x9E, 0xF3, 0x9F, 0xF3, 0xA0, 0xF4, 0x40, /* 0x04-0x07 */
10400 0xF7, 0xDC, 0xF4, 0x41, 0xF4, 0x42, 0xF4, 0x43, /* 0x08-0x0B */ 10400 0xF7, 0xDC, 0xF4, 0x41, 0xF4, 0x42, 0xF4, 0x43, /* 0x08-0x0B */
@@ -10462,7 +10462,7 @@ static unsigned char u2c_9B[512] = {
10462 0xF6, 0x60, 0xF6, 0x61, 0xF6, 0x62, 0xF6, 0x63, /* 0xFC-0xFF */ 10462 0xF6, 0x60, 0xF6, 0x61, 0xF6, 0x62, 0xF6, 0x63, /* 0xFC-0xFF */
10463}; 10463};
10464 10464
10465static unsigned char u2c_9C[512] = { 10465static const unsigned char u2c_9C[512] = {
10466 0xF6, 0x64, 0xF6, 0x65, 0xF6, 0x66, 0xF6, 0x67, /* 0x00-0x03 */ 10466 0xF6, 0x64, 0xF6, 0x65, 0xF6, 0x66, 0xF6, 0x67, /* 0x00-0x03 */
10467 0xF6, 0x68, 0xF6, 0x69, 0xF6, 0x6A, 0xF6, 0x6B, /* 0x04-0x07 */ 10467 0xF6, 0x68, 0xF6, 0x69, 0xF6, 0x6A, 0xF6, 0x6B, /* 0x04-0x07 */
10468 0xF6, 0x6C, 0xF6, 0x6D, 0xF6, 0x6E, 0xF6, 0x6F, /* 0x08-0x0B */ 10468 0xF6, 0x6C, 0xF6, 0x6D, 0xF6, 0x6E, 0xF6, 0x6F, /* 0x08-0x0B */
@@ -10530,7 +10530,7 @@ static unsigned char u2c_9C[512] = {
10530 0xF8, 0x59, 0xF8, 0x5A, 0xF8, 0x5B, 0xF8, 0x5C, /* 0xFC-0xFF */ 10530 0xF8, 0x59, 0xF8, 0x5A, 0xF8, 0x5B, 0xF8, 0x5C, /* 0xFC-0xFF */
10531}; 10531};
10532 10532
10533static unsigned char u2c_9D[512] = { 10533static const unsigned char u2c_9D[512] = {
10534 0xF8, 0x5D, 0xF8, 0x5E, 0xF8, 0x5F, 0xF8, 0x60, /* 0x00-0x03 */ 10534 0xF8, 0x5D, 0xF8, 0x5E, 0xF8, 0x5F, 0xF8, 0x60, /* 0x00-0x03 */
10535 0xF8, 0x61, 0xF8, 0x62, 0xF8, 0x63, 0xF8, 0x64, /* 0x04-0x07 */ 10535 0xF8, 0x61, 0xF8, 0x62, 0xF8, 0x63, 0xF8, 0x64, /* 0x04-0x07 */
10536 0xF8, 0x65, 0xF8, 0x66, 0xF8, 0x67, 0xF8, 0x68, /* 0x08-0x0B */ 10536 0xF8, 0x65, 0xF8, 0x66, 0xF8, 0x67, 0xF8, 0x68, /* 0x08-0x0B */
@@ -10598,7 +10598,7 @@ static unsigned char u2c_9D[512] = {
10598 0xFA, 0x9A, 0xFA, 0x9B, 0xFA, 0x9C, 0xFA, 0x9D, /* 0xFC-0xFF */ 10598 0xFA, 0x9A, 0xFA, 0x9B, 0xFA, 0x9C, 0xFA, 0x9D, /* 0xFC-0xFF */
10599}; 10599};
10600 10600
10601static unsigned char u2c_9E[512] = { 10601static const unsigned char u2c_9E[512] = {
10602 0xFA, 0x9E, 0xFA, 0x9F, 0xFA, 0xA0, 0xFB, 0x40, /* 0x00-0x03 */ 10602 0xFA, 0x9E, 0xFA, 0x9F, 0xFA, 0xA0, 0xFB, 0x40, /* 0x00-0x03 */
10603 0xFB, 0x41, 0xFB, 0x42, 0xFB, 0x43, 0xFB, 0x44, /* 0x04-0x07 */ 10603 0xFB, 0x41, 0xFB, 0x42, 0xFB, 0x43, 0xFB, 0x44, /* 0x04-0x07 */
10604 0xFB, 0x45, 0xFB, 0x46, 0xFB, 0x47, 0xFB, 0x48, /* 0x08-0x0B */ 10604 0xFB, 0x45, 0xFB, 0x46, 0xFB, 0x47, 0xFB, 0x48, /* 0x08-0x0B */
@@ -10666,7 +10666,7 @@ static unsigned char u2c_9E[512] = {
10666 0xED, 0xEB, 0xFC, 0x77, 0xF6, 0xBC, 0xFC, 0x78, /* 0xFC-0xFF */ 10666 0xED, 0xEB, 0xFC, 0x77, 0xF6, 0xBC, 0xFC, 0x78, /* 0xFC-0xFF */
10667}; 10667};
10668 10668
10669static unsigned char u2c_9F[512] = { 10669static const unsigned char u2c_9F[512] = {
10670 0xFC, 0x79, 0xFC, 0x7A, 0xFC, 0x7B, 0xFC, 0x7C, /* 0x00-0x03 */ 10670 0xFC, 0x79, 0xFC, 0x7A, 0xFC, 0x7B, 0xFC, 0x7C, /* 0x00-0x03 */
10671 0xFC, 0x7D, 0xFC, 0x7E, 0xFC, 0x80, 0xFC, 0x81, /* 0x04-0x07 */ 10671 0xFC, 0x7D, 0xFC, 0x7E, 0xFC, 0x80, 0xFC, 0x81, /* 0x04-0x07 */
10672 0xFC, 0x82, 0xFC, 0x83, 0xFC, 0x84, 0xF6, 0xBD, /* 0x08-0x0B */ 10672 0xFC, 0x82, 0xFC, 0x83, 0xFC, 0x84, 0xF6, 0xBD, /* 0x08-0x0B */
@@ -10712,11 +10712,11 @@ static unsigned char u2c_9F[512] = {
10712 0xFD, 0x9A, 0xFD, 0x9B, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */ 10712 0xFD, 0x9A, 0xFD, 0x9B, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */
10713}; 10713};
10714 10714
10715static unsigned char u2c_DC[512] = { 10715static const unsigned char u2c_DC[512] = {
10716 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10716 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10717}; 10717};
10718 10718
10719static unsigned char u2c_F9[512] = { 10719static const unsigned char u2c_F9[512] = {
10720 0xD8, 0x4D, 0xB8, 0xFC, 0xDC, 0x87, 0xD9, 0x5A, /* 0x00-0x03 */ 10720 0xD8, 0x4D, 0xB8, 0xFC, 0xDC, 0x87, 0xD9, 0x5A, /* 0x00-0x03 */
10721 0xBB, 0xAC, 0xB4, 0xAE, 0xBE, 0xE4, 0xFD, 0x94, /* 0x04-0x07 */ 10721 0xBB, 0xAC, 0xB4, 0xAE, 0xBE, 0xE4, 0xFD, 0x94, /* 0x04-0x07 */
10722 0xFD, 0x94, 0xC6, 0xF5, 0xBD, 0xF0, 0xC0, 0xAE, /* 0x08-0x0B */ 10722 0xFD, 0x94, 0xC6, 0xF5, 0xBD, 0xF0, 0xC0, 0xAE, /* 0x08-0x0B */
@@ -10784,7 +10784,7 @@ static unsigned char u2c_F9[512] = {
10784 0xD7, 0x52, 0xCA, 0xB2, 0xB2, 0xE8, 0xB4, 0xCC, /* 0xFC-0xFF */ 10784 0xD7, 0x52, 0xCA, 0xB2, 0xB2, 0xE8, 0xB4, 0xCC, /* 0xFC-0xFF */
10785}; 10785};
10786 10786
10787static unsigned char u2c_FA[512] = { 10787static const unsigned char u2c_FA[512] = {
10788 0xC7, 0xD0, 0xB6, 0xC8, 0xCD, 0xD8, 0xCC, 0xC7, /* 0x00-0x03 */ 10788 0xC7, 0xD0, 0xB6, 0xC8, 0xCD, 0xD8, 0xCC, 0xC7, /* 0x00-0x03 */
10789 0xD5, 0xAC, 0xB6, 0xB4, 0xB1, 0xA9, 0xDD, 0x97, /* 0x04-0x07 */ 10789 0xD5, 0xAC, 0xB6, 0xB4, 0xB1, 0xA9, 0xDD, 0x97, /* 0x04-0x07 */
10790 0xD0, 0xD0, 0xBD, 0xB5, 0xD2, 0x8A, 0xC0, 0xAA, /* 0x08-0x0B */ 10790 0xD0, 0xD0, 0xBD, 0xB5, 0xD2, 0x8A, 0xC0, 0xAA, /* 0x08-0x0B */
@@ -10799,7 +10799,7 @@ static unsigned char u2c_FA[512] = {
10799 0xF0, 0x5E, 0xFA, 0x51, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */ 10799 0xF0, 0x5E, 0xFA, 0x51, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
10800}; 10800};
10801 10801
10802static unsigned char u2c_FE[512] = { 10802static const unsigned char u2c_FE[512] = {
10803 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10803 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10804 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10804 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10805 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10805 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10829,7 +10829,7 @@ static unsigned char u2c_FE[512] = {
10829 0xA9, 0x85, 0xA9, 0x86, 0xA9, 0x87, 0xA9, 0x88, /* 0x68-0x6B */ 10829 0xA9, 0x85, 0xA9, 0x86, 0xA9, 0x87, 0xA9, 0x88, /* 0x68-0x6B */
10830}; 10830};
10831 10831
10832static unsigned char u2c_FF[512] = { 10832static const unsigned char u2c_FF[512] = {
10833 0x00, 0x00, 0xA3, 0xA1, 0xA3, 0xA2, 0xA3, 0xA3, /* 0x00-0x03 */ 10833 0x00, 0x00, 0xA3, 0xA1, 0xA3, 0xA2, 0xA3, 0xA3, /* 0x00-0x03 */
10834 0xA1, 0xE7, 0xA3, 0xA5, 0xA3, 0xA6, 0xA3, 0xA7, /* 0x04-0x07 */ 10834 0xA1, 0xE7, 0xA3, 0xA5, 0xA3, 0xA6, 0xA3, 0xA7, /* 0x04-0x07 */
10835 0xA3, 0xA8, 0xA3, 0xA9, 0xA3, 0xAA, 0xA3, 0xAB, /* 0x08-0x0B */ 10835 0xA3, 0xA8, 0xA3, 0xA9, 0xA3, 0xAA, 0xA3, 0xAB, /* 0x08-0x0B */
@@ -10891,7 +10891,7 @@ static unsigned char u2c_FF[512] = {
10891 0xA9, 0x57, 0xA3, 0xA4, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */ 10891 0xA9, 0x57, 0xA3, 0xA4, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
10892}; 10892};
10893 10893
10894static unsigned char *page_uni2charset[256] = { 10894static const unsigned char *const page_uni2charset[256] = {
10895 u2c_00, u2c_01, u2c_02, u2c_03, u2c_04, NULL, NULL, NULL, 10895 u2c_00, u2c_01, u2c_02, u2c_03, u2c_04, NULL, NULL, NULL,
10896 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10896 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
10897 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10897 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -10925,7 +10925,7 @@ static unsigned char *page_uni2charset[256] = {
10925 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10925 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
10926 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, u2c_FE, u2c_FF, }; 10926 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, u2c_FE, u2c_FF, };
10927 10927
10928static unsigned char charset2lower[256] = { 10928static const unsigned char charset2lower[256] = {
10929 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 10929 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
10930 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 10930 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
10931 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 10931 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -10961,7 +10961,7 @@ static unsigned char charset2lower[256] = {
10961 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 10961 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
10962}; 10962};
10963 10963
10964static unsigned char charset2upper[256] = { 10964static const unsigned char charset2upper[256] = {
10965 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 10965 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
10966 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 10966 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
10967 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 10967 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -11000,7 +11000,7 @@ static unsigned char charset2upper[256] = {
11000static int uni2char(const wchar_t uni, 11000static int uni2char(const wchar_t uni,
11001 unsigned char *out, int boundlen) 11001 unsigned char *out, int boundlen)
11002{ 11002{
11003 unsigned char *uni2charset; 11003 const unsigned char *uni2charset;
11004 unsigned char cl = uni&0xFF; 11004 unsigned char cl = uni&0xFF;
11005 unsigned char ch = (uni>>8)&0xFF; 11005 unsigned char ch = (uni>>8)&0xFF;
11006 unsigned char out0,out1; 11006 unsigned char out0,out1;
@@ -11050,7 +11050,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
11050 wchar_t *uni) 11050 wchar_t *uni)
11051{ 11051{
11052 unsigned char ch, cl; 11052 unsigned char ch, cl;
11053 wchar_t *charset2uni; 11053 const wchar_t *charset2uni;
11054 int n; 11054 int n;
11055 11055
11056 if (boundlen <= 0) 11056 if (boundlen <= 0)
diff --git a/fs/nls/nls_cp949.c b/fs/nls/nls_cp949.c
index 92ae19372f0f..8a7a2fe85c65 100644
--- a/fs/nls/nls_cp949.c
+++ b/fs/nls/nls_cp949.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t c2u_81[256] = { 16static const wchar_t c2u_81[256] = {
17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_81[256] = {
49 0xAD09,0xAD0A,0xAD0B,0xAD0E,0xAD10,0xAD12,0xAD13,0x0000,/* 0xF8-0xFF */ 49 0xAD09,0xAD0A,0xAD0B,0xAD0E,0xAD10,0xAD12,0xAD13,0x0000,/* 0xF8-0xFF */
50}; 50};
51 51
52static wchar_t c2u_82[256] = { 52static const wchar_t c2u_82[256] = {
53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -85,7 +85,7 @@ static wchar_t c2u_82[256] = {
85 0xADF1,0xADF2,0xADF3,0xADF4,0xADF5,0xADF6,0xADF7,0x0000,/* 0xF8-0xFF */ 85 0xADF1,0xADF2,0xADF3,0xADF4,0xADF5,0xADF6,0xADF7,0x0000,/* 0xF8-0xFF */
86}; 86};
87 87
88static wchar_t c2u_83[256] = { 88static const wchar_t c2u_83[256] = {
89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
91 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 91 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -121,7 +121,7 @@ static wchar_t c2u_83[256] = {
121 0xAEDF,0xAEE0,0xAEE1,0xAEE2,0xAEE3,0xAEE4,0xAEE5,0x0000,/* 0xF8-0xFF */ 121 0xAEDF,0xAEE0,0xAEE1,0xAEE2,0xAEE3,0xAEE4,0xAEE5,0x0000,/* 0xF8-0xFF */
122}; 122};
123 123
124static wchar_t c2u_84[256] = { 124static const wchar_t c2u_84[256] = {
125 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 125 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
126 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 126 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
127 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 127 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -157,7 +157,7 @@ static wchar_t c2u_84[256] = {
157 0xAFB5,0xAFB6,0xAFB7,0xAFBA,0xAFBB,0xAFBD,0xAFBE,0x0000,/* 0xF8-0xFF */ 157 0xAFB5,0xAFB6,0xAFB7,0xAFBA,0xAFBB,0xAFBD,0xAFBE,0x0000,/* 0xF8-0xFF */
158}; 158};
159 159
160static wchar_t c2u_85[256] = { 160static const wchar_t c2u_85[256] = {
161 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 161 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
162 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 162 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
163 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 163 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -193,7 +193,7 @@ static wchar_t c2u_85[256] = {
193 0xB096,0xB097,0xB09B,0xB09D,0xB09E,0xB0A3,0xB0A4,0x0000,/* 0xF8-0xFF */ 193 0xB096,0xB097,0xB09B,0xB09D,0xB09E,0xB0A3,0xB0A4,0x0000,/* 0xF8-0xFF */
194}; 194};
195 195
196static wchar_t c2u_86[256] = { 196static const wchar_t c2u_86[256] = {
197 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 197 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
198 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 198 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
199 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 199 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -229,7 +229,7 @@ static wchar_t c2u_86[256] = {
229 0xB195,0xB196,0xB197,0xB199,0xB19A,0xB19B,0xB19D,0x0000,/* 0xF8-0xFF */ 229 0xB195,0xB196,0xB197,0xB199,0xB19A,0xB19B,0xB19D,0x0000,/* 0xF8-0xFF */
230}; 230};
231 231
232static wchar_t c2u_87[256] = { 232static const wchar_t c2u_87[256] = {
233 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 233 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
234 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 234 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
235 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 235 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -265,7 +265,7 @@ static wchar_t c2u_87[256] = {
265 0xB266,0xB267,0xB26A,0xB26B,0xB26C,0xB26D,0xB26E,0x0000,/* 0xF8-0xFF */ 265 0xB266,0xB267,0xB26A,0xB26B,0xB26C,0xB26D,0xB26E,0x0000,/* 0xF8-0xFF */
266}; 266};
267 267
268static wchar_t c2u_88[256] = { 268static const wchar_t c2u_88[256] = {
269 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 269 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
270 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 270 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
271 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 271 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -301,7 +301,7 @@ static wchar_t c2u_88[256] = {
301 0xB359,0xB35A,0xB35D,0xB360,0xB361,0xB362,0xB363,0x0000,/* 0xF8-0xFF */ 301 0xB359,0xB35A,0xB35D,0xB360,0xB361,0xB362,0xB363,0x0000,/* 0xF8-0xFF */
302}; 302};
303 303
304static wchar_t c2u_89[256] = { 304static const wchar_t c2u_89[256] = {
305 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 305 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
306 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 306 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
307 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 307 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -337,7 +337,7 @@ static wchar_t c2u_89[256] = {
337 0xB43E,0xB43F,0xB440,0xB441,0xB442,0xB443,0xB444,0x0000,/* 0xF8-0xFF */ 337 0xB43E,0xB43F,0xB440,0xB441,0xB442,0xB443,0xB444,0x0000,/* 0xF8-0xFF */
338}; 338};
339 339
340static wchar_t c2u_8A[256] = { 340static const wchar_t c2u_8A[256] = {
341 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 341 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
342 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 342 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
343 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 343 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -373,7 +373,7 @@ static wchar_t c2u_8A[256] = {
373 0xB512,0xB513,0xB516,0xB517,0xB519,0xB51A,0xB51D,0x0000,/* 0xF8-0xFF */ 373 0xB512,0xB513,0xB516,0xB517,0xB519,0xB51A,0xB51D,0x0000,/* 0xF8-0xFF */
374}; 374};
375 375
376static wchar_t c2u_8B[256] = { 376static const wchar_t c2u_8B[256] = {
377 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 377 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
378 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 378 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -409,7 +409,7 @@ static wchar_t c2u_8B[256] = {
409 0xB5F9,0xB5FA,0xB5FB,0xB5FC,0xB5FD,0xB5FE,0xB5FF,0x0000,/* 0xF8-0xFF */ 409 0xB5F9,0xB5FA,0xB5FB,0xB5FC,0xB5FD,0xB5FE,0xB5FF,0x0000,/* 0xF8-0xFF */
410}; 410};
411 411
412static wchar_t c2u_8C[256] = { 412static const wchar_t c2u_8C[256] = {
413 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 413 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
414 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 414 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
415 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 415 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -445,7 +445,7 @@ static wchar_t c2u_8C[256] = {
445 0xB6BC,0xB6BD,0xB6BE,0xB6BF,0xB6C0,0xB6C1,0xB6C2,0x0000,/* 0xF8-0xFF */ 445 0xB6BC,0xB6BD,0xB6BE,0xB6BF,0xB6C0,0xB6C1,0xB6C2,0x0000,/* 0xF8-0xFF */
446}; 446};
447 447
448static wchar_t c2u_8D[256] = { 448static const wchar_t c2u_8D[256] = {
449 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 449 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
450 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 450 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -481,7 +481,7 @@ static wchar_t c2u_8D[256] = {
481 0xB793,0xB794,0xB795,0xB79A,0xB79B,0xB79D,0xB79E,0x0000,/* 0xF8-0xFF */ 481 0xB793,0xB794,0xB795,0xB79A,0xB79B,0xB79D,0xB79E,0x0000,/* 0xF8-0xFF */
482}; 482};
483 483
484static wchar_t c2u_8E[256] = { 484static const wchar_t c2u_8E[256] = {
485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -517,7 +517,7 @@ static wchar_t c2u_8E[256] = {
517 0xB87E,0xB87F,0xB880,0xB881,0xB882,0xB883,0xB884,0x0000,/* 0xF8-0xFF */ 517 0xB87E,0xB87F,0xB880,0xB881,0xB882,0xB883,0xB884,0x0000,/* 0xF8-0xFF */
518}; 518};
519 519
520static wchar_t c2u_8F[256] = { 520static const wchar_t c2u_8F[256] = {
521 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 521 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
522 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 522 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
523 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 523 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -553,7 +553,7 @@ static wchar_t c2u_8F[256] = {
553 0xB950,0xB952,0xB953,0xB954,0xB955,0xB956,0xB957,0x0000,/* 0xF8-0xFF */ 553 0xB950,0xB952,0xB953,0xB954,0xB955,0xB956,0xB957,0x0000,/* 0xF8-0xFF */
554}; 554};
555 555
556static wchar_t c2u_90[256] = { 556static const wchar_t c2u_90[256] = {
557 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 557 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
558 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 558 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
559 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 559 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -589,7 +589,7 @@ static wchar_t c2u_90[256] = {
589 0xBA3E,0xBA3F,0xBA41,0xBA43,0xBA44,0xBA45,0xBA46,0x0000,/* 0xF8-0xFF */ 589 0xBA3E,0xBA3F,0xBA41,0xBA43,0xBA44,0xBA45,0xBA46,0x0000,/* 0xF8-0xFF */
590}; 590};
591 591
592static wchar_t c2u_91[256] = { 592static const wchar_t c2u_91[256] = {
593 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 593 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
594 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 594 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
595 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 595 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -625,7 +625,7 @@ static wchar_t c2u_91[256] = {
625 0xBB21,0xBB22,0xBB23,0xBB24,0xBB25,0xBB26,0xBB27,0x0000,/* 0xF8-0xFF */ 625 0xBB21,0xBB22,0xBB23,0xBB24,0xBB25,0xBB26,0xBB27,0x0000,/* 0xF8-0xFF */
626}; 626};
627 627
628static wchar_t c2u_92[256] = { 628static const wchar_t c2u_92[256] = {
629 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 629 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
630 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 630 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
631 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 631 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -661,7 +661,7 @@ static wchar_t c2u_92[256] = {
661 0xBBF6,0xBBF7,0xBBFA,0xBBFB,0xBBFD,0xBBFE,0xBC01,0x0000,/* 0xF8-0xFF */ 661 0xBBF6,0xBBF7,0xBBFA,0xBBFB,0xBBFD,0xBBFE,0xBC01,0x0000,/* 0xF8-0xFF */
662}; 662};
663 663
664static wchar_t c2u_93[256] = { 664static const wchar_t c2u_93[256] = {
665 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 665 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
666 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 666 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
667 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 667 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -697,7 +697,7 @@ static wchar_t c2u_93[256] = {
697 0xBCF2,0xBCF3,0xBCF7,0xBCF9,0xBCFA,0xBCFB,0xBCFD,0x0000,/* 0xF8-0xFF */ 697 0xBCF2,0xBCF3,0xBCF7,0xBCF9,0xBCFA,0xBCFB,0xBCFD,0x0000,/* 0xF8-0xFF */
698}; 698};
699 699
700static wchar_t c2u_94[256] = { 700static const wchar_t c2u_94[256] = {
701 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 701 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
702 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 702 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
703 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 703 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -733,7 +733,7 @@ static wchar_t c2u_94[256] = {
733 0xBDCB,0xBDCC,0xBDCD,0xBDCE,0xBDCF,0xBDD0,0xBDD1,0x0000,/* 0xF8-0xFF */ 733 0xBDCB,0xBDCC,0xBDCD,0xBDCE,0xBDCF,0xBDD0,0xBDD1,0x0000,/* 0xF8-0xFF */
734}; 734};
735 735
736static wchar_t c2u_95[256] = { 736static const wchar_t c2u_95[256] = {
737 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 737 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
738 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 738 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
739 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 739 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -769,7 +769,7 @@ static wchar_t c2u_95[256] = {
769 0xBEB1,0xBEB2,0xBEB3,0xBEB4,0xBEB5,0xBEB6,0xBEB7,0x0000,/* 0xF8-0xFF */ 769 0xBEB1,0xBEB2,0xBEB3,0xBEB4,0xBEB5,0xBEB6,0xBEB7,0x0000,/* 0xF8-0xFF */
770}; 770};
771 771
772static wchar_t c2u_96[256] = { 772static const wchar_t c2u_96[256] = {
773 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 773 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
774 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 774 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
775 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 775 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -805,7 +805,7 @@ static wchar_t c2u_96[256] = {
805 0xBF7C,0xBF7D,0xBF7E,0xBF7F,0xBF80,0xBF81,0xBF82,0x0000,/* 0xF8-0xFF */ 805 0xBF7C,0xBF7D,0xBF7E,0xBF7F,0xBF80,0xBF81,0xBF82,0x0000,/* 0xF8-0xFF */
806}; 806};
807 807
808static wchar_t c2u_97[256] = { 808static const wchar_t c2u_97[256] = {
809 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 809 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
810 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 810 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
811 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 811 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -841,7 +841,7 @@ static wchar_t c2u_97[256] = {
841 0xC038,0xC039,0xC03A,0xC03B,0xC03D,0xC03E,0xC03F,0x0000,/* 0xF8-0xFF */ 841 0xC038,0xC039,0xC03A,0xC03B,0xC03D,0xC03E,0xC03F,0x0000,/* 0xF8-0xFF */
842}; 842};
843 843
844static wchar_t c2u_98[256] = { 844static const wchar_t c2u_98[256] = {
845 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 845 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
846 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 846 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
847 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 847 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -877,7 +877,7 @@ static wchar_t c2u_98[256] = {
877 0xC122,0xC125,0xC128,0xC129,0xC12A,0xC12B,0xC12E,0x0000,/* 0xF8-0xFF */ 877 0xC122,0xC125,0xC128,0xC129,0xC12A,0xC12B,0xC12E,0x0000,/* 0xF8-0xFF */
878}; 878};
879 879
880static wchar_t c2u_99[256] = { 880static const wchar_t c2u_99[256] = {
881 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 881 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
882 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 882 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
883 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 883 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -913,7 +913,7 @@ static wchar_t c2u_99[256] = {
913 0xC21A,0xC21B,0xC21D,0xC21E,0xC221,0xC222,0xC223,0x0000,/* 0xF8-0xFF */ 913 0xC21A,0xC21B,0xC21D,0xC21E,0xC221,0xC222,0xC223,0x0000,/* 0xF8-0xFF */
914}; 914};
915 915
916static wchar_t c2u_9A[256] = { 916static const wchar_t c2u_9A[256] = {
917 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 917 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
918 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 918 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
919 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 919 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -949,7 +949,7 @@ static wchar_t c2u_9A[256] = {
949 0xC305,0xC306,0xC307,0xC30A,0xC30B,0xC30E,0xC30F,0x0000,/* 0xF8-0xFF */ 949 0xC305,0xC306,0xC307,0xC30A,0xC30B,0xC30E,0xC30F,0x0000,/* 0xF8-0xFF */
950}; 950};
951 951
952static wchar_t c2u_9B[256] = { 952static const wchar_t c2u_9B[256] = {
953 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 953 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
954 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 954 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
955 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 955 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -985,7 +985,7 @@ static wchar_t c2u_9B[256] = {
985 0xC3D2,0xC3D3,0xC3D4,0xC3D5,0xC3D6,0xC3D7,0xC3DA,0x0000,/* 0xF8-0xFF */ 985 0xC3D2,0xC3D3,0xC3D4,0xC3D5,0xC3D6,0xC3D7,0xC3DA,0x0000,/* 0xF8-0xFF */
986}; 986};
987 987
988static wchar_t c2u_9C[256] = { 988static const wchar_t c2u_9C[256] = {
989 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 989 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
990 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 990 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
991 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 991 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1021,7 +1021,7 @@ static wchar_t c2u_9C[256] = {
1021 0xC4A3,0xC4A4,0xC4A5,0xC4A6,0xC4A7,0xC4A8,0xC4A9,0x0000,/* 0xF8-0xFF */ 1021 0xC4A3,0xC4A4,0xC4A5,0xC4A6,0xC4A7,0xC4A8,0xC4A9,0x0000,/* 0xF8-0xFF */
1022}; 1022};
1023 1023
1024static wchar_t c2u_9D[256] = { 1024static const wchar_t c2u_9D[256] = {
1025 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1025 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1026 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1026 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1027 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1027 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1057,7 +1057,7 @@ static wchar_t c2u_9D[256] = {
1057 0xC58A,0xC58B,0xC58E,0xC590,0xC592,0xC593,0xC594,0x0000,/* 0xF8-0xFF */ 1057 0xC58A,0xC58B,0xC58E,0xC590,0xC592,0xC593,0xC594,0x0000,/* 0xF8-0xFF */
1058}; 1058};
1059 1059
1060static wchar_t c2u_9E[256] = { 1060static const wchar_t c2u_9E[256] = {
1061 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1061 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1062 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1062 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1063 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1063 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1093,7 +1093,7 @@ static wchar_t c2u_9E[256] = {
1093 0xC69E,0xC69F,0xC6A0,0xC6A1,0xC6A2,0xC6A3,0xC6A6,0x0000,/* 0xF8-0xFF */ 1093 0xC69E,0xC69F,0xC6A0,0xC6A1,0xC6A2,0xC6A3,0xC6A6,0x0000,/* 0xF8-0xFF */
1094}; 1094};
1095 1095
1096static wchar_t c2u_9F[256] = { 1096static const wchar_t c2u_9F[256] = {
1097 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1097 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1098 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1098 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1099 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1099 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1129,7 +1129,7 @@ static wchar_t c2u_9F[256] = {
1129 0xC7AF,0xC7B1,0xC7B2,0xC7B3,0xC7B5,0xC7B6,0xC7B7,0x0000,/* 0xF8-0xFF */ 1129 0xC7AF,0xC7B1,0xC7B2,0xC7B3,0xC7B5,0xC7B6,0xC7B7,0x0000,/* 0xF8-0xFF */
1130}; 1130};
1131 1131
1132static wchar_t c2u_A0[256] = { 1132static const wchar_t c2u_A0[256] = {
1133 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1133 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1134 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1134 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1135 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1135 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1165,7 +1165,7 @@ static wchar_t c2u_A0[256] = {
1165 0xC89B,0xC89C,0xC89E,0xC8A0,0xC8A2,0xC8A3,0xC8A4,0x0000,/* 0xF8-0xFF */ 1165 0xC89B,0xC89C,0xC89E,0xC8A0,0xC8A2,0xC8A3,0xC8A4,0x0000,/* 0xF8-0xFF */
1166}; 1166};
1167 1167
1168static wchar_t c2u_A1[256] = { 1168static const wchar_t c2u_A1[256] = {
1169 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1169 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1170 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1170 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1201,7 +1201,7 @@ static wchar_t c2u_A1[256] = {
1201 0x2282,0x2283,0x222A,0x2229,0x2227,0x2228,0xFFE2,0x0000,/* 0xF8-0xFF */ 1201 0x2282,0x2283,0x222A,0x2229,0x2227,0x2228,0xFFE2,0x0000,/* 0xF8-0xFF */
1202}; 1202};
1203 1203
1204static wchar_t c2u_A2[256] = { 1204static const wchar_t c2u_A2[256] = {
1205 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1205 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1206 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1206 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1234,7 +1234,7 @@ static wchar_t c2u_A2[256] = {
1234 0x2116,0x33C7,0x2122,0x33C2,0x33D8,0x2121,0x20AC,0x00AE,/* 0xE0-0xE7 */ 1234 0x2116,0x33C7,0x2122,0x33C2,0x33D8,0x2121,0x20AC,0x00AE,/* 0xE0-0xE7 */
1235}; 1235};
1236 1236
1237static wchar_t c2u_A3[256] = { 1237static const wchar_t c2u_A3[256] = {
1238 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1238 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1239 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1239 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1240 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1240 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1270,7 +1270,7 @@ static wchar_t c2u_A3[256] = {
1270 0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3,0x0000,/* 0xF8-0xFF */ 1270 0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3,0x0000,/* 0xF8-0xFF */
1271}; 1271};
1272 1272
1273static wchar_t c2u_A4[256] = { 1273static const wchar_t c2u_A4[256] = {
1274 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1274 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1275 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1275 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1276 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1276 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1306,7 +1306,7 @@ static wchar_t c2u_A4[256] = {
1306 0x3188,0x3189,0x318A,0x318B,0x318C,0x318D,0x318E,0x0000,/* 0xF8-0xFF */ 1306 0x3188,0x3189,0x318A,0x318B,0x318C,0x318D,0x318E,0x0000,/* 0xF8-0xFF */
1307}; 1307};
1308 1308
1309static wchar_t c2u_A5[256] = { 1309static const wchar_t c2u_A5[256] = {
1310 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1310 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1311 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1311 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1312 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1312 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1342,7 +1342,7 @@ static wchar_t c2u_A5[256] = {
1342 0x03C9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF8-0xFF */ 1342 0x03C9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
1343}; 1343};
1344 1344
1345static wchar_t c2u_A6[256] = { 1345static const wchar_t c2u_A6[256] = {
1346 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1346 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1347 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1347 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1348 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1348 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1375,7 +1375,7 @@ static wchar_t c2u_A6[256] = {
1375 0x2546,0x2547,0x2548,0x2549,0x254A,0x0000,0x0000,0x0000,/* 0xE0-0xE7 */ 1375 0x2546,0x2547,0x2548,0x2549,0x254A,0x0000,0x0000,0x0000,/* 0xE0-0xE7 */
1376}; 1376};
1377 1377
1378static wchar_t c2u_A7[256] = { 1378static const wchar_t c2u_A7[256] = {
1379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1379 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1380 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1380 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1381 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1381 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1409,7 +1409,7 @@ static wchar_t c2u_A7[256] = {
1409 0x33AC,0x33DD,0x33D0,0x33D3,0x33C3,0x33C9,0x33DC,0x33C6,/* 0xE8-0xEF */ 1409 0x33AC,0x33DD,0x33D0,0x33D3,0x33C3,0x33C9,0x33DC,0x33C6,/* 0xE8-0xEF */
1410}; 1410};
1411 1411
1412static wchar_t c2u_A8[256] = { 1412static const wchar_t c2u_A8[256] = {
1413 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1413 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1414 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1414 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1415 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1415 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1445,7 +1445,7 @@ static wchar_t c2u_A8[256] = {
1445 0x2154,0x00BC,0x00BE,0x215B,0x215C,0x215D,0x215E,0x0000,/* 0xF8-0xFF */ 1445 0x2154,0x00BC,0x00BE,0x215B,0x215C,0x215D,0x215E,0x0000,/* 0xF8-0xFF */
1446}; 1446};
1447 1447
1448static wchar_t c2u_A9[256] = { 1448static const wchar_t c2u_A9[256] = {
1449 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1449 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1450 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1450 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1451 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1481,7 +1481,7 @@ static wchar_t c2u_A9[256] = {
1481 0x00B3,0x2074,0x207F,0x2081,0x2082,0x2083,0x2084,0x0000,/* 0xF8-0xFF */ 1481 0x00B3,0x2074,0x207F,0x2081,0x2082,0x2083,0x2084,0x0000,/* 0xF8-0xFF */
1482}; 1482};
1483 1483
1484static wchar_t c2u_AA[256] = { 1484static const wchar_t c2u_AA[256] = {
1485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1485 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1486 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1487 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1516,7 +1516,7 @@ static wchar_t c2u_AA[256] = {
1516 0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */ 1516 0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
1517}; 1517};
1518 1518
1519static wchar_t c2u_AB[256] = { 1519static const wchar_t c2u_AB[256] = {
1520 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1520 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1521 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1521 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1522 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1522 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1551,7 +1551,7 @@ static wchar_t c2u_AB[256] = {
1551 0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,/* 0xF0-0xF7 */ 1551 0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,/* 0xF0-0xF7 */
1552}; 1552};
1553 1553
1554static wchar_t c2u_AC[256] = { 1554static const wchar_t c2u_AC[256] = {
1555 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1555 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1556 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1556 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1557 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1557 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1586,7 +1586,7 @@ static wchar_t c2u_AC[256] = {
1586 0x044E,0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */ 1586 0x044E,0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
1587}; 1587};
1588 1588
1589static wchar_t c2u_AD[256] = { 1589static const wchar_t c2u_AD[256] = {
1590 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1590 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1591 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1591 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1592 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1592 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1611,7 +1611,7 @@ static wchar_t c2u_AD[256] = {
1611 0xCDC5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1611 0xCDC5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1612}; 1612};
1613 1613
1614static wchar_t c2u_AE[256] = { 1614static const wchar_t c2u_AE[256] = {
1615 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1615 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1616 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1616 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1617 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1617 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1636,7 +1636,7 @@ static wchar_t c2u_AE[256] = {
1636 0xCE2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1636 0xCE2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1637}; 1637};
1638 1638
1639static wchar_t c2u_AF[256] = { 1639static const wchar_t c2u_AF[256] = {
1640 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1640 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1641 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1641 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1642 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1642 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1661,7 +1661,7 @@ static wchar_t c2u_AF[256] = {
1661 0xCE99,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */ 1661 0xCE99,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
1662}; 1662};
1663 1663
1664static wchar_t c2u_B0[256] = { 1664static const wchar_t c2u_B0[256] = {
1665 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1665 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1666 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1666 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1667 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1667 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1697,7 +1697,7 @@ static wchar_t c2u_B0[256] = {
1697 0xACF5,0xACF6,0xACFC,0xACFD,0xAD00,0xAD04,0xAD06,0x0000,/* 0xF8-0xFF */ 1697 0xACF5,0xACF6,0xACFC,0xACFD,0xAD00,0xAD04,0xAD06,0x0000,/* 0xF8-0xFF */
1698}; 1698};
1699 1699
1700static wchar_t c2u_B1[256] = { 1700static const wchar_t c2u_B1[256] = {
1701 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1701 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1702 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1702 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1703 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1703 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1733,7 +1733,7 @@ static wchar_t c2u_B1[256] = {
1733 0xAE61,0xAE65,0xAE68,0xAE69,0xAE6C,0xAE70,0xAE78,0x0000,/* 0xF8-0xFF */ 1733 0xAE61,0xAE65,0xAE68,0xAE69,0xAE6C,0xAE70,0xAE78,0x0000,/* 0xF8-0xFF */
1734}; 1734};
1735 1735
1736static wchar_t c2u_B2[256] = { 1736static const wchar_t c2u_B2[256] = {
1737 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1737 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1738 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1738 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1739 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1739 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1769,7 +1769,7 @@ static wchar_t c2u_B2[256] = {
1769 0xB04C,0xB04E,0xB053,0xB054,0xB055,0xB057,0xB059,0x0000,/* 0xF8-0xFF */ 1769 0xB04C,0xB04E,0xB053,0xB054,0xB055,0xB057,0xB059,0x0000,/* 0xF8-0xFF */
1770}; 1770};
1771 1771
1772static wchar_t c2u_B3[256] = { 1772static const wchar_t c2u_B3[256] = {
1773 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1773 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1774 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1774 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1775 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1775 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1805,7 +1805,7 @@ static wchar_t c2u_B3[256] = {
1805 0xB19C,0xB1A8,0xB1CC,0xB1D0,0xB1D4,0xB1DC,0xB1DD,0x0000,/* 0xF8-0xFF */ 1805 0xB19C,0xB1A8,0xB1CC,0xB1D0,0xB1D4,0xB1DC,0xB1DD,0x0000,/* 0xF8-0xFF */
1806}; 1806};
1807 1807
1808static wchar_t c2u_B4[256] = { 1808static const wchar_t c2u_B4[256] = {
1809 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1809 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1810 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1810 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1811 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1811 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1841,7 +1841,7 @@ static wchar_t c2u_B4[256] = {
1841 0xB358,0xB35B,0xB35C,0xB35E,0xB35F,0xB364,0xB365,0x0000,/* 0xF8-0xFF */ 1841 0xB358,0xB35B,0xB35C,0xB35E,0xB35F,0xB364,0xB365,0x0000,/* 0xF8-0xFF */
1842}; 1842};
1843 1843
1844static wchar_t c2u_B5[256] = { 1844static const wchar_t c2u_B5[256] = {
1845 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1845 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1846 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1846 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1847 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1847 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1877,7 +1877,7 @@ static wchar_t c2u_B5[256] = {
1877 0xB528,0xB529,0xB52A,0xB530,0xB531,0xB534,0xB538,0x0000,/* 0xF8-0xFF */ 1877 0xB528,0xB529,0xB52A,0xB530,0xB531,0xB534,0xB538,0x0000,/* 0xF8-0xFF */
1878}; 1878};
1879 1879
1880static wchar_t c2u_B6[256] = { 1880static const wchar_t c2u_B6[256] = {
1881 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1881 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1882 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1882 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1883 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1883 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1913,7 +1913,7 @@ static wchar_t c2u_B6[256] = {
1913 0xB78D,0xB78F,0xB790,0xB791,0xB792,0xB796,0xB797,0x0000,/* 0xF8-0xFF */ 1913 0xB78D,0xB78F,0xB790,0xB791,0xB792,0xB796,0xB797,0x0000,/* 0xF8-0xFF */
1914}; 1914};
1915 1915
1916static wchar_t c2u_B7[256] = { 1916static const wchar_t c2u_B7[256] = {
1917 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1917 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1918 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1918 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1919 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1919 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1949,7 +1949,7 @@ static wchar_t c2u_B7[256] = {
1949 0xB951,0xB958,0xB959,0xB95C,0xB960,0xB968,0xB969,0x0000,/* 0xF8-0xFF */ 1949 0xB951,0xB958,0xB959,0xB95C,0xB960,0xB968,0xB969,0x0000,/* 0xF8-0xFF */
1950}; 1950};
1951 1951
1952static wchar_t c2u_B8[256] = { 1952static const wchar_t c2u_B8[256] = {
1953 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1953 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1954 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1954 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1955 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1955 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1985,7 +1985,7 @@ static wchar_t c2u_B8[256] = {
1985 0xBABB,0xBABD,0xBAC4,0xBAC8,0xBAD8,0xBAD9,0xBAFC,0x0000,/* 0xF8-0xFF */ 1985 0xBABB,0xBABD,0xBAC4,0xBAC8,0xBAD8,0xBAD9,0xBAFC,0x0000,/* 0xF8-0xFF */
1986}; 1986};
1987 1987
1988static wchar_t c2u_B9[256] = { 1988static const wchar_t c2u_B9[256] = {
1989 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1989 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1990 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1990 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1991 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1991 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2021,7 +2021,7 @@ static wchar_t c2u_B9[256] = {
2021 0xBC88,0xBC8B,0xBC8C,0xBC8E,0xBC94,0xBC95,0xBC97,0x0000,/* 0xF8-0xFF */ 2021 0xBC88,0xBC8B,0xBC8C,0xBC8E,0xBC94,0xBC95,0xBC97,0x0000,/* 0xF8-0xFF */
2022}; 2022};
2023 2023
2024static wchar_t c2u_BA[256] = { 2024static const wchar_t c2u_BA[256] = {
2025 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2025 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2026 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2026 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2027 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2027 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2057,7 +2057,7 @@ static wchar_t c2u_BA[256] = {
2057 0xBE57,0xBE59,0xBE5A,0xBE5B,0xBE60,0xBE61,0xBE64,0x0000,/* 0xF8-0xFF */ 2057 0xBE57,0xBE59,0xBE5A,0xBE5B,0xBE60,0xBE61,0xBE64,0x0000,/* 0xF8-0xFF */
2058}; 2058};
2059 2059
2060static wchar_t c2u_BB[256] = { 2060static const wchar_t c2u_BB[256] = {
2061 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2061 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2062 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2062 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2063 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2063 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2093,7 +2093,7 @@ static wchar_t c2u_BB[256] = {
2093 0xC0D0,0xC0D8,0xC0D9,0xC0DB,0xC0DC,0xC0DD,0xC0E4,0x0000,/* 0xF8-0xFF */ 2093 0xC0D0,0xC0D8,0xC0D9,0xC0DB,0xC0DC,0xC0DD,0xC0E4,0x0000,/* 0xF8-0xFF */
2094}; 2094};
2095 2095
2096static wchar_t c2u_BC[256] = { 2096static const wchar_t c2u_BC[256] = {
2097 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2097 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2098 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2098 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2099 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2099 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2129,7 +2129,7 @@ static wchar_t c2u_BC[256] = {
2129 0xC21C,0xC21F,0xC220,0xC228,0xC229,0xC22B,0xC22D,0x0000,/* 0xF8-0xFF */ 2129 0xC21C,0xC21F,0xC220,0xC228,0xC229,0xC22B,0xC22D,0x0000,/* 0xF8-0xFF */
2130}; 2130};
2131 2131
2132static wchar_t c2u_BD[256] = { 2132static const wchar_t c2u_BD[256] = {
2133 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2133 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2134 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2134 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2135 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2135 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2165,7 +2165,7 @@ static wchar_t c2u_BD[256] = {
2165 0xC3F5,0xC3F8,0xC408,0xC410,0xC424,0xC42C,0xC430,0x0000,/* 0xF8-0xFF */ 2165 0xC3F5,0xC3F8,0xC408,0xC410,0xC424,0xC42C,0xC430,0x0000,/* 0xF8-0xFF */
2166}; 2166};
2167 2167
2168static wchar_t c2u_BE[256] = { 2168static const wchar_t c2u_BE[256] = {
2169 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2169 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2170 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2170 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2171 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2201,7 +2201,7 @@ static wchar_t c2u_BE[256] = {
2201 0xC5C6,0xC5C7,0xC5C8,0xC5C9,0xC5CA,0xC5CC,0xC5CE,0x0000,/* 0xF8-0xFF */ 2201 0xC5C6,0xC5C7,0xC5C8,0xC5C9,0xC5CA,0xC5CC,0xC5CE,0x0000,/* 0xF8-0xFF */
2202}; 2202};
2203 2203
2204static wchar_t c2u_BF[256] = { 2204static const wchar_t c2u_BF[256] = {
2205 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2205 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2206 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2206 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2207 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2237,7 +2237,7 @@ static wchar_t c2u_BF[256] = {
2237 0xC6D0,0xC6D4,0xC6DC,0xC6DD,0xC6E0,0xC6E1,0xC6E8,0x0000,/* 0xF8-0xFF */ 2237 0xC6D0,0xC6D4,0xC6DC,0xC6DD,0xC6E0,0xC6E1,0xC6E8,0x0000,/* 0xF8-0xFF */
2238}; 2238};
2239 2239
2240static wchar_t c2u_C0[256] = { 2240static const wchar_t c2u_C0[256] = {
2241 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2241 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2242 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2242 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2243 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2243 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2273,7 +2273,7 @@ static wchar_t c2u_C0[256] = {
2273 0xC7E8,0xC7EC,0xC800,0xC801,0xC804,0xC808,0xC80A,0x0000,/* 0xF8-0xFF */ 2273 0xC7E8,0xC7EC,0xC800,0xC801,0xC804,0xC808,0xC80A,0x0000,/* 0xF8-0xFF */
2274}; 2274};
2275 2275
2276static wchar_t c2u_C1[256] = { 2276static const wchar_t c2u_C1[256] = {
2277 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2277 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2278 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2278 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2279 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2309,7 +2309,7 @@ static wchar_t c2u_C1[256] = {
2309 0xC9C4,0xC9C7,0xC9C8,0xC9CA,0xC9D0,0xC9D1,0xC9D3,0x0000,/* 0xF8-0xFF */ 2309 0xC9C4,0xC9C7,0xC9C8,0xC9CA,0xC9D0,0xC9D1,0xC9D3,0x0000,/* 0xF8-0xFF */
2310}; 2310};
2311 2311
2312static wchar_t c2u_C2[256] = { 2312static const wchar_t c2u_C2[256] = {
2313 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2313 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2314 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2314 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2315 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2315 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2345,7 +2345,7 @@ static wchar_t c2u_C2[256] = {
2345 0xCC29,0xCC2C,0xCC2E,0xCC30,0xCC38,0xCC39,0xCC3B,0x0000,/* 0xF8-0xFF */ 2345 0xCC29,0xCC2C,0xCC2E,0xCC30,0xCC38,0xCC39,0xCC3B,0x0000,/* 0xF8-0xFF */
2346}; 2346};
2347 2347
2348static wchar_t c2u_C3[256] = { 2348static const wchar_t c2u_C3[256] = {
2349 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2349 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2350 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2350 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2351 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2351 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2381,7 +2381,7 @@ static wchar_t c2u_C3[256] = {
2381 0xCE21,0xCE24,0xCE28,0xCE30,0xCE31,0xCE33,0xCE35,0x0000,/* 0xF8-0xFF */ 2381 0xCE21,0xCE24,0xCE28,0xCE30,0xCE31,0xCE33,0xCE35,0x0000,/* 0xF8-0xFF */
2382}; 2382};
2383 2383
2384static wchar_t c2u_C4[256] = { 2384static const wchar_t c2u_C4[256] = {
2385 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2385 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2386 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2386 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2387 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2387 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2417,7 +2417,7 @@ static wchar_t c2u_C4[256] = {
2417 0xD011,0xD018,0xD02D,0xD034,0xD035,0xD038,0xD03C,0x0000,/* 0xF8-0xFF */ 2417 0xD011,0xD018,0xD02D,0xD034,0xD035,0xD038,0xD03C,0x0000,/* 0xF8-0xFF */
2418}; 2418};
2419 2419
2420static wchar_t c2u_C5[256] = { 2420static const wchar_t c2u_C5[256] = {
2421 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2421 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2422 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2422 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2423 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2423 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2453,7 +2453,7 @@ static wchar_t c2u_C5[256] = {
2453 0xD234,0xD23C,0xD23D,0xD23F,0xD241,0xD248,0xD25C,0x0000,/* 0xF8-0xFF */ 2453 0xD234,0xD23C,0xD23D,0xD23F,0xD241,0xD248,0xD25C,0x0000,/* 0xF8-0xFF */
2454}; 2454};
2455 2455
2456static wchar_t c2u_C6[256] = { 2456static const wchar_t c2u_C6[256] = {
2457 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2457 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2458 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2458 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2459 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2459 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2489,7 +2489,7 @@ static wchar_t c2u_C6[256] = {
2489 0xD3ED,0xD3F0,0xD3F4,0xD3FC,0xD3FD,0xD3FF,0xD401,0x0000,/* 0xF8-0xFF */ 2489 0xD3ED,0xD3F0,0xD3F4,0xD3FC,0xD3FD,0xD3FF,0xD401,0x0000,/* 0xF8-0xFF */
2490}; 2490};
2491 2491
2492static wchar_t c2u_C7[256] = { 2492static const wchar_t c2u_C7[256] = {
2493 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2493 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2494 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2494 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2495 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2495 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2525,7 +2525,7 @@ static wchar_t c2u_C7[256] = {
2525 0xD610,0xD611,0xD613,0xD614,0xD615,0xD61C,0xD620,0x0000,/* 0xF8-0xFF */ 2525 0xD610,0xD611,0xD613,0xD614,0xD615,0xD61C,0xD620,0x0000,/* 0xF8-0xFF */
2526}; 2526};
2527 2527
2528static wchar_t c2u_C8[256] = { 2528static const wchar_t c2u_C8[256] = {
2529 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2529 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2530 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2530 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2531 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2531 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2561,7 +2561,7 @@ static wchar_t c2u_C8[256] = {
2561 0xD789,0xD78C,0xD790,0xD798,0xD799,0xD79B,0xD79D,0x0000,/* 0xF8-0xFF */ 2561 0xD789,0xD78C,0xD790,0xD798,0xD799,0xD79B,0xD79D,0x0000,/* 0xF8-0xFF */
2562}; 2562};
2563 2563
2564static wchar_t c2u_CA[256] = { 2564static const wchar_t c2u_CA[256] = {
2565 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2565 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2566 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2566 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2567 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2567 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2597,7 +2597,7 @@ static wchar_t c2u_CA[256] = {
2597 0x76E3,0x77B0,0x7D3A,0x90AF,0x9451,0x9452,0x9F95,0x0000,/* 0xF8-0xFF */ 2597 0x76E3,0x77B0,0x7D3A,0x90AF,0x9451,0x9452,0x9F95,0x0000,/* 0xF8-0xFF */
2598}; 2598};
2599 2599
2600static wchar_t c2u_CB[256] = { 2600static const wchar_t c2u_CB[256] = {
2601 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2601 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2602 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2602 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2603 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2603 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2633,7 +2633,7 @@ static wchar_t c2u_CB[256] = {
2633 0x5091,0x6770,0x6840,0x5109,0x528D,0x5292,0x6AA2,0x0000,/* 0xF8-0xFF */ 2633 0x5091,0x6770,0x6840,0x5109,0x528D,0x5292,0x6AA2,0x0000,/* 0xF8-0xFF */
2634}; 2634};
2635 2635
2636static wchar_t c2u_CC[256] = { 2636static const wchar_t c2u_CC[256] = {
2637 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2637 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2638 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2638 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2639 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2639 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2669,7 +2669,7 @@ static wchar_t c2u_CC[256] = {
2669 0x5951,0x5B63,0x5C46,0x60B8,0x6212,0x6842,0x68B0,0x0000,/* 0xF8-0xFF */ 2669 0x5951,0x5B63,0x5C46,0x60B8,0x6212,0x6842,0x68B0,0x0000,/* 0xF8-0xFF */
2670}; 2670};
2671 2671
2672static wchar_t c2u_CD[256] = { 2672static const wchar_t c2u_CD[256] = {
2673 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2673 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2674 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2674 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2675 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2675 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2705,7 +2705,7 @@ static wchar_t c2u_CD[256] = {
2705 0x8CA2,0x978F,0x4E32,0x5BE1,0x6208,0x679C,0x74DC,0x0000,/* 0xF8-0xFF */ 2705 0x8CA2,0x978F,0x4E32,0x5BE1,0x6208,0x679C,0x74DC,0x0000,/* 0xF8-0xFF */
2706}; 2706};
2707 2707
2708static wchar_t c2u_CE[256] = { 2708static const wchar_t c2u_CE[256] = {
2709 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2709 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2710 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2710 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2711 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2711 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2741,7 +2741,7 @@ static wchar_t c2u_CE[256] = {
2741 0x4E18,0x4E45,0x4E5D,0x4EC7,0x4FF1,0x5177,0x52FE,0x0000,/* 0xF8-0xFF */ 2741 0x4E18,0x4E45,0x4E5D,0x4EC7,0x4FF1,0x5177,0x52FE,0x0000,/* 0xF8-0xFF */
2742}; 2742};
2743 2743
2744static wchar_t c2u_CF[256] = { 2744static const wchar_t c2u_CF[256] = {
2745 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2745 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2746 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2746 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2747 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2747 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2777,7 +2777,7 @@ static wchar_t c2u_CF[256] = {
2777 0x8A6D,0x8ECC,0x994B,0xF906,0x6677,0x6B78,0x8CB4,0x0000,/* 0xF8-0xFF */ 2777 0x8A6D,0x8ECC,0x994B,0xF906,0x6677,0x6B78,0x8CB4,0x0000,/* 0xF8-0xFF */
2778}; 2778};
2779 2779
2780static wchar_t c2u_D0[256] = { 2780static const wchar_t c2u_D0[256] = {
2781 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2781 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2782 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2782 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2783 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2783 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2813,7 +2813,7 @@ static wchar_t c2u_D0[256] = {
2813 0x5D0E,0x5DF1,0x5E7E,0x5FCC,0x6280,0x65D7,0x65E3,0x0000,/* 0xF8-0xFF */ 2813 0x5D0E,0x5DF1,0x5E7E,0x5FCC,0x6280,0x65D7,0x65E3,0x0000,/* 0xF8-0xFF */
2814}; 2814};
2815 2815
2816static wchar_t c2u_D1[256] = { 2816static const wchar_t c2u_D1[256] = {
2817 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2817 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2818 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2818 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2819 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2819 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2849,7 +2849,7 @@ static wchar_t c2u_D1[256] = {
2849 0x6960,0x6E73,0xF922,0x7537,0xF923,0xF924,0xF925,0x0000,/* 0xF8-0xFF */ 2849 0x6960,0x6E73,0xF922,0x7537,0xF923,0xF924,0xF925,0x0000,/* 0xF8-0xFF */
2850}; 2850};
2851 2851
2852static wchar_t c2u_D2[256] = { 2852static const wchar_t c2u_D2[256] = {
2853 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2853 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2854 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2854 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2855 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2855 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2885,7 +2885,7 @@ static wchar_t c2u_D2[256] = {
2885 0xF959,0x5C3C,0x6CE5,0x533F,0x6EBA,0x591A,0x8336,0x0000,/* 0xF8-0xFF */ 2885 0xF959,0x5C3C,0x6CE5,0x533F,0x6EBA,0x591A,0x8336,0x0000,/* 0xF8-0xFF */
2886}; 2886};
2887 2887
2888static wchar_t c2u_D3[256] = { 2888static const wchar_t c2u_D3[256] = {
2889 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2889 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2890 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2890 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2891 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2891 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2921,7 +2921,7 @@ static wchar_t c2u_D3[256] = {
2921 0x5EA6,0x5F92,0x60BC,0x6311,0x6389,0x6417,0x6843,0x0000,/* 0xF8-0xFF */ 2921 0x5EA6,0x5F92,0x60BC,0x6311,0x6389,0x6417,0x6843,0x0000,/* 0xF8-0xFF */
2922}; 2922};
2923 2923
2924static wchar_t c2u_D4[256] = { 2924static const wchar_t c2u_D4[256] = {
2925 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2925 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2926 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2926 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2927 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2927 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2957,7 +2957,7 @@ static wchar_t c2u_D4[256] = {
2957 0x9127,0x9A30,0x5587,0x61F6,0xF95B,0x7669,0x7F85,0x0000,/* 0xF8-0xFF */ 2957 0x9127,0x9A30,0x5587,0x61F6,0xF95B,0x7669,0x7F85,0x0000,/* 0xF8-0xFF */
2958}; 2958};
2959 2959
2960static wchar_t c2u_D5[256] = { 2960static const wchar_t c2u_D5[256] = {
2961 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2961 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2962 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2962 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2963 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2963 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2993,7 +2993,7 @@ static wchar_t c2u_D5[256] = {
2993 0x792B,0x8F62,0x9742,0x6190,0x6200,0x6523,0x6F23,0x0000,/* 0xF8-0xFF */ 2993 0x792B,0x8F62,0x9742,0x6190,0x6200,0x6523,0x6F23,0x0000,/* 0xF8-0xFF */
2994}; 2994};
2995 2995
2996static wchar_t c2u_D6[256] = { 2996static const wchar_t c2u_D6[256] = {
2997 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2997 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2998 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2998 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2999 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2999 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3029,7 +3029,7 @@ static wchar_t c2u_D6[256] = {
3029 0x5ED6,0x6599,0x71CE,0x7642,0x77AD,0x804A,0x84FC,0x0000,/* 0xF8-0xFF */ 3029 0x5ED6,0x6599,0x71CE,0x7642,0x77AD,0x804A,0x84FC,0x0000,/* 0xF8-0xFF */
3030}; 3030};
3031 3031
3032static wchar_t c2u_D7[256] = { 3032static const wchar_t c2u_D7[256] = {
3033 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3033 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3034 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3034 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3035 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3035 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3065,7 +3065,7 @@ static wchar_t c2u_D7[256] = {
3065 0x9E9F,0x6797,0x6DCB,0x7433,0x81E8,0x9716,0x782C,0x0000,/* 0xF8-0xFF */ 3065 0x9E9F,0x6797,0x6DCB,0x7433,0x81E8,0x9716,0x782C,0x0000,/* 0xF8-0xFF */
3066}; 3066};
3067 3067
3068static wchar_t c2u_D8[256] = { 3068static const wchar_t c2u_D8[256] = {
3069 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3069 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3070 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3070 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3071 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3071 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3101,7 +3101,7 @@ static wchar_t c2u_D8[256] = {
3101 0x7704,0x7720,0x7DBF,0x7DEC,0x9762,0x9EB5,0x6EC5,0x0000,/* 0xF8-0xFF */ 3101 0x7704,0x7720,0x7DBF,0x7DEC,0x9762,0x9EB5,0x6EC5,0x0000,/* 0xF8-0xFF */
3102}; 3102};
3103 3103
3104static wchar_t c2u_D9[256] = { 3104static const wchar_t c2u_D9[256] = {
3105 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3105 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3106 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3106 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3107 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3107 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3137,7 +3137,7 @@ static wchar_t c2u_D9[256] = {
3137 0x58A8,0x9ED8,0x5011,0x520E,0x543B,0x554F,0x6587,0x0000,/* 0xF8-0xFF */ 3137 0x58A8,0x9ED8,0x5011,0x520E,0x543B,0x554F,0x6587,0x0000,/* 0xF8-0xFF */
3138}; 3138};
3139 3139
3140static wchar_t c2u_DA[256] = { 3140static const wchar_t c2u_DA[256] = {
3141 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3141 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3142 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3142 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3143 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3143 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3173,7 +3173,7 @@ static wchar_t c2u_DA[256] = {
3173 0x9812,0x98EF,0x52C3,0x62D4,0x64A5,0x6E24,0x6F51,0x0000,/* 0xF8-0xFF */ 3173 0x9812,0x98EF,0x52C3,0x62D4,0x64A5,0x6E24,0x6F51,0x0000,/* 0xF8-0xFF */
3174}; 3174};
3175 3175
3176static wchar_t c2u_DB[256] = { 3176static const wchar_t c2u_DB[256] = {
3177 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3177 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3178 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3178 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3179 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3179 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3209,7 +3209,7 @@ static wchar_t c2u_DB[256] = {
3209 0x50FB,0x5288,0x58C1,0x64D8,0x6A97,0x74A7,0x7656,0x0000,/* 0xF8-0xFF */ 3209 0x50FB,0x5288,0x58C1,0x64D8,0x6A97,0x74A7,0x7656,0x0000,/* 0xF8-0xFF */
3210}; 3210};
3211 3211
3212static wchar_t c2u_DC[256] = { 3212static const wchar_t c2u_DC[256] = {
3213 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3213 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3214 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3214 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3215 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3215 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3245,7 +3245,7 @@ static wchar_t c2u_DC[256] = {
3245 0x5256,0x526F,0x5426,0x5490,0x57E0,0x592B,0x5A66,0x0000,/* 0xF8-0xFF */ 3245 0x5256,0x526F,0x5426,0x5490,0x57E0,0x592B,0x5A66,0x0000,/* 0xF8-0xFF */
3246}; 3246};
3247 3247
3248static wchar_t c2u_DD[256] = { 3248static const wchar_t c2u_DD[256] = {
3249 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3249 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3250 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3250 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3251 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3251 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3281,7 +3281,7 @@ static wchar_t c2u_DD[256] = {
3281 0x7891,0x79D5,0x79D8,0x7C83,0x7DCB,0x7FE1,0x80A5,0x0000,/* 0xF8-0xFF */ 3281 0x7891,0x79D5,0x79D8,0x7C83,0x7DCB,0x7FE1,0x80A5,0x0000,/* 0xF8-0xFF */
3282}; 3282};
3283 3283
3284static wchar_t c2u_DE[256] = { 3284static const wchar_t c2u_DE[256] = {
3285 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3285 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3286 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3286 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3287 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3287 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3317,7 +3317,7 @@ static wchar_t c2u_DE[256] = {
3317 0x98FC,0x99DF,0x9E9D,0x524A,0xF969,0x6714,0xF96A,0x0000,/* 0xF8-0xFF */ 3317 0x98FC,0x99DF,0x9E9D,0x524A,0xF969,0x6714,0xF96A,0x0000,/* 0xF8-0xFF */
3318}; 3318};
3319 3319
3320static wchar_t c2u_DF[256] = { 3320static const wchar_t c2u_DF[256] = {
3321 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3321 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3322 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3322 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3323 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3323 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3353,7 +3353,7 @@ static wchar_t c2u_DF[256] = {
3353 0x68F2,0x7280,0x745E,0x7B6E,0x7D6E,0x7DD6,0x7F72,0x0000,/* 0xF8-0xFF */ 3353 0x68F2,0x7280,0x745E,0x7B6E,0x7D6E,0x7DD6,0x7F72,0x0000,/* 0xF8-0xFF */
3354}; 3354};
3355 3355
3356static wchar_t c2u_E0[256] = { 3356static const wchar_t c2u_E0[256] = {
3357 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3357 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3358 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3358 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3359 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3359 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3389,7 +3389,7 @@ static wchar_t c2u_E0[256] = {
3389 0x661F,0x665F,0x7329,0x73F9,0x76DB,0x7701,0x7B6C,0x0000,/* 0xF8-0xFF */ 3389 0x661F,0x665F,0x7329,0x73F9,0x76DB,0x7701,0x7B6C,0x0000,/* 0xF8-0xFF */
3390}; 3390};
3391 3391
3392static wchar_t c2u_E1[256] = { 3392static const wchar_t c2u_E1[256] = {
3393 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3393 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3394 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3394 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3395 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3395 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3425,7 +3425,7 @@ static wchar_t c2u_E1[256] = {
3425 0x58FD,0x5AC2,0x5B88,0x5CAB,0x5CC0,0x5E25,0x6101,0x0000,/* 0xF8-0xFF */ 3425 0x58FD,0x5AC2,0x5B88,0x5CAB,0x5CC0,0x5E25,0x6101,0x0000,/* 0xF8-0xFF */
3426}; 3426};
3427 3427
3428static wchar_t c2u_E2[256] = { 3428static const wchar_t c2u_E2[256] = {
3429 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3429 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3430 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3430 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3431 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3431 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3461,7 +3461,7 @@ static wchar_t c2u_E2[256] = {
3461 0x99B4,0x620C,0x8853,0x8FF0,0x9265,0x5D07,0x5D27,0x0000,/* 0xF8-0xFF */ 3461 0x99B4,0x620C,0x8853,0x8FF0,0x9265,0x5D07,0x5D27,0x0000,/* 0xF8-0xFF */
3462}; 3462};
3463 3463
3464static wchar_t c2u_E3[256] = { 3464static const wchar_t c2u_E3[256] = {
3465 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3465 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3466 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3466 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3467 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3467 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3497,7 +3497,7 @@ static wchar_t c2u_E3[256] = {
3497 0x5BA4,0x5BE6,0x6089,0x5BE9,0x5C0B,0x5FC3,0x6C81,0x0000,/* 0xF8-0xFF */ 3497 0x5BA4,0x5BE6,0x6089,0x5BE9,0x5C0B,0x5FC3,0x6C81,0x0000,/* 0xF8-0xFF */
3498}; 3498};
3499 3499
3500static wchar_t c2u_E4[256] = { 3500static const wchar_t c2u_E4[256] = {
3501 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3501 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3502 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3502 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3503 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3503 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3533,7 +3533,7 @@ static wchar_t c2u_E4[256] = {
3533 0x5384,0x627C,0x6396,0x6DB2,0x7E0A,0x814B,0x984D,0x0000,/* 0xF8-0xFF */ 3533 0x5384,0x627C,0x6396,0x6DB2,0x7E0A,0x814B,0x984D,0x0000,/* 0xF8-0xFF */
3534}; 3534};
3535 3535
3536static wchar_t c2u_E5[256] = { 3536static const wchar_t c2u_E5[256] = {
3537 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3537 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3538 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3538 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3539 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3539 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3569,7 +3569,7 @@ static wchar_t c2u_E5[256] = {
3569 0x4E88,0x4F59,0xF97F,0xF980,0xF981,0x5982,0xF982,0x0000,/* 0xF8-0xFF */ 3569 0x4E88,0x4F59,0xF97F,0xF980,0xF981,0x5982,0xF982,0x0000,/* 0xF8-0xFF */
3570}; 3570};
3571 3571
3572static wchar_t c2u_E6[256] = { 3572static const wchar_t c2u_E6[256] = {
3573 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3573 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3574 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3574 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3575 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3575 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3605,7 +3605,7 @@ static wchar_t c2u_E6[256] = {
3605 0x67D3,0xF9A5,0x708E,0x7130,0x7430,0x8276,0x82D2,0x0000,/* 0xF8-0xFF */ 3605 0x67D3,0xF9A5,0x708E,0x7130,0x7430,0x8276,0x82D2,0x0000,/* 0xF8-0xFF */
3606}; 3606};
3607 3607
3608static wchar_t c2u_E7[256] = { 3608static const wchar_t c2u_E7[256] = {
3609 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3609 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3610 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3610 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3611 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3611 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3641,7 +3641,7 @@ static wchar_t c2u_E7[256] = {
3641 0x61CA,0x6556,0x65FF,0x6664,0x68A7,0x6C5A,0x6FB3,0x0000,/* 0xF8-0xFF */ 3641 0x61CA,0x6556,0x65FF,0x6664,0x68A7,0x6C5A,0x6FB3,0x0000,/* 0xF8-0xFF */
3642}; 3642};
3643 3643
3644static wchar_t c2u_E8[256] = { 3644static const wchar_t c2u_E8[256] = {
3645 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3645 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3646 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3646 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3647 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3647 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3677,7 +3677,7 @@ static wchar_t c2u_E8[256] = {
3677 0x66DC,0xF9BF,0x6A48,0xF9C0,0x71FF,0x7464,0xF9C1,0x0000,/* 0xF8-0xFF */ 3677 0x66DC,0xF9BF,0x6A48,0xF9C0,0x71FF,0x7464,0xF9C1,0x0000,/* 0xF8-0xFF */
3678}; 3678};
3679 3679
3680static wchar_t c2u_E9[256] = { 3680static const wchar_t c2u_E9[256] = {
3681 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3681 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3682 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3682 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3683 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3683 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3713,7 +3713,7 @@ static wchar_t c2u_E9[256] = {
3713 0x6A52,0x6B9E,0x6F90,0x7189,0x8018,0x82B8,0x8553,0x0000,/* 0xF8-0xFF */ 3713 0x6A52,0x6B9E,0x6F90,0x7189,0x8018,0x82B8,0x8553,0x0000,/* 0xF8-0xFF */
3714}; 3714};
3715 3715
3716static wchar_t c2u_EA[256] = { 3716static const wchar_t c2u_EA[256] = {
3717 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3717 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3718 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3718 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3719 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3719 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3749,7 +3749,7 @@ static wchar_t c2u_EA[256] = {
3749 0x6961,0x6962,0x6CB9,0x6D27,0xF9CA,0x6E38,0xF9CB,0x0000,/* 0xF8-0xFF */ 3749 0x6961,0x6962,0x6CB9,0x6D27,0xF9CA,0x6E38,0xF9CB,0x0000,/* 0xF8-0xFF */
3750}; 3750};
3751 3751
3752static wchar_t c2u_EB[256] = { 3752static const wchar_t c2u_EB[256] = {
3753 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3753 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3754 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3754 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3755 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3755 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3785,7 +3785,7 @@ static wchar_t c2u_EB[256] = {
3785 0x77E3,0x7FA9,0x8264,0x858F,0x87FB,0x8863,0x8ABC,0x0000,/* 0xF8-0xFF */ 3785 0x77E3,0x7FA9,0x8264,0x858F,0x87FB,0x8863,0x8ABC,0x0000,/* 0xF8-0xFF */
3786}; 3786};
3787 3787
3788static wchar_t c2u_EC[256] = { 3788static const wchar_t c2u_EC[256] = {
3789 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3789 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3790 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3790 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3791 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3791 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3821,7 +3821,7 @@ static wchar_t c2u_EC[256] = {
3821 0xF9F5,0x7A14,0xF9F6,0x834F,0x8CC3,0x5165,0x5344,0x0000,/* 0xF8-0xFF */ 3821 0xF9F5,0x7A14,0xF9F6,0x834F,0x8CC3,0x5165,0x5344,0x0000,/* 0xF8-0xFF */
3822}; 3822};
3823 3823
3824static wchar_t c2u_ED[256] = { 3824static const wchar_t c2u_ED[256] = {
3825 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3825 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3826 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3826 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3827 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3827 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3857,7 +3857,7 @@ static wchar_t c2u_ED[256] = {
3857 0x8523,0x8594,0x85CF,0x88DD,0x8D13,0x91AC,0x9577,0x0000,/* 0xF8-0xFF */ 3857 0x8523,0x8594,0x85CF,0x88DD,0x8D13,0x91AC,0x9577,0x0000,/* 0xF8-0xFF */
3858}; 3858};
3859 3859
3860static wchar_t c2u_EE[256] = { 3860static const wchar_t c2u_EE[256] = {
3861 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3861 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3862 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3862 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3863 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3863 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3893,7 +3893,7 @@ static wchar_t c2u_EE[256] = {
3893 0x5EDB,0x609B,0x6230,0x6813,0x6BBF,0x6C08,0x6FB1,0x0000,/* 0xF8-0xFF */ 3893 0x5EDB,0x609B,0x6230,0x6813,0x6BBF,0x6C08,0x6FB1,0x0000,/* 0xF8-0xFF */
3894}; 3894};
3895 3895
3896static wchar_t c2u_EF[256] = { 3896static const wchar_t c2u_EF[256] = {
3897 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3897 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3898 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3898 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3899 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3899 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3929,7 +3929,7 @@ static wchar_t c2u_EF[256] = {
3929 0x914A,0x91D8,0x9266,0x92CC,0x9320,0x9706,0x9756,0x0000,/* 0xF8-0xFF */ 3929 0x914A,0x91D8,0x9266,0x92CC,0x9320,0x9706,0x9756,0x0000,/* 0xF8-0xFF */
3930}; 3930};
3931 3931
3932static wchar_t c2u_F0[256] = { 3932static const wchar_t c2u_F0[256] = {
3933 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3933 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3934 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3934 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3935 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3935 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3965,7 +3965,7 @@ static wchar_t c2u_F0[256] = {
3965 0x6DD9,0x742E,0x7A2E,0x7D42,0x7D9C,0x7E31,0x816B,0x0000,/* 0xF8-0xFF */ 3965 0x6DD9,0x742E,0x7A2E,0x7D42,0x7D9C,0x7E31,0x816B,0x0000,/* 0xF8-0xFF */
3966}; 3966};
3967 3967
3968static wchar_t c2u_F1[256] = { 3968static const wchar_t c2u_F1[256] = {
3969 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3969 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3970 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3970 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3971 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3971 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4001,7 +4001,7 @@ static wchar_t c2u_F1[256] = {
4001 0x75C7,0x7E52,0x84B8,0x8B49,0x8D08,0x4E4B,0x53EA,0x0000,/* 0xF8-0xFF */ 4001 0x75C7,0x7E52,0x84B8,0x8B49,0x8D08,0x4E4B,0x53EA,0x0000,/* 0xF8-0xFF */
4002}; 4002};
4003 4003
4004static wchar_t c2u_F2[256] = { 4004static const wchar_t c2u_F2[256] = {
4005 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4005 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4006 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4006 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4007 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4007 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4037,7 +4037,7 @@ static wchar_t c2u_F2[256] = {
4037 0x659F,0x6715,0xF9FD,0x57F7,0x6F57,0x7DDD,0x8F2F,0x0000,/* 0xF8-0xFF */ 4037 0x659F,0x6715,0xF9FD,0x57F7,0x6F57,0x7DDD,0x8F2F,0x0000,/* 0xF8-0xFF */
4038}; 4038};
4039 4039
4040static wchar_t c2u_F3[256] = { 4040static const wchar_t c2u_F3[256] = {
4041 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4041 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4042 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4042 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4043 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4043 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4073,7 +4073,7 @@ static wchar_t c2u_F3[256] = {
4073 0x83DC,0x8521,0x91C7,0x91F5,0x518A,0x67F5,0x7B56,0x0000,/* 0xF8-0xFF */ 4073 0x83DC,0x8521,0x91C7,0x91F5,0x518A,0x67F5,0x7B56,0x0000,/* 0xF8-0xFF */
4074}; 4074};
4075 4075
4076static wchar_t c2u_F4[256] = { 4076static const wchar_t c2u_F4[256] = {
4077 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4077 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4078 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4078 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4079 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4079 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4109,7 +4109,7 @@ static wchar_t c2u_F4[256] = {
4109 0x521D,0x527F,0x54E8,0x6194,0x6284,0x62DB,0x68A2,0x0000,/* 0xF8-0xFF */ 4109 0x521D,0x527F,0x54E8,0x6194,0x6284,0x62DB,0x68A2,0x0000,/* 0xF8-0xFF */
4110}; 4110};
4111 4111
4112static wchar_t c2u_F5[256] = { 4112static const wchar_t c2u_F5[256] = {
4113 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4113 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4114 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4114 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4115 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4115 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4145,7 +4145,7 @@ static wchar_t c2u_F5[256] = {
4145 0x6C96,0x87F2,0x885D,0x8877,0x60B4,0x81B5,0x8403,0x0000,/* 0xF8-0xFF */ 4145 0x6C96,0x87F2,0x885D,0x8877,0x60B4,0x81B5,0x8403,0x0000,/* 0xF8-0xFF */
4146}; 4146};
4147 4147
4148static wchar_t c2u_F6[256] = { 4148static const wchar_t c2u_F6[256] = {
4149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4150 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4150 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4151 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4151 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4181,7 +4181,7 @@ static wchar_t c2u_F6[256] = {
4181 0x666B,0x67DD,0x6FC1,0x6FEF,0x7422,0x7438,0x8A17,0x0000,/* 0xF8-0xFF */ 4181 0x666B,0x67DD,0x6FC1,0x6FEF,0x7422,0x7438,0x8A17,0x0000,/* 0xF8-0xFF */
4182}; 4182};
4183 4183
4184static wchar_t c2u_F7[256] = { 4184static const wchar_t c2u_F7[256] = {
4185 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4185 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4186 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4186 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4187 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4187 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4217,7 +4217,7 @@ static wchar_t c2u_F7[256] = {
4217 0x5742,0x677F,0x7248,0x74E3,0x8CA9,0x8FA6,0x9211,0x0000,/* 0xF8-0xFF */ 4217 0x5742,0x677F,0x7248,0x74E3,0x8CA9,0x8FA6,0x9211,0x0000,/* 0xF8-0xFF */
4218}; 4218};
4219 4219
4220static wchar_t c2u_F8[256] = { 4220static const wchar_t c2u_F8[256] = {
4221 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4221 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4222 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4222 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4223 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4223 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4253,7 +4253,7 @@ static wchar_t c2u_F8[256] = {
4253 0x74E2,0x7968,0x8868,0x8C79,0x98C7,0x98C4,0x9A43,0x0000,/* 0xF8-0xFF */ 4253 0x74E2,0x7968,0x8868,0x8C79,0x98C7,0x98C4,0x9A43,0x0000,/* 0xF8-0xFF */
4254}; 4254};
4255 4255
4256static wchar_t c2u_F9[256] = { 4256static const wchar_t c2u_F9[256] = {
4257 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4257 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4258 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4258 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4259 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4259 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4289,7 +4289,7 @@ static wchar_t c2u_F9[256] = {
4289 0x676D,0x6841,0x6C86,0x6E2F,0x7F38,0x809B,0x822A,0x0000,/* 0xF8-0xFF */ 4289 0x676D,0x6841,0x6C86,0x6E2F,0x7F38,0x809B,0x822A,0x0000,/* 0xF8-0xFF */
4290}; 4290};
4291 4291
4292static wchar_t c2u_FA[256] = { 4292static const wchar_t c2u_FA[256] = {
4293 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4293 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4294 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4294 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4295 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4295 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4325,7 +4325,7 @@ static wchar_t c2u_FA[256] = {
4325 0x83A2,0x92CF,0x9830,0x4EA8,0x5144,0x5211,0x578B,0x0000,/* 0xF8-0xFF */ 4325 0x83A2,0x92CF,0x9830,0x4EA8,0x5144,0x5211,0x578B,0x0000,/* 0xF8-0xFF */
4326}; 4326};
4327 4327
4328static wchar_t c2u_FB[256] = { 4328static const wchar_t c2u_FB[256] = {
4329 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4329 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4330 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4330 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4331 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4331 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4361,7 +4361,7 @@ static wchar_t c2u_FB[256] = {
4361 0x9D3B,0x5316,0x548C,0x5B05,0x6A3A,0x706B,0x7575,0x0000,/* 0xF8-0xFF */ 4361 0x9D3B,0x5316,0x548C,0x5B05,0x6A3A,0x706B,0x7575,0x0000,/* 0xF8-0xFF */
4362}; 4362};
4363 4363
4364static wchar_t c2u_FC[256] = { 4364static const wchar_t c2u_FC[256] = {
4365 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4365 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4366 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4366 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4367 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4367 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4397,7 +4397,7 @@ static wchar_t c2u_FC[256] = {
4397 0x5B5D,0x6548,0x6585,0x66C9,0x689F,0x6D8D,0x6DC6,0x0000,/* 0xF8-0xFF */ 4397 0x5B5D,0x6548,0x6585,0x66C9,0x689F,0x6D8D,0x6DC6,0x0000,/* 0xF8-0xFF */
4398}; 4398};
4399 4399
4400static wchar_t c2u_FD[256] = { 4400static const wchar_t c2u_FD[256] = {
4401 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 4401 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
4402 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 4402 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
4403 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 4403 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4433,7 +4433,7 @@ static wchar_t c2u_FD[256] = {
4433 0x71B9,0x71BA,0x72A7,0x79A7,0x7A00,0x7FB2,0x8A70,0x0000,/* 0xF8-0xFF */ 4433 0x71B9,0x71BA,0x72A7,0x79A7,0x7A00,0x7FB2,0x8A70,0x0000,/* 0xF8-0xFF */
4434}; 4434};
4435 4435
4436static wchar_t *page_charset2uni[256] = { 4436static const wchar_t *page_charset2uni[256] = {
4437 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4437 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4438 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4438 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4439 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4439 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -4468,7 +4468,7 @@ static wchar_t *page_charset2uni[256] = {
4468 c2u_F8, c2u_F9, c2u_FA, c2u_FB, c2u_FC, c2u_FD, NULL, NULL, 4468 c2u_F8, c2u_F9, c2u_FA, c2u_FB, c2u_FC, c2u_FD, NULL, NULL,
4469}; 4469};
4470 4470
4471static unsigned char u2c_01[512] = { 4471static const unsigned char u2c_01[512] = {
4472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4497,7 +4497,7 @@ static unsigned char u2c_01[512] = {
4497 0x00, 0x00, 0x00, 0x00, 0xA8, 0xAE, 0xA9, 0xAE, /* 0x64-0x67 */ 4497 0x00, 0x00, 0x00, 0x00, 0xA8, 0xAE, 0xA9, 0xAE, /* 0x64-0x67 */
4498}; 4498};
4499 4499
4500static unsigned char u2c_02[512] = { 4500static const unsigned char u2c_02[512] = {
4501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4557,7 +4557,7 @@ static unsigned char u2c_02[512] = {
4557 0x00, 0x00, 0xA2, 0xA9, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */ 4557 0x00, 0x00, 0xA2, 0xA9, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
4558}; 4558};
4559 4559
4560static unsigned char u2c_03[512] = { 4560static const unsigned char u2c_03[512] = {
4561 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4561 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4562 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4562 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4563 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4563 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4612,7 +4612,7 @@ static unsigned char u2c_03[512] = {
4612 0xA5, 0xF7, 0xA5, 0xF8, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */ 4612 0xA5, 0xF7, 0xA5, 0xF8, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
4613}; 4613};
4614 4614
4615static unsigned char u2c_04[512] = { 4615static const unsigned char u2c_04[512] = {
4616 0x00, 0x00, 0xAC, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4616 0x00, 0x00, 0xAC, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4636,7 +4636,7 @@ static unsigned char u2c_04[512] = {
4636 0x00, 0x00, 0xAC, 0xD7, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */ 4636 0x00, 0x00, 0xAC, 0xD7, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */
4637}; 4637};
4638 4638
4639static unsigned char u2c_11[512] = { 4639static const unsigned char u2c_11[512] = {
4640 0xA4, 0xA1, 0xA4, 0xA2, 0xA4, 0xA4, 0xA4, 0xA7, /* 0x00-0x03 */ 4640 0xA4, 0xA1, 0xA4, 0xA2, 0xA4, 0xA4, 0xA4, 0xA7, /* 0x00-0x03 */
4641 0xA4, 0xA8, 0xA4, 0xA9, 0xA4, 0xB1, 0xA4, 0xB2, /* 0x04-0x07 */ 4641 0xA4, 0xA8, 0xA4, 0xA9, 0xA4, 0xB1, 0xA4, 0xB2, /* 0x04-0x07 */
4642 0xA4, 0xB3, 0xA4, 0xB5, 0xA4, 0xB6, 0xA4, 0xB7, /* 0x08-0x0B */ 4642 0xA4, 0xB3, 0xA4, 0xB5, 0xA4, 0xB6, 0xA4, 0xB7, /* 0x08-0x0B */
@@ -4703,7 +4703,7 @@ static unsigned char u2c_11[512] = {
4703 0x00, 0x00, 0xA4, 0xF6, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 4703 0x00, 0x00, 0xA4, 0xF6, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
4704}; 4704};
4705 4705
4706static unsigned char u2c_20[512] = { 4706static const unsigned char u2c_20[512] = {
4707 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4707 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4750,7 +4750,7 @@ static unsigned char u2c_20[512] = {
4750 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, /* 0xA8-0xAB */ 4750 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, /* 0xA8-0xAB */
4751}; 4751};
4752 4752
4753static unsigned char u2c_21[512] = { 4753static const unsigned char u2c_21[512] = {
4754 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xC9, /* 0x00-0x03 */ 4754 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xC9, /* 0x00-0x03 */
4755 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4755 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4756 0x00, 0x00, 0xA2, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4756 0x00, 0x00, 0xA2, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4808,7 +4808,7 @@ static unsigned char u2c_21[512] = {
4808 0xA2, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */ 4808 0xA2, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
4809}; 4809};
4810 4810
4811static unsigned char u2c_22[512] = { 4811static const unsigned char u2c_22[512] = {
4812 0xA2, 0xA3, 0x00, 0x00, 0xA1, 0xD3, 0xA2, 0xA4, /* 0x00-0x03 */ 4812 0xA2, 0xA3, 0x00, 0x00, 0xA1, 0xD3, 0xA2, 0xA4, /* 0x00-0x03 */
4813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD4, /* 0x04-0x07 */ 4813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD4, /* 0x04-0x07 */
4814 0xA1, 0xF4, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xF5, /* 0x08-0x0B */ 4814 0xA1, 0xF4, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xF5, /* 0x08-0x0B */
@@ -4854,7 +4854,7 @@ static unsigned char u2c_22[512] = {
4854 0x00, 0x00, 0xA1, 0xD1, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */ 4854 0x00, 0x00, 0xA1, 0xD1, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */
4855}; 4855};
4856 4856
4857static unsigned char u2c_23[512] = { 4857static const unsigned char u2c_23[512] = {
4858 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4858 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4859 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4859 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4860 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4860 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4862,7 +4862,7 @@ static unsigned char u2c_23[512] = {
4862 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD2, 0x00, 0x00, /* 0x10-0x13 */ 4862 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD2, 0x00, 0x00, /* 0x10-0x13 */
4863}; 4863};
4864 4864
4865static unsigned char u2c_24[512] = { 4865static const unsigned char u2c_24[512] = {
4866 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4866 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4867 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4867 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4868 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4868 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4925,7 +4925,7 @@ static unsigned char u2c_24[512] = {
4925 0xA8, 0xE5, 0xA8, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */ 4925 0xA8, 0xE5, 0xA8, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
4926}; 4926};
4927 4927
4928static unsigned char u2c_25[512] = { 4928static const unsigned char u2c_25[512] = {
4929 0xA6, 0xA1, 0xA6, 0xAC, 0xA6, 0xA2, 0xA6, 0xAD, /* 0x00-0x03 */ 4929 0xA6, 0xA1, 0xA6, 0xAC, 0xA6, 0xA2, 0xA6, 0xAD, /* 0x00-0x03 */
4930 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4930 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4931 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4931 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4982,7 +4982,7 @@ static unsigned char u2c_25[512] = {
4982 0xA2, 0xC4, 0xA2, 0xC5, 0x00, 0x00, 0x00, 0x00, /* 0xD0-0xD3 */ 4982 0xA2, 0xC4, 0xA2, 0xC5, 0x00, 0x00, 0x00, 0x00, /* 0xD0-0xD3 */
4983}; 4983};
4984 4984
4985static unsigned char u2c_26[512] = { 4985static const unsigned char u2c_26[512] = {
4986 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4986 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4987 0x00, 0x00, 0xA1, 0xDA, 0xA1, 0xD9, 0x00, 0x00, /* 0x04-0x07 */ 4987 0x00, 0x00, 0xA1, 0xDA, 0xA1, 0xD9, 0x00, 0x00, /* 0x04-0x07 */
4988 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4988 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5013,7 +5013,7 @@ static unsigned char u2c_26[512] = {
5013 0xA2, 0xDD, 0xA2, 0xDA, 0x00, 0x00, 0x00, 0x00, /* 0x6C-0x6F */ 5013 0xA2, 0xDD, 0xA2, 0xDA, 0x00, 0x00, 0x00, 0x00, /* 0x6C-0x6F */
5014}; 5014};
5015 5015
5016static unsigned char u2c_30[512] = { 5016static const unsigned char u2c_30[512] = {
5017 0xA1, 0xA1, 0xA1, 0xA2, 0xA1, 0xA3, 0xA1, 0xA8, /* 0x00-0x03 */ 5017 0xA1, 0xA1, 0xA1, 0xA2, 0xA1, 0xA3, 0xA1, 0xA8, /* 0x00-0x03 */
5018 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5018 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5019 0xA1, 0xB4, 0xA1, 0xB5, 0xA1, 0xB6, 0xA1, 0xB7, /* 0x08-0x0B */ 5019 0xA1, 0xB4, 0xA1, 0xB5, 0xA1, 0xB6, 0xA1, 0xB7, /* 0x08-0x0B */
@@ -5079,7 +5079,7 @@ static unsigned char u2c_30[512] = {
5079 0xAB, 0xF4, 0xAB, 0xF5, 0xAB, 0xF6, 0x00, 0x00, /* 0xF4-0xF7 */ 5079 0xAB, 0xF4, 0xAB, 0xF5, 0xAB, 0xF6, 0x00, 0x00, /* 0xF4-0xF7 */
5080}; 5080};
5081 5081
5082static unsigned char u2c_31[512] = { 5082static const unsigned char u2c_31[512] = {
5083 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5083 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5084 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5084 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5085 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5085 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5123,7 +5123,7 @@ static unsigned char u2c_31[512] = {
5123 0xEF, 0xCB, 0xF4, 0xB8, 0xF2, 0xA2, 0xEC, 0xD1, /* 0x9C-0x9F */ 5123 0xEF, 0xCB, 0xF4, 0xB8, 0xF2, 0xA2, 0xEC, 0xD1, /* 0x9C-0x9F */
5124}; 5124};
5125 5125
5126static unsigned char u2c_32[512] = { 5126static const unsigned char u2c_32[512] = {
5127 0xA9, 0xB1, 0xA9, 0xB2, 0xA9, 0xB3, 0xA9, 0xB4, /* 0x00-0x03 */ 5127 0xA9, 0xB1, 0xA9, 0xB2, 0xA9, 0xB3, 0xA9, 0xB4, /* 0x00-0x03 */
5128 0xA9, 0xB5, 0xA9, 0xB6, 0xA9, 0xB7, 0xA9, 0xB8, /* 0x04-0x07 */ 5128 0xA9, 0xB5, 0xA9, 0xB6, 0xA9, 0xB7, 0xA9, 0xB8, /* 0x04-0x07 */
5129 0xA9, 0xB9, 0xA9, 0xBA, 0xA9, 0xBB, 0xA9, 0xBC, /* 0x08-0x0B */ 5129 0xA9, 0xB9, 0xA9, 0xBA, 0xA9, 0xBB, 0xA9, 0xBC, /* 0x08-0x0B */
@@ -5172,7 +5172,7 @@ static unsigned char u2c_32[512] = {
5172 0xE5, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */ 5172 0xE5, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */
5173}; 5173};
5174 5174
5175static unsigned char u2c_33[512] = { 5175static const unsigned char u2c_33[512] = {
5176 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5176 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5232,7 +5232,7 @@ static unsigned char u2c_33[512] = {
5232 0xA7, 0xEE, 0xA7, 0xE9, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */ 5232 0xA7, 0xEE, 0xA7, 0xE9, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
5233}; 5233};
5234 5234
5235static unsigned char u2c_4E[512] = { 5235static const unsigned char u2c_4E[512] = {
5236 0xEC, 0xE9, 0xEF, 0xCB, 0x00, 0x00, 0xF6, 0xD2, /* 0x00-0x03 */ 5236 0xEC, 0xE9, 0xEF, 0xCB, 0x00, 0x00, 0xF6, 0xD2, /* 0x00-0x03 */
5237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xB2, /* 0x04-0x07 */ 5237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xB2, /* 0x04-0x07 */
5238 0xED, 0xDB, 0xDF, 0xB2, 0xDF, 0xBE, 0xF9, 0xBB, /* 0x08-0x0B */ 5238 0xED, 0xDB, 0xDF, 0xB2, 0xDF, 0xBE, 0xF9, 0xBB, /* 0x08-0x0B */
@@ -5299,7 +5299,7 @@ static unsigned char u2c_4E[512] = {
5299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xF2, /* 0xF8-0xFB */ 5299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xF2, /* 0xF8-0xFB */
5300}; 5300};
5301 5301
5302static unsigned char u2c_4F[512] = { 5302static const unsigned char u2c_4F[512] = {
5303 0x00, 0x00, 0xD0, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5303 0x00, 0x00, 0xD0, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5305 0x00, 0x00, 0xF9, 0xF2, 0xEC, 0xA5, 0xD0, 0xDF, /* 0x08-0x0B */ 5305 0x00, 0x00, 0xF9, 0xF2, 0xEC, 0xA5, 0xD0, 0xDF, /* 0x08-0x0B */
@@ -5366,7 +5366,7 @@ static unsigned char u2c_4F[512] = {
5366 0xDC, 0xE4, 0x00, 0x00, 0xE5, 0xEF, 0x00, 0x00, /* 0xF8-0xFB */ 5366 0xDC, 0xE4, 0x00, 0x00, 0xE5, 0xEF, 0x00, 0x00, /* 0xF8-0xFB */
5367}; 5367};
5368 5368
5369static unsigned char u2c_50[512] = { 5369static const unsigned char u2c_50[512] = {
5370 0x00, 0x00, 0x00, 0x00, 0xDC, 0xB1, 0x00, 0x00, /* 0x00-0x03 */ 5370 0x00, 0x00, 0x00, 0x00, 0xDC, 0xB1, 0x00, 0x00, /* 0x00-0x03 */
5371 0x00, 0x00, 0x00, 0x00, 0xD5, 0xD6, 0x00, 0x00, /* 0x04-0x07 */ 5371 0x00, 0x00, 0x00, 0x00, 0xD5, 0xD6, 0x00, 0x00, /* 0x04-0x07 */
5372 0x00, 0x00, 0xF3, 0xDA, 0x00, 0x00, 0xCB, 0xC1, /* 0x08-0x0B */ 5372 0x00, 0x00, 0xF3, 0xDA, 0x00, 0x00, 0xCB, 0xC1, /* 0x08-0x0B */
@@ -5434,7 +5434,7 @@ static unsigned char u2c_50[512] = {
5434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xC7, /* 0xFC-0xFF */ 5434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xC7, /* 0xFC-0xFF */
5435}; 5435};
5436 5436
5437static unsigned char u2c_51[512] = { 5437static const unsigned char u2c_51[512] = {
5438 0xEB, 0xF0, 0xF1, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5438 0xEB, 0xF0, 0xF1, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5439 0xE5, 0xE2, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, /* 0x04-0x07 */ 5439 0xE5, 0xE2, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, /* 0x04-0x07 */
5440 0x00, 0x00, 0xCB, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5440 0x00, 0x00, 0xCB, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5502,7 +5502,7 @@ static unsigned char u2c_51[512] = {
5502 0x00, 0x00, 0xF9, 0xDE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5502 0x00, 0x00, 0xF9, 0xDE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5503}; 5503};
5504 5504
5505static unsigned char u2c_52[512] = { 5505static const unsigned char u2c_52[512] = {
5506 0xD3, 0xEF, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xD3, /* 0x00-0x03 */ 5506 0xD3, 0xEF, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xD3, /* 0x00-0x03 */
5507 0x00, 0x00, 0x00, 0x00, 0xDD, 0xC2, 0xEF, 0xB7, /* 0x04-0x07 */ 5507 0x00, 0x00, 0x00, 0x00, 0xDD, 0xC2, 0xEF, 0xB7, /* 0x04-0x07 */
5508 0xE7, 0xD4, 0x00, 0x00, 0xCA, 0xCA, 0x00, 0x00, /* 0x08-0x0B */ 5508 0xE7, 0xD4, 0x00, 0x00, 0xCA, 0xCA, 0x00, 0x00, /* 0x08-0x0B */
@@ -5570,7 +5570,7 @@ static unsigned char u2c_52[512] = {
5570 0x00, 0x00, 0x00, 0x00, 0xCE, 0xFE, 0xDA, 0xA8, /* 0xFC-0xFF */ 5570 0x00, 0x00, 0x00, 0x00, 0xCE, 0xFE, 0xDA, 0xA8, /* 0xFC-0xFF */
5571}; 5571};
5572 5572
5573static unsigned char u2c_53[512] = { 5573static const unsigned char u2c_53[512] = {
5574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5575 0x00, 0x00, 0xF8, 0xD0, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5575 0x00, 0x00, 0xF8, 0xD0, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5576 0xFD, 0xD6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5576 0xFD, 0xD6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5637,7 +5637,7 @@ static unsigned char u2c_53[512] = {
5637 0xDE, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 5637 0xDE, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
5638}; 5638};
5639 5639
5640static unsigned char u2c_54[512] = { 5640static const unsigned char u2c_54[512] = {
5641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD, 0xDE, /* 0x00-0x03 */ 5641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD, 0xDE, /* 0x00-0x03 */
5642 0xCA, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5642 0xCA, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5643 0xF9, 0xEA, 0xD1, 0xCE, 0xEE, 0xD4, 0x00, 0x00, /* 0x08-0x0B */ 5643 0xF9, 0xEA, 0xD1, 0xCE, 0xEE, 0xD4, 0x00, 0x00, /* 0x08-0x0B */
@@ -5704,7 +5704,7 @@ static unsigned char u2c_54[512] = {
5704 0x00, 0x00, 0x00, 0x00, 0xF8, 0xD4, 0x00, 0x00, /* 0xF8-0xFB */ 5704 0x00, 0x00, 0x00, 0x00, 0xF8, 0xD4, 0x00, 0x00, /* 0xF8-0xFB */
5705}; 5705};
5706 5706
5707static unsigned char u2c_55[512] = { 5707static const unsigned char u2c_55[512] = {
5708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5709 0xF8, 0xA6, 0x00, 0x00, 0xDE, 0xCA, 0xF2, 0xC6, /* 0x04-0x07 */ 5709 0xF8, 0xA6, 0x00, 0x00, 0xDE, 0xCA, 0xF2, 0xC6, /* 0x04-0x07 */
5710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5772,7 +5772,7 @@ static unsigned char u2c_55[512] = {
5772 0x00, 0x00, 0xE1, 0xF5, 0xF1, 0xB3, 0x00, 0x00, /* 0xFC-0xFF */ 5772 0x00, 0x00, 0xE1, 0xF5, 0xF1, 0xB3, 0x00, 0x00, /* 0xFC-0xFF */
5773}; 5773};
5774 5774
5775static unsigned char u2c_56[512] = { 5775static const unsigned char u2c_56[512] = {
5776 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5776 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5777 0x00, 0x00, 0x00, 0x00, 0xF7, 0xA3, 0x00, 0x00, /* 0x04-0x07 */ 5777 0x00, 0x00, 0x00, 0x00, 0xF7, 0xA3, 0x00, 0x00, /* 0x04-0x07 */
5778 0x00, 0x00, 0xCA, 0xA9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5778 0x00, 0x00, 0xCA, 0xA9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5839,7 +5839,7 @@ static unsigned char u2c_56[512] = {
5839 0x00, 0x00, 0xD6, 0xB7, 0xCD, 0xB3, 0x00, 0x00, /* 0xF8-0xFB */ 5839 0x00, 0x00, 0xD6, 0xB7, 0xCD, 0xB3, 0x00, 0x00, /* 0xF8-0xFB */
5840}; 5840};
5841 5841
5842static unsigned char u2c_57[512] = { 5842static const unsigned char u2c_57[512] = {
5843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xD5, /* 0x00-0x03 */ 5843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xD5, /* 0x00-0x03 */
5844 0xE5, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5844 0xE5, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5845 0xCF, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xCF, 0xD0, /* 0x08-0x0B */ 5845 0xCF, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xCF, 0xD0, /* 0x08-0x0B */
@@ -5907,7 +5907,7 @@ static unsigned char u2c_57[512] = {
5907 0xD0, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5907 0xD0, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5908}; 5908};
5909 5909
5910static unsigned char u2c_58[512] = { 5910static const unsigned char u2c_58[512] = {
5911 0xCF, 0xDC, 0x00, 0x00, 0xD3, 0xD1, 0x00, 0x00, /* 0x00-0x03 */ 5911 0xCF, 0xDC, 0x00, 0x00, 0xD3, 0xD1, 0x00, 0x00, /* 0x00-0x03 */
5912 0x00, 0x00, 0xCC, 0xB1, 0xF7, 0xD8, 0x00, 0x00, /* 0x04-0x07 */ 5912 0x00, 0x00, 0xCC, 0xB1, 0xF7, 0xD8, 0x00, 0x00, /* 0x04-0x07 */
5913 0xCB, 0xA8, 0xEB, 0xBC, 0xE4, 0xBE, 0x00, 0x00, /* 0x08-0x0B */ 5913 0xCB, 0xA8, 0xEB, 0xBC, 0xE4, 0xBE, 0x00, 0x00, /* 0x08-0x0B */
@@ -5975,7 +5975,7 @@ static unsigned char u2c_58[512] = {
5975 0x00, 0x00, 0xE1, 0xF8, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5975 0x00, 0x00, 0xE1, 0xF8, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5976}; 5976};
5977 5977
5978static unsigned char u2c_59[512] = { 5978static const unsigned char u2c_59[512] = {
5979 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5979 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5980 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5980 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5981 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5981 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6043,7 +6043,7 @@ static unsigned char u2c_59[512] = {
6043 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0xAC, /* 0xFC-0xFF */ 6043 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0xAC, /* 0xFC-0xFF */
6044}; 6044};
6045 6045
6046static unsigned char u2c_5A[512] = { 6046static const unsigned char u2c_5A[512] = {
6047 0x00, 0x00, 0xEA, 0xCE, 0x00, 0x00, 0xE8, 0xDF, /* 0x00-0x03 */ 6047 0x00, 0x00, 0xEA, 0xCE, 0x00, 0x00, 0xE8, 0xDF, /* 0x00-0x03 */
6048 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6048 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6049 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6049 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6106,7 +6106,7 @@ static unsigned char u2c_5A[512] = {
6106 0x00, 0x00, 0xD2, 0xEC, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */ 6106 0x00, 0x00, 0xD2, 0xEC, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
6107}; 6107};
6108 6108
6109static unsigned char u2c_5B[512] = { 6109static const unsigned char u2c_5B[512] = {
6110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6111 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6111 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6112 0x00, 0x00, 0xFD, 0xF0, 0x00, 0x00, 0xE0, 0xBD, /* 0x08-0x0B */ 6112 0x00, 0x00, 0xFD, 0xF0, 0x00, 0x00, 0xE0, 0xBD, /* 0x08-0x0B */
@@ -6173,7 +6173,7 @@ static unsigned char u2c_5B[512] = {
6173 0xF5, 0xBB, 0x00, 0x00, 0xDE, 0xD1, 0x00, 0x00, /* 0xF8-0xFB */ 6173 0xF5, 0xBB, 0x00, 0x00, 0xDE, 0xD1, 0x00, 0x00, /* 0xF8-0xFB */
6174}; 6174};
6175 6175
6176static unsigned char u2c_5C[512] = { 6176static const unsigned char u2c_5C[512] = {
6177 0x00, 0x00, 0xDC, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6177 0x00, 0x00, 0xDC, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6178 0xDE, 0xD2, 0x00, 0x00, 0x00, 0x00, 0xED, 0xE2, /* 0x04-0x07 */ 6178 0xDE, 0xD2, 0x00, 0x00, 0x00, 0x00, 0xED, 0xE2, /* 0x04-0x07 */
6179 0xEE, 0xF6, 0xEA, 0xCF, 0xF0, 0xEE, 0xE3, 0xFC, /* 0x08-0x0B */ 6179 0xEE, 0xF6, 0xEA, 0xCF, 0xF0, 0xEE, 0xE3, 0xFC, /* 0x08-0x0B */
@@ -6241,7 +6241,7 @@ static unsigned char u2c_5C[512] = {
6241 0x00, 0x00, 0xFA, 0xF2, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 6241 0x00, 0x00, 0xFA, 0xF2, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
6242}; 6242};
6243 6243
6244static unsigned char u2c_5D[512] = { 6244static const unsigned char u2c_5D[512] = {
6245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xFD, /* 0x04-0x07 */ 6246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xFD, /* 0x04-0x07 */
6247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6309,7 +6309,7 @@ static unsigned char u2c_5D[512] = {
6309 0x00, 0x00, 0xE1, 0xDE, 0xCB, 0xEE, 0x00, 0x00, /* 0xFC-0xFF */ 6309 0x00, 0x00, 0xE1, 0xDE, 0xCB, 0xEE, 0x00, 0x00, /* 0xFC-0xFF */
6310}; 6310};
6311 6311
6312static unsigned char u2c_5E[512] = { 6312static const unsigned char u2c_5E[512] = {
6313 0x00, 0x00, 0x00, 0x00, 0xE3, 0xBC, 0xF8, 0xD6, /* 0x00-0x03 */ 6313 0x00, 0x00, 0x00, 0x00, 0xE3, 0xBC, 0xF8, 0xD6, /* 0x00-0x03 */
6314 0x00, 0x00, 0x00, 0x00, 0xDB, 0xEE, 0x00, 0x00, /* 0x04-0x07 */ 6314 0x00, 0x00, 0x00, 0x00, 0xDB, 0xEE, 0x00, 0x00, /* 0x04-0x07 */
6315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6376,7 +6376,7 @@ static unsigned char u2c_5E[512] = {
6376 0x00, 0x00, 0x00, 0x00, 0xCB, 0xEF, 0xFC, 0xDF, /* 0xF8-0xFB */ 6376 0x00, 0x00, 0x00, 0x00, 0xCB, 0xEF, 0xFC, 0xDF, /* 0xF8-0xFB */
6377}; 6377};
6378 6378
6379static unsigned char u2c_5F[512] = { 6379static const unsigned char u2c_5F[512] = {
6380 0x00, 0x00, 0xDC, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6380 0x00, 0x00, 0xDC, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6381 0xD6, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6381 0xD6, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6382 0x00, 0x00, 0x00, 0x00, 0xF8, 0xC9, 0x00, 0x00, /* 0x08-0x0B */ 6382 0x00, 0x00, 0x00, 0x00, 0xF8, 0xC9, 0x00, 0x00, /* 0x08-0x0B */
@@ -6444,7 +6444,7 @@ static unsigned char u2c_5F[512] = {
6444 0x00, 0x00, 0xFB, 0xEC, 0x00, 0x00, 0xDD, 0xC8, /* 0xFC-0xFF */ 6444 0x00, 0x00, 0xFB, 0xEC, 0x00, 0x00, 0xDD, 0xC8, /* 0xFC-0xFF */
6445}; 6445};
6446 6446
6447static unsigned char u2c_60[512] = { 6447static const unsigned char u2c_60[512] = {
6448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6511,7 +6511,7 @@ static unsigned char u2c_60[512] = {
6511 0x00, 0x00, 0xE5, 0xA9, 0xE0, 0xF6, 0xF6, 0xB3, /* 0xF8-0xFB */ 6511 0x00, 0x00, 0xE5, 0xA9, 0xE0, 0xF6, 0xF6, 0xB3, /* 0xF8-0xFB */
6512}; 6512};
6513 6513
6514static unsigned char u2c_61[512] = { 6514static const unsigned char u2c_61[512] = {
6515 0x00, 0x00, 0xE1, 0xFE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6515 0x00, 0x00, 0xE1, 0xFE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6516 0x00, 0x00, 0x00, 0x00, 0xCB, 0xF0, 0x00, 0x00, /* 0x04-0x07 */ 6516 0x00, 0x00, 0x00, 0x00, 0xCB, 0xF0, 0x00, 0x00, /* 0x04-0x07 */
6517 0xEA, 0xEF, 0xEA, 0xF0, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6517 0xEA, 0xEF, 0xEA, 0xF0, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6579,7 +6579,7 @@ static unsigned char u2c_61[512] = {
6579 0xCF, 0xAB, 0x00, 0x00, 0x00, 0x00, 0xEB, 0xF3, /* 0xFC-0xFF */ 6579 0xCF, 0xAB, 0x00, 0x00, 0x00, 0x00, 0xEB, 0xF3, /* 0xFC-0xFF */
6580}; 6580};
6581 6581
6582static unsigned char u2c_62[512] = { 6582static const unsigned char u2c_62[512] = {
6583 0xD5, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6583 0xD5, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD3, 0xD4, /* 0x04-0x07 */ 6584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD3, 0xD4, /* 0x04-0x07 */
6585 0xCD, 0xFC, 0x00, 0x00, 0xD9, 0xE6, 0x00, 0x00, /* 0x08-0x0B */ 6585 0xCD, 0xFC, 0x00, 0x00, 0xD9, 0xE6, 0x00, 0x00, /* 0x08-0x0B */
@@ -6647,7 +6647,7 @@ static unsigned char u2c_62[512] = {
6647 0x00, 0x00, 0x00, 0x00, 0xE3, 0xA6, 0xD1, 0xDA, /* 0xFC-0xFF */ 6647 0x00, 0x00, 0x00, 0x00, 0xE3, 0xA6, 0xD1, 0xDA, /* 0xFC-0xFF */
6648}; 6648};
6649 6649
6650static unsigned char u2c_63[512] = { 6650static const unsigned char u2c_63[512] = {
6651 0x00, 0x00, 0xF2, 0xA5, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6651 0x00, 0x00, 0xF2, 0xA5, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6652 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF2, 0xA6, /* 0x04-0x07 */ 6652 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF2, 0xA6, /* 0x04-0x07 */
6653 0x00, 0x00, 0xE4, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6653 0x00, 0x00, 0xE4, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6713,7 +6713,7 @@ static unsigned char u2c_63[512] = {
6713 0xEA, 0xB5, 0x00, 0x00, 0xE5, 0xAA, 0xDF, 0xBA, /* 0xF4-0xF7 */ 6713 0xEA, 0xB5, 0x00, 0x00, 0xE5, 0xAA, 0xDF, 0xBA, /* 0xF4-0xF7 */
6714}; 6714};
6715 6715
6716static unsigned char u2c_64[512] = { 6716static const unsigned char u2c_64[512] = {
6717 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6717 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6781,7 +6781,7 @@ static unsigned char u2c_64[512] = {
6781 0x00, 0x00, 0x00, 0x00, 0xE8, 0xF6, 0x00, 0x00, /* 0xFC-0xFF */ 6781 0x00, 0x00, 0x00, 0x00, 0xE8, 0xF6, 0x00, 0x00, /* 0xFC-0xFF */
6782}; 6782};
6783 6783
6784static unsigned char u2c_65[512] = { 6784static const unsigned char u2c_65[512] = {
6785 0xDA, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6785 0xDA, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6786 0xF7, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6786 0xF7, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6787 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6787 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6849,7 +6849,7 @@ static unsigned char u2c_65[512] = {
6849 0xDA, 0xC4, 0xD4, 0xC5, 0x00, 0x00, 0xE7, 0xFA, /* 0xFC-0xFF */ 6849 0xDA, 0xC4, 0xD4, 0xC5, 0x00, 0x00, 0xE7, 0xFA, /* 0xFC-0xFF */
6850}; 6850};
6851 6851
6852static unsigned char u2c_66[512] = { 6852static const unsigned char u2c_66[512] = {
6853 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6853 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6854 0x00, 0x00, 0x00, 0x00, 0xCD, 0xE0, 0xE3, 0xB0, /* 0x04-0x07 */ 6854 0x00, 0x00, 0x00, 0x00, 0xCD, 0xE0, 0xE3, 0xB0, /* 0x04-0x07 */
6855 0x00, 0x00, 0xDB, 0xB2, 0xFB, 0xC4, 0x00, 0x00, /* 0x08-0x0B */ 6855 0x00, 0x00, 0xDB, 0xB2, 0xFB, 0xC4, 0x00, 0x00, /* 0x08-0x0B */
@@ -6917,7 +6917,7 @@ static unsigned char u2c_66[512] = {
6917 0xD8, 0xBA, 0x00, 0x00, 0xF1, 0xF4, 0xF4, 0xF0, /* 0xFC-0xFF */ 6917 0xD8, 0xBA, 0x00, 0x00, 0xF1, 0xF4, 0xF4, 0xF0, /* 0xFC-0xFF */
6918}; 6918};
6919 6919
6920static unsigned char u2c_67[512] = { 6920static const unsigned char u2c_67[512] = {
6921 0xF5, 0xCC, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xE5, /* 0x00-0x03 */ 6921 0xF5, 0xCC, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xE5, /* 0x00-0x03 */
6922 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6922 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6923 0xEA, 0xC5, 0xEA, 0xF3, 0x00, 0x00, 0xDD, 0xDB, /* 0x08-0x0B */ 6923 0xEA, 0xC5, 0xEA, 0xF3, 0x00, 0x00, 0xDD, 0xDB, /* 0x08-0x0B */
@@ -6985,7 +6985,7 @@ static unsigned char u2c_67[512] = {
6985 0x00, 0x00, 0x00, 0x00, 0xEF, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */ 6985 0x00, 0x00, 0x00, 0x00, 0xEF, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
6986}; 6986};
6987 6987
6988static unsigned char u2c_68[512] = { 6988static const unsigned char u2c_68[512] = {
6989 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6989 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6990 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6990 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6991 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6991 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7052,7 +7052,7 @@ static unsigned char u2c_68[512] = {
7052 0x00, 0x00, 0xD4, 0xA1, 0xCE, 0xB2, 0x00, 0x00, /* 0xF8-0xFB */ 7052 0x00, 0x00, 0xD4, 0xA1, 0xCE, 0xB2, 0x00, 0x00, /* 0xF8-0xFB */
7053}; 7053};
7054 7054
7055static unsigned char u2c_69[512] = { 7055static const unsigned char u2c_69[512] = {
7056 0xE8, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7056 0xE8, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7057 0x00, 0x00, 0xEB, 0xF5, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7057 0x00, 0x00, 0xEB, 0xF5, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7058 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7058 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7120,7 +7120,7 @@ static unsigned char u2c_69[512] = {
7120 0x00, 0x00, 0xF0, 0xCB, 0x00, 0x00, 0xD0, 0xC7, /* 0xFC-0xFF */ 7120 0x00, 0x00, 0xF0, 0xCB, 0x00, 0x00, 0xD0, 0xC7, /* 0xFC-0xFF */
7121}; 7121};
7122 7122
7123static unsigned char u2c_6A[512] = { 7123static const unsigned char u2c_6A[512] = {
7124 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC5, 0x00, 0x00, /* 0x00-0x03 */ 7124 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC5, 0x00, 0x00, /* 0x00-0x03 */
7125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7126 0x00, 0x00, 0x00, 0x00, 0xDB, 0xE0, 0x00, 0x00, /* 0x08-0x0B */ 7126 0x00, 0x00, 0x00, 0x00, 0xDB, 0xE0, 0x00, 0x00, /* 0x08-0x0B */
@@ -7187,7 +7187,7 @@ static unsigned char u2c_6A[512] = {
7187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xA1, /* 0xF8-0xFB */ 7187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xA1, /* 0xF8-0xFB */
7188}; 7188};
7189 7189
7190static unsigned char u2c_6B[512] = { 7190static const unsigned char u2c_6B[512] = {
7191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7192 0xD5, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7192 0xD5, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7193 0x00, 0x00, 0x00, 0x00, 0xCF, 0xED, 0x00, 0x00, /* 0x08-0x0B */ 7193 0x00, 0x00, 0x00, 0x00, 0xCF, 0xED, 0x00, 0x00, /* 0x08-0x0B */
@@ -7251,7 +7251,7 @@ static unsigned char u2c_6B[512] = {
7251 0xCF, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xEC-0xEF */ 7251 0xCF, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xEC-0xEF */
7252}; 7252};
7253 7253
7254static unsigned char u2c_6C[512] = { 7254static const unsigned char u2c_6C[512] = {
7255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7257 0xEE, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7257 0xEE, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7316,7 +7316,7 @@ static unsigned char u2c_6C[512] = {
7316 0xF7, 0xC1, 0x00, 0x00, 0x00, 0x00, 0xE7, 0xB6, /* 0xF0-0xF3 */ 7316 0xF7, 0xC1, 0x00, 0x00, 0x00, 0x00, 0xE7, 0xB6, /* 0xF0-0xF3 */
7317}; 7317};
7318 7318
7319static unsigned char u2c_6D[512] = { 7319static const unsigned char u2c_6D[512] = {
7320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xC7, /* 0x08-0x0B */ 7322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xC7, /* 0x08-0x0B */
@@ -7383,7 +7383,7 @@ static unsigned char u2c_6D[512] = {
7383 0xF4, 0xE8, 0xE5, 0xF4, 0xF4, 0xBC, 0xF4, 0xD5, /* 0xF8-0xFB */ 7383 0xF4, 0xE8, 0xE5, 0xF4, 0xF4, 0xBC, 0xF4, 0xD5, /* 0xF8-0xFB */
7384}; 7384};
7385 7385
7386static unsigned char u2c_6E[512] = { 7386static const unsigned char u2c_6E[512] = {
7387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7451,7 +7451,7 @@ static unsigned char u2c_6E[512] = {
7451 0x00, 0x00, 0x00, 0x00, 0xCD, 0xE3, 0xD8, 0xBB, /* 0xFC-0xFF */ 7451 0x00, 0x00, 0x00, 0x00, 0xCD, 0xE3, 0xD8, 0xBB, /* 0xFC-0xFF */
7452}; 7452};
7453 7453
7454static unsigned char u2c_6F[512] = { 7454static const unsigned char u2c_6F[512] = {
7455 0x00, 0x00, 0xE5, 0xDB, 0xF8, 0xF7, 0x00, 0x00, /* 0x00-0x03 */ 7455 0x00, 0x00, 0xE5, 0xDB, 0xF8, 0xF7, 0x00, 0x00, /* 0x00-0x03 */
7456 0x00, 0x00, 0x00, 0x00, 0xF6, 0xD4, 0x00, 0x00, /* 0x04-0x07 */ 7456 0x00, 0x00, 0x00, 0x00, 0xF6, 0xD4, 0x00, 0x00, /* 0x04-0x07 */
7457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7519,7 +7519,7 @@ static unsigned char u2c_6F[512] = {
7519 0x00, 0x00, 0x00, 0x00, 0xD5, 0xEB, 0x00, 0x00, /* 0xFC-0xFF */ 7519 0x00, 0x00, 0x00, 0x00, 0xD5, 0xEB, 0x00, 0x00, /* 0xFC-0xFF */
7520}; 7520};
7521 7521
7522static unsigned char u2c_70[512] = { 7522static const unsigned char u2c_70[512] = {
7523 0x00, 0x00, 0xE5, 0xC8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7523 0x00, 0x00, 0xE5, 0xC8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7524 0x00, 0x00, 0xFB, 0xA4, 0xD4, 0xB9, 0x00, 0x00, /* 0x04-0x07 */ 7524 0x00, 0x00, 0xFB, 0xA4, 0xD4, 0xB9, 0x00, 0x00, /* 0x04-0x07 */
7525 0x00, 0x00, 0xDE, 0xE1, 0x00, 0x00, 0xE4, 0xA3, /* 0x08-0x0B */ 7525 0x00, 0x00, 0xDE, 0xE1, 0x00, 0x00, 0xE4, 0xA3, /* 0x08-0x0B */
@@ -7587,7 +7587,7 @@ static unsigned char u2c_70[512] = {
7587 0x00, 0x00, 0xDC, 0xEB, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 7587 0x00, 0x00, 0xDC, 0xEB, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
7588}; 7588};
7589 7589
7590static unsigned char u2c_71[512] = { 7590static const unsigned char u2c_71[512] = {
7591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7592 0xFD, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7592 0xFD, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7593 0x00, 0x00, 0xE5, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7593 0x00, 0x00, 0xE5, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7655,7 +7655,7 @@ static unsigned char u2c_71[512] = {
7655 0xE3, 0xE8, 0x00, 0x00, 0xD4, 0xA7, 0xE8, 0xFC, /* 0xFC-0xFF */ 7655 0xE3, 0xE8, 0x00, 0x00, 0xD4, 0xA7, 0xE8, 0xFC, /* 0xFC-0xFF */
7656}; 7656};
7657 7657
7658static unsigned char u2c_72[512] = { 7658static const unsigned char u2c_72[512] = {
7659 0xFA, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7659 0xFA, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7660 0x00, 0x00, 0x00, 0x00, 0xF8, 0xEF, 0x00, 0x00, /* 0x04-0x07 */ 7660 0x00, 0x00, 0x00, 0x00, 0xF8, 0xEF, 0x00, 0x00, /* 0x04-0x07 */
7661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7723,7 +7723,7 @@ static unsigned char u2c_72[512] = {
7723 0xD5, 0xC9, 0xF8, 0xAC, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 7723 0xD5, 0xC9, 0xF8, 0xAC, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
7724}; 7724};
7725 7725
7726static unsigned char u2c_73[512] = { 7726static const unsigned char u2c_73[512] = {
7727 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7727 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7728 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7728 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7729 0x00, 0x00, 0x00, 0x00, 0xE7, 0xD9, 0x00, 0x00, /* 0x08-0x0B */ 7729 0x00, 0x00, 0x00, 0x00, 0xE7, 0xD9, 0x00, 0x00, /* 0x08-0x0B */
@@ -7791,7 +7791,7 @@ static unsigned char u2c_73[512] = {
7791 0x00, 0x00, 0xEF, 0xEA, 0xFA, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */ 7791 0x00, 0x00, 0xEF, 0xEA, 0xFA, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
7792}; 7792};
7793 7793
7794static unsigned char u2c_74[512] = { 7794static const unsigned char u2c_74[512] = {
7795 0x00, 0x00, 0xE0, 0xC4, 0x00, 0x00, 0xCF, 0xB9, /* 0x00-0x03 */ 7795 0x00, 0x00, 0xE0, 0xC4, 0x00, 0x00, 0xCF, 0xB9, /* 0x00-0x03 */
7796 0x00, 0x00, 0xD5, 0xCA, 0xD7, 0xE2, 0xE2, 0xAF, /* 0x04-0x07 */ 7796 0x00, 0x00, 0xD5, 0xCA, 0xD7, 0xE2, 0xE2, 0xAF, /* 0x04-0x07 */
7797 0x00, 0x00, 0xD7, 0xB8, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7797 0x00, 0x00, 0xD7, 0xB8, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7857,7 +7857,7 @@ static unsigned char u2c_74[512] = {
7857 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0xB6, /* 0xF4-0xF7 */ 7857 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0xB6, /* 0xF4-0xF7 */
7858}; 7858};
7859 7859
7860static unsigned char u2c_75[512] = { 7860static const unsigned char u2c_75[512] = {
7861 0x00, 0x00, 0xDC, 0xBA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7861 0x00, 0x00, 0xDC, 0xBA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7862 0xCC, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7862 0xCC, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7925,7 +7925,7 @@ static unsigned char u2c_75[512] = {
7925 0xCD, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 7925 0xCD, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
7926}; 7926};
7927 7927
7928static unsigned char u2c_76[512] = { 7928static const unsigned char u2c_76[512] = {
7929 0xE5, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7929 0xE5, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7930 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7930 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7931 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7931 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7993,7 +7993,7 @@ static unsigned char u2c_76[512] = {
7993 0xDA, 0xF0, 0x00, 0x00, 0xE2, 0xEA, 0x00, 0x00, /* 0xFC-0xFF */ 7993 0xDA, 0xF0, 0x00, 0x00, 0xE2, 0xEA, 0x00, 0x00, /* 0xFC-0xFF */
7994}; 7994};
7995 7995
7996static unsigned char u2c_77[512] = { 7996static const unsigned char u2c_77[512] = {
7997 0x00, 0x00, 0xE0, 0xFD, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7997 0x00, 0x00, 0xE0, 0xFD, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7998 0xD8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7998 0xD8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7999 0xF7, 0xAF, 0xDA, 0xB6, 0x00, 0x00, 0xCA, 0xD7, /* 0x08-0x0B */ 7999 0xF7, 0xAF, 0xDA, 0xB6, 0x00, 0x00, 0xCA, 0xD7, /* 0x08-0x0B */
@@ -8058,7 +8058,7 @@ static unsigned char u2c_77[512] = {
8058 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xB4, /* 0xF0-0xF3 */ 8058 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xB4, /* 0xF0-0xF3 */
8059}; 8059};
8060 8060
8061static unsigned char u2c_78[512] = { 8061static const unsigned char u2c_78[512] = {
8062 0x00, 0x00, 0x00, 0x00, 0xDE, 0xE3, 0x00, 0x00, /* 0x00-0x03 */ 8062 0x00, 0x00, 0x00, 0x00, 0xDE, 0xE3, 0x00, 0x00, /* 0x00-0x03 */
8063 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8063 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8064 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8064 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8125,7 +8125,7 @@ static unsigned char u2c_78[512] = {
8125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, 0xF2, /* 0xF8-0xFB */ 8125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, 0xF2, /* 0xF8-0xFB */
8126}; 8126};
8127 8127
8128static unsigned char u2c_79[512] = { 8128static const unsigned char u2c_79[512] = {
8129 0x00, 0x00, 0xF5, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8129 0x00, 0x00, 0xF5, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8192,7 +8192,7 @@ static unsigned char u2c_79[512] = {
8192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xB9, /* 0xF8-0xFB */ 8192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xB9, /* 0xF8-0xFB */
8193}; 8193};
8194 8194
8195static unsigned char u2c_7A[512] = { 8195static const unsigned char u2c_7A[512] = {
8196 0xFD, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8196 0xFD, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8197 0x00, 0x00, 0xE1, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8197 0x00, 0x00, 0xE1, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8198 0xCA, 0xD9, 0x00, 0x00, 0x00, 0x00, 0xEF, 0xEF, /* 0x08-0x0B */ 8198 0xCA, 0xD9, 0x00, 0x00, 0x00, 0x00, 0xEF, 0xEF, /* 0x08-0x0B */
@@ -8260,7 +8260,7 @@ static unsigned char u2c_7A[512] = {
8260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCA, 0xDA, /* 0xFC-0xFF */ 8260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCA, 0xDA, /* 0xFC-0xFF */
8261}; 8261};
8262 8262
8263static unsigned char u2c_7B[512] = { 8263static const unsigned char u2c_7B[512] = {
8264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8323,7 +8323,7 @@ static unsigned char u2c_7B[512] = {
8323 0x00, 0x00, 0xDE, 0xE8, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */ 8323 0x00, 0x00, 0xDE, 0xE8, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
8324}; 8324};
8325 8325
8326static unsigned char u2c_7C[512] = { 8326static const unsigned char u2c_7C[512] = {
8327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xEA, /* 0x04-0x07 */ 8328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xEA, /* 0x04-0x07 */
8329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8391,7 +8391,7 @@ static unsigned char u2c_7C[512] = {
8391 0x00, 0x00, 0x00, 0x00, 0xD0, 0xAC, 0x00, 0x00, /* 0xFC-0xFF */ 8391 0x00, 0x00, 0x00, 0x00, 0xD0, 0xAC, 0x00, 0x00, /* 0xFC-0xFF */
8392}; 8392};
8393 8393
8394static unsigned char u2c_7D[512] = { 8394static const unsigned char u2c_7D[512] = {
8395 0xD1, 0xBA, 0x00, 0x00, 0xF1, 0xC4, 0x00, 0x00, /* 0x00-0x03 */ 8395 0xD1, 0xBA, 0x00, 0x00, 0xF1, 0xC4, 0x00, 0x00, /* 0x00-0x03 */
8396 0xE5, 0xB3, 0xFB, 0xF5, 0xE9, 0xE1, 0xFD, 0xE0, /* 0x04-0x07 */ 8396 0xE5, 0xB3, 0xFB, 0xF5, 0xE9, 0xE1, 0xFD, 0xE0, /* 0x04-0x07 */
8397 0xFC, 0xBC, 0x00, 0x00, 0xDA, 0xA2, 0xDA, 0xA3, /* 0x08-0x0B */ 8397 0xFC, 0xBC, 0x00, 0x00, 0xDA, 0xA2, 0xDA, 0xA3, /* 0x08-0x0B */
@@ -8458,7 +8458,7 @@ static unsigned char u2c_7D[512] = {
8458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xC6, /* 0xF8-0xFB */ 8458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xC6, /* 0xF8-0xFB */
8459}; 8459};
8460 8460
8461static unsigned char u2c_7E[512] = { 8461static const unsigned char u2c_7E[512] = {
8462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8464 0x00, 0x00, 0xF2, 0xDB, 0xE4, 0xFC, 0x00, 0x00, /* 0x08-0x0B */ 8464 0x00, 0x00, 0xF2, 0xDB, 0xE4, 0xFC, 0x00, 0x00, /* 0x08-0x0B */
@@ -8502,7 +8502,7 @@ static unsigned char u2c_7E[512] = {
8502 0xD5, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */ 8502 0xD5, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
8503}; 8503};
8504 8504
8505static unsigned char u2c_7F[512] = { 8505static const unsigned char u2c_7F[512] = {
8506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8570,7 +8570,7 @@ static unsigned char u2c_7F[512] = {
8570 0xEC, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 8570 0xEC, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
8571}; 8571};
8572 8572
8573static unsigned char u2c_80[512] = { 8573static const unsigned char u2c_80[512] = {
8574 0xE9, 0xA5, 0xD6, 0xD5, 0x00, 0x00, 0xCD, 0xC5, /* 0x00-0x03 */ 8574 0xE9, 0xA5, 0xD6, 0xD5, 0x00, 0x00, 0xCD, 0xC5, /* 0x00-0x03 */
8575 0x00, 0x00, 0xED, 0xBA, 0xD1, 0xBD, 0x00, 0x00, /* 0x04-0x07 */ 8575 0x00, 0x00, 0xED, 0xBA, 0xD1, 0xBD, 0x00, 0x00, /* 0x04-0x07 */
8576 0x00, 0x00, 0xCF, 0xBE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8576 0x00, 0x00, 0xCF, 0xBE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8638,7 +8638,7 @@ static unsigned char u2c_80[512] = {
8638 0x00, 0x00, 0xD2, 0xF6, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 8638 0x00, 0x00, 0xD2, 0xF6, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
8639}; 8639};
8640 8640
8641static unsigned char u2c_81[512] = { 8641static const unsigned char u2c_81[512] = {
8642 0x00, 0x00, 0x00, 0x00, 0xF2, 0xB7, 0x00, 0x00, /* 0x00-0x03 */ 8642 0x00, 0x00, 0x00, 0x00, 0xF2, 0xB7, 0x00, 0x00, /* 0x00-0x03 */
8643 0x00, 0x00, 0xFA, 0xF6, 0xF6, 0xAA, 0xFA, 0xF7, /* 0x04-0x07 */ 8643 0x00, 0x00, 0xFA, 0xF6, 0xF6, 0xAA, 0xFA, 0xF7, /* 0x04-0x07 */
8644 0xD8, 0xE6, 0x00, 0x00, 0xF4, 0xB1, 0x00, 0x00, /* 0x08-0x0B */ 8644 0xD8, 0xE6, 0x00, 0x00, 0xF4, 0xB1, 0x00, 0x00, /* 0x08-0x0B */
@@ -8706,7 +8706,7 @@ static unsigned char u2c_81[512] = {
8706 0xCF, 0xBF, 0x00, 0x00, 0xEB, 0xAC, 0x00, 0x00, /* 0xFC-0xFF */ 8706 0xCF, 0xBF, 0x00, 0x00, 0xEB, 0xAC, 0x00, 0x00, /* 0xFC-0xFF */
8707}; 8707};
8708 8708
8709static unsigned char u2c_82[512] = { 8709static const unsigned char u2c_82[512] = {
8710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8711 0x00, 0x00, 0xCF, 0xC0, 0x00, 0x00, 0xE6, 0xA8, /* 0x04-0x07 */ 8711 0x00, 0x00, 0xCF, 0xC0, 0x00, 0x00, 0xE6, 0xA8, /* 0x04-0x07 */
8712 0xFD, 0xE9, 0x00, 0x00, 0xCF, 0xC1, 0x00, 0x00, /* 0x08-0x0B */ 8712 0xFD, 0xE9, 0x00, 0x00, 0xCF, 0xC1, 0x00, 0x00, /* 0x08-0x0B */
@@ -8774,7 +8774,7 @@ static unsigned char u2c_82[512] = {
8774 0x00, 0x00, 0xCD, 0xC9, 0xF9, 0xB7, 0x00, 0x00, /* 0xFC-0xFF */ 8774 0x00, 0x00, 0xCD, 0xC9, 0xF9, 0xB7, 0x00, 0x00, /* 0xFC-0xFF */
8775}; 8775};
8776 8776
8777static unsigned char u2c_83[512] = { 8777static const unsigned char u2c_83[512] = {
8778 0x00, 0x00, 0xF1, 0xE8, 0xD9, 0xF2, 0xDB, 0xF5, /* 0x00-0x03 */ 8778 0x00, 0x00, 0xF1, 0xE8, 0xD9, 0xF2, 0xDB, 0xF5, /* 0x00-0x03 */
8779 0xCA, 0xB5, 0xD9, 0xC6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8779 0xCA, 0xB5, 0xD9, 0xC6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8780 0x00, 0x00, 0xD8, 0xC9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8780 0x00, 0x00, 0xD8, 0xC9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8842,7 +8842,7 @@ static unsigned char u2c_83[512] = {
8842 0x00, 0x00, 0xE2, 0xDD, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 8842 0x00, 0x00, 0xE2, 0xDD, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
8843}; 8843};
8844 8844
8845static unsigned char u2c_84[512] = { 8845static const unsigned char u2c_84[512] = {
8846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFE, /* 0x00-0x03 */ 8846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFE, /* 0x00-0x03 */
8847 0xD4, 0xAC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8847 0xD4, 0xAC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8848 0x00, 0x00, 0x00, 0x00, 0xD5, 0xD1, 0x00, 0x00, /* 0x08-0x0B */ 8848 0x00, 0x00, 0x00, 0x00, 0xD5, 0xD1, 0x00, 0x00, /* 0x08-0x0B */
@@ -8910,7 +8910,7 @@ static unsigned char u2c_84[512] = {
8910 0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 8910 0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
8911}; 8911};
8912 8912
8913static unsigned char u2c_85[512] = { 8913static const unsigned char u2c_85[512] = {
8914 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8914 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8915 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8915 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8916 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8916 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8978,7 +8978,7 @@ static unsigned char u2c_85[512] = {
8978 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xAB, /* 0xFC-0xFF */ 8978 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xAB, /* 0xFC-0xFF */
8979}; 8979};
8980 8980
8981static unsigned char u2c_86[512] = { 8981static const unsigned char u2c_86[512] = {
8982 0x00, 0x00, 0x00, 0x00, 0xE7, 0xDE, 0x00, 0x00, /* 0x00-0x03 */ 8982 0x00, 0x00, 0x00, 0x00, 0xE7, 0xDE, 0x00, 0x00, /* 0x00-0x03 */
8983 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xE1, 0xCC, /* 0x04-0x07 */ 8983 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xE1, 0xCC, /* 0x04-0x07 */
8984 0x00, 0x00, 0x00, 0x00, 0xE8, 0xB3, 0x00, 0x00, /* 0x08-0x0B */ 8984 0x00, 0x00, 0x00, 0x00, 0xE8, 0xB3, 0x00, 0x00, /* 0x08-0x0B */
@@ -9046,7 +9046,7 @@ static unsigned char u2c_86[512] = {
9046 0x00, 0x00, 0x00, 0x00, 0xE4, 0xB6, 0x00, 0x00, /* 0xFC-0xFF */ 9046 0x00, 0x00, 0x00, 0x00, 0xE4, 0xB6, 0x00, 0x00, /* 0xFC-0xFF */
9047}; 9047};
9048 9048
9049static unsigned char u2c_87[512] = { 9049static const unsigned char u2c_87[512] = {
9050 0xF5, 0xB9, 0x00, 0x00, 0xDC, 0xF0, 0xE3, 0xF1, /* 0x00-0x03 */ 9050 0xF5, 0xB9, 0x00, 0x00, 0xDC, 0xF0, 0xE3, 0xF1, /* 0x00-0x03 */
9051 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9051 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9052 0xE8, 0xA5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9052 0xE8, 0xA5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9114,7 +9114,7 @@ static unsigned char u2c_87[512] = {
9114 0x00, 0x00, 0x00, 0x00, 0xE0, 0xEA, 0x00, 0x00, /* 0xFC-0xFF */ 9114 0x00, 0x00, 0x00, 0x00, 0xE0, 0xEA, 0x00, 0x00, /* 0xFC-0xFF */
9115}; 9115};
9116 9116
9117static unsigned char u2c_88[512] = { 9117static const unsigned char u2c_88[512] = {
9118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9119 0x00, 0x00, 0xE3, 0xB2, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9119 0x00, 0x00, 0xE3, 0xB2, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9182,7 +9182,7 @@ static unsigned char u2c_88[512] = {
9182 0x00, 0x00, 0xF0, 0xB2, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 9182 0x00, 0x00, 0xF0, 0xB2, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
9183}; 9183};
9184 9184
9185static unsigned char u2c_89[512] = { 9185static const unsigned char u2c_89[512] = {
9186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xDC, /* 0x04-0x07 */ 9187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xDC, /* 0x04-0x07 */
9188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9249,7 +9249,7 @@ static unsigned char u2c_89[512] = {
9249 0xF5, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 9249 0xF5, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
9250}; 9250};
9251 9251
9252static unsigned char u2c_8A[512] = { 9252static const unsigned char u2c_8A[512] = {
9253 0xE5, 0xEB, 0x00, 0x00, 0xEF, 0xF4, 0xDD, 0xB5, /* 0x00-0x03 */ 9253 0xE5, 0xEB, 0x00, 0x00, 0xEF, 0xF4, 0xDD, 0xB5, /* 0x00-0x03 */
9254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9255 0xCD, 0xAA, 0x00, 0x00, 0xE3, 0xF2, 0x00, 0x00, /* 0x08-0x0B */ 9255 0xCD, 0xAA, 0x00, 0x00, 0xE3, 0xF2, 0x00, 0x00, /* 0x08-0x0B */
@@ -9317,7 +9317,7 @@ static unsigned char u2c_8A[512] = {
9317 0x00, 0x00, 0x00, 0x00, 0xD1, 0xE7, 0x00, 0x00, /* 0xFC-0xFF */ 9317 0x00, 0x00, 0x00, 0x00, 0xD1, 0xE7, 0x00, 0x00, /* 0xFC-0xFF */
9318}; 9318};
9319 9319
9320static unsigned char u2c_8B[512] = { 9320static const unsigned char u2c_8B[512] = {
9321 0xD9, 0xC7, 0xE4, 0xD7, 0xEA, 0xDD, 0x00, 0x00, /* 0x00-0x03 */ 9321 0xD9, 0xC7, 0xE4, 0xD7, 0xEA, 0xDD, 0x00, 0x00, /* 0x00-0x03 */
9322 0xD4, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9322 0xD4, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9360,7 +9360,7 @@ static unsigned char u2c_8B[512] = {
9360 0x00, 0x00, 0x00, 0x00, 0xF3, 0xC6, 0x00, 0x00, /* 0x98-0x9B */ 9360 0x00, 0x00, 0x00, 0x00, 0xF3, 0xC6, 0x00, 0x00, /* 0x98-0x9B */
9361}; 9361};
9362 9362
9363static unsigned char u2c_8C[512] = { 9363static const unsigned char u2c_8C[512] = {
9364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9428,7 +9428,7 @@ static unsigned char u2c_8C[512] = {
9428 0xCF, 0xC5, 0xDF, 0xDF, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 9428 0xCF, 0xC5, 0xDF, 0xDF, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
9429}; 9429};
9430 9430
9431static unsigned char u2c_8D[512] = { 9431static const unsigned char u2c_8D[512] = {
9432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9433 0xF2, 0xBE, 0xF6, 0xA1, 0x00, 0x00, 0xEB, 0xCB, /* 0x04-0x07 */ 9433 0xF2, 0xBE, 0xF6, 0xA1, 0x00, 0x00, 0xEB, 0xCB, /* 0x04-0x07 */
9434 0xF1, 0xFC, 0x00, 0x00, 0xF3, 0xC7, 0x00, 0x00, /* 0x08-0x0B */ 9434 0xF1, 0xFC, 0x00, 0x00, 0xF3, 0xC7, 0x00, 0x00, /* 0x08-0x0B */
@@ -9493,7 +9493,7 @@ static unsigned char u2c_8D[512] = {
9493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xAF, /* 0xF0-0xF3 */ 9493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xAF, /* 0xF0-0xF3 */
9494}; 9494};
9495 9495
9496static unsigned char u2c_8E[512] = { 9496static const unsigned char u2c_8E[512] = {
9497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9499 0x00, 0x00, 0x00, 0x00, 0xE9, 0xC9, 0x00, 0x00, /* 0x08-0x0B */ 9499 0x00, 0x00, 0x00, 0x00, 0xE9, 0xC9, 0x00, 0x00, /* 0x08-0x0B */
@@ -9561,7 +9561,7 @@ static unsigned char u2c_8E[512] = {
9561 0x00, 0x00, 0x00, 0x00, 0xE3, 0xDC, 0x00, 0x00, /* 0xFC-0xFF */ 9561 0x00, 0x00, 0x00, 0x00, 0xE3, 0xDC, 0x00, 0x00, /* 0xFC-0xFF */
9562}; 9562};
9563 9563
9564static unsigned char u2c_8F[512] = { 9564static const unsigned char u2c_8F[512] = {
9565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xF2, /* 0x00-0x03 */ 9565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xF2, /* 0x00-0x03 */
9566 0x00, 0x00, 0xD6, 0xD9, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9566 0x00, 0x00, 0xD6, 0xD9, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9567 0x00, 0x00, 0xEE, 0xB0, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9567 0x00, 0x00, 0xEE, 0xB0, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9629,7 +9629,7 @@ static unsigned char u2c_8F[512] = {
9629 0x00, 0x00, 0xF5, 0xDA, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 9629 0x00, 0x00, 0xF5, 0xDA, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
9630}; 9630};
9631 9631
9632static unsigned char u2c_90[512] = { 9632static const unsigned char u2c_90[512] = {
9633 0xF7, 0xDC, 0xE1, 0xEA, 0xCE, 0xC1, 0xD4, 0xB1, /* 0x00-0x03 */ 9633 0xF7, 0xDC, 0xE1, 0xEA, 0xCE, 0xC1, 0xD4, 0xB1, /* 0x00-0x03 */
9634 0x00, 0x00, 0xFD, 0xB1, 0xE6, 0xBD, 0x00, 0x00, /* 0x04-0x07 */ 9634 0x00, 0x00, 0xFD, 0xB1, 0xE6, 0xBD, 0x00, 0x00, /* 0x04-0x07 */
9635 0xFB, 0xAD, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xE7, /* 0x08-0x0B */ 9635 0xFB, 0xAD, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xE7, /* 0x08-0x0B */
@@ -9697,7 +9697,7 @@ static unsigned char u2c_90[512] = {
9697 0x00, 0x00, 0xD4, 0xB4, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 9697 0x00, 0x00, 0xD4, 0xB4, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
9698}; 9698};
9699 9699
9700static unsigned char u2c_91[512] = { 9700static const unsigned char u2c_91[512] = {
9701 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC7, 0x00, 0x00, /* 0x00-0x03 */ 9701 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC7, 0x00, 0x00, /* 0x00-0x03 */
9702 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9702 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9703 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9703 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9763,7 +9763,7 @@ static unsigned char u2c_91[512] = {
9763 0x00, 0x00, 0xF3, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */ 9763 0x00, 0x00, 0xF3, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */
9764}; 9764};
9765 9765
9766static unsigned char u2c_92[512] = { 9766static const unsigned char u2c_92[512] = {
9767 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9767 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9768 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9768 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9769 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9769 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9831,7 +9831,7 @@ static unsigned char u2c_92[512] = {
9831 0xCB, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 9831 0xCB, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
9832}; 9832};
9833 9833
9834static unsigned char u2c_93[512] = { 9834static const unsigned char u2c_93[512] = {
9835 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9835 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9836 0xD6, 0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9836 0xD6, 0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9837 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9837 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9897,7 +9897,7 @@ static unsigned char u2c_93[512] = {
9897 0x00, 0x00, 0x00, 0x00, 0xF3, 0xA1, 0x00, 0x00, /* 0xF4-0xF7 */ 9897 0x00, 0x00, 0x00, 0x00, 0xF3, 0xA1, 0x00, 0x00, /* 0xF4-0xF7 */
9898}; 9898};
9899 9899
9900static unsigned char u2c_94[512] = { 9900static const unsigned char u2c_94[512] = {
9901 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9901 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9902 0xFC, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9902 0xFC, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9903 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9903 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9932,7 +9932,7 @@ static unsigned char u2c_94[512] = {
9932 0x00, 0x00, 0xF3, 0xC8, 0x00, 0x00, 0xF3, 0xBA, /* 0x7C-0x7F */ 9932 0x00, 0x00, 0xF3, 0xC8, 0x00, 0x00, 0xF3, 0xBA, /* 0x7C-0x7F */
9933}; 9933};
9934 9934
9935static unsigned char u2c_95[512] = { 9935static const unsigned char u2c_95[512] = {
9936 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9936 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9937 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9937 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9938 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9938 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9993,7 +9993,7 @@ static unsigned char u2c_95[512] = {
9993 0x00, 0x00, 0xF4, 0xC5, 0xDC, 0xA3, 0x00, 0x00, /* 0xE0-0xE3 */ 9993 0x00, 0x00, 0xF4, 0xC5, 0xDC, 0xA3, 0x00, 0x00, /* 0xE0-0xE3 */
9994}; 9994};
9995 9995
9996static unsigned char u2c_96[512] = { 9996static const unsigned char u2c_96[512] = {
9997 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9997 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9998 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9998 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9999 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9999 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10060,7 +10060,7 @@ static unsigned char u2c_96[512] = {
10060 0x00, 0x00, 0xDA, 0xDF, 0x00, 0x00, 0xEF, 0xB3, /* 0xF8-0xFB */ 10060 0x00, 0x00, 0xDA, 0xDF, 0x00, 0x00, 0xEF, 0xB3, /* 0xF8-0xFB */
10061}; 10061};
10062 10062
10063static unsigned char u2c_97[512] = { 10063static const unsigned char u2c_97[512] = {
10064 0xE2, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10064 0xE2, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10065 0x00, 0x00, 0x00, 0x00, 0xEF, 0xFD, 0xF2, 0xE8, /* 0x04-0x07 */ 10065 0x00, 0x00, 0x00, 0x00, 0xEF, 0xFD, 0xF2, 0xE8, /* 0x04-0x07 */
10066 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10066 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10128,7 +10128,7 @@ static unsigned char u2c_97[512] = {
10128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0xC2, /* 0xFC-0xFF */ 10128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0xC2, /* 0xFC-0xFF */
10129}; 10129};
10130 10130
10131static unsigned char u2c_98[512] = { 10131static const unsigned char u2c_98[512] = {
10132 0xFB, 0xE1, 0xFA, 0xED, 0xF0, 0xA2, 0xCC, 0xF1, /* 0x00-0x03 */ 10132 0xFB, 0xE1, 0xFA, 0xED, 0xF0, 0xA2, 0xCC, 0xF1, /* 0x00-0x03 */
10133 0x00, 0x00, 0xFA, 0xA3, 0xE2, 0xF7, 0x00, 0x00, /* 0x04-0x07 */ 10133 0x00, 0x00, 0xFA, 0xA3, 0xE2, 0xF7, 0x00, 0x00, /* 0x04-0x07 */
10134 0xE2, 0xCE, 0x00, 0x00, 0xE9, 0xF5, 0x00, 0x00, /* 0x08-0x0B */ 10134 0xE2, 0xCE, 0x00, 0x00, 0xE9, 0xF5, 0x00, 0x00, /* 0x08-0x0B */
@@ -10196,7 +10196,7 @@ static unsigned char u2c_98[512] = {
10196 0xDE, 0xF8, 0xF8, 0xE9, 0xE3, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */ 10196 0xDE, 0xF8, 0xF8, 0xE9, 0xE3, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
10197}; 10197};
10198 10198
10199static unsigned char u2c_99[512] = { 10199static const unsigned char u2c_99[512] = {
10200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xF5, /* 0x00-0x03 */ 10200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xF5, /* 0x00-0x03 */
10201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10202 0x00, 0x00, 0xFA, 0xC3, 0xE5, 0xD7, 0x00, 0x00, /* 0x08-0x0B */ 10202 0x00, 0x00, 0xFA, 0xC3, 0xE5, 0xD7, 0x00, 0x00, /* 0x08-0x0B */
@@ -10264,7 +10264,7 @@ static unsigned char u2c_99[512] = {
10264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xE7, /* 0xFC-0xFF */ 10264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xE7, /* 0xFC-0xFF */
10265}; 10265};
10266 10266
10267static unsigned char u2c_9A[512] = { 10267static const unsigned char u2c_9A[512] = {
10268 0x00, 0x00, 0xDE, 0xBE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10268 0x00, 0x00, 0xDE, 0xBE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10270 0xDC, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10270 0xDC, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10328,7 +10328,7 @@ static unsigned char u2c_9A[512] = {
10328 0x00, 0x00, 0x00, 0x00, 0xDB, 0xA5, 0x00, 0x00, /* 0xEC-0xEF */ 10328 0x00, 0x00, 0x00, 0x00, 0xDB, 0xA5, 0x00, 0x00, /* 0xEC-0xEF */
10329}; 10329};
10330 10330
10331static unsigned char u2c_9B[512] = { 10331static const unsigned char u2c_9B[512] = {
10332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10391,7 +10391,7 @@ static unsigned char u2c_9B[512] = {
10391 0xCC, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */ 10391 0xCC, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
10392}; 10392};
10393 10393
10394static unsigned char u2c_9C[512] = { 10394static const unsigned char u2c_9C[512] = {
10395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10457,7 +10457,7 @@ static unsigned char u2c_9C[512] = {
10457 0xD9, 0xB0, 0x00, 0x00, 0xE6, 0xE9, 0x00, 0x00, /* 0xF4-0xF7 */ 10457 0xD9, 0xB0, 0x00, 0x00, 0xE6, 0xE9, 0x00, 0x00, /* 0xF4-0xF7 */
10458}; 10458};
10459 10459
10460static unsigned char u2c_9D[512] = { 10460static const unsigned char u2c_9D[512] = {
10461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10463 0x00, 0x00, 0xE4, 0xBC, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10463 0x00, 0x00, 0xE4, 0xBC, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10524,7 +10524,7 @@ static unsigned char u2c_9D[512] = {
10524 0xFD, 0xD3, 0xEB, 0xED, 0xD6, 0xDC, 0x00, 0x00, /* 0xF8-0xFB */ 10524 0xFD, 0xD3, 0xEB, 0xED, 0xD6, 0xDC, 0x00, 0x00, /* 0xF8-0xFB */
10525}; 10525};
10526 10526
10527static unsigned char u2c_9E[512] = { 10527static const unsigned char u2c_9E[512] = {
10528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 10529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
10530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10590,7 +10590,7 @@ static unsigned char u2c_9E[512] = {
10590 0xDA, 0xBD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */ 10590 0xDA, 0xBD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */
10591}; 10591};
10592 10592
10593static unsigned char u2c_9F[512] = { 10593static const unsigned char u2c_9F[512] = {
10594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 10594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
10595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xA8, /* 0x04-0x07 */ 10595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xA8, /* 0x04-0x07 */
10596 0xDC, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 10596 0xDC, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10634,7 +10634,7 @@ static unsigned char u2c_9F[512] = {
10634 0xCF, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */ 10634 0xCF, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
10635}; 10635};
10636 10636
10637static unsigned char u2c_AC[512] = { 10637static const unsigned char u2c_AC[512] = {
10638 0xB0, 0xA1, 0xB0, 0xA2, 0x81, 0x41, 0x81, 0x42, /* 0x00-0x03 */ 10638 0xB0, 0xA1, 0xB0, 0xA2, 0x81, 0x41, 0x81, 0x42, /* 0x00-0x03 */
10639 0xB0, 0xA3, 0x81, 0x43, 0x81, 0x44, 0xB0, 0xA4, /* 0x04-0x07 */ 10639 0xB0, 0xA3, 0x81, 0x43, 0x81, 0x44, 0xB0, 0xA4, /* 0x04-0x07 */
10640 0xB0, 0xA5, 0xB0, 0xA6, 0xB0, 0xA7, 0x81, 0x45, /* 0x08-0x0B */ 10640 0xB0, 0xA5, 0xB0, 0xA6, 0xB0, 0xA7, 0x81, 0x45, /* 0x08-0x0B */
@@ -10702,7 +10702,7 @@ static unsigned char u2c_AC[512] = {
10702 0xB0, 0xFA, 0xB0, 0xFB, 0x81, 0xF0, 0x81, 0xF1, /* 0xFC-0xFF */ 10702 0xB0, 0xFA, 0xB0, 0xFB, 0x81, 0xF0, 0x81, 0xF1, /* 0xFC-0xFF */
10703}; 10703};
10704 10704
10705static unsigned char u2c_AD[512] = { 10705static const unsigned char u2c_AD[512] = {
10706 0xB0, 0xFC, 0x81, 0xF2, 0x81, 0xF3, 0x81, 0xF4, /* 0x00-0x03 */ 10706 0xB0, 0xFC, 0x81, 0xF2, 0x81, 0xF3, 0x81, 0xF4, /* 0x00-0x03 */
10707 0xB0, 0xFD, 0x81, 0xF5, 0xB0, 0xFE, 0x81, 0xF6, /* 0x04-0x07 */ 10707 0xB0, 0xFD, 0x81, 0xF5, 0xB0, 0xFE, 0x81, 0xF6, /* 0x04-0x07 */
10708 0x81, 0xF7, 0x81, 0xF8, 0x81, 0xF9, 0x81, 0xFA, /* 0x08-0x0B */ 10708 0x81, 0xF7, 0x81, 0xF8, 0x81, 0xF9, 0x81, 0xFA, /* 0x08-0x0B */
@@ -10770,7 +10770,7 @@ static unsigned char u2c_AD[512] = {
10770 0xB1, 0xD9, 0x83, 0x43, 0x83, 0x44, 0xB1, 0xDA, /* 0xFC-0xFF */ 10770 0xB1, 0xD9, 0x83, 0x43, 0x83, 0x44, 0xB1, 0xDA, /* 0xFC-0xFF */
10771}; 10771};
10772 10772
10773static unsigned char u2c_AE[512] = { 10773static const unsigned char u2c_AE[512] = {
10774 0xB1, 0xDB, 0xB1, 0xDC, 0x83, 0x45, 0x83, 0x46, /* 0x00-0x03 */ 10774 0xB1, 0xDB, 0xB1, 0xDC, 0x83, 0x45, 0x83, 0x46, /* 0x00-0x03 */
10775 0x83, 0x47, 0x83, 0x48, 0x83, 0x49, 0x83, 0x4A, /* 0x04-0x07 */ 10775 0x83, 0x47, 0x83, 0x48, 0x83, 0x49, 0x83, 0x4A, /* 0x04-0x07 */
10776 0xB1, 0xDD, 0xB1, 0xDE, 0x83, 0x4B, 0xB1, 0xDF, /* 0x08-0x0B */ 10776 0xB1, 0xDD, 0xB1, 0xDE, 0x83, 0x4B, 0xB1, 0xDF, /* 0x08-0x0B */
@@ -10838,7 +10838,7 @@ static unsigned char u2c_AE[512] = {
10838 0xB2, 0xBA, 0x84, 0x52, 0x84, 0x53, 0x84, 0x54, /* 0xFC-0xFF */ 10838 0xB2, 0xBA, 0x84, 0x52, 0x84, 0x53, 0x84, 0x54, /* 0xFC-0xFF */
10839}; 10839};
10840 10840
10841static unsigned char u2c_AF[512] = { 10841static const unsigned char u2c_AF[512] = {
10842 0x84, 0x55, 0x84, 0x56, 0x84, 0x57, 0x84, 0x58, /* 0x00-0x03 */ 10842 0x84, 0x55, 0x84, 0x56, 0x84, 0x57, 0x84, 0x58, /* 0x00-0x03 */
10843 0x84, 0x59, 0x84, 0x5A, 0x84, 0x61, 0xB2, 0xBB, /* 0x04-0x07 */ 10843 0x84, 0x59, 0x84, 0x5A, 0x84, 0x61, 0xB2, 0xBB, /* 0x04-0x07 */
10844 0xB2, 0xBC, 0x84, 0x62, 0x84, 0x63, 0x84, 0x64, /* 0x08-0x0B */ 10844 0xB2, 0xBC, 0x84, 0x62, 0x84, 0x63, 0x84, 0x64, /* 0x08-0x0B */
@@ -10906,7 +10906,7 @@ static unsigned char u2c_AF[512] = {
10906 0x85, 0x75, 0x85, 0x76, 0x85, 0x77, 0x85, 0x78, /* 0xFC-0xFF */ 10906 0x85, 0x75, 0x85, 0x76, 0x85, 0x77, 0x85, 0x78, /* 0xFC-0xFF */
10907}; 10907};
10908 10908
10909static unsigned char u2c_B0[512] = { 10909static const unsigned char u2c_B0[512] = {
10910 0xB2, 0xEB, 0xB2, 0xEC, 0x85, 0x79, 0x85, 0x7A, /* 0x00-0x03 */ 10910 0xB2, 0xEB, 0xB2, 0xEC, 0x85, 0x79, 0x85, 0x7A, /* 0x00-0x03 */
10911 0xB2, 0xED, 0x85, 0x81, 0x85, 0x82, 0x85, 0x83, /* 0x04-0x07 */ 10911 0xB2, 0xED, 0x85, 0x81, 0x85, 0x82, 0x85, 0x83, /* 0x04-0x07 */
10912 0x85, 0x84, 0x85, 0x85, 0x85, 0x86, 0x85, 0x87, /* 0x08-0x0B */ 10912 0x85, 0x84, 0x85, 0x85, 0x85, 0x86, 0x85, 0x87, /* 0x08-0x0B */
@@ -10974,7 +10974,7 @@ static unsigned char u2c_B0[512] = {
10974 0x86, 0x8C, 0x86, 0x8D, 0x86, 0x8E, 0x86, 0x8F, /* 0xFC-0xFF */ 10974 0x86, 0x8C, 0x86, 0x8D, 0x86, 0x8E, 0x86, 0x8F, /* 0xFC-0xFF */
10975}; 10975};
10976 10976
10977static unsigned char u2c_B1[512] = { 10977static const unsigned char u2c_B1[512] = {
10978 0x86, 0x90, 0x86, 0x91, 0x86, 0x92, 0x86, 0x93, /* 0x00-0x03 */ 10978 0x86, 0x90, 0x86, 0x91, 0x86, 0x92, 0x86, 0x93, /* 0x00-0x03 */
10979 0x86, 0x94, 0x86, 0x95, 0x86, 0x96, 0x86, 0x97, /* 0x04-0x07 */ 10979 0x86, 0x94, 0x86, 0x95, 0x86, 0x96, 0x86, 0x97, /* 0x04-0x07 */
10980 0xB3, 0xCA, 0xB3, 0xCB, 0x86, 0x98, 0xB3, 0xCC, /* 0x08-0x0B */ 10980 0xB3, 0xCA, 0xB3, 0xCB, 0x86, 0x98, 0xB3, 0xCC, /* 0x08-0x0B */
@@ -11042,7 +11042,7 @@ static unsigned char u2c_B1[512] = {
11042 0x87, 0x9E, 0xB4, 0xA8, 0x87, 0x9F, 0x87, 0xA0, /* 0xFC-0xFF */ 11042 0x87, 0x9E, 0xB4, 0xA8, 0x87, 0x9F, 0x87, 0xA0, /* 0xFC-0xFF */
11043}; 11043};
11044 11044
11045static unsigned char u2c_B2[512] = { 11045static const unsigned char u2c_B2[512] = {
11046 0x87, 0xA1, 0x87, 0xA2, 0x87, 0xA3, 0x87, 0xA4, /* 0x00-0x03 */ 11046 0x87, 0xA1, 0x87, 0xA2, 0x87, 0xA3, 0x87, 0xA4, /* 0x00-0x03 */
11047 0xB4, 0xA9, 0xB4, 0xAA, 0x87, 0xA5, 0x87, 0xA6, /* 0x04-0x07 */ 11047 0xB4, 0xA9, 0xB4, 0xAA, 0x87, 0xA5, 0x87, 0xA6, /* 0x04-0x07 */
11048 0xB4, 0xAB, 0x87, 0xA7, 0x87, 0xA8, 0xB4, 0xAC, /* 0x08-0x0B */ 11048 0xB4, 0xAB, 0x87, 0xA7, 0x87, 0xA8, 0xB4, 0xAC, /* 0x08-0x0B */
@@ -11110,7 +11110,7 @@ static unsigned char u2c_B2[512] = {
11110 0x88, 0xAA, 0x88, 0xAB, 0x88, 0xAC, 0xB4, 0xEA, /* 0xFC-0xFF */ 11110 0x88, 0xAA, 0x88, 0xAB, 0x88, 0xAC, 0xB4, 0xEA, /* 0xFC-0xFF */
11111}; 11111};
11112 11112
11113static unsigned char u2c_B3[512] = { 11113static const unsigned char u2c_B3[512] = {
11114 0xB4, 0xEB, 0xB4, 0xEC, 0x88, 0xAD, 0x88, 0xAE, /* 0x00-0x03 */ 11114 0xB4, 0xEB, 0xB4, 0xEC, 0x88, 0xAD, 0x88, 0xAE, /* 0x00-0x03 */
11115 0xB4, 0xED, 0x88, 0xAF, 0x88, 0xB0, 0x88, 0xB1, /* 0x04-0x07 */ 11115 0xB4, 0xED, 0x88, 0xAF, 0x88, 0xB0, 0x88, 0xB1, /* 0x04-0x07 */
11116 0xB4, 0xEE, 0x88, 0xB2, 0x88, 0xB3, 0x88, 0xB4, /* 0x08-0x0B */ 11116 0xB4, 0xEE, 0x88, 0xB2, 0x88, 0xB3, 0x88, 0xB4, /* 0x08-0x0B */
@@ -11178,7 +11178,7 @@ static unsigned char u2c_B3[512] = {
11178 0xB5, 0xC5, 0x89, 0xBF, 0x89, 0xC0, 0x89, 0xC1, /* 0xFC-0xFF */ 11178 0xB5, 0xC5, 0x89, 0xBF, 0x89, 0xC0, 0x89, 0xC1, /* 0xFC-0xFF */
11179}; 11179};
11180 11180
11181static unsigned char u2c_B4[512] = { 11181static const unsigned char u2c_B4[512] = {
11182 0x89, 0xC2, 0x89, 0xC3, 0x89, 0xC4, 0x89, 0xC5, /* 0x00-0x03 */ 11182 0x89, 0xC2, 0x89, 0xC3, 0x89, 0xC4, 0x89, 0xC5, /* 0x00-0x03 */
11183 0x89, 0xC6, 0x89, 0xC7, 0x89, 0xC8, 0x89, 0xC9, /* 0x04-0x07 */ 11183 0x89, 0xC6, 0x89, 0xC7, 0x89, 0xC8, 0x89, 0xC9, /* 0x04-0x07 */
11184 0x89, 0xCA, 0x89, 0xCB, 0x89, 0xCC, 0x89, 0xCD, /* 0x08-0x0B */ 11184 0x89, 0xCA, 0x89, 0xCB, 0x89, 0xCC, 0x89, 0xCD, /* 0x08-0x0B */
@@ -11246,7 +11246,7 @@ static unsigned char u2c_B4[512] = {
11246 0x8A, 0xE2, 0x8A, 0xE3, 0x8A, 0xE4, 0x8A, 0xE5, /* 0xFC-0xFF */ 11246 0x8A, 0xE2, 0x8A, 0xE3, 0x8A, 0xE4, 0x8A, 0xE5, /* 0xFC-0xFF */
11247}; 11247};
11248 11248
11249static unsigned char u2c_B5[512] = { 11249static const unsigned char u2c_B5[512] = {
11250 0x8A, 0xE6, 0x8A, 0xE7, 0x8A, 0xE8, 0x8A, 0xE9, /* 0x00-0x03 */ 11250 0x8A, 0xE6, 0x8A, 0xE7, 0x8A, 0xE8, 0x8A, 0xE9, /* 0x00-0x03 */
11251 0x8A, 0xEA, 0x8A, 0xEB, 0x8A, 0xEC, 0x8A, 0xED, /* 0x04-0x07 */ 11251 0x8A, 0xEA, 0x8A, 0xEB, 0x8A, 0xEC, 0x8A, 0xED, /* 0x04-0x07 */
11252 0x8A, 0xEE, 0x8A, 0xEF, 0x8A, 0xF0, 0x8A, 0xF1, /* 0x08-0x0B */ 11252 0x8A, 0xEE, 0x8A, 0xEF, 0x8A, 0xF0, 0x8A, 0xF1, /* 0x08-0x0B */
@@ -11314,7 +11314,7 @@ static unsigned char u2c_B5[512] = {
11314 0x8B, 0xFB, 0x8B, 0xFC, 0x8B, 0xFD, 0x8B, 0xFE, /* 0xFC-0xFF */ 11314 0x8B, 0xFB, 0x8B, 0xFC, 0x8B, 0xFD, 0x8B, 0xFE, /* 0xFC-0xFF */
11315}; 11315};
11316 11316
11317static unsigned char u2c_B6[512] = { 11317static const unsigned char u2c_B6[512] = {
11318 0x8C, 0x41, 0x8C, 0x42, 0x8C, 0x43, 0x8C, 0x44, /* 0x00-0x03 */ 11318 0x8C, 0x41, 0x8C, 0x42, 0x8C, 0x43, 0x8C, 0x44, /* 0x00-0x03 */
11319 0x8C, 0x45, 0x8C, 0x46, 0x8C, 0x47, 0x8C, 0x48, /* 0x04-0x07 */ 11319 0x8C, 0x45, 0x8C, 0x46, 0x8C, 0x47, 0x8C, 0x48, /* 0x04-0x07 */
11320 0x8C, 0x49, 0x8C, 0x4A, 0x8C, 0x4B, 0x8C, 0x4C, /* 0x08-0x0B */ 11320 0x8C, 0x49, 0x8C, 0x4A, 0x8C, 0x4B, 0x8C, 0x4C, /* 0x08-0x0B */
@@ -11382,7 +11382,7 @@ static unsigned char u2c_B6[512] = {
11382 0x8D, 0x82, 0x8D, 0x83, 0x8D, 0x84, 0x8D, 0x85, /* 0xFC-0xFF */ 11382 0x8D, 0x82, 0x8D, 0x83, 0x8D, 0x84, 0x8D, 0x85, /* 0xFC-0xFF */
11383}; 11383};
11384 11384
11385static unsigned char u2c_B7[512] = { 11385static const unsigned char u2c_B7[512] = {
11386 0xB6, 0xDC, 0xB6, 0xDD, 0x8D, 0x86, 0x8D, 0x87, /* 0x00-0x03 */ 11386 0xB6, 0xDC, 0xB6, 0xDD, 0x8D, 0x86, 0x8D, 0x87, /* 0x00-0x03 */
11387 0x8D, 0x88, 0xB6, 0xDE, 0x8D, 0x89, 0x8D, 0x8A, /* 0x04-0x07 */ 11387 0x8D, 0x88, 0xB6, 0xDE, 0x8D, 0x89, 0x8D, 0x8A, /* 0x04-0x07 */
11388 0x8D, 0x8B, 0x8D, 0x8C, 0x8D, 0x8D, 0x8D, 0x8E, /* 0x08-0x0B */ 11388 0x8D, 0x8B, 0x8D, 0x8C, 0x8D, 0x8D, 0x8D, 0x8E, /* 0x08-0x0B */
@@ -11450,7 +11450,7 @@ static unsigned char u2c_B7[512] = {
11450 0xB7, 0xB3, 0xB7, 0xB4, 0x8E, 0x9B, 0xB7, 0xB5, /* 0xFC-0xFF */ 11450 0xB7, 0xB3, 0xB7, 0xB4, 0x8E, 0x9B, 0xB7, 0xB5, /* 0xFC-0xFF */
11451}; 11451};
11452 11452
11453static unsigned char u2c_B8[512] = { 11453static const unsigned char u2c_B8[512] = {
11454 0xB7, 0xB6, 0xB7, 0xB7, 0x8E, 0x9C, 0x8E, 0x9D, /* 0x00-0x03 */ 11454 0xB7, 0xB6, 0xB7, 0xB7, 0x8E, 0x9C, 0x8E, 0x9D, /* 0x00-0x03 */
11455 0x8E, 0x9E, 0x8E, 0x9F, 0x8E, 0xA0, 0xB7, 0xB8, /* 0x04-0x07 */ 11455 0x8E, 0x9E, 0x8E, 0x9F, 0x8E, 0xA0, 0xB7, 0xB8, /* 0x04-0x07 */
11456 0xB7, 0xB9, 0xB7, 0xBA, 0x8E, 0xA1, 0x8E, 0xA2, /* 0x08-0x0B */ 11456 0xB7, 0xB9, 0xB7, 0xBA, 0x8E, 0xA1, 0x8E, 0xA2, /* 0x08-0x0B */
@@ -11518,7 +11518,7 @@ static unsigned char u2c_B8[512] = {
11518 0x8F, 0xAE, 0xB7, 0xEE, 0x8F, 0xAF, 0x8F, 0xB0, /* 0xFC-0xFF */ 11518 0x8F, 0xAE, 0xB7, 0xEE, 0x8F, 0xAF, 0x8F, 0xB0, /* 0xFC-0xFF */
11519}; 11519};
11520 11520
11521static unsigned char u2c_B9[512] = { 11521static const unsigned char u2c_B9[512] = {
11522 0x8F, 0xB1, 0x8F, 0xB2, 0x8F, 0xB3, 0x8F, 0xB4, /* 0x00-0x03 */ 11522 0x8F, 0xB1, 0x8F, 0xB2, 0x8F, 0xB3, 0x8F, 0xB4, /* 0x00-0x03 */
11523 0xB7, 0xEF, 0x8F, 0xB5, 0x8F, 0xB6, 0x8F, 0xB7, /* 0x04-0x07 */ 11523 0xB7, 0xEF, 0x8F, 0xB5, 0x8F, 0xB6, 0x8F, 0xB7, /* 0x04-0x07 */
11524 0x8F, 0xB8, 0x8F, 0xB9, 0x8F, 0xBA, 0x8F, 0xBB, /* 0x08-0x0B */ 11524 0x8F, 0xB8, 0x8F, 0xB9, 0x8F, 0xBA, 0x8F, 0xBB, /* 0x08-0x0B */
@@ -11586,7 +11586,7 @@ static unsigned char u2c_B9[512] = {
11586 0x90, 0xBD, 0x90, 0xBE, 0x90, 0xBF, 0x90, 0xC0, /* 0xFC-0xFF */ 11586 0x90, 0xBD, 0x90, 0xBE, 0x90, 0xBF, 0x90, 0xC0, /* 0xFC-0xFF */
11587}; 11587};
11588 11588
11589static unsigned char u2c_BA[512] = { 11589static const unsigned char u2c_BA[512] = {
11590 0xB8, 0xCF, 0xB8, 0xD0, 0x90, 0xC1, 0x90, 0xC2, /* 0x00-0x03 */ 11590 0xB8, 0xCF, 0xB8, 0xD0, 0x90, 0xC1, 0x90, 0xC2, /* 0x00-0x03 */
11591 0x90, 0xC3, 0x90, 0xC4, 0x90, 0xC5, 0x90, 0xC6, /* 0x04-0x07 */ 11591 0x90, 0xC3, 0x90, 0xC4, 0x90, 0xC5, 0x90, 0xC6, /* 0x04-0x07 */
11592 0xB8, 0xD1, 0x90, 0xC7, 0x90, 0xC8, 0x90, 0xC9, /* 0x08-0x0B */ 11592 0xB8, 0xD1, 0x90, 0xC7, 0x90, 0xC8, 0x90, 0xC9, /* 0x08-0x0B */
@@ -11654,7 +11654,7 @@ static unsigned char u2c_BA[512] = {
11654 0xB8, 0xFE, 0x91, 0xDC, 0x91, 0xDD, 0x91, 0xDE, /* 0xFC-0xFF */ 11654 0xB8, 0xFE, 0x91, 0xDC, 0x91, 0xDD, 0x91, 0xDE, /* 0xFC-0xFF */
11655}; 11655};
11656 11656
11657static unsigned char u2c_BB[512] = { 11657static const unsigned char u2c_BB[512] = {
11658 0xB9, 0xA1, 0x91, 0xDF, 0x91, 0xE0, 0x91, 0xE1, /* 0x00-0x03 */ 11658 0xB9, 0xA1, 0x91, 0xDF, 0x91, 0xE0, 0x91, 0xE1, /* 0x00-0x03 */
11659 0xB9, 0xA2, 0x91, 0xE2, 0x91, 0xE3, 0x91, 0xE4, /* 0x04-0x07 */ 11659 0xB9, 0xA2, 0x91, 0xE2, 0x91, 0xE3, 0x91, 0xE4, /* 0x04-0x07 */
11660 0x91, 0xE5, 0x91, 0xE6, 0x91, 0xE7, 0x91, 0xE8, /* 0x08-0x0B */ 11660 0x91, 0xE5, 0x91, 0xE6, 0x91, 0xE7, 0x91, 0xE8, /* 0x08-0x0B */
@@ -11722,7 +11722,7 @@ static unsigned char u2c_BB[512] = {
11722 0xB9, 0xCE, 0x92, 0xFC, 0x92, 0xFD, 0xB9, 0xCF, /* 0xFC-0xFF */ 11722 0xB9, 0xCE, 0x92, 0xFC, 0x92, 0xFD, 0xB9, 0xCF, /* 0xFC-0xFF */
11723}; 11723};
11724 11724
11725static unsigned char u2c_BC[512] = { 11725static const unsigned char u2c_BC[512] = {
11726 0xB9, 0xD0, 0x92, 0xFE, 0xB9, 0xD1, 0x93, 0x41, /* 0x00-0x03 */ 11726 0xB9, 0xD0, 0x92, 0xFE, 0xB9, 0xD1, 0x93, 0x41, /* 0x00-0x03 */
11727 0x93, 0x42, 0x93, 0x43, 0x93, 0x44, 0x93, 0x45, /* 0x04-0x07 */ 11727 0x93, 0x42, 0x93, 0x43, 0x93, 0x44, 0x93, 0x45, /* 0x04-0x07 */
11728 0xB9, 0xD2, 0xB9, 0xD3, 0x93, 0x46, 0xB9, 0xD4, /* 0x08-0x0B */ 11728 0xB9, 0xD2, 0xB9, 0xD3, 0x93, 0x46, 0xB9, 0xD4, /* 0x08-0x0B */
@@ -11790,7 +11790,7 @@ static unsigned char u2c_BC[512] = {
11790 0xBA, 0xBC, 0x93, 0xFE, 0x94, 0x41, 0x94, 0x42, /* 0xFC-0xFF */ 11790 0xBA, 0xBC, 0x93, 0xFE, 0x94, 0x41, 0x94, 0x42, /* 0xFC-0xFF */
11791}; 11791};
11792 11792
11793static unsigned char u2c_BD[512] = { 11793static const unsigned char u2c_BD[512] = {
11794 0x94, 0x43, 0x94, 0x44, 0x94, 0x45, 0x94, 0x46, /* 0x00-0x03 */ 11794 0x94, 0x43, 0x94, 0x44, 0x94, 0x45, 0x94, 0x46, /* 0x00-0x03 */
11795 0xBA, 0xBD, 0xBA, 0xBE, 0x94, 0x47, 0xBA, 0xBF, /* 0x04-0x07 */ 11795 0xBA, 0xBD, 0xBA, 0xBE, 0x94, 0x47, 0xBA, 0xBF, /* 0x04-0x07 */
11796 0x94, 0x48, 0xBA, 0xC0, 0x94, 0x49, 0x94, 0x4A, /* 0x08-0x0B */ 11796 0x94, 0x48, 0xBA, 0xC0, 0x94, 0x49, 0x94, 0x4A, /* 0x08-0x0B */
@@ -11858,7 +11858,7 @@ static unsigned char u2c_BD[512] = {
11858 0x95, 0x69, 0x95, 0x6A, 0x95, 0x6B, 0x95, 0x6C, /* 0xFC-0xFF */ 11858 0x95, 0x69, 0x95, 0x6A, 0x95, 0x6B, 0x95, 0x6C, /* 0xFC-0xFF */
11859}; 11859};
11860 11860
11861static unsigned char u2c_BE[512] = { 11861static const unsigned char u2c_BE[512] = {
11862 0xBA, 0xE7, 0x95, 0x6D, 0x95, 0x6E, 0xBA, 0xE8, /* 0x00-0x03 */ 11862 0xBA, 0xE7, 0x95, 0x6D, 0x95, 0x6E, 0xBA, 0xE8, /* 0x00-0x03 */
11863 0x95, 0x6F, 0xBA, 0xE9, 0x95, 0x70, 0x95, 0x71, /* 0x04-0x07 */ 11863 0x95, 0x6F, 0xBA, 0xE9, 0x95, 0x70, 0x95, 0x71, /* 0x04-0x07 */
11864 0x95, 0x72, 0x95, 0x73, 0x95, 0x74, 0x95, 0x75, /* 0x08-0x0B */ 11864 0x95, 0x72, 0x95, 0x73, 0x95, 0x74, 0x95, 0x75, /* 0x08-0x0B */
@@ -11926,7 +11926,7 @@ static unsigned char u2c_BE[512] = {
11926 0x96, 0x87, 0x96, 0x88, 0x96, 0x89, 0x96, 0x8A, /* 0xFC-0xFF */ 11926 0x96, 0x87, 0x96, 0x88, 0x96, 0x89, 0x96, 0x8A, /* 0xFC-0xFF */
11927}; 11927};
11928 11928
11929static unsigned char u2c_BF[512] = { 11929static const unsigned char u2c_BF[512] = {
11930 0x96, 0x8B, 0xBB, 0xBF, 0x96, 0x8C, 0x96, 0x8D, /* 0x00-0x03 */ 11930 0x96, 0x8B, 0xBB, 0xBF, 0x96, 0x8C, 0x96, 0x8D, /* 0x00-0x03 */
11931 0x96, 0x8E, 0x96, 0x8F, 0x96, 0x90, 0x96, 0x91, /* 0x04-0x07 */ 11931 0x96, 0x8E, 0x96, 0x8F, 0x96, 0x90, 0x96, 0x91, /* 0x04-0x07 */
11932 0xBB, 0xC0, 0xBB, 0xC1, 0x96, 0x92, 0x96, 0x93, /* 0x08-0x0B */ 11932 0xBB, 0xC0, 0xBB, 0xC1, 0x96, 0x92, 0x96, 0x93, /* 0x08-0x0B */
@@ -11994,7 +11994,7 @@ static unsigned char u2c_BF[512] = {
11994 0x97, 0xBC, 0x97, 0xBD, 0x97, 0xBE, 0x97, 0xBF, /* 0xFC-0xFF */ 11994 0x97, 0xBC, 0x97, 0xBD, 0x97, 0xBE, 0x97, 0xBF, /* 0xFC-0xFF */
11995}; 11995};
11996 11996
11997static unsigned char u2c_C0[512] = { 11997static const unsigned char u2c_C0[512] = {
11998 0x97, 0xC0, 0x97, 0xC1, 0x97, 0xC2, 0x97, 0xC3, /* 0x00-0x03 */ 11998 0x97, 0xC0, 0x97, 0xC1, 0x97, 0xC2, 0x97, 0xC3, /* 0x00-0x03 */
11999 0x97, 0xC4, 0x97, 0xC5, 0x97, 0xC6, 0x97, 0xC7, /* 0x04-0x07 */ 11999 0x97, 0xC4, 0x97, 0xC5, 0x97, 0xC6, 0x97, 0xC7, /* 0x04-0x07 */
12000 0x97, 0xC8, 0x97, 0xC9, 0x97, 0xCA, 0x97, 0xCB, /* 0x08-0x0B */ 12000 0x97, 0xC8, 0x97, 0xC9, 0x97, 0xCA, 0x97, 0xCB, /* 0x08-0x0B */
@@ -12062,7 +12062,7 @@ static unsigned char u2c_C0[512] = {
12062 0x98, 0xDC, 0x98, 0xDD, 0x98, 0xDE, 0x98, 0xDF, /* 0xFC-0xFF */ 12062 0x98, 0xDC, 0x98, 0xDD, 0x98, 0xDE, 0x98, 0xDF, /* 0xFC-0xFF */
12063}; 12063};
12064 12064
12065static unsigned char u2c_C1[512] = { 12065static const unsigned char u2c_C1[512] = {
12066 0xBC, 0xA8, 0x98, 0xE0, 0x98, 0xE1, 0x98, 0xE2, /* 0x00-0x03 */ 12066 0xBC, 0xA8, 0x98, 0xE0, 0x98, 0xE1, 0x98, 0xE2, /* 0x00-0x03 */
12067 0xBC, 0xA9, 0x98, 0xE3, 0x98, 0xE4, 0x98, 0xE5, /* 0x04-0x07 */ 12067 0xBC, 0xA9, 0x98, 0xE3, 0x98, 0xE4, 0x98, 0xE5, /* 0x04-0x07 */
12068 0xBC, 0xAA, 0x98, 0xE6, 0x98, 0xE7, 0x98, 0xE8, /* 0x08-0x0B */ 12068 0xBC, 0xAA, 0x98, 0xE6, 0x98, 0xE7, 0x98, 0xE8, /* 0x08-0x0B */
@@ -12130,7 +12130,7 @@ static unsigned char u2c_C1[512] = {
12130 0xBC, 0xEE, 0xBC, 0xEF, 0x99, 0xE4, 0x99, 0xE5, /* 0xFC-0xFF */ 12130 0xBC, 0xEE, 0xBC, 0xEF, 0x99, 0xE4, 0x99, 0xE5, /* 0xFC-0xFF */
12131}; 12131};
12132 12132
12133static unsigned char u2c_C2[512] = { 12133static const unsigned char u2c_C2[512] = {
12134 0xBC, 0xF0, 0x99, 0xE6, 0x99, 0xE7, 0x99, 0xE8, /* 0x00-0x03 */ 12134 0xBC, 0xF0, 0x99, 0xE6, 0x99, 0xE7, 0x99, 0xE8, /* 0x00-0x03 */
12135 0xBC, 0xF1, 0x99, 0xE9, 0x99, 0xEA, 0x99, 0xEB, /* 0x04-0x07 */ 12135 0xBC, 0xF1, 0x99, 0xE9, 0x99, 0xEA, 0x99, 0xEB, /* 0x04-0x07 */
12136 0x99, 0xEC, 0x99, 0xED, 0x99, 0xEE, 0x99, 0xEF, /* 0x08-0x0B */ 12136 0x99, 0xEC, 0x99, 0xED, 0x99, 0xEE, 0x99, 0xEF, /* 0x08-0x0B */
@@ -12198,7 +12198,7 @@ static unsigned char u2c_C2[512] = {
12198 0xBD, 0xD1, 0x9A, 0xF1, 0x9A, 0xF2, 0x9A, 0xF3, /* 0xFC-0xFF */ 12198 0xBD, 0xD1, 0x9A, 0xF1, 0x9A, 0xF2, 0x9A, 0xF3, /* 0xFC-0xFF */
12199}; 12199};
12200 12200
12201static unsigned char u2c_C3[512] = { 12201static const unsigned char u2c_C3[512] = {
12202 0xBD, 0xD2, 0x9A, 0xF4, 0x9A, 0xF5, 0x9A, 0xF6, /* 0x00-0x03 */ 12202 0xBD, 0xD2, 0x9A, 0xF4, 0x9A, 0xF5, 0x9A, 0xF6, /* 0x00-0x03 */
12203 0x9A, 0xF7, 0x9A, 0xF8, 0x9A, 0xF9, 0x9A, 0xFA, /* 0x04-0x07 */ 12203 0x9A, 0xF7, 0x9A, 0xF8, 0x9A, 0xF9, 0x9A, 0xFA, /* 0x04-0x07 */
12204 0xBD, 0xD3, 0xBD, 0xD4, 0x9A, 0xFB, 0x9A, 0xFC, /* 0x08-0x0B */ 12204 0xBD, 0xD3, 0xBD, 0xD4, 0x9A, 0xFB, 0x9A, 0xFC, /* 0x08-0x0B */
@@ -12266,7 +12266,7 @@ static unsigned char u2c_C3[512] = {
12266 0x9C, 0x58, 0x9C, 0x59, 0x9C, 0x5A, 0x9C, 0x61, /* 0xFC-0xFF */ 12266 0x9C, 0x58, 0x9C, 0x59, 0x9C, 0x5A, 0x9C, 0x61, /* 0xFC-0xFF */
12267}; 12267};
12268 12268
12269static unsigned char u2c_C4[512] = { 12269static const unsigned char u2c_C4[512] = {
12270 0x9C, 0x62, 0x9C, 0x63, 0x9C, 0x64, 0x9C, 0x65, /* 0x00-0x03 */ 12270 0x9C, 0x62, 0x9C, 0x63, 0x9C, 0x64, 0x9C, 0x65, /* 0x00-0x03 */
12271 0x9C, 0x66, 0x9C, 0x67, 0x9C, 0x68, 0x9C, 0x69, /* 0x04-0x07 */ 12271 0x9C, 0x66, 0x9C, 0x67, 0x9C, 0x68, 0x9C, 0x69, /* 0x04-0x07 */
12272 0xBD, 0xFA, 0x9C, 0x6A, 0x9C, 0x6B, 0x9C, 0x6C, /* 0x08-0x0B */ 12272 0xBD, 0xFA, 0x9C, 0x6A, 0x9C, 0x6B, 0x9C, 0x6C, /* 0x08-0x0B */
@@ -12334,7 +12334,7 @@ static unsigned char u2c_C4[512] = {
12334 0x9D, 0x97, 0x9D, 0x98, 0x9D, 0x99, 0xBE, 0xB7, /* 0xFC-0xFF */ 12334 0x9D, 0x97, 0x9D, 0x98, 0x9D, 0x99, 0xBE, 0xB7, /* 0xFC-0xFF */
12335}; 12335};
12336 12336
12337static unsigned char u2c_C5[512] = { 12337static const unsigned char u2c_C5[512] = {
12338 0xBE, 0xB8, 0xBE, 0xB9, 0x9D, 0x9A, 0x9D, 0x9B, /* 0x00-0x03 */ 12338 0xBE, 0xB8, 0xBE, 0xB9, 0x9D, 0x9A, 0x9D, 0x9B, /* 0x00-0x03 */
12339 0x9D, 0x9C, 0x9D, 0x9D, 0x9D, 0x9E, 0x9D, 0x9F, /* 0x04-0x07 */ 12339 0x9D, 0x9C, 0x9D, 0x9D, 0x9D, 0x9E, 0x9D, 0x9F, /* 0x04-0x07 */
12340 0x9D, 0xA0, 0x9D, 0xA1, 0x9D, 0xA2, 0x9D, 0xA3, /* 0x08-0x0B */ 12340 0x9D, 0xA0, 0x9D, 0xA1, 0x9D, 0xA2, 0x9D, 0xA3, /* 0x08-0x0B */
@@ -12402,7 +12402,7 @@ static unsigned char u2c_C5[512] = {
12402 0xBF, 0xB0, 0xBF, 0xB1, 0xBF, 0xB2, 0xBF, 0xB3, /* 0xFC-0xFF */ 12402 0xBF, 0xB0, 0xBF, 0xB1, 0xBF, 0xB2, 0xBF, 0xB3, /* 0xFC-0xFF */
12403}; 12403};
12404 12404
12405static unsigned char u2c_C6[512] = { 12405static const unsigned char u2c_C6[512] = {
12406 0xBF, 0xB4, 0xBF, 0xB5, 0x9E, 0x8E, 0x9E, 0x8F, /* 0x00-0x03 */ 12406 0xBF, 0xB4, 0xBF, 0xB5, 0x9E, 0x8E, 0x9E, 0x8F, /* 0x00-0x03 */
12407 0x9E, 0x90, 0xBF, 0xB6, 0xBF, 0xB7, 0xBF, 0xB8, /* 0x04-0x07 */ 12407 0x9E, 0x90, 0xBF, 0xB6, 0xBF, 0xB7, 0xBF, 0xB8, /* 0x04-0x07 */
12408 0xBF, 0xB9, 0x9E, 0x91, 0x9E, 0x92, 0x9E, 0x93, /* 0x08-0x0B */ 12408 0xBF, 0xB9, 0x9E, 0x91, 0x9E, 0x92, 0x9E, 0x93, /* 0x08-0x0B */
@@ -12470,7 +12470,7 @@ static unsigned char u2c_C6[512] = {
12470 0x9F, 0x88, 0xC0, 0xA6, 0x9F, 0x89, 0x9F, 0x8A, /* 0xFC-0xFF */ 12470 0x9F, 0x88, 0xC0, 0xA6, 0x9F, 0x89, 0x9F, 0x8A, /* 0xFC-0xFF */
12471}; 12471};
12472 12472
12473static unsigned char u2c_C7[512] = { 12473static const unsigned char u2c_C7[512] = {
12474 0x9F, 0x8B, 0x9F, 0x8C, 0x9F, 0x8D, 0x9F, 0x8E, /* 0x00-0x03 */ 12474 0x9F, 0x8B, 0x9F, 0x8C, 0x9F, 0x8D, 0x9F, 0x8E, /* 0x00-0x03 */
12475 0xC0, 0xA7, 0xC0, 0xA8, 0x9F, 0x8F, 0x9F, 0x90, /* 0x04-0x07 */ 12475 0xC0, 0xA7, 0xC0, 0xA8, 0x9F, 0x8F, 0x9F, 0x90, /* 0x04-0x07 */
12476 0xC0, 0xA9, 0x9F, 0x91, 0x9F, 0x92, 0x9F, 0x93, /* 0x08-0x0B */ 12476 0xC0, 0xA9, 0x9F, 0x91, 0x9F, 0x92, 0x9F, 0x93, /* 0x08-0x0B */
@@ -12538,7 +12538,7 @@ static unsigned char u2c_C7[512] = {
12538 0xA0, 0x82, 0xA0, 0x83, 0xA0, 0x84, 0xA0, 0x85, /* 0xFC-0xFF */ 12538 0xA0, 0x82, 0xA0, 0x83, 0xA0, 0x84, 0xA0, 0x85, /* 0xFC-0xFF */
12539}; 12539};
12540 12540
12541static unsigned char u2c_C8[512] = { 12541static const unsigned char u2c_C8[512] = {
12542 0xC0, 0xFA, 0xC0, 0xFB, 0xA0, 0x86, 0xA0, 0x87, /* 0x00-0x03 */ 12542 0xC0, 0xFA, 0xC0, 0xFB, 0xA0, 0x86, 0xA0, 0x87, /* 0x00-0x03 */
12543 0xC0, 0xFC, 0xA0, 0x88, 0xA0, 0x89, 0xA0, 0x8A, /* 0x04-0x07 */ 12543 0xC0, 0xFC, 0xA0, 0x88, 0xA0, 0x89, 0xA0, 0x8A, /* 0x04-0x07 */
12544 0xC0, 0xFD, 0xA0, 0x8B, 0xC0, 0xFE, 0xA0, 0x8C, /* 0x08-0x0B */ 12544 0xC0, 0xFD, 0xA0, 0x8B, 0xC0, 0xFE, 0xA0, 0x8C, /* 0x08-0x0B */
@@ -12606,7 +12606,7 @@ static unsigned char u2c_C8[512] = {
12606 0xC1, 0xD6, 0xC1, 0xD7, 0xA1, 0x96, 0xA1, 0x97, /* 0xFC-0xFF */ 12606 0xC1, 0xD6, 0xC1, 0xD7, 0xA1, 0x96, 0xA1, 0x97, /* 0xFC-0xFF */
12607}; 12607};
12608 12608
12609static unsigned char u2c_C9[512] = { 12609static const unsigned char u2c_C9[512] = {
12610 0xC1, 0xD8, 0xA1, 0x98, 0xA1, 0x99, 0xA1, 0x9A, /* 0x00-0x03 */ 12610 0xC1, 0xD8, 0xA1, 0x98, 0xA1, 0x99, 0xA1, 0x9A, /* 0x00-0x03 */
12611 0xC1, 0xD9, 0xC1, 0xDA, 0xC1, 0xDB, 0xA1, 0x9B, /* 0x04-0x07 */ 12611 0xC1, 0xD9, 0xC1, 0xDA, 0xC1, 0xDB, 0xA1, 0x9B, /* 0x04-0x07 */
12612 0xA1, 0x9C, 0xA1, 0x9D, 0xA1, 0x9E, 0xA1, 0x9F, /* 0x08-0x0B */ 12612 0xA1, 0x9C, 0xA1, 0x9D, 0xA1, 0x9E, 0xA1, 0x9F, /* 0x08-0x0B */
@@ -12674,7 +12674,7 @@ static unsigned char u2c_C9[512] = {
12674 0xC2, 0xB2, 0xA4, 0x54, 0xA4, 0x55, 0xA4, 0x56, /* 0xFC-0xFF */ 12674 0xC2, 0xB2, 0xA4, 0x54, 0xA4, 0x55, 0xA4, 0x56, /* 0xFC-0xFF */
12675}; 12675};
12676 12676
12677static unsigned char u2c_CA[512] = { 12677static const unsigned char u2c_CA[512] = {
12678 0xC2, 0xB3, 0xA4, 0x57, 0xA4, 0x58, 0xA4, 0x59, /* 0x00-0x03 */ 12678 0xC2, 0xB3, 0xA4, 0x57, 0xA4, 0x58, 0xA4, 0x59, /* 0x00-0x03 */
12679 0xA4, 0x5A, 0xA4, 0x61, 0xA4, 0x62, 0xA4, 0x63, /* 0x04-0x07 */ 12679 0xA4, 0x5A, 0xA4, 0x61, 0xA4, 0x62, 0xA4, 0x63, /* 0x04-0x07 */
12680 0xC2, 0xB4, 0xC2, 0xB5, 0xA4, 0x64, 0xC2, 0xB6, /* 0x08-0x0B */ 12680 0xC2, 0xB4, 0xC2, 0xB5, 0xA4, 0x64, 0xC2, 0xB6, /* 0x08-0x0B */
@@ -12742,7 +12742,7 @@ static unsigned char u2c_CA[512] = {
12742 0xA6, 0x93, 0xA6, 0x94, 0xA6, 0x95, 0xA6, 0x96, /* 0xFC-0xFF */ 12742 0xA6, 0x93, 0xA6, 0x94, 0xA6, 0x95, 0xA6, 0x96, /* 0xFC-0xFF */
12743}; 12743};
12744 12744
12745static unsigned char u2c_CB[512] = { 12745static const unsigned char u2c_CB[512] = {
12746 0xA6, 0x97, 0xA6, 0x98, 0xA6, 0x99, 0xA6, 0x9A, /* 0x00-0x03 */ 12746 0xA6, 0x97, 0xA6, 0x98, 0xA6, 0x99, 0xA6, 0x9A, /* 0x00-0x03 */
12747 0xA6, 0x9B, 0xA6, 0x9C, 0xA6, 0x9D, 0xA6, 0x9E, /* 0x04-0x07 */ 12747 0xA6, 0x9B, 0xA6, 0x9C, 0xA6, 0x9D, 0xA6, 0x9E, /* 0x04-0x07 */
12748 0xC2, 0xD7, 0xA6, 0x9F, 0xA6, 0xA0, 0xA7, 0x41, /* 0x08-0x0B */ 12748 0xC2, 0xD7, 0xA6, 0x9F, 0xA6, 0xA0, 0xA7, 0x41, /* 0x08-0x0B */
@@ -12810,7 +12810,7 @@ static unsigned char u2c_CB[512] = {
12810 0xA9, 0x7A, 0xA9, 0x81, 0xA9, 0x82, 0xA9, 0x83, /* 0xFC-0xFF */ 12810 0xA9, 0x7A, 0xA9, 0x81, 0xA9, 0x82, 0xA9, 0x83, /* 0xFC-0xFF */
12811}; 12811};
12812 12812
12813static unsigned char u2c_CC[512] = { 12813static const unsigned char u2c_CC[512] = {
12814 0xA9, 0x84, 0xA9, 0x85, 0xA9, 0x86, 0xA9, 0x87, /* 0x00-0x03 */ 12814 0xA9, 0x84, 0xA9, 0x85, 0xA9, 0x86, 0xA9, 0x87, /* 0x00-0x03 */
12815 0xA9, 0x88, 0xA9, 0x89, 0xA9, 0x8A, 0xA9, 0x8B, /* 0x04-0x07 */ 12815 0xA9, 0x88, 0xA9, 0x89, 0xA9, 0x8A, 0xA9, 0x8B, /* 0x04-0x07 */
12816 0xA9, 0x8C, 0xA9, 0x8D, 0xA9, 0x8E, 0xA9, 0x8F, /* 0x08-0x0B */ 12816 0xA9, 0x8C, 0xA9, 0x8D, 0xA9, 0x8E, 0xA9, 0x8F, /* 0x08-0x0B */
@@ -12878,7 +12878,7 @@ static unsigned char u2c_CC[512] = {
12878 0xAB, 0x9F, 0xAB, 0xA0, 0xAC, 0x41, 0xAC, 0x42, /* 0xFC-0xFF */ 12878 0xAB, 0x9F, 0xAB, 0xA0, 0xAC, 0x41, 0xAC, 0x42, /* 0xFC-0xFF */
12879}; 12879};
12880 12880
12881static unsigned char u2c_CD[512] = { 12881static const unsigned char u2c_CD[512] = {
12882 0xAC, 0x43, 0xC3, 0xC9, 0xAC, 0x44, 0xAC, 0x45, /* 0x00-0x03 */ 12882 0xAC, 0x43, 0xC3, 0xC9, 0xAC, 0x44, 0xAC, 0x45, /* 0x00-0x03 */
12883 0xAC, 0x46, 0xAC, 0x47, 0xAC, 0x48, 0xAC, 0x49, /* 0x04-0x07 */ 12883 0xAC, 0x46, 0xAC, 0x47, 0xAC, 0x48, 0xAC, 0x49, /* 0x04-0x07 */
12884 0xC3, 0xCA, 0xC3, 0xCB, 0xAC, 0x4A, 0xAC, 0x4B, /* 0x08-0x0B */ 12884 0xC3, 0xCA, 0xC3, 0xCB, 0xAC, 0x4A, 0xAC, 0x4B, /* 0x08-0x0B */
@@ -12946,7 +12946,7 @@ static unsigned char u2c_CD[512] = {
12946 0xAE, 0x75, 0xC3, 0xF1, 0xAE, 0x76, 0xAE, 0x77, /* 0xFC-0xFF */ 12946 0xAE, 0x75, 0xC3, 0xF1, 0xAE, 0x76, 0xAE, 0x77, /* 0xFC-0xFF */
12947}; 12947};
12948 12948
12949static unsigned char u2c_CE[512] = { 12949static const unsigned char u2c_CE[512] = {
12950 0xAE, 0x78, 0xAE, 0x79, 0xAE, 0x7A, 0xAE, 0x81, /* 0x00-0x03 */ 12950 0xAE, 0x78, 0xAE, 0x79, 0xAE, 0x7A, 0xAE, 0x81, /* 0x00-0x03 */
12951 0xC3, 0xF2, 0xAE, 0x82, 0xAE, 0x83, 0xAE, 0x84, /* 0x04-0x07 */ 12951 0xC3, 0xF2, 0xAE, 0x82, 0xAE, 0x83, 0xAE, 0x84, /* 0x04-0x07 */
12952 0xC3, 0xF3, 0xAE, 0x85, 0xAE, 0x86, 0xAE, 0x87, /* 0x08-0x0B */ 12952 0xC3, 0xF3, 0xAE, 0x85, 0xAE, 0x86, 0xAE, 0x87, /* 0x08-0x0B */
@@ -13014,7 +13014,7 @@ static unsigned char u2c_CE[512] = {
13014 0xB0, 0x9D, 0xB0, 0x9E, 0xB0, 0x9F, 0xB0, 0xA0, /* 0xFC-0xFF */ 13014 0xB0, 0x9D, 0xB0, 0x9E, 0xB0, 0x9F, 0xB0, 0xA0, /* 0xFC-0xFF */
13015}; 13015};
13016 13016
13017static unsigned char u2c_CF[512] = { 13017static const unsigned char u2c_CF[512] = {
13018 0xC4, 0xC9, 0xC4, 0xCA, 0xB1, 0x41, 0xB1, 0x42, /* 0x00-0x03 */ 13018 0xC4, 0xC9, 0xC4, 0xCA, 0xB1, 0x41, 0xB1, 0x42, /* 0x00-0x03 */
13019 0xC4, 0xCB, 0xB1, 0x43, 0xB1, 0x44, 0xB1, 0x45, /* 0x04-0x07 */ 13019 0xC4, 0xCB, 0xB1, 0x43, 0xB1, 0x44, 0xB1, 0x45, /* 0x04-0x07 */
13020 0xC4, 0xCC, 0xB1, 0x46, 0xB1, 0x47, 0xB1, 0x48, /* 0x08-0x0B */ 13020 0xC4, 0xCC, 0xB1, 0x46, 0xB1, 0x47, 0xB1, 0x48, /* 0x08-0x0B */
@@ -13082,7 +13082,7 @@ static unsigned char u2c_CF[512] = {
13082 0xC4, 0xF5, 0xB3, 0x6F, 0xB3, 0x70, 0xB3, 0x71, /* 0xFC-0xFF */ 13082 0xC4, 0xF5, 0xB3, 0x6F, 0xB3, 0x70, 0xB3, 0x71, /* 0xFC-0xFF */
13083}; 13083};
13084 13084
13085static unsigned char u2c_D0[512] = { 13085static const unsigned char u2c_D0[512] = {
13086 0xC4, 0xF6, 0xB3, 0x72, 0xB3, 0x73, 0xB3, 0x74, /* 0x00-0x03 */ 13086 0xC4, 0xF6, 0xB3, 0x72, 0xB3, 0x73, 0xB3, 0x74, /* 0x00-0x03 */
13087 0xC4, 0xF7, 0xB3, 0x75, 0xB3, 0x76, 0xB3, 0x77, /* 0x04-0x07 */ 13087 0xC4, 0xF7, 0xB3, 0x75, 0xB3, 0x76, 0xB3, 0x77, /* 0x04-0x07 */
13088 0xB3, 0x78, 0xB3, 0x79, 0xB3, 0x7A, 0xB3, 0x81, /* 0x08-0x0B */ 13088 0xB3, 0x78, 0xB3, 0x79, 0xB3, 0x7A, 0xB3, 0x81, /* 0x08-0x0B */
@@ -13150,7 +13150,7 @@ static unsigned char u2c_D0[512] = {
13150 0xB5, 0x98, 0xB5, 0x99, 0xB5, 0x9A, 0xB5, 0x9B, /* 0xFC-0xFF */ 13150 0xB5, 0x98, 0xB5, 0x99, 0xB5, 0x9A, 0xB5, 0x9B, /* 0xFC-0xFF */
13151}; 13151};
13152 13152
13153static unsigned char u2c_D1[512] = { 13153static const unsigned char u2c_D1[512] = {
13154 0xB5, 0x9C, 0xB5, 0x9D, 0xB5, 0x9E, 0xB5, 0x9F, /* 0x00-0x03 */ 13154 0xB5, 0x9C, 0xB5, 0x9D, 0xB5, 0x9E, 0xB5, 0x9F, /* 0x00-0x03 */
13155 0xB5, 0xA0, 0xB6, 0x41, 0xB6, 0x42, 0xB6, 0x43, /* 0x04-0x07 */ 13155 0xB5, 0xA0, 0xB6, 0x41, 0xB6, 0x42, 0xB6, 0x43, /* 0x04-0x07 */
13156 0xB6, 0x44, 0xB6, 0x45, 0xB6, 0x46, 0xB6, 0x47, /* 0x08-0x0B */ 13156 0xB6, 0x44, 0xB6, 0x45, 0xB6, 0x46, 0xB6, 0x47, /* 0x08-0x0B */
@@ -13218,7 +13218,7 @@ static unsigned char u2c_D1[512] = {
13218 0xB8, 0x70, 0xB8, 0x71, 0xB8, 0x72, 0xB8, 0x73, /* 0xFC-0xFF */ 13218 0xB8, 0x70, 0xB8, 0x71, 0xB8, 0x72, 0xB8, 0x73, /* 0xFC-0xFF */
13219}; 13219};
13220 13220
13221static unsigned char u2c_D2[512] = { 13221static const unsigned char u2c_D2[512] = {
13222 0xB8, 0x74, 0xB8, 0x75, 0xB8, 0x76, 0xB8, 0x77, /* 0x00-0x03 */ 13222 0xB8, 0x74, 0xB8, 0x75, 0xB8, 0x76, 0xB8, 0x77, /* 0x00-0x03 */
13223 0xB8, 0x78, 0xB8, 0x79, 0xB8, 0x7A, 0xC5, 0xF2, /* 0x04-0x07 */ 13223 0xB8, 0x78, 0xB8, 0x79, 0xB8, 0x7A, 0xC5, 0xF2, /* 0x04-0x07 */
13224 0xB8, 0x81, 0xC5, 0xF3, 0xB8, 0x82, 0xB8, 0x83, /* 0x08-0x0B */ 13224 0xB8, 0x81, 0xC5, 0xF3, 0xB8, 0x82, 0xB8, 0x83, /* 0x08-0x0B */
@@ -13286,7 +13286,7 @@ static unsigned char u2c_D2[512] = {
13286 0xBB, 0x42, 0xBB, 0x43, 0xBB, 0x44, 0xBB, 0x45, /* 0xFC-0xFF */ 13286 0xBB, 0x42, 0xBB, 0x43, 0xBB, 0x44, 0xBB, 0x45, /* 0xFC-0xFF */
13287}; 13287};
13288 13288
13289static unsigned char u2c_D3[512] = { 13289static const unsigned char u2c_D3[512] = {
13290 0xC6, 0xC0, 0xC6, 0xC1, 0xBB, 0x46, 0xC6, 0xC2, /* 0x00-0x03 */ 13290 0xC6, 0xC0, 0xC6, 0xC1, 0xBB, 0x46, 0xC6, 0xC2, /* 0x00-0x03 */
13291 0xBB, 0x47, 0xC6, 0xC3, 0xBB, 0x48, 0xBB, 0x49, /* 0x04-0x07 */ 13291 0xBB, 0x47, 0xC6, 0xC3, 0xBB, 0x48, 0xBB, 0x49, /* 0x04-0x07 */
13292 0xBB, 0x4A, 0xBB, 0x4B, 0xBB, 0x4C, 0xBB, 0x4D, /* 0x08-0x0B */ 13292 0xBB, 0x4A, 0xBB, 0x4B, 0xBB, 0x4C, 0xBB, 0x4D, /* 0x08-0x0B */
@@ -13354,7 +13354,7 @@ static unsigned char u2c_D3[512] = {
13354 0xC6, 0xFB, 0xC6, 0xFC, 0xBD, 0x65, 0xC6, 0xFD, /* 0xFC-0xFF */ 13354 0xC6, 0xFB, 0xC6, 0xFC, 0xBD, 0x65, 0xC6, 0xFD, /* 0xFC-0xFF */
13355}; 13355};
13356 13356
13357static unsigned char u2c_D4[512] = { 13357static const unsigned char u2c_D4[512] = {
13358 0xBD, 0x66, 0xC6, 0xFE, 0xBD, 0x67, 0xBD, 0x68, /* 0x00-0x03 */ 13358 0xBD, 0x66, 0xC6, 0xFE, 0xBD, 0x67, 0xBD, 0x68, /* 0x00-0x03 */
13359 0xBD, 0x69, 0xBD, 0x6A, 0xBD, 0x6B, 0xBD, 0x6C, /* 0x04-0x07 */ 13359 0xBD, 0x69, 0xBD, 0x6A, 0xBD, 0x6B, 0xBD, 0x6C, /* 0x04-0x07 */
13360 0xC7, 0xA1, 0xBD, 0x6D, 0xBD, 0x6E, 0xBD, 0x6F, /* 0x08-0x0B */ 13360 0xC7, 0xA1, 0xBD, 0x6D, 0xBD, 0x6E, 0xBD, 0x6F, /* 0x08-0x0B */
@@ -13422,7 +13422,7 @@ static unsigned char u2c_D4[512] = {
13422 0xBF, 0xA0, 0xC7, 0xC0, 0xC0, 0x41, 0xC0, 0x42, /* 0xFC-0xFF */ 13422 0xBF, 0xA0, 0xC7, 0xC0, 0xC0, 0x41, 0xC0, 0x42, /* 0xFC-0xFF */
13423}; 13423};
13424 13424
13425static unsigned char u2c_D5[512] = { 13425static const unsigned char u2c_D5[512] = {
13426 0xC0, 0x43, 0xC0, 0x44, 0xC0, 0x45, 0xC0, 0x46, /* 0x00-0x03 */ 13426 0xC0, 0x43, 0xC0, 0x44, 0xC0, 0x45, 0xC0, 0x46, /* 0x00-0x03 */
13427 0xC7, 0xC1, 0xC0, 0x47, 0xC0, 0x48, 0xC0, 0x49, /* 0x04-0x07 */ 13427 0xC7, 0xC1, 0xC0, 0x47, 0xC0, 0x48, 0xC0, 0x49, /* 0x04-0x07 */
13428 0xC7, 0xC2, 0xC0, 0x4A, 0xC0, 0x4B, 0xC0, 0x4C, /* 0x08-0x0B */ 13428 0xC7, 0xC2, 0xC0, 0x4A, 0xC0, 0x4B, 0xC0, 0x4C, /* 0x08-0x0B */
@@ -13490,7 +13490,7 @@ static unsigned char u2c_D5[512] = {
13490 0xC2, 0x6A, 0xC2, 0x6B, 0xC2, 0x6C, 0xC2, 0x6D, /* 0xFC-0xFF */ 13490 0xC2, 0x6A, 0xC2, 0x6B, 0xC2, 0x6C, 0xC2, 0x6D, /* 0xFC-0xFF */
13491}; 13491};
13492 13492
13493static unsigned char u2c_D6[512] = { 13493static const unsigned char u2c_D6[512] = {
13494 0xC7, 0xF4, 0xC7, 0xF5, 0xC2, 0x6E, 0xC2, 0x6F, /* 0x00-0x03 */ 13494 0xC7, 0xF4, 0xC7, 0xF5, 0xC2, 0x6E, 0xC2, 0x6F, /* 0x00-0x03 */
13495 0xC7, 0xF6, 0xC2, 0x70, 0xC2, 0x71, 0xC2, 0x72, /* 0x04-0x07 */ 13495 0xC7, 0xF6, 0xC2, 0x70, 0xC2, 0x71, 0xC2, 0x72, /* 0x04-0x07 */
13496 0xC7, 0xF7, 0xC2, 0x73, 0xC2, 0x74, 0xC2, 0x75, /* 0x08-0x0B */ 13496 0xC7, 0xF7, 0xC2, 0x73, 0xC2, 0x74, 0xC2, 0x75, /* 0x08-0x0B */
@@ -13558,7 +13558,7 @@ static unsigned char u2c_D6[512] = {
13558 0xC8, 0xD1, 0xC8, 0xD2, 0xC4, 0x8D, 0xC4, 0x8E, /* 0xFC-0xFF */ 13558 0xC8, 0xD1, 0xC8, 0xD2, 0xC4, 0x8D, 0xC4, 0x8E, /* 0xFC-0xFF */
13559}; 13559};
13560 13560
13561static unsigned char u2c_D7[512] = { 13561static const unsigned char u2c_D7[512] = {
13562 0xC8, 0xD3, 0xC4, 0x8F, 0xC4, 0x90, 0xC4, 0x91, /* 0x00-0x03 */ 13562 0xC8, 0xD3, 0xC4, 0x8F, 0xC4, 0x90, 0xC4, 0x91, /* 0x00-0x03 */
13563 0xC8, 0xD4, 0xC4, 0x92, 0xC4, 0x93, 0xC4, 0x94, /* 0x04-0x07 */ 13563 0xC8, 0xD4, 0xC4, 0x92, 0xC4, 0x93, 0xC4, 0x94, /* 0x04-0x07 */
13564 0xC4, 0x95, 0xC4, 0x96, 0xC4, 0x97, 0xC4, 0x98, /* 0x08-0x0B */ 13564 0xC4, 0x95, 0xC4, 0x96, 0xC4, 0x97, 0xC4, 0x98, /* 0x08-0x0B */
@@ -13603,11 +13603,11 @@ static unsigned char u2c_D7[512] = {
13603 0xC6, 0x4F, 0xC6, 0x50, 0xC6, 0x51, 0xC6, 0x52, /* 0xA0-0xA3 */ 13603 0xC6, 0x4F, 0xC6, 0x50, 0xC6, 0x51, 0xC6, 0x52, /* 0xA0-0xA3 */
13604}; 13604};
13605 13605
13606static unsigned char u2c_DC[512] = { 13606static const unsigned char u2c_DC[512] = {
13607 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 13607 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
13608}; 13608};
13609 13609
13610static unsigned char u2c_F9[512] = { 13610static const unsigned char u2c_F9[512] = {
13611 0xCB, 0xD0, 0xCB, 0xD6, 0xCB, 0xE7, 0xCD, 0xCF, /* 0x00-0x03 */ 13611 0xCB, 0xD0, 0xCB, 0xD6, 0xCB, 0xE7, 0xCD, 0xCF, /* 0x00-0x03 */
13612 0xCD, 0xE8, 0xCE, 0xAD, 0xCF, 0xFB, 0xD0, 0xA2, /* 0x04-0x07 */ 13612 0xCD, 0xE8, 0xCE, 0xAD, 0xCF, 0xFB, 0xD0, 0xA2, /* 0x04-0x07 */
13613 0xD0, 0xB8, 0xD0, 0xD0, 0xD0, 0xDD, 0xD1, 0xD4, /* 0x08-0x0B */ 13613 0xD0, 0xB8, 0xD0, 0xD0, 0xD0, 0xDD, 0xD1, 0xD4, /* 0x08-0x0B */
@@ -13675,7 +13675,7 @@ static unsigned char u2c_F9[512] = {
13675 0xF2, 0xBD, 0xF2, 0xFA, 0xF3, 0xB1, 0xF4, 0xA7, /* 0xFC-0xFF */ 13675 0xF2, 0xBD, 0xF2, 0xFA, 0xF3, 0xB1, 0xF4, 0xA7, /* 0xFC-0xFF */
13676}; 13676};
13677 13677
13678static unsigned char u2c_FA[512] = { 13678static const unsigned char u2c_FA[512] = {
13679 0xF4, 0xEE, 0xF6, 0xF4, 0xF6, 0xF6, 0xF7, 0xB8, /* 0x00-0x03 */ 13679 0xF4, 0xEE, 0xF6, 0xF4, 0xF6, 0xF6, 0xF7, 0xB8, /* 0x00-0x03 */
13680 0xF7, 0xC8, 0xF7, 0xD3, 0xF8, 0xDB, 0xF8, 0xF0, /* 0x04-0x07 */ 13680 0xF7, 0xC8, 0xF7, 0xD3, 0xF8, 0xDB, 0xF8, 0xF0, /* 0x04-0x07 */
13681 0xFA, 0xA1, 0xFA, 0xA2, 0xFA, 0xE6, 0xFC, 0xA9, /* 0x08-0x0B */ 13681 0xFA, 0xA1, 0xFA, 0xA2, 0xFA, 0xE6, 0xFC, 0xA9, /* 0x08-0x0B */
@@ -13690,7 +13690,7 @@ static unsigned char u2c_FA[512] = {
13690 0xCE, 0xBD, 0xF9, 0xCD, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */ 13690 0xCE, 0xBD, 0xF9, 0xCD, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
13691}; 13691};
13692 13692
13693static unsigned char u2c_FF[512] = { 13693static const unsigned char u2c_FF[512] = {
13694 0x00, 0x00, 0xA3, 0xA1, 0xA3, 0xA2, 0xA3, 0xA3, /* 0x00-0x03 */ 13694 0x00, 0x00, 0xA3, 0xA1, 0xA3, 0xA2, 0xA3, 0xA3, /* 0x00-0x03 */
13695 0xA3, 0xA4, 0xA3, 0xA5, 0xA3, 0xA6, 0xA3, 0xA7, /* 0x04-0x07 */ 13695 0xA3, 0xA4, 0xA3, 0xA5, 0xA3, 0xA6, 0xA3, 0xA7, /* 0x04-0x07 */
13696 0xA3, 0xA8, 0xA3, 0xA9, 0xA3, 0xAA, 0xA3, 0xAB, /* 0x08-0x0B */ 13696 0xA3, 0xA8, 0xA3, 0xA9, 0xA3, 0xAA, 0xA3, 0xAB, /* 0x08-0x0B */
@@ -13752,7 +13752,7 @@ static unsigned char u2c_FF[512] = {
13752 0x00, 0x00, 0xA1, 0xCD, 0xA3, 0xDC, 0x00, 0x00, /* 0xE4-0xE7 */ 13752 0x00, 0x00, 0xA1, 0xCD, 0xA3, 0xDC, 0x00, 0x00, /* 0xE4-0xE7 */
13753}; 13753};
13754 13754
13755static unsigned char *page_uni2charset[256] = { 13755static const unsigned char *const page_uni2charset[256] = {
13756 NULL, u2c_01, u2c_02, u2c_03, u2c_04, NULL, NULL, NULL, 13756 NULL, u2c_01, u2c_02, u2c_03, u2c_04, NULL, NULL, NULL,
13757 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 13757 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
13758 NULL, u2c_11, NULL, NULL, NULL, NULL, NULL, NULL, 13758 NULL, u2c_11, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -13786,7 +13786,7 @@ static unsigned char *page_uni2charset[256] = {
13786 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 13786 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
13787 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, NULL, u2c_FF, }; 13787 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, NULL, u2c_FF, };
13788 13788
13789static unsigned char charset2lower[256] = { 13789static const unsigned char charset2lower[256] = {
13790 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 13790 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
13791 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 13791 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
13792 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 13792 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -13822,7 +13822,7 @@ static unsigned char charset2lower[256] = {
13822 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 13822 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
13823}; 13823};
13824 13824
13825static unsigned char charset2upper[256] = { 13825static const unsigned char charset2upper[256] = {
13826 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 13826 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
13827 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 13827 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
13828 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 13828 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -13861,7 +13861,7 @@ static unsigned char charset2upper[256] = {
13861static int uni2char(const wchar_t uni, 13861static int uni2char(const wchar_t uni,
13862 unsigned char *out, int boundlen) 13862 unsigned char *out, int boundlen)
13863{ 13863{
13864 unsigned char *uni2charset; 13864 const unsigned char *uni2charset;
13865 unsigned char cl = uni&0xFF; 13865 unsigned char cl = uni&0xFF;
13866 unsigned char ch = (uni>>8)&0xFF; 13866 unsigned char ch = (uni>>8)&0xFF;
13867 int n; 13867 int n;
@@ -13893,7 +13893,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
13893 wchar_t *uni) 13893 wchar_t *uni)
13894{ 13894{
13895 unsigned char ch, cl; 13895 unsigned char ch, cl;
13896 wchar_t *charset2uni; 13896 const wchar_t *charset2uni;
13897 int n; 13897 int n;
13898 13898
13899 if (boundlen <= 0) 13899 if (boundlen <= 0)
diff --git a/fs/nls/nls_cp950.c b/fs/nls/nls_cp950.c
index 5665945fb88c..ef2536829aa5 100644
--- a/fs/nls/nls_cp950.c
+++ b/fs/nls/nls_cp950.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t c2u_A1[256] = { 16static const wchar_t c2u_A1[256] = {
17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 17 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 18 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 19 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_A1[256] = {
49 0x2196,0x2197,0x2199,0x2198,0x2225,0x2223,0xFF0F,0x0000,/* 0xF8-0xFF */ 49 0x2196,0x2197,0x2199,0x2198,0x2225,0x2223,0xFF0F,0x0000,/* 0xF8-0xFF */
50}; 50};
51 51
52static wchar_t c2u_A2[256] = { 52static const wchar_t c2u_A2[256] = {
53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 53 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 54 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 55 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -85,7 +85,7 @@ static wchar_t c2u_A2[256] = {
85 0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0x0000,/* 0xF8-0xFF */ 85 0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0x0000,/* 0xF8-0xFF */
86}; 86};
87 87
88static wchar_t c2u_A3[256] = { 88static const wchar_t c2u_A3[256] = {
89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 89 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 90 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
91 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 91 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -118,7 +118,7 @@ static wchar_t c2u_A3[256] = {
118 0x0000,0x20AC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xE0-0xE7 */ 118 0x0000,0x20AC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xE0-0xE7 */
119}; 119};
120 120
121static wchar_t c2u_A4[256] = { 121static const wchar_t c2u_A4[256] = {
122 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 122 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
123 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 123 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
124 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 124 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -154,7 +154,7 @@ static wchar_t c2u_A4[256] = {
154 0x723B,0x7247,0x7259,0x725B,0x72AC,0x738B,0x4E19,0x0000,/* 0xF8-0xFF */ 154 0x723B,0x7247,0x7259,0x725B,0x72AC,0x738B,0x4E19,0x0000,/* 0xF8-0xFF */
155}; 155};
156 156
157static wchar_t c2u_A5[256] = { 157static const wchar_t c2u_A5[256] = {
158 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 158 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
159 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 159 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
160 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 160 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -190,7 +190,7 @@ static wchar_t c2u_A5[256] = {
190 0x4F01,0x4F0B,0x5149,0x5147,0x5146,0x5148,0x5168,0x0000,/* 0xF8-0xFF */ 190 0x4F01,0x4F0B,0x5149,0x5147,0x5146,0x5148,0x5168,0x0000,/* 0xF8-0xFF */
191}; 191};
192 192
193static wchar_t c2u_A6[256] = { 193static const wchar_t c2u_A6[256] = {
194 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 194 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
195 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 195 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
196 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 196 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -226,7 +226,7 @@ static wchar_t c2u_A6[256] = {
226 0x4F3A,0x4F38,0x4F43,0x4F54,0x4F3C,0x4F46,0x4F63,0x0000,/* 0xF8-0xFF */ 226 0x4F3A,0x4F38,0x4F43,0x4F54,0x4F3C,0x4F46,0x4F63,0x0000,/* 0xF8-0xFF */
227}; 227};
228 228
229static wchar_t c2u_A7[256] = { 229static const wchar_t c2u_A7[256] = {
230 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 230 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
231 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 231 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
232 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 232 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -262,7 +262,7 @@ static wchar_t c2u_A7[256] = {
262 0x6751,0x675C,0x6756,0x675E,0x6749,0x6746,0x6760,0x0000,/* 0xF8-0xFF */ 262 0x6751,0x675C,0x6756,0x675E,0x6749,0x6746,0x6760,0x0000,/* 0xF8-0xFF */
263}; 263};
264 264
265static wchar_t c2u_A8[256] = { 265static const wchar_t c2u_A8[256] = {
266 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 266 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
267 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 267 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
268 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 268 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -298,7 +298,7 @@ static wchar_t c2u_A8[256] = {
298 0x5378,0x5379,0x53D6,0x53D4,0x53D7,0x5473,0x5475,0x0000,/* 0xF8-0xFF */ 298 0x5378,0x5379,0x53D6,0x53D4,0x53D7,0x5473,0x5475,0x0000,/* 0xF8-0xFF */
299}; 299};
300 300
301static wchar_t c2u_A9[256] = { 301static const wchar_t c2u_A9[256] = {
302 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 302 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
303 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 303 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
304 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 304 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -334,7 +334,7 @@ static wchar_t c2u_A9[256] = {
334 0x6606,0x6602,0x660E,0x6600,0x660F,0x6615,0x660A,0x0000,/* 0xF8-0xFF */ 334 0x6606,0x6602,0x660E,0x6600,0x660F,0x6615,0x660A,0x0000,/* 0xF8-0xFF */
335}; 335};
336 336
337static wchar_t c2u_AA[256] = { 337static const wchar_t c2u_AA[256] = {
338 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 338 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
339 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 339 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
340 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 340 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -370,7 +370,7 @@ static wchar_t c2u_AA[256] = {
370 0x9577,0x9580,0x961C,0x9640,0x963F,0x963B,0x9644,0x0000,/* 0xF8-0xFF */ 370 0x9577,0x9580,0x961C,0x9640,0x963F,0x963B,0x9644,0x0000,/* 0xF8-0xFF */
371}; 371};
372 372
373static wchar_t c2u_AB[256] = { 373static const wchar_t c2u_AB[256] = {
374 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 374 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
375 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 375 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
376 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 376 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -406,7 +406,7 @@ static wchar_t c2u_AB[256] = {
406 0x62ED,0x6301,0x62EE,0x62FD,0x6307,0x62F1,0x62F7,0x0000,/* 0xF8-0xFF */ 406 0x62ED,0x6301,0x62EE,0x62FD,0x6307,0x62F1,0x62F7,0x0000,/* 0xF8-0xFF */
407}; 407};
408 408
409static wchar_t c2u_AC[256] = { 409static const wchar_t c2u_AC[256] = {
410 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 410 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
411 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 411 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
412 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 412 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -442,7 +442,7 @@ static wchar_t c2u_AC[256] = {
442 0x7D07,0x7D04,0x7D06,0x7F38,0x7F8E,0x7FBF,0x8004,0x0000,/* 0xF8-0xFF */ 442 0x7D07,0x7D04,0x7D06,0x7F38,0x7F8E,0x7FBF,0x8004,0x0000,/* 0xF8-0xFF */
443}; 443};
444 444
445static wchar_t c2u_AD[256] = { 445static const wchar_t c2u_AD[256] = {
446 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 446 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
447 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 447 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
448 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 448 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -478,7 +478,7 @@ static wchar_t c2u_AD[256] = {
478 0x5514,0x54E9,0x54ED,0x54E1,0x5509,0x54EE,0x54EA,0x0000,/* 0xF8-0xFF */ 478 0x5514,0x54E9,0x54ED,0x54E1,0x5509,0x54EE,0x54EA,0x0000,/* 0xF8-0xFF */
479}; 479};
480 480
481static wchar_t c2u_AE[256] = { 481static const wchar_t c2u_AE[256] = {
482 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 482 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
483 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 483 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
484 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 484 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -514,7 +514,7 @@ static wchar_t c2u_AE[256] = {
514 0x6D88,0x6D87,0x6D66,0x6D78,0x6D77,0x6D59,0x6D93,0x0000,/* 0xF8-0xFF */ 514 0x6D88,0x6D87,0x6D66,0x6D78,0x6D77,0x6D59,0x6D93,0x0000,/* 0xF8-0xFF */
515}; 515};
516 516
517static wchar_t c2u_AF[256] = { 517static const wchar_t c2u_AF[256] = {
518 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 518 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
519 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 519 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
520 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 520 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -550,7 +550,7 @@ static wchar_t c2u_AF[256] = {
550 0x8339,0x8336,0x8317,0x8340,0x8331,0x8328,0x8343,0x0000,/* 0xF8-0xFF */ 550 0x8339,0x8336,0x8317,0x8340,0x8331,0x8328,0x8343,0x0000,/* 0xF8-0xFF */
551}; 551};
552 552
553static wchar_t c2u_B0[256] = { 553static const wchar_t c2u_B0[256] = {
554 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 554 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
555 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 555 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
556 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 556 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -586,7 +586,7 @@ static wchar_t c2u_B0[256] = {
586 0x5962,0x5A36,0x5A41,0x5A49,0x5A66,0x5A6A,0x5A40,0x0000,/* 0xF8-0xFF */ 586 0x5962,0x5A36,0x5A41,0x5A49,0x5A66,0x5A6A,0x5A40,0x0000,/* 0xF8-0xFF */
587}; 587};
588 588
589static wchar_t c2u_B1[256] = { 589static const wchar_t c2u_B1[256] = {
590 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 590 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
591 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 591 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
592 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 592 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -622,7 +622,7 @@ static wchar_t c2u_B1[256] = {
622 0x689D,0x68A8,0x689F,0x68A1,0x6882,0x6B32,0x6BBA,0x0000,/* 0xF8-0xFF */ 622 0x689D,0x68A8,0x689F,0x68A1,0x6882,0x6B32,0x6BBA,0x0000,/* 0xF8-0xFF */
623}; 623};
624 624
625static wchar_t c2u_B2[256] = { 625static const wchar_t c2u_B2[256] = {
626 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 626 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
627 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 627 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
628 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 628 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -658,7 +658,7 @@ static wchar_t c2u_B2[256] = {
658 0x838A,0x8393,0x8389,0x83A0,0x8377,0x837B,0x837C,0x0000,/* 0xF8-0xFF */ 658 0x838A,0x8393,0x8389,0x83A0,0x8377,0x837B,0x837C,0x0000,/* 0xF8-0xFF */
659}; 659};
660 660
661static wchar_t c2u_B3[256] = { 661static const wchar_t c2u_B3[256] = {
662 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 662 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
663 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 663 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
664 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 664 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -694,7 +694,7 @@ static wchar_t c2u_B3[256] = {
694 0x5831,0x5821,0x581D,0x5820,0x58F9,0x58FA,0x5960,0x0000,/* 0xF8-0xFF */ 694 0x5831,0x5821,0x581D,0x5820,0x58F9,0x58FA,0x5960,0x0000,/* 0xF8-0xFF */
695}; 695};
696 696
697static wchar_t c2u_B4[256] = { 697static const wchar_t c2u_B4[256] = {
698 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 698 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
699 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 699 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
700 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 700 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -730,7 +730,7 @@ static wchar_t c2u_B4[256] = {
730 0x6E4D,0x6E3A,0x6E2C,0x6E43,0x6E1D,0x6E3E,0x6ECB,0x0000,/* 0xF8-0xFF */ 730 0x6E4D,0x6E3A,0x6E2C,0x6E43,0x6E1D,0x6E3E,0x6ECB,0x0000,/* 0xF8-0xFF */
731}; 731};
732 732
733static wchar_t c2u_B5[256] = { 733static const wchar_t c2u_B5[256] = {
734 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 734 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
735 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 735 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
736 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 736 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -766,7 +766,7 @@ static wchar_t c2u_B5[256] = {
766 0x8996,0x8A3B,0x8A60,0x8A55,0x8A5E,0x8A3C,0x8A41,0x0000,/* 0xF8-0xFF */ 766 0x8996,0x8A3B,0x8A60,0x8A55,0x8A5E,0x8A3C,0x8A41,0x0000,/* 0xF8-0xFF */
767}; 767};
768 768
769static wchar_t c2u_B6[256] = { 769static const wchar_t c2u_B6[256] = {
770 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 770 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
771 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 771 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
772 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 772 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -802,7 +802,7 @@ static wchar_t c2u_B6[256] = {
802 0x5967,0x5AC1,0x5AC9,0x5ACC,0x5ABE,0x5ABD,0x5ABC,0x0000,/* 0xF8-0xFF */ 802 0x5967,0x5AC1,0x5AC9,0x5ACC,0x5ABE,0x5ABD,0x5ABC,0x0000,/* 0xF8-0xFF */
803}; 803};
804 804
805static wchar_t c2u_B7[256] = { 805static const wchar_t c2u_B7[256] = {
806 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 806 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
807 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 807 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
808 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 808 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -838,7 +838,7 @@ static wchar_t c2u_B7[256] = {
838 0x76DE,0x76DF,0x775B,0x776B,0x7766,0x775E,0x7763,0x0000,/* 0xF8-0xFF */ 838 0x76DE,0x76DF,0x775B,0x776B,0x7766,0x775E,0x7763,0x0000,/* 0xF8-0xFF */
839}; 839};
840 840
841static wchar_t c2u_B8[256] = { 841static const wchar_t c2u_B8[256] = {
842 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 842 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
843 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 843 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
844 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 844 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -874,7 +874,7 @@ static wchar_t c2u_B8[256] = {
874 0x8DE4,0x8DE6,0x8EB2,0x8F03,0x8F09,0x8EFE,0x8F0A,0x0000,/* 0xF8-0xFF */ 874 0x8DE4,0x8DE6,0x8EB2,0x8F03,0x8F09,0x8EFE,0x8F0A,0x0000,/* 0xF8-0xFF */
875}; 875};
876 876
877static wchar_t c2u_B9[256] = { 877static const wchar_t c2u_B9[256] = {
878 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 878 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
879 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 879 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
880 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 880 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -910,7 +910,7 @@ static wchar_t c2u_B9[256] = {
910 0x5ED3,0x5ED6,0x5F0A,0x5F46,0x5F70,0x5FB9,0x6147,0x0000,/* 0xF8-0xFF */ 910 0x5ED3,0x5ED6,0x5F0A,0x5F46,0x5F70,0x5FB9,0x6147,0x0000,/* 0xF8-0xFF */
911}; 911};
912 912
913static wchar_t c2u_BA[256] = { 913static const wchar_t c2u_BA[256] = {
914 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 914 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
915 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 915 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
916 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 916 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -946,7 +946,7 @@ static wchar_t c2u_BA[256] = {
946 0x7DBF,0x7DB5,0x7DB8,0x7DAD,0x7DD2,0x7DC7,0x7DAC,0x0000,/* 0xF8-0xFF */ 946 0x7DBF,0x7DB5,0x7DB8,0x7DAD,0x7DD2,0x7DC7,0x7DAC,0x0000,/* 0xF8-0xFF */
947}; 947};
948 948
949static wchar_t c2u_BB[256] = { 949static const wchar_t c2u_BB[256] = {
950 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 950 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
951 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 951 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
952 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 952 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -982,7 +982,7 @@ static wchar_t c2u_BB[256] = {
982 0x50F5,0x50F9,0x5102,0x5108,0x5109,0x5105,0x51DC,0x0000,/* 0xF8-0xFF */ 982 0x50F5,0x50F9,0x5102,0x5108,0x5109,0x5105,0x51DC,0x0000,/* 0xF8-0xFF */
983}; 983};
984 984
985static wchar_t c2u_BC[256] = { 985static const wchar_t c2u_BC[256] = {
986 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 986 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
987 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 987 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
988 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 988 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1018,7 +1018,7 @@ static wchar_t c2u_BC[256] = {
1018 0x7256,0x729B,0x734E,0x7357,0x7469,0x748B,0x7483,0x0000,/* 0xF8-0xFF */ 1018 0x7256,0x729B,0x734E,0x7357,0x7469,0x748B,0x7483,0x0000,/* 0xF8-0xFF */
1019}; 1019};
1020 1020
1021static wchar_t c2u_BD[256] = { 1021static const wchar_t c2u_BD[256] = {
1022 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1022 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1023 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1023 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1024 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1024 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1054,7 +1054,7 @@ static wchar_t c2u_BD[256] = {
1054 0x8F1B,0x8F1F,0x8F29,0x8F26,0x8F2A,0x8F1C,0x8F1E,0x0000,/* 0xF8-0xFF */ 1054 0x8F1B,0x8F1F,0x8F29,0x8F26,0x8F2A,0x8F1C,0x8F1E,0x0000,/* 0xF8-0xFF */
1055}; 1055};
1056 1056
1057static wchar_t c2u_BE[256] = { 1057static const wchar_t c2u_BE[256] = {
1058 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1058 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1059 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1059 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1060 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1060 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1090,7 +1090,7 @@ static wchar_t c2u_BE[256] = {
1090 0x6A48,0x6B59,0x6B77,0x6C05,0x6FC2,0x6FB1,0x6FA1,0x0000,/* 0xF8-0xFF */ 1090 0x6A48,0x6B59,0x6B77,0x6C05,0x6FC2,0x6FB1,0x6FA1,0x0000,/* 0xF8-0xFF */
1091}; 1091};
1092 1092
1093static wchar_t c2u_BF[256] = { 1093static const wchar_t c2u_BF[256] = {
1094 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1094 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1095 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1095 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1096 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1096 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1126,7 +1126,7 @@ static wchar_t c2u_BF[256] = {
1126 0x9333,0x932F,0x9322,0x92FC,0x932B,0x9304,0x931A,0x0000,/* 0xF8-0xFF */ 1126 0x9333,0x932F,0x9322,0x92FC,0x932B,0x9304,0x931A,0x0000,/* 0xF8-0xFF */
1127}; 1127};
1128 1128
1129static wchar_t c2u_C0[256] = { 1129static const wchar_t c2u_C0[256] = {
1130 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1130 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1131 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1131 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1132 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1132 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1162,7 +1162,7 @@ static wchar_t c2u_C0[256] = {
1162 0x7642,0x764C,0x76EA,0x77B3,0x77AA,0x77B0,0x77AC,0x0000,/* 0xF8-0xFF */ 1162 0x7642,0x764C,0x76EA,0x77B3,0x77AA,0x77B0,0x77AC,0x0000,/* 0xF8-0xFF */
1163}; 1163};
1164 1164
1165static wchar_t c2u_C1[256] = { 1165static const wchar_t c2u_C1[256] = {
1166 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1166 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1167 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1167 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1168 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1168 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1198,7 +1198,7 @@ static wchar_t c2u_C1[256] = {
1198 0x971E,0x97A0,0x97D3,0x9846,0x98B6,0x9935,0x9A01,0x0000,/* 0xF8-0xFF */ 1198 0x971E,0x97A0,0x97D3,0x9846,0x98B6,0x9935,0x9A01,0x0000,/* 0xF8-0xFF */
1199}; 1199};
1200 1200
1201static wchar_t c2u_C2[256] = { 1201static const wchar_t c2u_C2[256] = {
1202 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1202 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1203 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1203 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1204 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1204 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1234,7 +1234,7 @@ static wchar_t c2u_C2[256] = {
1234 0x96DC,0x96D9,0x96DB,0x96DE,0x9724,0x97A3,0x97A6,0x0000,/* 0xF8-0xFF */ 1234 0x96DC,0x96D9,0x96DB,0x96DE,0x9724,0x97A3,0x97A6,0x0000,/* 0xF8-0xFF */
1235}; 1235};
1236 1236
1237static wchar_t c2u_C3[256] = { 1237static const wchar_t c2u_C3[256] = {
1238 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1238 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1239 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1239 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1240 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1240 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1270,7 +1270,7 @@ static wchar_t c2u_C3[256] = {
1270 0x96E3,0x972A,0x9727,0x9761,0x97DC,0x97FB,0x985E,0x0000,/* 0xF8-0xFF */ 1270 0x96E3,0x972A,0x9727,0x9761,0x97DC,0x97FB,0x985E,0x0000,/* 0xF8-0xFF */
1271}; 1271};
1272 1272
1273static wchar_t c2u_C4[256] = { 1273static const wchar_t c2u_C4[256] = {
1274 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1274 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1275 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1275 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1276 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1276 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1306,7 +1306,7 @@ static wchar_t c2u_C4[256] = {
1306 0x8822,0x8821,0x881F,0x896A,0x896C,0x89BD,0x8B74,0x0000,/* 0xF8-0xFF */ 1306 0x8822,0x8821,0x881F,0x896A,0x896C,0x89BD,0x8B74,0x0000,/* 0xF8-0xFF */
1307}; 1307};
1308 1308
1309static wchar_t c2u_C5[256] = { 1309static const wchar_t c2u_C5[256] = {
1310 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1310 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1311 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1311 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1312 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1312 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1342,7 +1342,7 @@ static wchar_t c2u_C5[256] = {
1342 0x7F50,0x7F88,0x8836,0x8839,0x8862,0x8B93,0x8B92,0x0000,/* 0xF8-0xFF */ 1342 0x7F50,0x7F88,0x8836,0x8839,0x8862,0x8B93,0x8B92,0x0000,/* 0xF8-0xFF */
1343}; 1343};
1344 1344
1345static wchar_t c2u_C6[256] = { 1345static const wchar_t c2u_C6[256] = {
1346 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1346 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1347 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1347 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1348 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1348 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1361,7 +1361,7 @@ static wchar_t c2u_C6[256] = {
1361 0x9E1A,0x7228,0x9A6A,0x9B31,0x9E1B,0x9E1E,0x7C72,0x0000,/* 0x78-0x7F */ 1361 0x9E1A,0x7228,0x9A6A,0x9B31,0x9E1B,0x9E1E,0x7C72,0x0000,/* 0x78-0x7F */
1362}; 1362};
1363 1363
1364static wchar_t c2u_C9[256] = { 1364static const wchar_t c2u_C9[256] = {
1365 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1365 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1366 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1366 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1367 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1367 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1397,7 +1397,7 @@ static wchar_t c2u_C9[256] = {
1397 0x6C46,0x6C52,0x6C5C,0x6C4F,0x6C4A,0x6C54,0x6C4B,0x0000,/* 0xF8-0xFF */ 1397 0x6C46,0x6C52,0x6C5C,0x6C4F,0x6C4A,0x6C54,0x6C4B,0x0000,/* 0xF8-0xFF */
1398}; 1398};
1399 1399
1400static wchar_t c2u_CA[256] = { 1400static const wchar_t c2u_CA[256] = {
1401 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1401 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1402 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1402 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1403 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1403 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1433,7 +1433,7 @@ static wchar_t c2u_CA[256] = {
1433 0x65F0,0x65F4,0x65F3,0x65F2,0x65F5,0x6745,0x6747,0x0000,/* 0xF8-0xFF */ 1433 0x65F0,0x65F4,0x65F3,0x65F2,0x65F5,0x6745,0x6747,0x0000,/* 0xF8-0xFF */
1434}; 1434};
1435 1435
1436static wchar_t c2u_CB[256] = { 1436static const wchar_t c2u_CB[256] = {
1437 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1437 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1438 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1438 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1439 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1439 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1469,7 +1469,7 @@ static wchar_t c2u_CB[256] = {
1469 0x5776,0x5780,0x5775,0x577B,0x5773,0x5774,0x5762,0x0000,/* 0xF8-0xFF */ 1469 0x5776,0x5780,0x5775,0x577B,0x5773,0x5774,0x5762,0x0000,/* 0xF8-0xFF */
1470}; 1470};
1471 1471
1472static wchar_t c2u_CC[256] = { 1472static const wchar_t c2u_CC[256] = {
1473 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1473 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1474 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1474 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1475 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1475 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1505,7 +1505,7 @@ static wchar_t c2u_CC[256] = {
1505 0x6CD0,0x6CC2,0x6CBA,0x6CC3,0x6CC6,0x6CED,0x6CF2,0x0000,/* 0xF8-0xFF */ 1505 0x6CD0,0x6CC2,0x6CBA,0x6CC3,0x6CC6,0x6CED,0x6CF2,0x0000,/* 0xF8-0xFF */
1506}; 1506};
1507 1507
1508static wchar_t c2u_CD[256] = { 1508static const wchar_t c2u_CD[256] = {
1509 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1509 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1510 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1510 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1511 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1511 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1541,7 +1541,7 @@ static wchar_t c2u_CD[256] = {
1541 0x5399,0x5398,0x54BA,0x54A1,0x54AD,0x54A5,0x54CF,0x0000,/* 0xF8-0xFF */ 1541 0x5399,0x5398,0x54BA,0x54A1,0x54AD,0x54A5,0x54CF,0x0000,/* 0xF8-0xFF */
1542}; 1542};
1543 1543
1544static wchar_t c2u_CE[256] = { 1544static const wchar_t c2u_CE[256] = {
1545 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1545 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1546 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1546 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1547 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1547 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1577,7 +1577,7 @@ static wchar_t c2u_CE[256] = {
1577 0x662E,0x670F,0x6710,0x67C1,0x67F2,0x67C8,0x67BA,0x0000,/* 0xF8-0xFF */ 1577 0x662E,0x670F,0x6710,0x67C1,0x67F2,0x67C8,0x67BA,0x0000,/* 0xF8-0xFF */
1578}; 1578};
1579 1579
1580static wchar_t c2u_CF[256] = { 1580static const wchar_t c2u_CF[256] = {
1581 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1581 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1582 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1582 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1583 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1583 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1613,7 +1613,7 @@ static wchar_t c2u_CF[256] = {
1613 0x7944,0x79D5,0x79CD,0x79CF,0x79D6,0x79CE,0x7A80,0x0000,/* 0xF8-0xFF */ 1613 0x7944,0x79D5,0x79CD,0x79CF,0x79D6,0x79CE,0x7A80,0x0000,/* 0xF8-0xFF */
1614}; 1614};
1615 1615
1616static wchar_t c2u_D0[256] = { 1616static const wchar_t c2u_D0[256] = {
1617 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1617 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1618 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1618 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1619 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1619 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1649,7 +1649,7 @@ static wchar_t c2u_D0[256] = {
1649 0x54FF,0x5504,0x5508,0x54EB,0x5511,0x5505,0x54F1,0x0000,/* 0xF8-0xFF */ 1649 0x54FF,0x5504,0x5508,0x54EB,0x5511,0x5505,0x54F1,0x0000,/* 0xF8-0xFF */
1650}; 1650};
1651 1651
1652static wchar_t c2u_D1[256] = { 1652static const wchar_t c2u_D1[256] = {
1653 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1653 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1654 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1654 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1655 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1655 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1685,7 +1685,7 @@ static wchar_t c2u_D1[256] = {
1685 0x6B31,0x6B34,0x6B6D,0x8082,0x6B88,0x6BE6,0x6BE4,0x0000,/* 0xF8-0xFF */ 1685 0x6B31,0x6B34,0x6B6D,0x8082,0x6B88,0x6BE6,0x6BE4,0x0000,/* 0xF8-0xFF */
1686}; 1686};
1687 1687
1688static wchar_t c2u_D2[256] = { 1688static const wchar_t c2u_D2[256] = {
1689 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1689 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1690 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1690 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1691 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1691 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1721,7 +1721,7 @@ static wchar_t c2u_D2[256] = {
1721 0x7A85,0x7A8B,0x7A8C,0x7A8A,0x7A87,0x7AD8,0x7B10,0x0000,/* 0xF8-0xFF */ 1721 0x7A85,0x7A8B,0x7A8C,0x7A8A,0x7A87,0x7AD8,0x7B10,0x0000,/* 0xF8-0xFF */
1722}; 1722};
1723 1723
1724static wchar_t c2u_D3[256] = { 1724static const wchar_t c2u_D3[256] = {
1725 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1725 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1726 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1726 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1727 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1727 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1757,7 +1757,7 @@ static wchar_t c2u_D3[256] = {
1757 0x90E5,0x90D8,0x90DB,0x90D7,0x90DC,0x90E4,0x9150,0x0000,/* 0xF8-0xFF */ 1757 0x90E5,0x90D8,0x90DB,0x90D7,0x90DC,0x90E4,0x9150,0x0000,/* 0xF8-0xFF */
1758}; 1758};
1759 1759
1760static wchar_t c2u_D4[256] = { 1760static const wchar_t c2u_D4[256] = {
1761 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1761 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1762 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1762 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1763 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1763 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1793,7 +1793,7 @@ static wchar_t c2u_D4[256] = {
1793 0x5D20,0x5D0C,0x5D28,0x5D0D,0x5D26,0x5D25,0x5D0F,0x0000,/* 0xF8-0xFF */ 1793 0x5D20,0x5D0C,0x5D28,0x5D0D,0x5D26,0x5D25,0x5D0F,0x0000,/* 0xF8-0xFF */
1794}; 1794};
1795 1795
1796static wchar_t c2u_D5[256] = { 1796static const wchar_t c2u_D5[256] = {
1797 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1797 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1798 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1798 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1799 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1799 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1829,7 +1829,7 @@ static wchar_t c2u_D5[256] = {
1829 0x6DED,0x6DF0,0x6DBA,0x6DD5,0x6DC2,0x6DCF,0x6DC9,0x0000,/* 0xF8-0xFF */ 1829 0x6DED,0x6DF0,0x6DBA,0x6DD5,0x6DC2,0x6DCF,0x6DC9,0x0000,/* 0xF8-0xFF */
1830}; 1830};
1831 1831
1832static wchar_t c2u_D6[256] = { 1832static const wchar_t c2u_D6[256] = {
1833 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1833 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1834 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1834 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1835 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1835 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1865,7 +1865,7 @@ static wchar_t c2u_D6[256] = {
1865 0x7FCD,0x7FD0,0x7FD1,0x7FC7,0x7FCF,0x7FC9,0x801F,0x0000,/* 0xF8-0xFF */ 1865 0x7FCD,0x7FD0,0x7FD1,0x7FC7,0x7FCF,0x7FC9,0x801F,0x0000,/* 0xF8-0xFF */
1866}; 1866};
1867 1867
1868static wchar_t c2u_D7[256] = { 1868static const wchar_t c2u_D7[256] = {
1869 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1869 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1870 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1870 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1871 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1871 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1901,7 +1901,7 @@ static wchar_t c2u_D7[256] = {
1901 0x91F4,0x91F1,0x91F3,0x91F8,0x91E4,0x91F9,0x91EA,0x0000,/* 0xF8-0xFF */ 1901 0x91F4,0x91F1,0x91F3,0x91F8,0x91E4,0x91F9,0x91EA,0x0000,/* 0xF8-0xFF */
1902}; 1902};
1903 1903
1904static wchar_t c2u_D8[256] = { 1904static const wchar_t c2u_D8[256] = {
1905 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1905 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1906 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1906 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1907 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1907 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1937,7 +1937,7 @@ static wchar_t c2u_D8[256] = {
1937 0x60C9,0x60B9,0x60CC,0x60E2,0x60CE,0x60C4,0x6114,0x0000,/* 0xF8-0xFF */ 1937 0x60C9,0x60B9,0x60CC,0x60E2,0x60CE,0x60C4,0x6114,0x0000,/* 0xF8-0xFF */
1938}; 1938};
1939 1939
1940static wchar_t c2u_D9[256] = { 1940static const wchar_t c2u_D9[256] = {
1941 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1941 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1942 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1942 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1943 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1943 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1973,7 +1973,7 @@ static wchar_t c2u_D9[256] = {
1973 0x6E4B,0x6E40,0x6E51,0x6E3B,0x6E03,0x6E2E,0x6E5E,0x0000,/* 0xF8-0xFF */ 1973 0x6E4B,0x6E40,0x6E51,0x6E3B,0x6E03,0x6E2E,0x6E5E,0x0000,/* 0xF8-0xFF */
1974}; 1974};
1975 1975
1976static wchar_t c2u_DA[256] = { 1976static const wchar_t c2u_DA[256] = {
1977 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 1977 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
1978 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 1978 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
1979 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 1979 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2009,7 +2009,7 @@ static wchar_t c2u_DA[256] = {
2009 0x7D69,0x7D51,0x7D5F,0x7D4E,0x7F3E,0x7F3F,0x7F65,0x0000,/* 0xF8-0xFF */ 2009 0x7D69,0x7D51,0x7D5F,0x7D4E,0x7F3E,0x7F3F,0x7F65,0x0000,/* 0xF8-0xFF */
2010}; 2010};
2011 2011
2012static wchar_t c2u_DB[256] = { 2012static const wchar_t c2u_DB[256] = {
2013 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2013 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2014 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2014 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2015 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2015 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2045,7 +2045,7 @@ static wchar_t c2u_DB[256] = {
2045 0x8DD9,0x8DC8,0x8DD7,0x8DC5,0x8EEF,0x8EF7,0x8EFA,0x0000,/* 0xF8-0xFF */ 2045 0x8DD9,0x8DC8,0x8DD7,0x8DC5,0x8EEF,0x8EF7,0x8EFA,0x0000,/* 0xF8-0xFF */
2046}; 2046};
2047 2047
2048static wchar_t c2u_DC[256] = { 2048static const wchar_t c2u_DC[256] = {
2049 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2049 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2050 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2050 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2051 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2051 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2081,7 +2081,7 @@ static wchar_t c2u_DC[256] = {
2081 0x5AB1,0x5AB5,0x5AB0,0x5ABF,0x5AC8,0x5ABB,0x5AC6,0x0000,/* 0xF8-0xFF */ 2081 0x5AB1,0x5AB5,0x5AB0,0x5ABF,0x5AC8,0x5ABB,0x5AC6,0x0000,/* 0xF8-0xFF */
2082}; 2082};
2083 2083
2084static wchar_t c2u_DD[256] = { 2084static const wchar_t c2u_DD[256] = {
2085 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2085 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2086 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2086 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2087 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2087 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2117,7 +2117,7 @@ static wchar_t c2u_DD[256] = {
2117 0x6B42,0x6B48,0x6B41,0x6B9B,0xFA0D,0x6BFB,0x6BFC,0x0000,/* 0xF8-0xFF */ 2117 0x6B42,0x6B48,0x6B41,0x6B9B,0xFA0D,0x6BFB,0x6BFC,0x0000,/* 0xF8-0xFF */
2118}; 2118};
2119 2119
2120static wchar_t c2u_DE[256] = { 2120static const wchar_t c2u_DE[256] = {
2121 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2121 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2122 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2122 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2123 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2123 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2153,7 +2153,7 @@ static wchar_t c2u_DE[256] = {
2153 0x7A18,0x7A19,0x7A12,0x7A17,0x7A15,0x7A22,0x7A13,0x0000,/* 0xF8-0xFF */ 2153 0x7A18,0x7A19,0x7A12,0x7A17,0x7A15,0x7A22,0x7A13,0x0000,/* 0xF8-0xFF */
2154}; 2154};
2155 2155
2156static wchar_t c2u_DF[256] = { 2156static const wchar_t c2u_DF[256] = {
2157 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2157 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2158 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2158 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2159 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2159 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2189,7 +2189,7 @@ static wchar_t c2u_DF[256] = {
2189 0x88CC,0x88D0,0x8985,0x899B,0x89DF,0x89E5,0x89E4,0x0000,/* 0xF8-0xFF */ 2189 0x88CC,0x88D0,0x8985,0x899B,0x89DF,0x89E5,0x89E4,0x0000,/* 0xF8-0xFF */
2190}; 2190};
2191 2191
2192static wchar_t c2u_E0[256] = { 2192static const wchar_t c2u_E0[256] = {
2193 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2193 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2194 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2194 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2195 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2195 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2225,7 +2225,7 @@ static wchar_t c2u_E0[256] = {
2225 0x50E4,0x50D3,0x50EC,0x50F0,0x50EF,0x50E3,0x50E0,0x0000,/* 0xF8-0xFF */ 2225 0x50E4,0x50D3,0x50EC,0x50F0,0x50EF,0x50E3,0x50E0,0x0000,/* 0xF8-0xFF */
2226}; 2226};
2227 2227
2228static wchar_t c2u_E1[256] = { 2228static const wchar_t c2u_E1[256] = {
2229 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2229 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2230 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2230 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2231 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2231 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2261,7 +2261,7 @@ static wchar_t c2u_E1[256] = {
2261 0x669F,0x6705,0x6704,0x6722,0x69B1,0x69B6,0x69C9,0x0000,/* 0xF8-0xFF */ 2261 0x669F,0x6705,0x6704,0x6722,0x69B1,0x69B6,0x69C9,0x0000,/* 0xF8-0xFF */
2262}; 2262};
2263 2263
2264static wchar_t c2u_E2[256] = { 2264static const wchar_t c2u_E2[256] = {
2265 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2265 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2266 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2266 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2267 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2267 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2297,7 +2297,7 @@ static wchar_t c2u_E2[256] = {
2297 0x7998,0x798A,0x798B,0x7996,0x7995,0x7994,0x7993,0x0000,/* 0xF8-0xFF */ 2297 0x7998,0x798A,0x798B,0x7996,0x7995,0x7994,0x7993,0x0000,/* 0xF8-0xFF */
2298}; 2298};
2299 2299
2300static wchar_t c2u_E3[256] = { 2300static const wchar_t c2u_E3[256] = {
2301 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2301 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2302 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2302 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2303 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2303 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2333,7 +2333,7 @@ static wchar_t c2u_E3[256] = {
2333 0x88F2,0x88FA,0x88FE,0x88EE,0x88FC,0x88F6,0x88FB,0x0000,/* 0xF8-0xFF */ 2333 0x88F2,0x88FA,0x88FE,0x88EE,0x88FC,0x88F6,0x88FB,0x0000,/* 0xF8-0xFF */
2334}; 2334};
2335 2335
2336static wchar_t c2u_E4[256] = { 2336static const wchar_t c2u_E4[256] = {
2337 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2337 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2338 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2338 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2339 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2339 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2369,7 +2369,7 @@ static wchar_t c2u_E4[256] = {
2369 0x564C,0x5635,0x5641,0x564A,0x5649,0x5646,0x5658,0x0000,/* 0xF8-0xFF */ 2369 0x564C,0x5635,0x5641,0x564A,0x5649,0x5646,0x5658,0x0000,/* 0xF8-0xFF */
2370}; 2370};
2371 2371
2372static wchar_t c2u_E5[256] = { 2372static const wchar_t c2u_E5[256] = {
2373 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2373 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2374 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2374 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2375 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2375 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2405,7 +2405,7 @@ static wchar_t c2u_E5[256] = {
2405 0x6C02,0x6F41,0x6F26,0x6F7E,0x6F87,0x6FC6,0x6F92,0x0000,/* 0xF8-0xFF */ 2405 0x6C02,0x6F41,0x6F26,0x6F7E,0x6F87,0x6FC6,0x6F92,0x0000,/* 0xF8-0xFF */
2406}; 2406};
2407 2407
2408static wchar_t c2u_E6[256] = { 2408static const wchar_t c2u_E6[256] = {
2409 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2409 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2410 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2410 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2411 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2411 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2441,7 +2441,7 @@ static wchar_t c2u_E6[256] = {
2441 0x7FEC,0x7FE6,0x7FE8,0x8064,0x8067,0x81A3,0x819F,0x0000,/* 0xF8-0xFF */ 2441 0x7FEC,0x7FE6,0x7FE8,0x8064,0x8067,0x81A3,0x819F,0x0000,/* 0xF8-0xFF */
2442}; 2442};
2443 2443
2444static wchar_t c2u_E7[256] = { 2444static const wchar_t c2u_E7[256] = {
2445 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2445 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2446 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2446 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2447 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2447 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2477,7 +2477,7 @@ static wchar_t c2u_E7[256] = {
2477 0x8E15,0x8E1B,0x8E16,0x8E11,0x8E19,0x8E26,0x8E27,0x0000,/* 0xF8-0xFF */ 2477 0x8E15,0x8E1B,0x8E16,0x8E11,0x8E19,0x8E26,0x8E27,0x0000,/* 0xF8-0xFF */
2478}; 2478};
2479 2479
2480static wchar_t c2u_E8[256] = { 2480static const wchar_t c2u_E8[256] = {
2481 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2481 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2482 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2482 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2483 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2483 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2513,7 +2513,7 @@ static wchar_t c2u_E8[256] = {
2513 0x5111,0x51DE,0x5334,0x53E1,0x5670,0x5660,0x566E,0x0000,/* 0xF8-0xFF */ 2513 0x5111,0x51DE,0x5334,0x53E1,0x5670,0x5660,0x566E,0x0000,/* 0xF8-0xFF */
2514}; 2514};
2515 2515
2516static wchar_t c2u_E9[256] = { 2516static const wchar_t c2u_E9[256] = {
2517 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2517 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2518 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2518 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2519 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2519 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2549,7 +2549,7 @@ static wchar_t c2u_E9[256] = {
2549 0x6FAE,0x6FBA,0x6FAC,0x6FAA,0x6FCF,0x6FBF,0x6FB8,0x0000,/* 0xF8-0xFF */ 2549 0x6FAE,0x6FBA,0x6FAC,0x6FAA,0x6FCF,0x6FBF,0x6FB8,0x0000,/* 0xF8-0xFF */
2550}; 2550};
2551 2551
2552static wchar_t c2u_EA[256] = { 2552static const wchar_t c2u_EA[256] = {
2553 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2553 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2554 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2554 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2555 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2555 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2585,7 +2585,7 @@ static wchar_t c2u_EA[256] = {
2585 0x8556,0x8545,0x856B,0x854D,0x8553,0x8561,0x8558,0x0000,/* 0xF8-0xFF */ 2585 0x8556,0x8545,0x856B,0x854D,0x8553,0x8561,0x8558,0x0000,/* 0xF8-0xFF */
2586}; 2586};
2587 2587
2588static wchar_t c2u_EB[256] = { 2588static const wchar_t c2u_EB[256] = {
2589 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2589 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2590 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2590 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2591 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2591 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2621,7 +2621,7 @@ static wchar_t c2u_EB[256] = {
2621 0x92FF,0x9329,0x9339,0x9335,0x932A,0x9314,0x930C,0x0000,/* 0xF8-0xFF */ 2621 0x92FF,0x9329,0x9339,0x9335,0x932A,0x9314,0x930C,0x0000,/* 0xF8-0xFF */
2622}; 2622};
2623 2623
2624static wchar_t c2u_EC[256] = { 2624static const wchar_t c2u_EC[256] = {
2625 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2625 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2626 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2626 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2627 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2627 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2657,7 +2657,7 @@ static wchar_t c2u_EC[256] = {
2657 0x6A9F,0x6A9B,0x6AA1,0x6A9E,0x6A87,0x6A93,0x6A8E,0x0000,/* 0xF8-0xFF */ 2657 0x6A9F,0x6A9B,0x6AA1,0x6A9E,0x6A87,0x6A93,0x6A8E,0x0000,/* 0xF8-0xFF */
2658}; 2658};
2659 2659
2660static wchar_t c2u_ED[256] = { 2660static const wchar_t c2u_ED[256] = {
2661 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2661 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2662 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2662 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2663 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2663 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2693,7 +2693,7 @@ static wchar_t c2u_ED[256] = {
2693 0x85A0,0x858B,0x85A3,0x857B,0x85A4,0x859A,0x859E,0x0000,/* 0xF8-0xFF */ 2693 0x85A0,0x858B,0x85A3,0x857B,0x85A4,0x859A,0x859E,0x0000,/* 0xF8-0xFF */
2694}; 2694};
2695 2695
2696static wchar_t c2u_EE[256] = { 2696static const wchar_t c2u_EE[256] = {
2697 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2697 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2698 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2698 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2699 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2699 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2729,7 +2729,7 @@ static wchar_t c2u_EE[256] = {
2729 0x971F,0x9718,0x971D,0x9719,0x979A,0x97A1,0x979C,0x0000,/* 0xF8-0xFF */ 2729 0x971F,0x9718,0x971D,0x9719,0x979A,0x97A1,0x979C,0x0000,/* 0xF8-0xFF */
2730}; 2730};
2731 2731
2732static wchar_t c2u_EF[256] = { 2732static const wchar_t c2u_EF[256] = {
2733 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2733 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2734 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2734 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2735 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2735 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2765,7 +2765,7 @@ static wchar_t c2u_EF[256] = {
2765 0x700A,0x7201,0x71FF,0x71F9,0x7203,0x71FD,0x7376,0x0000,/* 0xF8-0xFF */ 2765 0x700A,0x7201,0x71FF,0x71F9,0x7203,0x71FD,0x7376,0x0000,/* 0xF8-0xFF */
2766}; 2766};
2767 2767
2768static wchar_t c2u_F0[256] = { 2768static const wchar_t c2u_F0[256] = {
2769 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2769 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2770 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2770 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2771 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2771 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2801,7 +2801,7 @@ static wchar_t c2u_F0[256] = {
2801 0x8E62,0x8E60,0x8E57,0x8E56,0x8E5E,0x8E65,0x8E67,0x0000,/* 0xF8-0xFF */ 2801 0x8E62,0x8E60,0x8E57,0x8E56,0x8E5E,0x8E65,0x8E67,0x0000,/* 0xF8-0xFF */
2802}; 2802};
2803 2803
2804static wchar_t c2u_F1[256] = { 2804static const wchar_t c2u_F1[256] = {
2805 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2805 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2806 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2806 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2807 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2807 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2837,7 +2837,7 @@ static wchar_t c2u_F1[256] = {
2837 0x58DB,0x5912,0x5B3D,0x5B3E,0x5B3F,0x5DC3,0x5E70,0x0000,/* 0xF8-0xFF */ 2837 0x58DB,0x5912,0x5B3D,0x5B3E,0x5B3F,0x5DC3,0x5E70,0x0000,/* 0xF8-0xFF */
2838}; 2838};
2839 2839
2840static wchar_t c2u_F2[256] = { 2840static const wchar_t c2u_F2[256] = {
2841 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2841 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2842 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2842 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2843 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2843 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2873,7 +2873,7 @@ static wchar_t c2u_F2[256] = {
2873 0x8B4A,0x8B40,0x8B53,0x8B56,0x8B54,0x8B4B,0x8B55,0x0000,/* 0xF8-0xFF */ 2873 0x8B4A,0x8B40,0x8B53,0x8B56,0x8B54,0x8B4B,0x8B55,0x0000,/* 0xF8-0xFF */
2874}; 2874};
2875 2875
2876static wchar_t c2u_F3[256] = { 2876static const wchar_t c2u_F3[256] = {
2877 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2877 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2878 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2878 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2879 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2879 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2909,7 +2909,7 @@ static wchar_t c2u_F3[256] = {
2909 0x9F41,0x9F4D,0x9F56,0x9F57,0x9F58,0x5337,0x56B2,0x0000,/* 0xF8-0xFF */ 2909 0x9F41,0x9F4D,0x9F56,0x9F57,0x9F58,0x5337,0x56B2,0x0000,/* 0xF8-0xFF */
2910}; 2910};
2911 2911
2912static wchar_t c2u_F4[256] = { 2912static const wchar_t c2u_F4[256] = {
2913 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2913 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2914 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2914 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2915 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2915 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2945,7 +2945,7 @@ static wchar_t c2u_F4[256] = {
2945 0x9416,0x9412,0x93FA,0x9409,0x93F8,0x940A,0x93FF,0x0000,/* 0xF8-0xFF */ 2945 0x9416,0x9412,0x93FA,0x9409,0x93F8,0x940A,0x93FF,0x0000,/* 0xF8-0xFF */
2946}; 2946};
2947 2947
2948static wchar_t c2u_F5[256] = { 2948static const wchar_t c2u_F5[256] = {
2949 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2949 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2950 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2950 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2951 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2951 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2981,7 +2981,7 @@ static wchar_t c2u_F5[256] = {
2981 0x8627,0x862E,0x8621,0x8620,0x8629,0x861E,0x8625,0x0000,/* 0xF8-0xFF */ 2981 0x8627,0x862E,0x8621,0x8620,0x8629,0x861E,0x8625,0x0000,/* 0xF8-0xFF */
2982}; 2982};
2983 2983
2984static wchar_t c2u_F6[256] = { 2984static const wchar_t c2u_F6[256] = {
2985 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 2985 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
2986 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 2986 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
2987 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 2987 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3017,7 +3017,7 @@ static wchar_t c2u_F6[256] = {
3017 0x7A70,0x7A71,0x7C57,0x7C5C,0x7C59,0x7C5B,0x7C5A,0x0000,/* 0xF8-0xFF */ 3017 0x7A70,0x7A71,0x7C57,0x7C5C,0x7C59,0x7C5B,0x7C5A,0x0000,/* 0xF8-0xFF */
3018}; 3018};
3019 3019
3020static wchar_t c2u_F7[256] = { 3020static const wchar_t c2u_F7[256] = {
3021 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3021 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3022 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3022 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3023 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3023 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3053,7 +3053,7 @@ static wchar_t c2u_F7[256] = {
3053 0x8832,0x882E,0x8833,0x8976,0x8974,0x8973,0x89FE,0x0000,/* 0xF8-0xFF */ 3053 0x8832,0x882E,0x8833,0x8976,0x8974,0x8973,0x89FE,0x0000,/* 0xF8-0xFF */
3054}; 3054};
3055 3055
3056static wchar_t c2u_F8[256] = { 3056static const wchar_t c2u_F8[256] = {
3057 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3057 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3058 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3058 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3059 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3059 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3089,7 +3089,7 @@ static wchar_t c2u_F8[256] = {
3089 0x77D8,0x77D9,0x7939,0x7C69,0x7C6B,0x7CF6,0x7E9A,0x0000,/* 0xF8-0xFF */ 3089 0x77D8,0x77D9,0x7939,0x7C69,0x7C6B,0x7CF6,0x7E9A,0x0000,/* 0xF8-0xFF */
3090}; 3090};
3091 3091
3092static wchar_t c2u_F9[256] = { 3092static const wchar_t c2u_F9[256] = {
3093 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */ 3093 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
3094 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */ 3094 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
3095 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */ 3095 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3125,7 +3125,7 @@ static wchar_t c2u_F9[256] = {
3125 0x2551,0x2550,0x256D,0x256E,0x2570,0x256F,0x2593,0x0000,/* 0xF8-0xFF */ 3125 0x2551,0x2550,0x256D,0x256E,0x2570,0x256F,0x2593,0x0000,/* 0xF8-0xFF */
3126}; 3126};
3127 3127
3128static wchar_t *page_charset2uni[256] = { 3128static const wchar_t *page_charset2uni[256] = {
3129 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3129 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3130 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3130 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3131 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3131 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -3160,7 +3160,7 @@ static wchar_t *page_charset2uni[256] = {
3160 c2u_F8, c2u_F9, NULL, NULL, NULL, NULL, NULL, NULL, 3160 c2u_F8, c2u_F9, NULL, NULL, NULL, NULL, NULL, NULL,
3161}; 3161};
3162 3162
3163static unsigned char u2c_02[512] = { 3163static const unsigned char u2c_02[512] = {
3164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3219,7 +3219,7 @@ static unsigned char u2c_02[512] = {
3219 0x00, 0x00, 0xA3, 0xBB, 0x00, 0x00, 0x00, 0x00, /* 0xD8-0xDB */ 3219 0x00, 0x00, 0xA3, 0xBB, 0x00, 0x00, 0x00, 0x00, /* 0xD8-0xDB */
3220}; 3220};
3221 3221
3222static unsigned char u2c_03[512] = { 3222static const unsigned char u2c_03[512] = {
3223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3224 0x00, 0x00, 0xA1, 0xC2, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3224 0x00, 0x00, 0xA1, 0xC2, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3274,7 +3274,7 @@ static unsigned char u2c_03[512] = {
3274 0xA3, 0x72, 0xA3, 0x73, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */ 3274 0xA3, 0x72, 0xA3, 0x73, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
3275}; 3275};
3276 3276
3277static unsigned char u2c_20[512] = { 3277static const unsigned char u2c_20[512] = {
3278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3293,7 +3293,7 @@ static unsigned char u2c_20[512] = {
3293 0x00, 0x00, 0x00, 0x00, 0xA1, 0xC3, 0x00, 0x00, /* 0x3C-0x3F */ 3293 0x00, 0x00, 0x00, 0x00, 0xA1, 0xC3, 0x00, 0x00, /* 0x3C-0x3F */
3294}; 3294};
3295 3295
3296static unsigned char u2c_21[512] = { 3296static const unsigned char u2c_21[512] = {
3297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x4A, /* 0x00-0x03 */ 3297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x4A, /* 0x00-0x03 */
3298 0x00, 0x00, 0xA1, 0xC1, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3298 0x00, 0x00, 0xA1, 0xC1, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3299 0x00, 0x00, 0xA2, 0x4B, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3299 0x00, 0x00, 0xA2, 0x4B, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3336,7 +3336,7 @@ static unsigned char u2c_21[512] = {
3336 0xA1, 0xFB, 0xA1, 0xFA, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9B */ 3336 0xA1, 0xFB, 0xA1, 0xFA, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9B */
3337}; 3337};
3338 3338
3339static unsigned char u2c_22[512] = { 3339static const unsigned char u2c_22[512] = {
3340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3388,12 +3388,12 @@ static unsigned char u2c_22[512] = {
3388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xE9, /* 0xBC-0xBF */ 3388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xE9, /* 0xBC-0xBF */
3389}; 3389};
3390 3390
3391static unsigned char u2c_23[512] = { 3391static const unsigned char u2c_23[512] = {
3392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x5B, /* 0x04-0x07 */ 3393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x5B, /* 0x04-0x07 */
3394}; 3394};
3395 3395
3396static unsigned char u2c_25[512] = { 3396static const unsigned char u2c_25[512] = {
3397 0xA2, 0x77, 0x00, 0x00, 0xA2, 0x78, 0x00, 0x00, /* 0x00-0x03 */ 3397 0xA2, 0x77, 0x00, 0x00, 0xA2, 0x78, 0x00, 0x00, /* 0x00-0x03 */
3398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3455,7 +3455,7 @@ static unsigned char u2c_25[512] = {
3455 0xA2, 0xAB, 0xA2, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */ 3455 0xA2, 0xAB, 0xA2, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
3456}; 3456};
3457 3457
3458static unsigned char u2c_26[512] = { 3458static const unsigned char u2c_26[512] = {
3459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3460 0x00, 0x00, 0xA1, 0xB9, 0xA1, 0xB8, 0x00, 0x00, /* 0x04-0x07 */ 3460 0x00, 0x00, 0xA1, 0xB9, 0xA1, 0xB8, 0x00, 0x00, /* 0x04-0x07 */
3461 0x00, 0x00, 0xA1, 0xF3, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3461 0x00, 0x00, 0xA1, 0xF3, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3475,7 +3475,7 @@ static unsigned char u2c_26[512] = {
3475 0xA1, 0xF0, 0xA1, 0xF2, 0xA1, 0xF1, 0x00, 0x00, /* 0x40-0x43 */ 3475 0xA1, 0xF0, 0xA1, 0xF2, 0xA1, 0xF1, 0x00, 0x00, /* 0x40-0x43 */
3476}; 3476};
3477 3477
3478static unsigned char u2c_30[512] = { 3478static const unsigned char u2c_30[512] = {
3479 0xA1, 0x40, 0xA1, 0x42, 0xA1, 0x43, 0xA1, 0xB2, /* 0x00-0x03 */ 3479 0xA1, 0x40, 0xA1, 0x42, 0xA1, 0x43, 0xA1, 0xB2, /* 0x00-0x03 */
3480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3481 0xA1, 0x71, 0xA1, 0x72, 0xA1, 0x6D, 0xA1, 0x6E, /* 0x08-0x0B */ 3481 0xA1, 0x71, 0xA1, 0x72, 0xA1, 0x6D, 0xA1, 0x6E, /* 0x08-0x0B */
@@ -3491,7 +3491,7 @@ static unsigned char u2c_30[512] = {
3491 0xA1, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x33 */ 3491 0xA1, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x33 */
3492}; 3492};
3493 3493
3494static unsigned char u2c_31[512] = { 3494static const unsigned char u2c_31[512] = {
3495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3496 0x00, 0x00, 0xA3, 0x74, 0xA3, 0x75, 0xA3, 0x76, /* 0x04-0x07 */ 3496 0x00, 0x00, 0xA3, 0x74, 0xA3, 0x75, 0xA3, 0x76, /* 0x04-0x07 */
3497 0xA3, 0x77, 0xA3, 0x78, 0xA3, 0x79, 0xA3, 0x7A, /* 0x08-0x0B */ 3497 0xA3, 0x77, 0xA3, 0x78, 0xA3, 0x79, 0xA3, 0x7A, /* 0x08-0x0B */
@@ -3535,7 +3535,7 @@ static unsigned char u2c_31[512] = {
3535 0xA4, 0x42, 0xA4, 0xD1, 0xA6, 0x61, 0xA4, 0x48, /* 0x9C-0x9F */ 3535 0xA4, 0x42, 0xA4, 0xD1, 0xA6, 0x61, 0xA4, 0x48, /* 0x9C-0x9F */
3536}; 3536};
3537 3537
3538static unsigned char u2c_32[512] = { 3538static const unsigned char u2c_32[512] = {
3539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3584,7 +3584,7 @@ static unsigned char u2c_32[512] = {
3584 0xA9, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */ 3584 0xA9, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */
3585}; 3585};
3586 3586
3587static unsigned char u2c_33[512] = { 3587static const unsigned char u2c_33[512] = {
3588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 3590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3642,7 +3642,7 @@ static unsigned char u2c_33[512] = {
3642 0x00, 0x00, 0xA2, 0x4F, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */ 3642 0x00, 0x00, 0xA2, 0x4F, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
3643}; 3643};
3644 3644
3645static unsigned char u2c_4E[512] = { 3645static const unsigned char u2c_4E[512] = {
3646 0xA4, 0x40, 0xA4, 0x42, 0x00, 0x00, 0xA4, 0x43, /* 0x00-0x03 */ 3646 0xA4, 0x40, 0xA4, 0x42, 0x00, 0x00, 0xA4, 0x43, /* 0x00-0x03 */
3647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9, 0x45, /* 0x04-0x07 */ 3647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9, 0x45, /* 0x04-0x07 */
3648 0xA4, 0x56, 0xA4, 0x54, 0xA4, 0x57, 0xA4, 0x55, /* 0x08-0x0B */ 3648 0xA4, 0x56, 0xA4, 0x54, 0xA4, 0x57, 0xA4, 0x55, /* 0x08-0x0B */
@@ -3710,7 +3710,7 @@ static unsigned char u2c_4E[512] = {
3710 0x00, 0x00, 0xA5, 0xF7, 0x00, 0x00, 0xA5, 0xE9, /* 0xFC-0xFF */ 3710 0x00, 0x00, 0xA5, 0xF7, 0x00, 0x00, 0xA5, 0xE9, /* 0xFC-0xFF */
3711}; 3711};
3712 3712
3713static unsigned char u2c_4F[512] = { 3713static const unsigned char u2c_4F[512] = {
3714 0xC9, 0xB1, 0xA5, 0xF8, 0xC9, 0xB5, 0x00, 0x00, /* 0x00-0x03 */ 3714 0xC9, 0xB1, 0xA5, 0xF8, 0xC9, 0xB5, 0x00, 0x00, /* 0x00-0x03 */
3715 0xC9, 0xB9, 0xC9, 0xB6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 3715 0xC9, 0xB9, 0xC9, 0xB6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
3716 0xC9, 0xB3, 0xA5, 0xEA, 0xA5, 0xEC, 0xA5, 0xF9, /* 0x08-0x0B */ 3716 0xC9, 0xB3, 0xA5, 0xEA, 0xA5, 0xEC, 0xA5, 0xF9, /* 0x08-0x0B */
@@ -3778,7 +3778,7 @@ static unsigned char u2c_4F[512] = {
3778 0x00, 0x00, 0x00, 0x00, 0xAD, 0xDA, 0x00, 0x00, /* 0xFC-0xFF */ 3778 0x00, 0x00, 0x00, 0x00, 0xAD, 0xDA, 0x00, 0x00, /* 0xFC-0xFF */
3779}; 3779};
3780 3780
3781static unsigned char u2c_50[512] = { 3781static const unsigned char u2c_50[512] = {
3782 0xAD, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3782 0xAD, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3783 0x00, 0x00, 0xD0, 0xC9, 0xAD, 0xC7, 0xD0, 0xCA, /* 0x04-0x07 */ 3783 0x00, 0x00, 0xD0, 0xC9, 0xAD, 0xC7, 0xD0, 0xCA, /* 0x04-0x07 */
3784 0x00, 0x00, 0xAD, 0xDC, 0x00, 0x00, 0xAD, 0xD3, /* 0x08-0x0B */ 3784 0x00, 0x00, 0xAD, 0xDC, 0x00, 0x00, 0xAD, 0xD3, /* 0x08-0x0B */
@@ -3846,7 +3846,7 @@ static unsigned char u2c_50[512] = {
3846 0x00, 0x00, 0xE4, 0xF0, 0xE4, 0xED, 0xE4, 0xE6, /* 0xFC-0xFF */ 3846 0x00, 0x00, 0xE4, 0xF0, 0xE4, 0xED, 0xE4, 0xE6, /* 0xFC-0xFF */
3847}; 3847};
3848 3848
3849static unsigned char u2c_51[512] = { 3849static const unsigned char u2c_51[512] = {
3850 0xBB, 0xF6, 0x00, 0x00, 0xBB, 0xFA, 0xE4, 0xE7, /* 0x00-0x03 */ 3850 0xBB, 0xF6, 0x00, 0x00, 0xBB, 0xFA, 0xE4, 0xE7, /* 0x00-0x03 */
3851 0xBB, 0xF5, 0xBB, 0xFD, 0xE4, 0xEA, 0xE4, 0xEB, /* 0x04-0x07 */ 3851 0xBB, 0xF5, 0xBB, 0xFD, 0xE4, 0xEA, 0xE4, 0xEB, /* 0x04-0x07 */
3852 0xBB, 0xFB, 0xBB, 0xFC, 0xE4, 0xF1, 0xE4, 0xEE, /* 0x08-0x0B */ 3852 0xBB, 0xFB, 0xBB, 0xFC, 0xE4, 0xF1, 0xE4, 0xEE, /* 0x08-0x0B */
@@ -3914,7 +3914,7 @@ static unsigned char u2c_51[512] = {
3914 0x00, 0x00, 0xA8, 0xE7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 3914 0x00, 0x00, 0xA8, 0xE7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
3915}; 3915};
3916 3916
3917static unsigned char u2c_52[512] = { 3917static const unsigned char u2c_52[512] = {
3918 0xA4, 0x4D, 0xA4, 0x4E, 0x00, 0x00, 0xA4, 0x62, /* 0x00-0x03 */ 3918 0xA4, 0x4D, 0xA4, 0x4E, 0x00, 0x00, 0xA4, 0x62, /* 0x00-0x03 */
3919 0x00, 0x00, 0x00, 0x00, 0xA4, 0xC0, 0xA4, 0xC1, /* 0x04-0x07 */ 3919 0x00, 0x00, 0x00, 0x00, 0xA4, 0xC0, 0xA4, 0xC1, /* 0x04-0x07 */
3920 0xA4, 0xC2, 0xC9, 0xBE, 0xA5, 0x5A, 0x00, 0x00, /* 0x08-0x0B */ 3920 0xA4, 0xC2, 0xC9, 0xBE, 0xA5, 0x5A, 0x00, 0x00, /* 0x08-0x0B */
@@ -3982,7 +3982,7 @@ static unsigned char u2c_52[512] = {
3982 0xC9, 0x56, 0x00, 0x00, 0xA4, 0xC4, 0xA4, 0xC5, /* 0xFC-0xFF */ 3982 0xC9, 0x56, 0x00, 0x00, 0xA4, 0xC4, 0xA4, 0xC5, /* 0xFC-0xFF */
3983}; 3983};
3984 3984
3985static unsigned char u2c_53[512] = { 3985static const unsigned char u2c_53[512] = {
3986 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 3986 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
3987 0x00, 0x00, 0xA5, 0x5D, 0xA5, 0x5E, 0x00, 0x00, /* 0x04-0x07 */ 3987 0x00, 0x00, 0xA5, 0x5D, 0xA5, 0x5E, 0x00, 0x00, /* 0x04-0x07 */
3988 0xA6, 0x49, 0xCA, 0x71, 0xCB, 0xD6, 0xCB, 0xD7, /* 0x08-0x0B */ 3988 0xA6, 0x49, 0xCA, 0x71, 0xCB, 0xD6, 0xCB, 0xD7, /* 0x08-0x0B */
@@ -4050,7 +4050,7 @@ static unsigned char u2c_53[512] = {
4050 0xA5, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4050 0xA5, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4051}; 4051};
4052 4052
4053static unsigned char u2c_54[512] = { 4053static const unsigned char u2c_54[512] = {
4054 0x00, 0x00, 0xA6, 0x53, 0x00, 0x00, 0xA6, 0x59, /* 0x00-0x03 */ 4054 0x00, 0x00, 0xA6, 0x53, 0x00, 0x00, 0xA6, 0x59, /* 0x00-0x03 */
4055 0xA6, 0x55, 0x00, 0x00, 0xA6, 0x5B, 0xC9, 0xC5, /* 0x04-0x07 */ 4055 0xA6, 0x55, 0x00, 0x00, 0xA6, 0x5B, 0xC9, 0xC5, /* 0x04-0x07 */
4056 0xA6, 0x58, 0xA6, 0x4E, 0xA6, 0x51, 0xA6, 0x54, /* 0x08-0x0B */ 4056 0xA6, 0x58, 0xA6, 0x4E, 0xA6, 0x51, 0xA6, 0x54, /* 0x08-0x0B */
@@ -4118,7 +4118,7 @@ static unsigned char u2c_54[512] = {
4118 0xAD, 0xF3, 0xAE, 0x43, 0x00, 0x00, 0xD0, 0xF8, /* 0xFC-0xFF */ 4118 0xAD, 0xF3, 0xAE, 0x43, 0x00, 0x00, 0xD0, 0xF8, /* 0xFC-0xFF */
4119}; 4119};
4120 4120
4121static unsigned char u2c_55[512] = { 4121static const unsigned char u2c_55[512] = {
4122 0x00, 0x00, 0xAD, 0xF1, 0x00, 0x00, 0xD1, 0x46, /* 0x00-0x03 */ 4122 0x00, 0x00, 0xAD, 0xF1, 0x00, 0x00, 0xD1, 0x46, /* 0x00-0x03 */
4123 0xD0, 0xF9, 0xD0, 0xFD, 0xAD, 0xF6, 0xAE, 0x42, /* 0x04-0x07 */ 4123 0xD0, 0xF9, 0xD0, 0xFD, 0xAD, 0xF6, 0xAE, 0x42, /* 0x04-0x07 */
4124 0xD0, 0xFA, 0xAD, 0xFC, 0xD1, 0x40, 0xD1, 0x47, /* 0x08-0x0B */ 4124 0xD0, 0xFA, 0xAD, 0xFC, 0xD1, 0x40, 0xD1, 0x47, /* 0x08-0x0B */
@@ -4186,7 +4186,7 @@ static unsigned char u2c_55[512] = {
4186 0xE1, 0x4B, 0xB9, 0xC2, 0xB9, 0xBE, 0xE1, 0x54, /* 0xFC-0xFF */ 4186 0xE1, 0x4B, 0xB9, 0xC2, 0xB9, 0xBE, 0xE1, 0x54, /* 0xFC-0xFF */
4187}; 4187};
4188 4188
4189static unsigned char u2c_56[512] = { 4189static const unsigned char u2c_56[512] = {
4190 0xB9, 0xBF, 0xE1, 0x4E, 0xE1, 0x50, 0x00, 0x00, /* 0x00-0x03 */ 4190 0xB9, 0xBF, 0xE1, 0x4E, 0xE1, 0x50, 0x00, 0x00, /* 0x00-0x03 */
4191 0xE1, 0x53, 0x00, 0x00, 0xB9, 0xC4, 0x00, 0x00, /* 0x04-0x07 */ 4191 0xE1, 0x53, 0x00, 0x00, 0xB9, 0xC4, 0x00, 0x00, /* 0x04-0x07 */
4192 0xB9, 0xCB, 0xB9, 0xC5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4192 0xB9, 0xCB, 0xB9, 0xC5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4254,7 +4254,7 @@ static unsigned char u2c_56[512] = {
4254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xAA, /* 0xFC-0xFF */ 4254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xAA, /* 0xFC-0xFF */
4255}; 4255};
4256 4256
4257static unsigned char u2c_57[512] = { 4257static const unsigned char u2c_57[512] = {
4258 0x00, 0x00, 0xD1, 0x48, 0xD1, 0x49, 0xAE, 0x45, /* 0x00-0x03 */ 4258 0x00, 0x00, 0xD1, 0x48, 0xD1, 0x49, 0xAE, 0x45, /* 0x00-0x03 */
4259 0xAE, 0x46, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xAC, /* 0x04-0x07 */ 4259 0xAE, 0x46, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xAC, /* 0x04-0x07 */
4260 0xB0, 0xE9, 0xB0, 0xEB, 0xD4, 0xAB, 0xB0, 0xEA, /* 0x08-0x0B */ 4260 0xB0, 0xE9, 0xB0, 0xEB, 0xD4, 0xAB, 0xB0, 0xEA, /* 0x08-0x0B */
@@ -4322,7 +4322,7 @@ static unsigned char u2c_57[512] = {
4322 0xD4, 0xC3, 0xD4, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4322 0xD4, 0xC3, 0xD4, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4323}; 4323};
4324 4324
4325static unsigned char u2c_58[512] = { 4325static const unsigned char u2c_58[512] = {
4326 0xD4, 0xB3, 0xD4, 0xC6, 0xB0, 0xF3, 0x00, 0x00, /* 0x00-0x03 */ 4326 0xD4, 0xB3, 0xD4, 0xC6, 0xB0, 0xF3, 0x00, 0x00, /* 0x00-0x03 */
4327 0xD4, 0xCC, 0xB0, 0xED, 0xB0, 0xEF, 0xD4, 0xBB, /* 0x04-0x07 */ 4327 0xD4, 0xCC, 0xB0, 0xED, 0xB0, 0xEF, 0xD4, 0xBB, /* 0x04-0x07 */
4328 0xD4, 0xB6, 0xAE, 0x4B, 0xB0, 0xEE, 0xD4, 0xB8, /* 0x08-0x0B */ 4328 0xD4, 0xB6, 0xAE, 0x4B, 0xB0, 0xEE, 0xD4, 0xB8, /* 0x08-0x0B */
@@ -4390,7 +4390,7 @@ static unsigned char u2c_58[512] = {
4390 0xDC, 0xF2, 0xB9, 0xD8, 0xE1, 0x69, 0xE5, 0x53, /* 0xFC-0xFF */ 4390 0xDC, 0xF2, 0xB9, 0xD8, 0xE1, 0x69, 0xE5, 0x53, /* 0xFC-0xFF */
4391}; 4391};
4392 4392
4393static unsigned char u2c_59[512] = { 4393static const unsigned char u2c_59[512] = {
4394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9, 0x5A, /* 0x00-0x03 */ 4394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9, 0x5A, /* 0x00-0x03 */
4395 0x00, 0x00, 0x00, 0x00, 0xCA, 0xB0, 0x00, 0x00, /* 0x04-0x07 */ 4395 0x00, 0x00, 0x00, 0x00, 0xCA, 0xB0, 0x00, 0x00, /* 0x04-0x07 */
4396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 4396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4458,7 +4458,7 @@ static unsigned char u2c_59[512] = {
4458 0xCE, 0x6A, 0xCE, 0x69, 0xCE, 0x74, 0xAB, 0xBA, /* 0xFC-0xFF */ 4458 0xCE, 0x6A, 0xCE, 0x69, 0xCE, 0x74, 0xAB, 0xBA, /* 0xFC-0xFF */
4459}; 4459};
4460 4460
4461static unsigned char u2c_5A[512] = { 4461static const unsigned char u2c_5A[512] = {
4462 0xCE, 0x65, 0xAB, 0xC2, 0x00, 0x00, 0xAB, 0xBD, /* 0x00-0x03 */ 4462 0xCE, 0x65, 0xAB, 0xC2, 0x00, 0x00, 0xAB, 0xBD, /* 0x00-0x03 */
4463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4464 0x00, 0x00, 0xAE, 0x5C, 0xD1, 0x62, 0x00, 0x00, /* 0x08-0x0B */ 4464 0x00, 0x00, 0xAE, 0x5C, 0xD1, 0x62, 0x00, 0x00, /* 0x08-0x0B */
@@ -4526,7 +4526,7 @@ static unsigned char u2c_5A[512] = {
4526 0x00, 0x00, 0xE5, 0x56, 0x00, 0x00, 0xE5, 0x54, /* 0xFC-0xFF */ 4526 0x00, 0x00, 0xE5, 0x56, 0x00, 0x00, 0xE5, 0x54, /* 0xFC-0xFF */
4527}; 4527};
4528 4528
4529static unsigned char u2c_5B[512] = { 4529static const unsigned char u2c_5B[512] = {
4530 0x00, 0x00, 0xE5, 0x5D, 0xE5, 0x5B, 0xE5, 0x59, /* 0x00-0x03 */ 4530 0x00, 0x00, 0xE5, 0x5D, 0xE5, 0x5B, 0xE5, 0x59, /* 0x00-0x03 */
4531 0x00, 0x00, 0xE5, 0x5F, 0x00, 0x00, 0xE5, 0x5E, /* 0x04-0x07 */ 4531 0x00, 0x00, 0xE5, 0x5F, 0x00, 0x00, 0xE5, 0x5E, /* 0x04-0x07 */
4532 0xBC, 0x63, 0xBC, 0x5E, 0x00, 0x00, 0xBC, 0x60, /* 0x08-0x0B */ 4532 0xBC, 0x63, 0xBC, 0x5E, 0x00, 0x00, 0xBC, 0x60, /* 0x08-0x0B */
@@ -4594,7 +4594,7 @@ static unsigned char u2c_5B[512] = {
4594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 4594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
4595}; 4595};
4596 4596
4597static unsigned char u2c_5C[512] = { 4597static const unsigned char u2c_5C[512] = {
4598 0x00, 0x00, 0xAB, 0xCA, 0x00, 0x00, 0xD1, 0x69, /* 0x00-0x03 */ 4598 0x00, 0x00, 0xAB, 0xCA, 0x00, 0x00, 0xD1, 0x69, /* 0x00-0x03 */
4599 0xAE, 0x67, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x4E, /* 0x04-0x07 */ 4599 0xAE, 0x67, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x4E, /* 0x04-0x07 */
4600 0xB1, 0x4D, 0xB1, 0x4C, 0xB4, 0x4C, 0xB4, 0x4D, /* 0x08-0x0B */ 4600 0xB1, 0x4D, 0xB1, 0x4C, 0xB4, 0x4C, 0xB4, 0x4D, /* 0x08-0x0B */
@@ -4662,7 +4662,7 @@ static unsigned char u2c_5C[512] = {
4662 0x00, 0x00, 0xAE, 0x6C, 0x00, 0x00, 0xD1, 0x6D, /* 0xFC-0xFF */ 4662 0x00, 0x00, 0xAE, 0x6C, 0x00, 0x00, 0xD1, 0x6D, /* 0xFC-0xFF */
4663}; 4663};
4664 4664
4665static unsigned char u2c_5D[512] = { 4665static const unsigned char u2c_5D[512] = {
4666 0xD1, 0x71, 0xAE, 0x72, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4666 0xD1, 0x71, 0xAE, 0x72, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4667 0x00, 0x00, 0x00, 0x00, 0xB1, 0x53, 0xB1, 0x52, /* 0x04-0x07 */ 4667 0x00, 0x00, 0x00, 0x00, 0xB1, 0x53, 0xB1, 0x52, /* 0x04-0x07 */
4668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xF5, /* 0x08-0x0B */ 4668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xF5, /* 0x08-0x0B */
@@ -4730,7 +4730,7 @@ static unsigned char u2c_5D[512] = {
4730 0x00, 0x00, 0xB4, 0x53, 0xA4, 0x79, 0xC9, 0x5D, /* 0xFC-0xFF */ 4730 0x00, 0x00, 0xB4, 0x53, 0xA4, 0x79, 0xC9, 0x5D, /* 0xFC-0xFF */
4731}; 4731};
4732 4732
4733static unsigned char u2c_5E[512] = { 4733static const unsigned char u2c_5E[512] = {
4734 0x00, 0x00, 0x00, 0x00, 0xA5, 0xAB, 0xA5, 0xAC, /* 0x00-0x03 */ 4734 0x00, 0x00, 0x00, 0x00, 0xA5, 0xAB, 0xA5, 0xAC, /* 0x00-0x03 */
4735 0xC9, 0x78, 0x00, 0x00, 0xA6, 0x7C, 0x00, 0x00, /* 0x04-0x07 */ 4735 0xC9, 0x78, 0x00, 0x00, 0xA6, 0x7C, 0x00, 0x00, /* 0x04-0x07 */
4736 0x00, 0x00, 0x00, 0x00, 0xCA, 0xCB, 0x00, 0x00, /* 0x08-0x0B */ 4736 0x00, 0x00, 0x00, 0x00, 0xCA, 0xCB, 0x00, 0x00, /* 0x08-0x0B */
@@ -4798,7 +4798,7 @@ static unsigned char u2c_5E[512] = {
4798 0x00, 0x00, 0x00, 0x00, 0xA4, 0x7B, 0xA4, 0xDC, /* 0xFC-0xFF */ 4798 0x00, 0x00, 0x00, 0x00, 0xA4, 0x7B, 0xA4, 0xDC, /* 0xFC-0xFF */
4799}; 4799};
4800 4800
4801static unsigned char u2c_5F[512] = { 4801static const unsigned char u2c_5F[512] = {
4802 0x00, 0x00, 0xA5, 0xAF, 0xC9, 0xDD, 0x00, 0x00, /* 0x00-0x03 */ 4802 0x00, 0x00, 0xA5, 0xAF, 0xC9, 0xDD, 0x00, 0x00, /* 0x00-0x03 */
4803 0xA7, 0xCB, 0xCA, 0xD2, 0x00, 0x00, 0xCE, 0xBB, /* 0x04-0x07 */ 4803 0xA7, 0xCB, 0xCA, 0xD2, 0x00, 0x00, 0xCE, 0xBB, /* 0x04-0x07 */
4804 0xAB, 0xD9, 0x00, 0x00, 0xB9, 0xFA, 0xA4, 0x7C, /* 0x08-0x0B */ 4804 0xAB, 0xD9, 0x00, 0x00, 0xB9, 0xFA, 0xA4, 0x7C, /* 0x08-0x0B */
@@ -4866,7 +4866,7 @@ static unsigned char u2c_5F[512] = {
4866 0x00, 0x00, 0xA9, 0xBF, 0x00, 0x00, 0xA9, 0xC1, /* 0xFC-0xFF */ 4866 0x00, 0x00, 0xA9, 0xBF, 0x00, 0x00, 0xA9, 0xC1, /* 0xFC-0xFF */
4867}; 4867};
4868 4868
4869static unsigned char u2c_60[512] = { 4869static const unsigned char u2c_60[512] = {
4870 0xCA, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 4870 0xCA, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
4871 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 4871 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
4872 0x00, 0x00, 0xCC, 0xAF, 0xCC, 0xA2, 0xCC, 0x7E, /* 0x08-0x0B */ 4872 0x00, 0x00, 0xCC, 0xAF, 0xCC, 0xA2, 0xCC, 0x7E, /* 0x08-0x0B */
@@ -4934,7 +4934,7 @@ static unsigned char u2c_60[512] = {
4934 0xD9, 0x47, 0x00, 0x00, 0xD9, 0x48, 0xD9, 0x4E, /* 0xFC-0xFF */ 4934 0xD9, 0x47, 0x00, 0x00, 0xD9, 0x48, 0xD9, 0x4E, /* 0xFC-0xFF */
4935}; 4935};
4936 4936
4937static unsigned char u2c_61[512] = { 4937static const unsigned char u2c_61[512] = {
4938 0xB4, 0x73, 0xB7, 0x54, 0x00, 0x00, 0xD9, 0x4A, /* 0x00-0x03 */ 4938 0xB4, 0x73, 0xB7, 0x54, 0x00, 0x00, 0xD9, 0x4A, /* 0x00-0x03 */
4939 0xD9, 0x4F, 0xD9, 0x43, 0xB7, 0x5E, 0x00, 0x00, /* 0x04-0x07 */ 4939 0xD9, 0x4F, 0xD9, 0x43, 0xB7, 0x5E, 0x00, 0x00, /* 0x04-0x07 */
4940 0xB7, 0x55, 0xB4, 0x72, 0xD9, 0x41, 0xD9, 0x50, /* 0x08-0x0B */ 4940 0xB7, 0x55, 0xB4, 0x72, 0xD9, 0x41, 0xD9, 0x50, /* 0x08-0x0B */
@@ -5002,7 +5002,7 @@ static unsigned char u2c_61[512] = {
5002 0xC4, 0xDF, 0xF5, 0xCC, 0xC4, 0xE0, 0xC5, 0x74, /* 0xFC-0xFF */ 5002 0xC4, 0xDF, 0xF5, 0xCC, 0xC4, 0xE0, 0xC5, 0x74, /* 0xFC-0xFF */
5003}; 5003};
5004 5004
5005static unsigned char u2c_62[512] = { 5005static const unsigned char u2c_62[512] = {
5006 0xC5, 0xCA, 0xF7, 0xD9, 0x00, 0x00, 0xF7, 0xDA, /* 0x00-0x03 */ 5006 0xC5, 0xCA, 0xF7, 0xD9, 0x00, 0x00, 0xF7, 0xDA, /* 0x00-0x03 */
5007 0xF7, 0xDB, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xBA, /* 0x04-0x07 */ 5007 0xF7, 0xDB, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xBA, /* 0x04-0x07 */
5008 0xA4, 0xE0, 0xC9, 0x7C, 0xA5, 0xB3, 0x00, 0x00, /* 0x08-0x0B */ 5008 0xA4, 0xE0, 0xC9, 0x7C, 0xA5, 0xB3, 0x00, 0x00, /* 0x08-0x0B */
@@ -5070,7 +5070,7 @@ static unsigned char u2c_62[512] = {
5070 0xAB, 0xF7, 0xAB, 0xFB, 0xAC, 0x42, 0xAE, 0xB3, /* 0xFC-0xFF */ 5070 0xAB, 0xF7, 0xAB, 0xFB, 0xAC, 0x42, 0xAE, 0xB3, /* 0xFC-0xFF */
5071}; 5071};
5072 5072
5073static unsigned char u2c_63[512] = { 5073static const unsigned char u2c_63[512] = {
5074 0xCE, 0xE0, 0xAB, 0xF9, 0xAC, 0x45, 0xCE, 0xD9, /* 0x00-0x03 */ 5074 0xCE, 0xE0, 0xAB, 0xF9, 0xAC, 0x45, 0xCE, 0xD9, /* 0x00-0x03 */
5075 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xFC, /* 0x04-0x07 */ 5075 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xFC, /* 0x04-0x07 */
5076 0xAE, 0xB2, 0xAB, 0xF6, 0x00, 0x00, 0xCE, 0xD6, /* 0x08-0x0B */ 5076 0xAE, 0xB2, 0xAB, 0xF6, 0x00, 0x00, 0xCE, 0xD6, /* 0x08-0x0B */
@@ -5138,7 +5138,7 @@ static unsigned char u2c_63[512] = {
5138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5139}; 5139};
5140 5140
5141static unsigned char u2c_64[512] = { 5141static const unsigned char u2c_64[512] = {
5142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5143 0x00, 0x00, 0x00, 0x00, 0xB7, 0x70, 0x00, 0x00, /* 0x04-0x07 */ 5143 0x00, 0x00, 0x00, 0x00, 0xB7, 0x70, 0x00, 0x00, /* 0x04-0x07 */
5144 0x00, 0x00, 0xDD, 0x7C, 0xDD, 0xB1, 0xDD, 0xB6, /* 0x08-0x0B */ 5144 0x00, 0x00, 0xDD, 0x7C, 0xDD, 0xB1, 0xDD, 0xB6, /* 0x08-0x0B */
@@ -5206,7 +5206,7 @@ static unsigned char u2c_64[512] = {
5206 0xEF, 0xD7, 0xEF, 0xD3, 0xC2, 0x5A, 0xEF, 0xD1, /* 0xFC-0xFF */ 5206 0xEF, 0xD7, 0xEF, 0xD3, 0xC2, 0x5A, 0xEF, 0xD1, /* 0xFC-0xFF */
5207}; 5207};
5208 5208
5209static unsigned char u2c_65[512] = { 5209static const unsigned char u2c_65[512] = {
5210 0xC3, 0x6B, 0xEF, 0xD5, 0x00, 0x00, 0xEF, 0xD6, /* 0x00-0x03 */ 5210 0xC3, 0x6B, 0xEF, 0xD5, 0x00, 0x00, 0xEF, 0xD6, /* 0x00-0x03 */
5211 0xEF, 0xD2, 0x00, 0x00, 0xC2, 0x5B, 0xF2, 0x42, /* 0x04-0x07 */ 5211 0xEF, 0xD2, 0x00, 0x00, 0xC2, 0x5B, 0xF2, 0x42, /* 0x04-0x07 */
5212 0x00, 0x00, 0xF2, 0x45, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5212 0x00, 0x00, 0xF2, 0x45, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5274,7 +5274,7 @@ static unsigned char u2c_65[512] = {
5274 0xCC, 0xC5, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5274 0xCC, 0xC5, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5275}; 5275};
5276 5276
5277static unsigned char u2c_66[512] = { 5277static const unsigned char u2c_66[512] = {
5278 0xA9, 0xFB, 0x00, 0x00, 0xA9, 0xF9, 0xCC, 0xCA, /* 0x00-0x03 */ 5278 0xA9, 0xFB, 0x00, 0x00, 0xA9, 0xF9, 0xCC, 0xCA, /* 0x00-0x03 */
5279 0xCC, 0xC6, 0xCC, 0xCD, 0xA9, 0xF8, 0xAA, 0x40, /* 0x04-0x07 */ 5279 0xCC, 0xC6, 0xCC, 0xCD, 0xA9, 0xF8, 0xAA, 0x40, /* 0x04-0x07 */
5280 0xCC, 0xC8, 0xCC, 0xC4, 0xA9, 0xFE, 0xCC, 0xCB, /* 0x08-0x0B */ 5280 0xCC, 0xC8, 0xCC, 0xC4, 0xA9, 0xFE, 0xCC, 0xCB, /* 0x08-0x0B */
@@ -5342,7 +5342,7 @@ static unsigned char u2c_66[512] = {
5342 0xB0, 0xD2, 0x00, 0x00, 0xB4, 0xBF, 0xB4, 0xC0, /* 0xFC-0xFF */ 5342 0xB0, 0xD2, 0x00, 0x00, 0xB4, 0xBF, 0xB4, 0xC0, /* 0xFC-0xFF */
5343}; 5343};
5344 5344
5345static unsigned char u2c_67[512] = { 5345static const unsigned char u2c_67[512] = {
5346 0xB3, 0xCC, 0xD9, 0xA9, 0x00, 0x00, 0xB7, 0x7C, /* 0x00-0x03 */ 5346 0xB3, 0xCC, 0xD9, 0xA9, 0x00, 0x00, 0xB7, 0x7C, /* 0x00-0x03 */
5347 0xE1, 0xFA, 0xE1, 0xF9, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5347 0xE1, 0xFA, 0xE1, 0xF9, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5348 0xA4, 0xEB, 0xA6, 0xB3, 0xCC, 0xD2, 0xAA, 0x42, /* 0x08-0x0B */ 5348 0xA4, 0xEB, 0xA6, 0xB3, 0xCC, 0xD2, 0xAA, 0x42, /* 0x08-0x0B */
@@ -5410,7 +5410,7 @@ static unsigned char u2c_67[512] = {
5410 0xCF, 0x57, 0x00, 0x00, 0x00, 0x00, 0xAC, 0x55, /* 0xFC-0xFF */ 5410 0xCF, 0x57, 0x00, 0x00, 0x00, 0x00, 0xAC, 0x55, /* 0xFC-0xFF */
5411}; 5411};
5412 5412
5413static unsigned char u2c_68[512] = { 5413static const unsigned char u2c_68[512] = {
5414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5478,7 +5478,7 @@ static unsigned char u2c_68[512] = {
5478 0xD9, 0xC8, 0xD9, 0xC7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5478 0xD9, 0xC8, 0xD9, 0xC7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5479}; 5479};
5480 5480
5481static unsigned char u2c_69[512] = { 5481static const unsigned char u2c_69[512] = {
5482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5483 0xD9, 0xAC, 0xB4, 0xC8, 0xD9, 0xD4, 0xD9, 0xBC, /* 0x04-0x07 */ 5483 0xD9, 0xAC, 0xB4, 0xC8, 0xD9, 0xD4, 0xD9, 0xBC, /* 0x04-0x07 */
5484 0xD9, 0xBE, 0x00, 0x00, 0xD9, 0xCB, 0xD9, 0xCA, /* 0x08-0x0B */ 5484 0xD9, 0xBE, 0x00, 0x00, 0xD9, 0xCB, 0xD9, 0xCA, /* 0x08-0x0B */
@@ -5546,7 +5546,7 @@ static unsigned char u2c_69[512] = {
5546 0xE5, 0xE4, 0xBC, 0xD1, 0xE5, 0xD8, 0xE5, 0xD3, /* 0xFC-0xFF */ 5546 0xE5, 0xE4, 0xBC, 0xD1, 0xE5, 0xD8, 0xE5, 0xD3, /* 0xFC-0xFF */
5547}; 5547};
5548 5548
5549static unsigned char u2c_6A[512] = { 5549static const unsigned char u2c_6A[512] = {
5550 0xE5, 0xCA, 0xBC, 0xCE, 0xBC, 0xD6, 0x00, 0x00, /* 0x00-0x03 */ 5550 0xE5, 0xCA, 0xBC, 0xCE, 0xBC, 0xD6, 0x00, 0x00, /* 0x00-0x03 */
5551 0xE5, 0xE7, 0xBC, 0xD7, 0xE5, 0xCB, 0xE5, 0xED, /* 0x04-0x07 */ 5551 0xE5, 0xE7, 0xBC, 0xD7, 0xE5, 0xCB, 0xE5, 0xED, /* 0x04-0x07 */
5552 0xE5, 0xE0, 0xE5, 0xE6, 0xBC, 0xD4, 0x00, 0x00, /* 0x08-0x0B */ 5552 0xE5, 0xE0, 0xE5, 0xE6, 0xBC, 0xD4, 0x00, 0x00, /* 0x08-0x0B */
@@ -5614,7 +5614,7 @@ static unsigned char u2c_6A[512] = {
5614 0xF5, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5614 0xF5, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5615}; 5615};
5616 5616
5617static unsigned char u2c_6B[512] = { 5617static const unsigned char u2c_6B[512] = {
5618 0xF5, 0xD2, 0x00, 0x00, 0xF5, 0xCE, 0xF5, 0xD0, /* 0x00-0x03 */ 5618 0xF5, 0xD2, 0x00, 0x00, 0xF5, 0xCE, 0xF5, 0xD0, /* 0x00-0x03 */
5619 0xC4, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5619 0xC4, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5620 0xF6, 0xE5, 0xF6, 0xE6, 0xC5, 0x76, 0xF6, 0xE4, /* 0x08-0x0B */ 5620 0xF6, 0xE5, 0xF6, 0xE6, 0xC5, 0x76, 0xF6, 0xE4, /* 0x08-0x0B */
@@ -5682,7 +5682,7 @@ static unsigned char u2c_6B[512] = {
5682 0xDD, 0xFE, 0xB7, 0xB7, 0xE2, 0x6B, 0xE5, 0xF7, /* 0xFC-0xFF */ 5682 0xDD, 0xFE, 0xB7, 0xB7, 0xE2, 0x6B, 0xE5, 0xF7, /* 0xFC-0xFF */
5683}; 5683};
5684 5684
5685static unsigned char u2c_6C[512] = { 5685static const unsigned char u2c_6C[512] = {
5686 0xE5, 0xF6, 0xE5, 0xF5, 0xE5, 0xF8, 0xE9, 0xE7, /* 0x00-0x03 */ 5686 0xE5, 0xF6, 0xE5, 0xF5, 0xE5, 0xF8, 0xE9, 0xE7, /* 0x00-0x03 */
5687 0xE9, 0xE6, 0xBE, 0xFB, 0xE9, 0xE8, 0x00, 0x00, /* 0x04-0x07 */ 5687 0xE9, 0xE6, 0xBE, 0xFB, 0xE9, 0xE8, 0x00, 0x00, /* 0x04-0x07 */
5688 0xC0, 0xD6, 0xED, 0x4D, 0x00, 0x00, 0xEF, 0xEA, /* 0x08-0x0B */ 5688 0xC0, 0xD6, 0xED, 0x4D, 0x00, 0x00, 0xEF, 0xEA, /* 0x08-0x0B */
@@ -5749,7 +5749,7 @@ static unsigned char u2c_6C[512] = {
5749 0x00, 0x00, 0xCD, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */ 5749 0x00, 0x00, 0xCD, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
5750}; 5750};
5751 5751
5752static unsigned char u2c_6D[512] = { 5752static const unsigned char u2c_6D[512] = {
5753 0xCF, 0x7C, 0xCF, 0xA1, 0x00, 0x00, 0xCF, 0xA4, /* 0x00-0x03 */ 5753 0xCF, 0x7C, 0xCF, 0xA1, 0x00, 0x00, 0xCF, 0xA4, /* 0x00-0x03 */
5754 0xCF, 0x77, 0x00, 0x00, 0x00, 0x00, 0xCF, 0xA7, /* 0x04-0x07 */ 5754 0xCF, 0x77, 0x00, 0x00, 0x00, 0x00, 0xCF, 0xA7, /* 0x04-0x07 */
5755 0xCF, 0xAA, 0xCF, 0xAC, 0xCF, 0x74, 0xAC, 0x76, /* 0x08-0x0B */ 5755 0xCF, 0xAA, 0xCF, 0xAC, 0xCF, 0x74, 0xAC, 0x76, /* 0x08-0x0B */
@@ -5817,7 +5817,7 @@ static unsigned char u2c_6D[512] = {
5817 0xD9, 0xE7, 0xD6, 0x43, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 5817 0xD9, 0xE7, 0xD6, 0x43, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
5818}; 5818};
5819 5819
5820static unsigned char u2c_6E[512] = { 5820static const unsigned char u2c_6E[512] = {
5821 0xD5, 0xEB, 0x00, 0x00, 0x00, 0x00, 0xD9, 0xFC, /* 0x00-0x03 */ 5821 0xD5, 0xEB, 0x00, 0x00, 0x00, 0x00, 0xD9, 0xFC, /* 0x00-0x03 */
5822 0x00, 0x00, 0xB2, 0x4D, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 5822 0x00, 0x00, 0xB2, 0x4D, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
5823 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 5823 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5885,7 +5885,7 @@ static unsigned char u2c_6E[512] = {
5885 0xE2, 0xB3, 0xE2, 0xAF, 0xBA, 0x75, 0xBA, 0xA1, /* 0xFC-0xFF */ 5885 0xE2, 0xB3, 0xE2, 0xAF, 0xBA, 0x75, 0xBA, 0xA1, /* 0xFC-0xFF */
5886}; 5886};
5887 5887
5888static unsigned char u2c_6F[512] = { 5888static const unsigned char u2c_6F[512] = {
5889 0xE6, 0x53, 0xBA, 0xAE, 0xBA, 0x7D, 0xE2, 0x6F, /* 0x00-0x03 */ 5889 0xE6, 0x53, 0xBA, 0xAE, 0xBA, 0x7D, 0xE2, 0x6F, /* 0x00-0x03 */
5890 0x00, 0x00, 0xE2, 0xAE, 0xBA, 0xA3, 0xE2, 0xAB, /* 0x04-0x07 */ 5890 0x00, 0x00, 0xE2, 0xAE, 0xBA, 0xA3, 0xE2, 0xAB, /* 0x04-0x07 */
5891 0xE2, 0xB8, 0xE2, 0x75, 0xE2, 0x7E, 0x00, 0x00, /* 0x08-0x0B */ 5891 0xE2, 0xB8, 0xE2, 0x75, 0xE2, 0x7E, 0x00, 0x00, /* 0x08-0x0B */
@@ -5953,7 +5953,7 @@ static unsigned char u2c_6F[512] = {
5953 0xEF, 0xF6, 0x00, 0x00, 0xC2, 0x6F, 0xEF, 0xF2, /* 0xFC-0xFF */ 5953 0xEF, 0xF6, 0x00, 0x00, 0xC2, 0x6F, 0xEF, 0xF2, /* 0xFC-0xFF */
5954}; 5954};
5955 5955
5956static unsigned char u2c_70[512] = { 5956static const unsigned char u2c_70[512] = {
5957 0xEF, 0xF3, 0xEF, 0xEE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 5957 0xEF, 0xF3, 0xEF, 0xEE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
5958 0xE9, 0xF6, 0xEF, 0xEF, 0xC2, 0x70, 0xEF, 0xEB, /* 0x04-0x07 */ 5958 0xE9, 0xF6, 0xEF, 0xEF, 0xC2, 0x70, 0xEF, 0xEB, /* 0x04-0x07 */
5959 0x00, 0x00, 0xC2, 0x6D, 0xEF, 0xF8, 0xC2, 0x6E, /* 0x08-0x0B */ 5959 0x00, 0x00, 0xC2, 0x6D, 0xEF, 0xF8, 0xC2, 0x6E, /* 0x08-0x0B */
@@ -6021,7 +6021,7 @@ static unsigned char u2c_70[512] = {
6021 0xD6, 0x52, 0xB2, 0x6C, 0x00, 0x00, 0xD6, 0x53, /* 0xFC-0xFF */ 6021 0xD6, 0x52, 0xB2, 0x6C, 0x00, 0x00, 0xD6, 0x53, /* 0xFC-0xFF */
6022}; 6022};
6023 6023
6024static unsigned char u2c_71[512] = { 6024static const unsigned char u2c_71[512] = {
6025 0xD6, 0x56, 0x00, 0x00, 0xD6, 0x5A, 0x00, 0x00, /* 0x00-0x03 */ 6025 0xD6, 0x56, 0x00, 0x00, 0xD6, 0x5A, 0x00, 0x00, /* 0x00-0x03 */
6026 0xD6, 0x4F, 0x00, 0x00, 0xD6, 0x54, 0x00, 0x00, /* 0x04-0x07 */ 6026 0xD6, 0x4F, 0x00, 0x00, 0xD6, 0x54, 0x00, 0x00, /* 0x04-0x07 */
6027 0x00, 0x00, 0xB2, 0x6A, 0xB2, 0x6B, 0xD6, 0x59, /* 0x08-0x0B */ 6027 0x00, 0x00, 0xB2, 0x6A, 0xB2, 0x6B, 0xD6, 0x59, /* 0x08-0x0B */
@@ -6089,7 +6089,7 @@ static unsigned char u2c_71[512] = {
6089 0xC2, 0x75, 0xEF, 0xFD, 0xC2, 0x76, 0xEF, 0xFA, /* 0xFC-0xFF */ 6089 0xC2, 0x75, 0xEF, 0xFD, 0xC2, 0x76, 0xEF, 0xFA, /* 0xFC-0xFF */
6090}; 6090};
6091 6091
6092static unsigned char u2c_72[512] = { 6092static const unsigned char u2c_72[512] = {
6093 0x00, 0x00, 0xEF, 0xF9, 0xF2, 0x6C, 0xEF, 0xFC, /* 0x00-0x03 */ 6093 0x00, 0x00, 0xEF, 0xF9, 0xF2, 0x6C, 0xEF, 0xFC, /* 0x00-0x03 */
6094 0x00, 0x00, 0xF2, 0x6D, 0xC3, 0x7A, 0xF2, 0x6B, /* 0x04-0x07 */ 6094 0x00, 0x00, 0xF2, 0x6D, 0xC3, 0x7A, 0xF2, 0x6B, /* 0x04-0x07 */
6095 0x00, 0x00, 0x00, 0x00, 0xF2, 0x6A, 0x00, 0x00, /* 0x08-0x0B */ 6095 0x00, 0x00, 0x00, 0x00, 0xF2, 0x6A, 0x00, 0x00, /* 0x08-0x0B */
@@ -6157,7 +6157,7 @@ static unsigned char u2c_72[512] = {
6157 0xAF, 0x54, 0xAF, 0x56, 0xD2, 0xA6, 0xD6, 0x67, /* 0xFC-0xFF */ 6157 0xAF, 0x54, 0xAF, 0x56, 0xD2, 0xA6, 0xD6, 0x67, /* 0xFC-0xFF */
6158}; 6158};
6159 6159
6160static unsigned char u2c_73[512] = { 6160static const unsigned char u2c_73[512] = {
6161 0xD2, 0xA3, 0xD2, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6161 0xD2, 0xA3, 0xD2, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0x62, /* 0x04-0x07 */ 6162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0x62, /* 0x04-0x07 */
6163 0xD6, 0x66, 0x00, 0x00, 0xD6, 0x65, 0xDA, 0x6E, /* 0x08-0x0B */ 6163 0xD6, 0x66, 0x00, 0x00, 0xD6, 0x65, 0xDA, 0x6E, /* 0x08-0x0B */
@@ -6225,7 +6225,7 @@ static unsigned char u2c_73[512] = {
6225 0xD6, 0x74, 0xD6, 0x70, 0xB2, 0x7B, 0xD6, 0x75, /* 0xFC-0xFF */ 6225 0xD6, 0x74, 0xD6, 0x70, 0xB2, 0x7B, 0xD6, 0x75, /* 0xFC-0xFF */
6226}; 6226};
6227 6227
6228static unsigned char u2c_74[512] = { 6228static const unsigned char u2c_74[512] = {
6229 0xD6, 0x72, 0xD6, 0x6F, 0x00, 0x00, 0xB2, 0x79, /* 0x00-0x03 */ 6229 0xD6, 0x72, 0xD6, 0x6F, 0x00, 0x00, 0xB2, 0x79, /* 0x00-0x03 */
6230 0xD6, 0x6E, 0xB2, 0x77, 0xB2, 0x7A, 0xD6, 0x71, /* 0x04-0x07 */ 6230 0xD6, 0x6E, 0xB2, 0x77, 0xB2, 0x7A, 0xD6, 0x71, /* 0x04-0x07 */
6231 0xD6, 0x79, 0xAF, 0x5B, 0xB2, 0x78, 0xD6, 0x77, /* 0x08-0x0B */ 6231 0xD6, 0x79, 0xAF, 0x5B, 0xB2, 0x78, 0xD6, 0x77, /* 0x08-0x0B */
@@ -6293,7 +6293,7 @@ static unsigned char u2c_74[512] = {
6293 0x00, 0x00, 0xDE, 0xC2, 0xDE, 0xC1, 0xDE, 0xC0, /* 0xFC-0xFF */ 6293 0x00, 0x00, 0xDE, 0xC2, 0xDE, 0xC1, 0xDE, 0xC0, /* 0xFC-0xFF */
6294}; 6294};
6295 6295
6296static unsigned char u2c_75[512] = { 6296static const unsigned char u2c_75[512] = {
6297 0xE2, 0xD5, 0x00, 0x00, 0xE2, 0xD6, 0xE2, 0xD7, /* 0x00-0x03 */ 6297 0xE2, 0xD5, 0x00, 0x00, 0xE2, 0xD6, 0xE2, 0xD7, /* 0x00-0x03 */
6298 0xBA, 0xC2, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xAD, /* 0x04-0x07 */ 6298 0xBA, 0xC2, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xAD, /* 0x04-0x07 */
6299 0xE6, 0xAC, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x69, /* 0x08-0x0B */ 6299 0xE6, 0xAC, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x69, /* 0x08-0x0B */
@@ -6361,7 +6361,7 @@ static unsigned char u2c_75[512] = {
6361 0xDE, 0xCC, 0xDE, 0xD4, 0xDE, 0xCB, 0xB7, 0xF5, /* 0xFC-0xFF */ 6361 0xDE, 0xCC, 0xDE, 0xD4, 0xDE, 0xCB, 0xB7, 0xF5, /* 0xFC-0xFF */
6362}; 6362};
6363 6363
6364static unsigned char u2c_76[512] = { 6364static const unsigned char u2c_76[512] = {
6365 0xB7, 0xEF, 0xB7, 0xF1, 0x00, 0x00, 0xDE, 0xC9, /* 0x00-0x03 */ 6365 0xB7, 0xEF, 0xB7, 0xF1, 0x00, 0x00, 0xDE, 0xC9, /* 0x00-0x03 */
6366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6367 0xE2, 0xDB, 0xBA, 0xC7, 0xE2, 0xDF, 0xBA, 0xC6, /* 0x08-0x0B */ 6367 0xE2, 0xDB, 0xBA, 0xC7, 0xE2, 0xDF, 0xBA, 0xC6, /* 0x08-0x0B */
@@ -6429,7 +6429,7 @@ static unsigned char u2c_76[512] = {
6429 0xAC, 0xDF, 0x00, 0x00, 0xAC, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */ 6429 0xAC, 0xDF, 0x00, 0x00, 0xAC, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
6430}; 6430};
6431 6431
6432static unsigned char u2c_77[512] = { 6432static const unsigned char u2c_77[512] = {
6433 0x00, 0x00, 0xAC, 0xD9, 0x00, 0x00, 0xCF, 0xE1, /* 0x00-0x03 */ 6433 0x00, 0x00, 0xAC, 0xD9, 0x00, 0x00, 0xCF, 0xE1, /* 0x00-0x03 */
6434 0xCF, 0xE2, 0xCF, 0xE3, 0x00, 0x00, 0xAC, 0xE0, /* 0x04-0x07 */ 6434 0xCF, 0xE2, 0xCF, 0xE3, 0x00, 0x00, 0xAC, 0xE0, /* 0x04-0x07 */
6435 0xCF, 0xE0, 0xAC, 0xDC, 0xCF, 0xE4, 0xAC, 0xDD, /* 0x08-0x0B */ 6435 0xCF, 0xE0, 0xAC, 0xDC, 0xCF, 0xE4, 0xAC, 0xDD, /* 0x08-0x0B */
@@ -6497,7 +6497,7 @@ static unsigned char u2c_77[512] = {
6497 0xCD, 0x7B, 0xAA, 0xBF, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 6497 0xCD, 0x7B, 0xAA, 0xBF, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
6498}; 6498};
6499 6499
6500static unsigned char u2c_78[512] = { 6500static const unsigned char u2c_78[512] = {
6501 0x00, 0x00, 0x00, 0x00, 0xAC, 0xE2, 0xCF, 0xF2, /* 0x00-0x03 */ 6501 0x00, 0x00, 0x00, 0x00, 0xAC, 0xE2, 0xCF, 0xF2, /* 0x00-0x03 */
6502 0x00, 0x00, 0xCF, 0xED, 0xCF, 0xEA, 0x00, 0x00, /* 0x04-0x07 */ 6502 0x00, 0x00, 0xCF, 0xED, 0xCF, 0xEA, 0x00, 0x00, /* 0x04-0x07 */
6503 0x00, 0x00, 0xCF, 0xF1, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6503 0x00, 0x00, 0xCF, 0xF1, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6565,7 +6565,7 @@ static unsigned char u2c_78[512] = {
6565 0xED, 0xA9, 0xED, 0xA6, 0xED, 0xAD, 0xF0, 0x56, /* 0xFC-0xFF */ 6565 0xED, 0xA9, 0xED, 0xA6, 0xED, 0xAD, 0xF0, 0x56, /* 0xFC-0xFF */
6566}; 6566};
6567 6567
6568static unsigned char u2c_79[512] = { 6568static const unsigned char u2c_79[512] = {
6569 0x00, 0x00, 0xC1, 0x47, 0xED, 0xA7, 0x00, 0x00, /* 0x00-0x03 */ 6569 0x00, 0x00, 0xC1, 0x47, 0xED, 0xA7, 0x00, 0x00, /* 0x00-0x03 */
6570 0xED, 0xAE, 0xED, 0xAB, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6570 0xED, 0xAE, 0xED, 0xAB, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6571 0x00, 0x00, 0xF0, 0x5A, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6571 0x00, 0x00, 0xF0, 0x5A, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6633,7 +6633,7 @@ static unsigned char u2c_79[512] = {
6633 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 6633 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
6634}; 6634};
6635 6635
6636static unsigned char u2c_7A[512] = { 6636static const unsigned char u2c_7A[512] = {
6637 0xB5, 0x7D, 0x00, 0x00, 0xDA, 0xD6, 0xDA, 0xD8, /* 0x00-0x03 */ 6637 0xB5, 0x7D, 0x00, 0x00, 0xDA, 0xD6, 0xDA, 0xD8, /* 0x00-0x03 */
6638 0xDA, 0xDA, 0xB5, 0x7C, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6638 0xDA, 0xDA, 0xB5, 0x7C, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6639 0xB5, 0x7A, 0x00, 0x00, 0xDA, 0xD7, 0xB5, 0x7B, /* 0x08-0x0B */ 6639 0xB5, 0x7A, 0x00, 0x00, 0xDA, 0xD7, 0xB5, 0x7B, /* 0x08-0x0B */
@@ -6701,7 +6701,7 @@ static unsigned char u2c_7A[512] = {
6701 0x00, 0x00, 0xAC, 0xF2, 0x00, 0x00, 0xAC, 0xF1, /* 0xFC-0xFF */ 6701 0x00, 0x00, 0xAC, 0xF2, 0x00, 0x00, 0xAC, 0xF1, /* 0xFC-0xFF */
6702}; 6702};
6703 6703
6704static unsigned char u2c_7B[512] = { 6704static const unsigned char u2c_7B[512] = {
6705 0xD0, 0x42, 0xD0, 0x43, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6705 0xD0, 0x42, 0xD0, 0x43, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6706 0xD3, 0x40, 0xD3, 0x42, 0xAF, 0xB9, 0x00, 0x00, /* 0x04-0x07 */ 6706 0xD3, 0x40, 0xD3, 0x42, 0xAF, 0xB9, 0x00, 0x00, /* 0x04-0x07 */
6707 0xD3, 0x44, 0xD3, 0x47, 0xD3, 0x45, 0x00, 0x00, /* 0x08-0x0B */ 6707 0xD3, 0x44, 0xD3, 0x47, 0xD3, 0x45, 0x00, 0x00, /* 0x08-0x0B */
@@ -6769,7 +6769,7 @@ static unsigned char u2c_7B[512] = {
6769 0x00, 0x00, 0xED, 0xC9, 0xC1, 0x4E, 0xED, 0xBE, /* 0xFC-0xFF */ 6769 0x00, 0x00, 0xED, 0xC9, 0xC1, 0x4E, 0xED, 0xBE, /* 0xFC-0xFF */
6770}; 6770};
6771 6771
6772static unsigned char u2c_7C[512] = { 6772static const unsigned char u2c_7C[512] = {
6773 0xED, 0xBD, 0xED, 0xC7, 0xED, 0xC4, 0xED, 0xC6, /* 0x00-0x03 */ 6773 0xED, 0xBD, 0xED, 0xC7, 0xED, 0xC4, 0xED, 0xC6, /* 0x00-0x03 */
6774 0x00, 0x00, 0xED, 0xBA, 0xED, 0xCA, 0xC1, 0x4C, /* 0x04-0x07 */ 6774 0x00, 0x00, 0xED, 0xBA, 0xED, 0xCA, 0xC1, 0x4C, /* 0x04-0x07 */
6775 0x00, 0x00, 0xED, 0xC5, 0xED, 0xCE, 0xED, 0xC2, /* 0x08-0x0B */ 6775 0x00, 0x00, 0xED, 0xC5, 0xED, 0xCE, 0xED, 0xC2, /* 0x08-0x0B */
@@ -6837,7 +6837,7 @@ static unsigned char u2c_7C[512] = {
6837 0x00, 0x00, 0xCD, 0xA9, 0xAA, 0xC8, 0x00, 0x00, /* 0xFC-0xFF */ 6837 0x00, 0x00, 0xCD, 0xA9, 0xAA, 0xC8, 0x00, 0x00, /* 0xFC-0xFF */
6838}; 6838};
6839 6839
6840static unsigned char u2c_7D[512] = { 6840static const unsigned char u2c_7D[512] = {
6841 0xAC, 0xF6, 0xD0, 0x4C, 0xAC, 0xF4, 0xD0, 0x4A, /* 0x00-0x03 */ 6841 0xAC, 0xF6, 0xD0, 0x4C, 0xAC, 0xF4, 0xD0, 0x4A, /* 0x00-0x03 */
6842 0xAC, 0xF9, 0xAC, 0xF5, 0xAC, 0xFA, 0xAC, 0xF8, /* 0x04-0x07 */ 6842 0xAC, 0xF9, 0xAC, 0xF5, 0xAC, 0xFA, 0xAC, 0xF8, /* 0x04-0x07 */
6843 0xD0, 0x4B, 0xAC, 0xF7, 0xAF, 0xBF, 0xAF, 0xBE, /* 0x08-0x0B */ 6843 0xD0, 0x4B, 0xAC, 0xF7, 0xAF, 0xBF, 0xAF, 0xBE, /* 0x08-0x0B */
@@ -6904,7 +6904,7 @@ static unsigned char u2c_7D[512] = {
6904 0x00, 0x00, 0xBD, 0x7B, 0xE6, 0xEA, 0xBD, 0x6F, /* 0xF8-0xFB */ 6904 0x00, 0x00, 0xBD, 0x7B, 0xE6, 0xEA, 0xBD, 0x6F, /* 0xF8-0xFB */
6905}; 6905};
6906 6906
6907static unsigned char u2c_7E[512] = { 6907static const unsigned char u2c_7E[512] = {
6908 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xE9, /* 0x00-0x03 */ 6908 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xE9, /* 0x00-0x03 */
6909 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6909 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6910 0xBF, 0xA2, 0xBF, 0xA7, 0xBF, 0x7E, 0xEA, 0xD8, /* 0x08-0x0B */ 6910 0xBF, 0xA2, 0xBF, 0xA7, 0xBF, 0x7E, 0xEA, 0xD8, /* 0x08-0x0B */
@@ -6948,7 +6948,7 @@ static unsigned char u2c_7E[512] = {
6948 0xC6, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */ 6948 0xC6, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
6949}; 6949};
6950 6950
6951static unsigned char u2c_7F[512] = { 6951static const unsigned char u2c_7F[512] = {
6952 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 6952 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
6953 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 6953 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
6954 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 6954 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7016,7 +7016,7 @@ static unsigned char u2c_7F[512] = {
7016 0xC1, 0x6C, 0xF2, 0xBE, 0xF2, 0xBF, 0xF4, 0xB1, /* 0xFC-0xFF */ 7016 0xC1, 0x6C, 0xF2, 0xBE, 0xF2, 0xBF, 0xF4, 0xB1, /* 0xFC-0xFF */
7017}; 7017};
7018 7018
7019static unsigned char u2c_80[512] = { 7019static const unsigned char u2c_80[512] = {
7020 0xC4, 0xA3, 0xA6, 0xD1, 0x00, 0x00, 0xA6, 0xD2, /* 0x00-0x03 */ 7020 0xC4, 0xA3, 0xA6, 0xD1, 0x00, 0x00, 0xA6, 0xD2, /* 0x00-0x03 */
7021 0xAC, 0xFE, 0xAA, 0xCC, 0xAF, 0xCF, 0xD0, 0x51, /* 0x04-0x07 */ 7021 0xAC, 0xFE, 0xAA, 0xCC, 0xAF, 0xCF, 0xD0, 0x51, /* 0x04-0x07 */
7022 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xC0, /* 0x08-0x0B */ 7022 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xC0, /* 0x08-0x0B */
@@ -7084,7 +7084,7 @@ static unsigned char u2c_80[512] = {
7084 0xAF, 0xE2, 0xAF, 0xE0, 0xDB, 0x48, 0x00, 0x00, /* 0xFC-0xFF */ 7084 0xAF, 0xE2, 0xAF, 0xE0, 0xDB, 0x48, 0x00, 0x00, /* 0xFC-0xFF */
7085}; 7085};
7086 7086
7087static unsigned char u2c_81[512] = { 7087static const unsigned char u2c_81[512] = {
7088 0xD3, 0x6F, 0xD3, 0x6D, 0xAF, 0xD7, 0x00, 0x00, /* 0x00-0x03 */ 7088 0xD3, 0x6F, 0xD3, 0x6D, 0xAF, 0xD7, 0x00, 0x00, /* 0x00-0x03 */
7089 0x00, 0x00, 0xAF, 0xD9, 0xAF, 0xDC, 0x00, 0x00, /* 0x04-0x07 */ 7089 0x00, 0x00, 0xAF, 0xD9, 0xAF, 0xDC, 0x00, 0x00, /* 0x04-0x07 */
7090 0xAF, 0xDF, 0x00, 0x00, 0xAF, 0xE1, 0x00, 0x00, /* 0x08-0x0B */ 7090 0xAF, 0xDF, 0x00, 0x00, 0xAF, 0xE1, 0x00, 0x00, /* 0x08-0x0B */
@@ -7152,7 +7152,7 @@ static unsigned char u2c_81[512] = {
7152 0xA6, 0xDD, 0x00, 0x00, 0xAA, 0xD8, 0xD0, 0x68, /* 0xFC-0xFF */ 7152 0xA6, 0xDD, 0x00, 0x00, 0xAA, 0xD8, 0xD0, 0x68, /* 0xFC-0xFF */
7153}; 7153};
7154 7154
7155static unsigned char u2c_82[512] = { 7155static const unsigned char u2c_82[512] = {
7156 0xAF, 0xE6, 0xD3, 0x70, 0xB2, 0xEA, 0x00, 0x00, /* 0x00-0x03 */ 7156 0xAF, 0xE6, 0xD3, 0x70, 0xB2, 0xEA, 0x00, 0x00, /* 0x00-0x03 */
7157 0xDB, 0x57, 0xB8, 0xA4, 0x00, 0x00, 0xBB, 0x50, /* 0x04-0x07 */ 7157 0xDB, 0x57, 0xB8, 0xA4, 0x00, 0x00, 0xBB, 0x50, /* 0x04-0x07 */
7158 0xBF, 0xB3, 0xC1, 0x7C, 0xC2, 0xC2, 0xF4, 0xB5, /* 0x08-0x0B */ 7158 0xBF, 0xB3, 0xC1, 0x7C, 0xC2, 0xC2, 0xF4, 0xB5, /* 0x08-0x0B */
@@ -7220,7 +7220,7 @@ static unsigned char u2c_82[512] = {
7220 0x00, 0x00, 0x00, 0x00, 0xD0, 0x6C, 0x00, 0x00, /* 0xFC-0xFF */ 7220 0x00, 0x00, 0x00, 0x00, 0xD0, 0x6C, 0x00, 0x00, /* 0xFC-0xFF */
7221}; 7221};
7222 7222
7223static unsigned char u2c_83[512] = { 7223static const unsigned char u2c_83[512] = {
7224 0xD0, 0x70, 0xAD, 0x5F, 0xAD, 0x5A, 0xAD, 0x53, /* 0x00-0x03 */ 7224 0xD0, 0x70, 0xAD, 0x5F, 0xAD, 0x5A, 0xAD, 0x53, /* 0x00-0x03 */
7225 0xAD, 0x58, 0xAD, 0x54, 0xAD, 0x67, 0xD0, 0x6E, /* 0x04-0x07 */ 7225 0xAD, 0x58, 0xAD, 0x54, 0xAD, 0x67, 0xD0, 0x6E, /* 0x04-0x07 */
7226 0xD3, 0xA5, 0xAD, 0x5B, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7226 0xD3, 0xA5, 0xAD, 0x5B, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7288,7 +7288,7 @@ static unsigned char u2c_83[512] = {
7288 0xDB, 0x65, 0xB5, 0xE0, 0xDB, 0xB0, 0xDB, 0x71, /* 0xFC-0xFF */ 7288 0xDB, 0x65, 0xB5, 0xE0, 0xDB, 0xB0, 0xDB, 0x71, /* 0xFC-0xFF */
7289}; 7289};
7290 7290
7291static unsigned char u2c_84[512] = { 7291static const unsigned char u2c_84[512] = {
7292 0x00, 0x00, 0xDB, 0x6D, 0x00, 0x00, 0xB5, 0xD1, /* 0x00-0x03 */ 7292 0x00, 0x00, 0xDB, 0x6D, 0x00, 0x00, 0xB5, 0xD1, /* 0x00-0x03 */
7293 0xB5, 0xE5, 0x00, 0x00, 0xDB, 0x7C, 0xB5, 0xE7, /* 0x04-0x07 */ 7293 0xB5, 0xE5, 0x00, 0x00, 0xDB, 0x7C, 0xB5, 0xE7, /* 0x04-0x07 */
7294 0x00, 0x00, 0xDB, 0x78, 0xB5, 0xDC, 0xB5, 0xD6, /* 0x08-0x0B */ 7294 0x00, 0x00, 0xDB, 0x78, 0xB5, 0xDC, 0xB5, 0xD6, /* 0x08-0x0B */
@@ -7356,7 +7356,7 @@ static unsigned char u2c_84[512] = {
7356 0xE7, 0x64, 0xE7, 0x6E, 0xE7, 0x69, 0xBD, 0xB6, /* 0xFC-0xFF */ 7356 0xE7, 0x64, 0xE7, 0x6E, 0xE7, 0x69, 0xBD, 0xB6, /* 0xFC-0xFF */
7357}; 7357};
7358 7358
7359static unsigned char u2c_85[512] = { 7359static const unsigned char u2c_85[512] = {
7360 0xE7, 0x4F, 0x00, 0x00, 0xE7, 0x6D, 0x00, 0x00, /* 0x00-0x03 */ 7360 0xE7, 0x4F, 0x00, 0x00, 0xE7, 0x6D, 0x00, 0x00, /* 0x00-0x03 */
7361 0x00, 0x00, 0x00, 0x00, 0xBD, 0xB7, 0xDF, 0xBD, /* 0x04-0x07 */ 7361 0x00, 0x00, 0x00, 0x00, 0xBD, 0xB7, 0xDF, 0xBD, /* 0x04-0x07 */
7362 0xE7, 0x5B, 0xE7, 0x52, 0xE7, 0x55, 0xE7, 0x7B, /* 0x08-0x0B */ 7362 0xE7, 0x5B, 0xE7, 0x52, 0xE7, 0x55, 0xE7, 0x7B, /* 0x08-0x0B */
@@ -7424,7 +7424,7 @@ static unsigned char u2c_85[512] = {
7424 0x00, 0x00, 0xF4, 0xC3, 0xF4, 0xBB, 0xF4, 0xB9, /* 0xFC-0xFF */ 7424 0x00, 0x00, 0xF4, 0xC3, 0xF4, 0xBB, 0xF4, 0xB9, /* 0xFC-0xFF */
7425}; 7425};
7426 7426
7427static unsigned char u2c_86[512] = { 7427static const unsigned char u2c_86[512] = {
7428 0xF4, 0xBD, 0xF4, 0xBA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7428 0xF4, 0xBD, 0xF4, 0xBA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7429 0xF4, 0xBF, 0xF4, 0xC1, 0xC4, 0xAA, 0xC4, 0xAC, /* 0x04-0x07 */ 7429 0xF4, 0xBF, 0xF4, 0xC1, 0xC4, 0xAA, 0xC4, 0xAC, /* 0x04-0x07 */
7430 0x00, 0x00, 0xF4, 0xC0, 0xC4, 0xAD, 0xC4, 0xAB, /* 0x08-0x0B */ 7430 0x00, 0x00, 0xF4, 0xC0, 0xC4, 0xAD, 0xC4, 0xAB, /* 0x08-0x0B */
@@ -7492,7 +7492,7 @@ static unsigned char u2c_86[512] = {
7492 0x00, 0x00, 0x00, 0x00, 0xB8, 0xBF, 0x00, 0x00, /* 0xFC-0xFF */ 7492 0x00, 0x00, 0x00, 0x00, 0xB8, 0xBF, 0x00, 0x00, /* 0xFC-0xFF */
7493}; 7493};
7494 7494
7495static unsigned char u2c_87[512] = { 7495static const unsigned char u2c_87[512] = {
7496 0xB8, 0xBE, 0xDF, 0xED, 0xB8, 0xC1, 0xB8, 0xC2, /* 0x00-0x03 */ 7496 0xB8, 0xBE, 0xDF, 0xED, 0xB8, 0xC1, 0xB8, 0xC2, /* 0x00-0x03 */
7497 0xDF, 0xE3, 0xDF, 0xF0, 0xB8, 0xC3, 0xB8, 0xBD, /* 0x04-0x07 */ 7497 0xDF, 0xE3, 0xDF, 0xF0, 0xB8, 0xC3, 0xB8, 0xBD, /* 0x04-0x07 */
7498 0xB8, 0xBC, 0xDF, 0xEC, 0xB8, 0xC4, 0xDF, 0xE2, /* 0x08-0x0B */ 7498 0xB8, 0xBC, 0xDF, 0xEC, 0xB8, 0xC4, 0xDF, 0xE2, /* 0x08-0x0B */
@@ -7560,7 +7560,7 @@ static unsigned char u2c_87[512] = {
7560 0xF2, 0xE4, 0x00, 0x00, 0xC3, 0xCA, 0xF2, 0xE6, /* 0xFC-0xFF */ 7560 0xF2, 0xE4, 0x00, 0x00, 0xC3, 0xCA, 0xF2, 0xE6, /* 0xFC-0xFF */
7561}; 7561};
7562 7562
7563static unsigned char u2c_88[512] = { 7563static const unsigned char u2c_88[512] = {
7564 0xF2, 0xDB, 0xF0, 0xCE, 0xF2, 0xE8, 0xF2, 0xDD, /* 0x00-0x03 */ 7564 0xF2, 0xDB, 0xF0, 0xCE, 0xF2, 0xE8, 0xF2, 0xDD, /* 0x00-0x03 */
7565 0x00, 0x00, 0xC3, 0xC7, 0xF2, 0xE3, 0x00, 0x00, /* 0x04-0x07 */ 7565 0x00, 0x00, 0xC3, 0xC7, 0xF2, 0xE3, 0x00, 0x00, /* 0x04-0x07 */
7566 0xF2, 0xE5, 0xF2, 0xE0, 0xF2, 0xE7, 0xF2, 0xE2, /* 0x08-0x0B */ 7566 0xF2, 0xE5, 0xF2, 0xE0, 0xF2, 0xE7, 0xF2, 0xE2, /* 0x08-0x0B */
@@ -7628,7 +7628,7 @@ static unsigned char u2c_88[512] = {
7628 0xE3, 0xFC, 0xBB, 0x73, 0xE3, 0xFA, 0x00, 0x00, /* 0xFC-0xFF */ 7628 0xE3, 0xFC, 0xBB, 0x73, 0xE3, 0xFA, 0x00, 0x00, /* 0xFC-0xFF */
7629}; 7629};
7630 7630
7631static unsigned char u2c_89[512] = { 7631static const unsigned char u2c_89[512] = {
7632 0x00, 0x00, 0xDB, 0xCE, 0xBB, 0x6F, 0x00, 0x00, /* 0x00-0x03 */ 7632 0x00, 0x00, 0xDB, 0xCE, 0xBB, 0x6F, 0x00, 0x00, /* 0x00-0x03 */
7633 0x00, 0x00, 0xE7, 0xC2, 0xE7, 0xC9, 0xBD, 0xC6, /* 0x04-0x07 */ 7633 0x00, 0x00, 0xE7, 0xC2, 0xE7, 0xC9, 0xBD, 0xC6, /* 0x04-0x07 */
7634 0x00, 0x00, 0xE7, 0xCD, 0xBD, 0xCA, 0xE7, 0xC5, /* 0x08-0x0B */ 7634 0x00, 0x00, 0xE7, 0xCD, 0xBD, 0xCA, 0xE7, 0xC5, /* 0x08-0x0B */
@@ -7696,7 +7696,7 @@ static unsigned char u2c_89[512] = {
7696 0xC5, 0xA9, 0x00, 0x00, 0xF7, 0xFE, 0xF9, 0x4C, /* 0xFC-0xFF */ 7696 0xC5, 0xA9, 0x00, 0x00, 0xF7, 0xFE, 0xF9, 0x4C, /* 0xFC-0xFF */
7697}; 7697};
7698 7698
7699static unsigned char u2c_8A[512] = { 7699static const unsigned char u2c_8A[512] = {
7700 0xA8, 0xA5, 0x00, 0x00, 0xAD, 0x71, 0xAD, 0x72, /* 0x00-0x03 */ 7700 0xA8, 0xA5, 0x00, 0x00, 0xAD, 0x71, 0xAD, 0x72, /* 0x00-0x03 */
7701 0xD0, 0xB0, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xB1, /* 0x04-0x07 */ 7701 0xD0, 0xB0, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xB1, /* 0x04-0x07 */
7702 0xAD, 0x70, 0x00, 0x00, 0xB0, 0x54, 0x00, 0x00, /* 0x08-0x0B */ 7702 0xAD, 0x70, 0x00, 0x00, 0xB0, 0x54, 0x00, 0x00, /* 0x08-0x0B */
@@ -7764,7 +7764,7 @@ static unsigned char u2c_8A[512] = {
7764 0xBF, 0xDC, 0x00, 0x00, 0xBF, 0xD5, 0xEB, 0xAE, /* 0xFC-0xFF */ 7764 0xBF, 0xDC, 0x00, 0x00, 0xBF, 0xD5, 0xEB, 0xAE, /* 0xFC-0xFF */
7765}; 7765};
7766 7766
7767static unsigned char u2c_8B[512] = { 7767static const unsigned char u2c_8B[512] = {
7768 0xBF, 0xD1, 0xBF, 0xD6, 0xBF, 0xD7, 0x00, 0x00, /* 0x00-0x03 */ 7768 0xBF, 0xD1, 0xBF, 0xD6, 0xBF, 0xD7, 0x00, 0x00, /* 0x00-0x03 */
7769 0xC1, 0xC3, 0xEE, 0xA4, 0xEE, 0xAD, 0xEE, 0xAA, /* 0x04-0x07 */ 7769 0xC1, 0xC3, 0xEE, 0xA4, 0xEE, 0xAD, 0xEE, 0xAA, /* 0x04-0x07 */
7770 0xEE, 0xAC, 0x00, 0x00, 0xC1, 0xC0, 0xEE, 0xA5, /* 0x08-0x0B */ 7770 0xEE, 0xAC, 0x00, 0x00, 0xC1, 0xC0, 0xEE, 0xA5, /* 0x08-0x0B */
@@ -7808,7 +7808,7 @@ static unsigned char u2c_8B[512] = {
7808 0xC6, 0x6D, 0x00, 0x00, 0xF9, 0xA9, 0xF9, 0xC8, /* 0x9C-0x9F */ 7808 0xC6, 0x6D, 0x00, 0x00, 0xF9, 0xA9, 0xF9, 0xC8, /* 0x9C-0x9F */
7809}; 7809};
7810 7810
7811static unsigned char u2c_8C[512] = { 7811static const unsigned char u2c_8C[512] = {
7812 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 7812 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
7813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 7813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
7814 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 7814 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7876,7 +7876,7 @@ static unsigned char u2c_8C[512] = {
7876 0xC1, 0xCA, 0xC1, 0xC9, 0xF0, 0xF3, 0x00, 0x00, /* 0xFC-0xFF */ 7876 0xC1, 0xCA, 0xC1, 0xC9, 0xF0, 0xF3, 0x00, 0x00, /* 0xFC-0xFF */
7877}; 7877};
7878 7878
7879static unsigned char u2c_8D[512] = { 7879static const unsigned char u2c_8D[512] = {
7880 0xF0, 0xF6, 0x00, 0x00, 0xF0, 0xF5, 0x00, 0x00, /* 0x00-0x03 */ 7880 0xF0, 0xF6, 0x00, 0x00, 0xF0, 0xF5, 0x00, 0x00, /* 0x00-0x03 */
7881 0xF0, 0xF4, 0xC2, 0xD8, 0xF3, 0x48, 0xF3, 0x49, /* 0x04-0x07 */ 7881 0xF0, 0xF4, 0xC2, 0xD8, 0xF3, 0x48, 0xF3, 0x49, /* 0x04-0x07 */
7882 0xC3, 0xD8, 0xF3, 0x4A, 0xC3, 0xD9, 0x00, 0x00, /* 0x08-0x0B */ 7882 0xC3, 0xD8, 0xF3, 0x4A, 0xC3, 0xD9, 0x00, 0x00, /* 0x08-0x0B */
@@ -7944,7 +7944,7 @@ static unsigned char u2c_8D[512] = {
7944 0xBB, 0xB1, 0xE4, 0x5B, 0xE4, 0x61, 0xE4, 0x59, /* 0xFC-0xFF */ 7944 0xBB, 0xB1, 0xE4, 0x5B, 0xE4, 0x61, 0xE4, 0x59, /* 0xFC-0xFF */
7945}; 7945};
7946 7946
7947static unsigned char u2c_8E[512] = { 7947static const unsigned char u2c_8E[512] = {
7948 0xE4, 0x62, 0x00, 0x00, 0xE4, 0x58, 0xE4, 0x5D, /* 0x00-0x03 */ 7948 0xE4, 0x62, 0x00, 0x00, 0xE4, 0x58, 0xE4, 0x5D, /* 0x00-0x03 */
7949 0xE4, 0x63, 0xE4, 0x60, 0xE4, 0x5F, 0xE4, 0x5E, /* 0x04-0x07 */ 7949 0xE4, 0x63, 0xE4, 0x60, 0xE4, 0x5F, 0xE4, 0x5E, /* 0x04-0x07 */
7950 0x00, 0x00, 0xE4, 0x57, 0xE4, 0x5C, 0x00, 0x00, /* 0x08-0x0B */ 7950 0x00, 0x00, 0xE4, 0x57, 0xE4, 0x5C, 0x00, 0x00, /* 0x08-0x0B */
@@ -8012,7 +8012,7 @@ static unsigned char u2c_8E[512] = {
8012 0xB6, 0x63, 0x00, 0x00, 0xB8, 0xFD, 0xE0, 0x75, /* 0xFC-0xFF */ 8012 0xB6, 0x63, 0x00, 0x00, 0xB8, 0xFD, 0xE0, 0x75, /* 0xFC-0xFF */
8013}; 8013};
8014 8014
8015static unsigned char u2c_8F[512] = { 8015static const unsigned char u2c_8F[512] = {
8016 0xE0, 0x77, 0xE0, 0x76, 0xE0, 0x7B, 0xB8, 0xFB, /* 0x00-0x03 */ 8016 0xE0, 0x77, 0xE0, 0x76, 0xE0, 0x7B, 0xB8, 0xFB, /* 0x00-0x03 */
8017 0x00, 0x00, 0xE0, 0x78, 0xE0, 0x74, 0xE0, 0x79, /* 0x04-0x07 */ 8017 0x00, 0x00, 0xE0, 0x78, 0xE0, 0x74, 0xE0, 0x79, /* 0x04-0x07 */
8018 0xE0, 0x7A, 0xB8, 0xFC, 0xB8, 0xFE, 0xE0, 0x7C, /* 0x08-0x0B */ 8018 0xE0, 0x7A, 0xB8, 0xFC, 0xB8, 0xFE, 0xE0, 0x7C, /* 0x08-0x0B */
@@ -8080,7 +8080,7 @@ static unsigned char u2c_8F[512] = {
8080 0xD3, 0xF0, 0xB0, 0x6C, 0xD3, 0xEA, 0xD3, 0xED, /* 0xFC-0xFF */ 8080 0xD3, 0xF0, 0xB0, 0x6C, 0xD3, 0xEA, 0xD3, 0xED, /* 0xFC-0xFF */
8081}; 8081};
8082 8082
8083static unsigned char u2c_90[512] = { 8083static const unsigned char u2c_90[512] = {
8084 0xB0, 0x68, 0xB0, 0x65, 0xD3, 0xEC, 0xB0, 0x6B, /* 0x00-0x03 */ 8084 0xB0, 0x68, 0xB0, 0x65, 0xD3, 0xEC, 0xB0, 0x6B, /* 0x00-0x03 */
8085 0xD3, 0xEF, 0xB0, 0x6D, 0xB0, 0x66, 0x00, 0x00, /* 0x04-0x07 */ 8085 0xD3, 0xEF, 0xB0, 0x6D, 0xB0, 0x66, 0x00, 0x00, /* 0x04-0x07 */
8086 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD7, 0xE3, /* 0x08-0x0B */ 8086 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD7, 0xE3, /* 0x08-0x0B */
@@ -8148,7 +8148,7 @@ static unsigned char u2c_90[512] = {
8148 0xDC, 0x54, 0xB3, 0xA3, 0xB6, 0x6E, 0xDC, 0x53, /* 0xFC-0xFF */ 8148 0xDC, 0x54, 0xB3, 0xA3, 0xB6, 0x6E, 0xDC, 0x53, /* 0xFC-0xFF */
8149}; 8149};
8150 8150
8151static unsigned char u2c_91[512] = { 8151static const unsigned char u2c_91[512] = {
8152 0xDC, 0x59, 0xDC, 0x58, 0xB6, 0x6B, 0xDC, 0x5C, /* 0x00-0x03 */ 8152 0xDC, 0x59, 0xDC, 0x58, 0xB6, 0x6B, 0xDC, 0x5C, /* 0x00-0x03 */
8153 0xDC, 0x52, 0xDC, 0x5B, 0xDC, 0x50, 0xDC, 0x5A, /* 0x04-0x07 */ 8153 0xDC, 0x52, 0xDC, 0x5B, 0xDC, 0x50, 0xDC, 0x5A, /* 0x04-0x07 */
8154 0xDC, 0x55, 0xB6, 0x6D, 0x00, 0x00, 0xE0, 0xAA, /* 0x08-0x0B */ 8154 0xDC, 0x55, 0xB6, 0x6D, 0x00, 0x00, 0xE0, 0xAA, /* 0x08-0x0B */
@@ -8216,7 +8216,7 @@ static unsigned char u2c_91[512] = {
8216 0x00, 0x00, 0xDC, 0x6D, 0x00, 0x00, 0xDC, 0x6C, /* 0xFC-0xFF */ 8216 0x00, 0x00, 0xDC, 0x6D, 0x00, 0x00, 0xDC, 0x6C, /* 0xFC-0xFF */
8217}; 8217};
8218 8218
8219static unsigned char u2c_92[512] = { 8219static const unsigned char u2c_92[512] = {
8220 0xDC, 0x6A, 0xDC, 0x62, 0xDC, 0x71, 0xDC, 0x65, /* 0x00-0x03 */ 8220 0xDC, 0x6A, 0xDC, 0x62, 0xDC, 0x71, 0xDC, 0x65, /* 0x00-0x03 */
8221 0xDC, 0x6F, 0xDC, 0x76, 0xDC, 0x6E, 0xB6, 0x79, /* 0x04-0x07 */ 8221 0xDC, 0x6F, 0xDC, 0x76, 0xDC, 0x6E, 0xB6, 0x79, /* 0x04-0x07 */
8222 0x00, 0x00, 0xB6, 0x75, 0xDC, 0x63, 0x00, 0x00, /* 0x08-0x0B */ 8222 0x00, 0x00, 0xB6, 0x75, 0xDC, 0x63, 0x00, 0x00, /* 0x08-0x0B */
@@ -8284,7 +8284,7 @@ static unsigned char u2c_92[512] = {
8284 0xBF, 0xFB, 0x00, 0x00, 0xEC, 0x41, 0xEB, 0xF8, /* 0xFC-0xFF */ 8284 0xBF, 0xFB, 0x00, 0x00, 0xEC, 0x41, 0xEB, 0xF8, /* 0xFC-0xFF */
8285}; 8285};
8286 8286
8287static unsigned char u2c_93[512] = { 8287static const unsigned char u2c_93[512] = {
8288 0xEC, 0x43, 0xEB, 0xE9, 0xEB, 0xF6, 0x00, 0x00, /* 0x00-0x03 */ 8288 0xEC, 0x43, 0xEB, 0xE9, 0xEB, 0xF6, 0x00, 0x00, /* 0x00-0x03 */
8289 0xBF, 0xFD, 0x00, 0x00, 0xEB, 0xE1, 0x00, 0x00, /* 0x04-0x07 */ 8289 0xBF, 0xFD, 0x00, 0x00, 0xEB, 0xE1, 0x00, 0x00, /* 0x04-0x07 */
8290 0xEB, 0xDF, 0xEC, 0x42, 0x00, 0x00, 0xEC, 0x40, /* 0x08-0x0B */ 8290 0xEB, 0xDF, 0xEC, 0x42, 0x00, 0x00, 0xEC, 0x40, /* 0x08-0x0B */
@@ -8352,7 +8352,7 @@ static unsigned char u2c_93[512] = {
8352 0xF5, 0x40, 0xC4, 0xC3, 0xF4, 0xED, 0xF4, 0xFE, /* 0xFC-0xFF */ 8352 0xF5, 0x40, 0xC4, 0xC3, 0xF4, 0xED, 0xF4, 0xFE, /* 0xFC-0xFF */
8353}; 8353};
8354 8354
8355static unsigned char u2c_94[512] = { 8355static const unsigned char u2c_94[512] = {
8356 0xF4, 0xF4, 0x00, 0x00, 0x00, 0x00, 0xC4, 0xC2, /* 0x00-0x03 */ 8356 0xF4, 0xF4, 0x00, 0x00, 0x00, 0x00, 0xC4, 0xC2, /* 0x00-0x03 */
8357 0x00, 0x00, 0x00, 0x00, 0xF5, 0x44, 0xF4, 0xF6, /* 0x04-0x07 */ 8357 0x00, 0x00, 0x00, 0x00, 0xF5, 0x44, 0xF4, 0xF6, /* 0x04-0x07 */
8358 0x00, 0x00, 0xF4, 0xFB, 0xF4, 0xFD, 0xF4, 0xE7, /* 0x08-0x0B */ 8358 0x00, 0x00, 0xF4, 0xFB, 0xF4, 0xFD, 0xF4, 0xE7, /* 0x08-0x0B */
@@ -8389,7 +8389,7 @@ static unsigned char u2c_94[512] = {
8389 0xF9, 0xC0, 0xF9, 0xC1, 0xF9, 0xBF, 0xF9, 0xC9, /* 0x80-0x83 */ 8389 0xF9, 0xC0, 0xF9, 0xC1, 0xF9, 0xBF, 0xF9, 0xC9, /* 0x80-0x83 */
8390}; 8390};
8391 8391
8392static unsigned char u2c_95[512] = { 8392static const unsigned char u2c_95[512] = {
8393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8451,7 +8451,7 @@ static unsigned char u2c_95[512] = {
8451 0xF6, 0x6C, 0xF6, 0x6B, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */ 8451 0xF6, 0x6C, 0xF6, 0x6B, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
8452}; 8452};
8453 8453
8454static unsigned char u2c_96[512] = { 8454static const unsigned char u2c_96[512] = {
8455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 8456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
8457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8519,7 +8519,7 @@ static unsigned char u2c_96[512] = {
8519 0x00, 0x00, 0xE0, 0xD7, 0x00, 0x00, 0xE4, 0xBD, /* 0xFC-0xFF */ 8519 0x00, 0x00, 0xE0, 0xD7, 0x00, 0x00, 0xE4, 0xBD, /* 0xFC-0xFF */
8520}; 8520};
8521 8521
8522static unsigned char u2c_97[512] = { 8522static const unsigned char u2c_97[512] = {
8523 0xBB, 0xDD, 0x00, 0x00, 0xE8, 0xAF, 0x00, 0x00, /* 0x00-0x03 */ 8523 0xBB, 0xDD, 0x00, 0x00, 0xE8, 0xAF, 0x00, 0x00, /* 0x00-0x03 */
8524 0xBE, 0x5D, 0xE8, 0xAD, 0xBE, 0x5E, 0xBE, 0x5F, /* 0x04-0x07 */ 8524 0xBE, 0x5D, 0xE8, 0xAD, 0xBE, 0x5E, 0xBE, 0x5F, /* 0x04-0x07 */
8525 0xE8, 0xAE, 0xBE, 0x60, 0x00, 0x00, 0xEC, 0x51, /* 0x08-0x0B */ 8525 0xE8, 0xAE, 0xBE, 0x60, 0x00, 0x00, 0xEC, 0x51, /* 0x08-0x0B */
@@ -8587,7 +8587,7 @@ static unsigned char u2c_97[512] = {
8587 0x00, 0x00, 0xF5, 0x4C, 0xF5, 0x4D, 0xC5, 0x54, /* 0xFC-0xFF */ 8587 0x00, 0x00, 0xF5, 0x4C, 0xF5, 0x4D, 0xC5, 0x54, /* 0xFC-0xFF */
8588}; 8588};
8589 8589
8590static unsigned char u2c_98[512] = { 8590static const unsigned char u2c_98[512] = {
8591 0xF8, 0x51, 0xAD, 0xB6, 0xB3, 0xBB, 0xB3, 0xBC, /* 0x00-0x03 */ 8591 0xF8, 0x51, 0xAD, 0xB6, 0xB3, 0xBB, 0xB3, 0xBC, /* 0x00-0x03 */
8592 0xD8, 0x4E, 0xB6, 0xB5, 0xB6, 0xB6, 0xDC, 0xAC, /* 0x04-0x07 */ 8592 0xD8, 0x4E, 0xB6, 0xB5, 0xB6, 0xB6, 0xDC, 0xAC, /* 0x04-0x07 */
8593 0xB6, 0xB7, 0x00, 0x00, 0xB9, 0x7A, 0x00, 0x00, /* 0x08-0x0B */ 8593 0xB6, 0xB7, 0x00, 0x00, 0xB9, 0x7A, 0x00, 0x00, /* 0x08-0x0B */
@@ -8655,7 +8655,7 @@ static unsigned char u2c_98[512] = {
8655 0xB9, 0x7D, 0xB9, 0xA1, 0xB9, 0xA2, 0x00, 0x00, /* 0xFC-0xFF */ 8655 0xB9, 0x7D, 0xB9, 0xA1, 0xB9, 0xA2, 0x00, 0x00, /* 0xFC-0xFF */
8656}; 8656};
8657 8657
8658static unsigned char u2c_99[512] = { 8658static const unsigned char u2c_99[512] = {
8659 0xE4, 0xCF, 0x00, 0x00, 0xE4, 0xCE, 0xBB, 0xE5, /* 0x00-0x03 */ 8659 0xE4, 0xCF, 0x00, 0x00, 0xE4, 0xCE, 0xBB, 0xE5, /* 0x00-0x03 */
8660 0x00, 0x00, 0xBB, 0xE6, 0x00, 0x00, 0xE4, 0xD0, /* 0x04-0x07 */ 8660 0x00, 0x00, 0xBB, 0xE6, 0x00, 0x00, 0xE4, 0xD0, /* 0x04-0x07 */
8661 0xE8, 0xBF, 0xBB, 0xE8, 0xBE, 0x69, 0x00, 0x00, /* 0x08-0x0B */ 8661 0xE8, 0xBF, 0xBB, 0xE8, 0xBE, 0x69, 0x00, 0x00, /* 0x08-0x0B */
@@ -8723,7 +8723,7 @@ static unsigned char u2c_99[512] = {
8723 0xEF, 0x62, 0xEF, 0x60, 0xEF, 0x61, 0xC2, 0x40, /* 0xFC-0xFF */ 8723 0xEF, 0x62, 0xEF, 0x60, 0xEF, 0x61, 0xC2, 0x40, /* 0xFC-0xFF */
8724}; 8724};
8725 8725
8726static unsigned char u2c_9A[512] = { 8726static const unsigned char u2c_9A[512] = {
8727 0x00, 0x00, 0xC1, 0xFE, 0xEF, 0x58, 0xEF, 0x63, /* 0x00-0x03 */ 8727 0x00, 0x00, 0xC1, 0xFE, 0xEF, 0x58, 0xEF, 0x63, /* 0x00-0x03 */
8728 0xF1, 0xB3, 0xF1, 0xB6, 0xF1, 0xB8, 0xF1, 0xB7, /* 0x04-0x07 */ 8728 0xF1, 0xB3, 0xF1, 0xB6, 0xF1, 0xB8, 0xF1, 0xB7, /* 0x04-0x07 */
8729 0x00, 0x00, 0xF1, 0xB1, 0xF1, 0xB5, 0xF1, 0xB0, /* 0x08-0x0B */ 8729 0x00, 0x00, 0xF1, 0xB1, 0xF1, 0xB5, 0xF1, 0xB0, /* 0x08-0x0B */
@@ -8791,7 +8791,7 @@ static unsigned char u2c_9A[512] = {
8791 0xEF, 0x68, 0xEF, 0x66, 0xEF, 0x65, 0x00, 0x00, /* 0xFC-0xFF */ 8791 0xEF, 0x68, 0xEF, 0x66, 0xEF, 0x65, 0x00, 0x00, /* 0xFC-0xFF */
8792}; 8792};
8793 8793
8794static unsigned char u2c_9B[512] = { 8794static const unsigned char u2c_9B[512] = {
8795 0x00, 0x00, 0xEF, 0x67, 0x00, 0x00, 0xC3, 0x4F, /* 0x00-0x03 */ 8795 0x00, 0x00, 0xEF, 0x67, 0x00, 0x00, 0xC3, 0x4F, /* 0x00-0x03 */
8796 0xF1, 0xBC, 0xF1, 0xBD, 0xC3, 0x50, 0x00, 0x00, /* 0x04-0x07 */ 8796 0xF1, 0xBC, 0xF1, 0xBD, 0xC3, 0x50, 0x00, 0x00, /* 0x04-0x07 */
8797 0xF1, 0xBB, 0x00, 0x00, 0xF3, 0xC3, 0xF3, 0xC2, /* 0x08-0x0B */ 8797 0xF1, 0xBB, 0x00, 0x00, 0xF3, 0xC3, 0xF3, 0xC2, /* 0x08-0x0B */
@@ -8859,7 +8859,7 @@ static unsigned char u2c_9B[512] = {
8859 0x00, 0x00, 0xC3, 0x56, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */ 8859 0x00, 0x00, 0xC3, 0x56, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
8860}; 8860};
8861 8861
8862static unsigned char u2c_9C[512] = { 8862static const unsigned char u2c_9C[512] = {
8863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 8863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
8864 0x00, 0x00, 0xF5, 0x6D, 0xF5, 0x73, 0xF5, 0x71, /* 0x04-0x07 */ 8864 0x00, 0x00, 0xF5, 0x6D, 0xF5, 0x73, 0xF5, 0x71, /* 0x04-0x07 */
8865 0xF5, 0x6B, 0xF5, 0x76, 0x00, 0x00, 0xF5, 0x6A, /* 0x08-0x0B */ 8865 0xF5, 0x6B, 0xF5, 0x76, 0x00, 0x00, 0xF5, 0x6A, /* 0x08-0x0B */
@@ -8927,7 +8927,7 @@ static unsigned char u2c_9C[512] = {
8927 0xE8, 0xE4, 0xE8, 0xE6, 0x00, 0x00, 0xE8, 0xE7, /* 0xFC-0xFF */ 8927 0xE8, 0xE4, 0xE8, 0xE6, 0x00, 0x00, 0xE8, 0xE7, /* 0xFC-0xFF */
8928}; 8928};
8929 8929
8930static unsigned char u2c_9D[512] = { 8930static const unsigned char u2c_9D[512] = {
8931 0xE8, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xA1, /* 0x00-0x03 */ 8931 0xE8, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xA1, /* 0x00-0x03 */
8932 0xE8, 0xEF, 0xE8, 0xEE, 0xBE, 0x7D, 0xE8, 0xE9, /* 0x04-0x07 */ 8932 0xE8, 0xEF, 0xE8, 0xEE, 0xBE, 0x7D, 0xE8, 0xE9, /* 0x04-0x07 */
8933 0xE8, 0xED, 0xBE, 0x7E, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 8933 0xE8, 0xED, 0xBE, 0x7E, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8995,7 +8995,7 @@ static unsigned char u2c_9D[512] = {
8995 0x00, 0x00, 0xF8, 0xE6, 0xF8, 0xDD, 0xF8, 0xE5, /* 0xFC-0xFF */ 8995 0x00, 0x00, 0xF8, 0xE6, 0xF8, 0xDD, 0xF8, 0xE5, /* 0xFC-0xFF */
8996}; 8996};
8997 8997
8998static unsigned char u2c_9E[512] = { 8998static const unsigned char u2c_9E[512] = {
8999 0xF8, 0xE2, 0xF8, 0xE3, 0xF8, 0xDC, 0xF8, 0xDF, /* 0x00-0x03 */ 8999 0xF8, 0xE2, 0xF8, 0xE3, 0xF8, 0xDC, 0xF8, 0xDF, /* 0x00-0x03 */
9000 0xF8, 0xE7, 0xF8, 0xE1, 0xF8, 0xE0, 0xF8, 0xDE, /* 0x04-0x07 */ 9000 0xF8, 0xE7, 0xF8, 0xE1, 0xF8, 0xE0, 0xF8, 0xDE, /* 0x04-0x07 */
9001 0x00, 0x00, 0xF8, 0xE4, 0x00, 0x00, 0xF9, 0x5D, /* 0x08-0x0B */ 9001 0x00, 0x00, 0xF8, 0xE4, 0x00, 0x00, 0xF9, 0x5D, /* 0x08-0x0B */
@@ -9063,7 +9063,7 @@ static unsigned char u2c_9E[512] = {
9063 0xF3, 0xF5, 0xE0, 0xEF, 0x00, 0x00, 0xEF, 0xB1, /* 0xFC-0xFF */ 9063 0xF3, 0xF5, 0xE0, 0xEF, 0x00, 0x00, 0xEF, 0xB1, /* 0xFC-0xFF */
9064}; 9064};
9065 9065
9066static unsigned char u2c_9F[512] = { 9066static const unsigned char u2c_9F[512] = {
9067 0xF1, 0xE2, 0xF1, 0xE1, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9067 0xF1, 0xE2, 0xF1, 0xE1, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9068 0x00, 0x00, 0x00, 0x00, 0xF8, 0x78, 0xC6, 0x52, /* 0x04-0x07 */ 9068 0x00, 0x00, 0x00, 0x00, 0xF8, 0x78, 0xC6, 0x52, /* 0x04-0x07 */
9069 0x00, 0x00, 0xF9, 0x65, 0xF9, 0x7E, 0x00, 0x00, /* 0x08-0x0B */ 9069 0x00, 0x00, 0xF9, 0x65, 0xF9, 0x7E, 0x00, 0x00, /* 0x08-0x0B */
@@ -9109,11 +9109,11 @@ static unsigned char u2c_9F[512] = {
9109 0xF9, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */ 9109 0xF9, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */
9110}; 9110};
9111 9111
9112static unsigned char u2c_DC[512] = { 9112static const unsigned char u2c_DC[512] = {
9113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9114}; 9114};
9115 9115
9116static unsigned char u2c_F9[512] = { 9116static const unsigned char u2c_F9[512] = {
9117 0xB0, 0x5A, 0xA7, 0xF3, 0xA8, 0xAE, 0xB8, 0xEB, /* 0x00-0x03 */ 9117 0xB0, 0x5A, 0xA7, 0xF3, 0xA8, 0xAE, 0xB8, 0xEB, /* 0x00-0x03 */
9118 0xB7, 0xC6, 0xA6, 0xEA, 0xA5, 0x79, 0xC0, 0x74, /* 0x04-0x07 */ 9118 0xB7, 0xC6, 0xA6, 0xEA, 0xA5, 0x79, 0xC0, 0x74, /* 0x04-0x07 */
9119 0xC0, 0x74, 0xAB, 0xB4, 0xAA, 0xF7, 0xB3, 0xE2, /* 0x08-0x0B */ 9119 0xC0, 0x74, 0xAB, 0xB4, 0xAA, 0xF7, 0xB3, 0xE2, /* 0x08-0x0B */
@@ -9181,7 +9181,7 @@ static unsigned char u2c_F9[512] = {
9181 0xC3, 0xD1, 0xA4, 0xB0, 0xAF, 0xF9, 0xA8, 0xEB, /* 0xFC-0xFF */ 9181 0xC3, 0xD1, 0xA4, 0xB0, 0xAF, 0xF9, 0xA8, 0xEB, /* 0xFC-0xFF */
9182}; 9182};
9183 9183
9184static unsigned char u2c_FA[512] = { 9184static const unsigned char u2c_FA[512] = {
9185 0xA4, 0xC1, 0xAB, 0xD7, 0xA9, 0xDD, 0xBF, 0x7D, /* 0x00-0x03 */ 9185 0xA4, 0xC1, 0xAB, 0xD7, 0xA9, 0xDD, 0xBF, 0x7D, /* 0x00-0x03 */
9186 0xA6, 0x76, 0xAC, 0x7D, 0xBC, 0xC9, 0xBF, 0xE7, /* 0x04-0x07 */ 9186 0xA6, 0x76, 0xAC, 0x7D, 0xBC, 0xC9, 0xBF, 0xE7, /* 0x04-0x07 */
9187 0xA6, 0xE6, 0xAD, 0xB0, 0xA8, 0xA3, 0xB9, 0xF8, /* 0x08-0x0B */ 9187 0xA6, 0xE6, 0xAD, 0xB0, 0xA8, 0xA3, 0xB9, 0xF8, /* 0x08-0x0B */
@@ -9196,7 +9196,7 @@ static unsigned char u2c_FA[512] = {
9196 0xC0, 0x5D, 0xC5, 0x62, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */ 9196 0xC0, 0x5D, 0xC5, 0x62, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
9197}; 9197};
9198 9198
9199static unsigned char u2c_FE[512] = { 9199static const unsigned char u2c_FE[512] = {
9200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */ 9200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
9201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */ 9201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
9202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */ 9202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9226,7 +9226,7 @@ static unsigned char u2c_FE[512] = {
9226 0xA2, 0x42, 0xA2, 0x4C, 0xA2, 0x4D, 0xA2, 0x4E, /* 0x68-0x6B */ 9226 0xA2, 0x42, 0xA2, 0x4C, 0xA2, 0x4D, 0xA2, 0x4E, /* 0x68-0x6B */
9227}; 9227};
9228 9228
9229static unsigned char u2c_FF[512] = { 9229static const unsigned char u2c_FF[512] = {
9230 0x00, 0x00, 0xA1, 0x49, 0xA1, 0xA8, 0xA1, 0xAD, /* 0x00-0x03 */ 9230 0x00, 0x00, 0xA1, 0x49, 0xA1, 0xA8, 0xA1, 0xAD, /* 0x00-0x03 */
9231 0xA2, 0x43, 0xA2, 0x48, 0xA1, 0xAE, 0xA1, 0xA6, /* 0x04-0x07 */ 9231 0xA2, 0x43, 0xA2, 0x48, 0xA1, 0xAE, 0xA1, 0xA6, /* 0x04-0x07 */
9232 0xA1, 0x5D, 0xA1, 0x5E, 0xA1, 0xAF, 0xA1, 0xCF, /* 0x08-0x0B */ 9232 0xA1, 0x5D, 0xA1, 0x5E, 0xA1, 0xAF, 0xA1, 0xCF, /* 0x08-0x0B */
@@ -9288,7 +9288,7 @@ static unsigned char u2c_FF[512] = {
9288 0x00, 0x00, 0xA2, 0x44, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */ 9288 0x00, 0x00, 0xA2, 0x44, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
9289}; 9289};
9290 9290
9291static unsigned char *page_uni2charset[256] = { 9291static const unsigned char *const page_uni2charset[256] = {
9292 NULL, NULL, u2c_02, u2c_03, NULL, NULL, NULL, NULL, 9292 NULL, NULL, u2c_02, u2c_03, NULL, NULL, NULL, NULL,
9293 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 9293 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9294 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 9294 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -9322,7 +9322,7 @@ static unsigned char *page_uni2charset[256] = {
9322 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 9322 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9323 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, u2c_FE, u2c_FF, }; 9323 NULL, u2c_F9, u2c_FA, NULL, NULL, NULL, u2c_FE, u2c_FF, };
9324 9324
9325static unsigned char charset2lower[256] = { 9325static const unsigned char charset2lower[256] = {
9326 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 9326 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
9327 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 9327 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
9328 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 9328 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -9358,7 +9358,7 @@ static unsigned char charset2lower[256] = {
9358 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 9358 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
9359}; 9359};
9360 9360
9361static unsigned char charset2upper[256] = { 9361static const unsigned char charset2upper[256] = {
9362 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 9362 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
9363 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 9363 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
9364 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 9364 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -9397,7 +9397,7 @@ static unsigned char charset2upper[256] = {
9397static int uni2char(const wchar_t uni, 9397static int uni2char(const wchar_t uni,
9398 unsigned char *out, int boundlen) 9398 unsigned char *out, int boundlen)
9399{ 9399{
9400 unsigned char *uni2charset; 9400 const unsigned char *uni2charset;
9401 unsigned char cl = uni&0xFF; 9401 unsigned char cl = uni&0xFF;
9402 unsigned char ch = (uni>>8)&0xFF; 9402 unsigned char ch = (uni>>8)&0xFF;
9403 int n; 9403 int n;
@@ -9429,7 +9429,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
9429 wchar_t *uni) 9429 wchar_t *uni)
9430{ 9430{
9431 unsigned char ch, cl; 9431 unsigned char ch, cl;
9432 wchar_t *charset2uni; 9432 const wchar_t *charset2uni;
9433 int n; 9433 int n;
9434 9434
9435 if (boundlen <= 0) 9435 if (boundlen <= 0)
diff --git a/fs/nls/nls_euc-jp.c b/fs/nls/nls_euc-jp.c
index 73293511578b..7424929a278b 100644
--- a/fs/nls/nls_euc-jp.c
+++ b/fs/nls/nls_euc-jp.c
@@ -57,7 +57,7 @@ static struct nls_table *p_nls;
57} while(0) 57} while(0)
58 58
59/* SJIS IBM extended characters to EUC map */ 59/* SJIS IBM extended characters to EUC map */
60static unsigned char sjisibm2euc_map[][2] = { 60static const unsigned char sjisibm2euc_map[][2] = {
61 {0xF3, 0xF3}, {0xF3, 0xF4}, {0xF3, 0xF5}, {0xF3, 0xF6}, {0xF3, 0xF7}, 61 {0xF3, 0xF3}, {0xF3, 0xF4}, {0xF3, 0xF5}, {0xF3, 0xF6}, {0xF3, 0xF7},
62 {0xF3, 0xF8}, {0xF3, 0xF9}, {0xF3, 0xFA}, {0xF3, 0xFB}, {0xF3, 0xFC}, 62 {0xF3, 0xF8}, {0xF3, 0xF9}, {0xF3, 0xFA}, {0xF3, 0xFB}, {0xF3, 0xFC},
63 {0xF3, 0xFD}, {0xF3, 0xFE}, {0xF4, 0xA1}, {0xF4, 0xA2}, {0xF4, 0xA3}, 63 {0xF3, 0xFD}, {0xF3, 0xFE}, {0xF4, 0xA1}, {0xF4, 0xA2}, {0xF4, 0xA3},
@@ -243,7 +243,7 @@ static struct {
243}; 243};
244 244
245/* EUC to SJIS IBM extended characters map (G3 Upper block) */ 245/* EUC to SJIS IBM extended characters map (G3 Upper block) */
246static unsigned char euc2sjisibm_g3upper_map[][2] = { 246static const unsigned char euc2sjisibm_g3upper_map[][2] = {
247 {0xFA, 0x40}, {0xFA, 0x41}, {0xFA, 0x42}, {0xFA, 0x43}, {0xFA, 0x44}, 247 {0xFA, 0x40}, {0xFA, 0x41}, {0xFA, 0x42}, {0xFA, 0x43}, {0xFA, 0x44},
248 {0xFA, 0x45}, {0xFA, 0x46}, {0xFA, 0x47}, {0xFA, 0x48}, {0xFA, 0x49}, 248 {0xFA, 0x45}, {0xFA, 0x46}, {0xFA, 0x47}, {0xFA, 0x48}, {0xFA, 0x49},
249 {0xFA, 0x4A}, {0xFA, 0x4B}, {0xFA, 0x4C}, {0xFA, 0x4D}, {0xFA, 0x4E}, 249 {0xFA, 0x4A}, {0xFA, 0x4B}, {0xFA, 0x4C}, {0xFA, 0x4D}, {0xFA, 0x4E},
diff --git a/fs/nls/nls_iso8859-1.c b/fs/nls/nls_iso8859-1.c
index 2483c3c6c1c1..7b951bb5849c 100644
--- a/fs/nls/nls_iso8859-1.c
+++ b/fs/nls/nls_iso8859-1.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00fc, 0x00fd, 0x00fe, 0x00ff, 96 0x00fc, 0x00fd, 0x00fe, 0x00ff,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,11 +132,11 @@ static unsigned char page00[256] = {
132 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 132 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char *page_uni2charset[256] = { 135static const unsigned char *const page_uni2charset[256] = {
136 page00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 136 page00, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
137}; 137};
138 138
139static unsigned char charset2lower[256] = { 139static const unsigned char charset2lower[256] = {
140 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 140 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
141 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 141 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
142 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 142 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -172,7 +172,7 @@ static unsigned char charset2lower[256] = {
172 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 172 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
173}; 173};
174 174
175static unsigned char charset2upper[256] = { 175static const unsigned char charset2upper[256] = {
176 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 176 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
177 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 177 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
178 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 178 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -210,7 +210,7 @@ static unsigned char charset2upper[256] = {
210 210
211static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 211static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
212{ 212{
213 unsigned char *uni2charset; 213 const unsigned char *uni2charset;
214 unsigned char cl = uni & 0x00ff; 214 unsigned char cl = uni & 0x00ff;
215 unsigned char ch = (uni & 0xff00) >> 8; 215 unsigned char ch = (uni & 0xff00) >> 8;
216 216
diff --git a/fs/nls/nls_iso8859-13.c b/fs/nls/nls_iso8859-13.c
index 7b8721d74368..c4d52ea9f092 100644
--- a/fs/nls/nls_iso8859-13.c
+++ b/fs/nls/nls_iso8859-13.c
@@ -11,7 +11,7 @@
11#include <linux/nls.h> 11#include <linux/nls.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13 13
14static wchar_t charset2uni[256] = { 14static const wchar_t charset2uni[256] = {
15 /* 0x00*/ 15 /* 0x00*/
16 0x0000, 0x0001, 0x0002, 0x0003, 16 0x0000, 0x0001, 0x0002, 0x0003,
17 0x0004, 0x0005, 0x0006, 0x0007, 17 0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
94 0x00fc, 0x017c, 0x017e, 0x2019, 94 0x00fc, 0x017c, 0x017e, 0x2019,
95}; 95};
96 96
97static unsigned char page00[256] = { 97static const unsigned char page00[256] = {
98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -130,7 +130,7 @@ static unsigned char page00[256] = {
130 0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 130 0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
131}; 131};
132 132
133static unsigned char page01[256] = { 133static const unsigned char page01[256] = {
134 0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */ 134 0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */
135 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ 135 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
136 0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */ 136 0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */
@@ -149,14 +149,14 @@ static unsigned char page01[256] = {
149 0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */ 149 0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */
150}; 150};
151 151
152static unsigned char page20[256] = { 152static const unsigned char page20[256] = {
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
156 0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */ 156 0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */
157}; 157};
158 158
159static unsigned char *page_uni2charset[256] = { 159static const unsigned char *const page_uni2charset[256] = {
160 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 160 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
161 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 161 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
162 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 162 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -164,7 +164,7 @@ static unsigned char *page_uni2charset[256] = {
164 page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 164 page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
165}; 165};
166 166
167static unsigned char charset2lower[256] = { 167static const unsigned char charset2lower[256] = {
168 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 168 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
169 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 169 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
170 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 170 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -200,7 +200,7 @@ static unsigned char charset2lower[256] = {
200 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 200 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
201}; 201};
202 202
203static unsigned char charset2upper[256] = { 203static const unsigned char charset2upper[256] = {
204 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 204 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
205 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 205 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
206 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 206 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -238,7 +238,7 @@ static unsigned char charset2upper[256] = {
238 238
239static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 239static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
240{ 240{
241 unsigned char *uni2charset; 241 const unsigned char *uni2charset;
242 unsigned char cl = uni & 0x00ff; 242 unsigned char cl = uni & 0x00ff;
243 unsigned char ch = (uni & 0xff00) >> 8; 243 unsigned char ch = (uni & 0xff00) >> 8;
244 244
diff --git a/fs/nls/nls_iso8859-14.c b/fs/nls/nls_iso8859-14.c
index 2e895e638dba..dc02600c7fe1 100644
--- a/fs/nls/nls_iso8859-14.c
+++ b/fs/nls/nls_iso8859-14.c
@@ -18,7 +18,7 @@
18#include <linux/nls.h> 18#include <linux/nls.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20 20
21static wchar_t charset2uni[256] = { 21static const wchar_t charset2uni[256] = {
22 /* 0x00*/ 22 /* 0x00*/
23 0x0000, 0x0001, 0x0002, 0x0003, 23 0x0000, 0x0001, 0x0002, 0x0003,
24 0x0004, 0x0005, 0x0006, 0x0007, 24 0x0004, 0x0005, 0x0006, 0x0007,
@@ -101,7 +101,7 @@ static wchar_t charset2uni[256] = {
101 0x00fc, 0x00fd, 0x0177, 0x00ff, 101 0x00fc, 0x00fd, 0x0177, 0x00ff,
102}; 102};
103 103
104static unsigned char page00[256] = { 104static const unsigned char page00[256] = {
105 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 105 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
106 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 106 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
107 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 107 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -137,7 +137,7 @@ static unsigned char page00[256] = {
137 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */ 137 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */
138}; 138};
139 139
140static unsigned char page01[256] = { 140static const unsigned char page01[256] = {
141 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 141 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
142 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 142 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -173,7 +173,7 @@ static unsigned char page01[256] = {
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
174}; 174};
175 175
176static unsigned char page1e[256] = { 176static const unsigned char page1e[256] = {
177 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 177 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
178 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 178 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page1e[256] = {
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
210}; 210};
211 211
212static unsigned char *page_uni2charset[256] = { 212static const unsigned char *const page_uni2charset[256] = {
213 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 213 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
215 215
@@ -220,7 +220,7 @@ static unsigned char *page_uni2charset[256] = {
220 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 220 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
221}; 221};
222 222
223static unsigned char charset2lower[256] = { 223static const unsigned char charset2lower[256] = {
224 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 224 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
225 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 225 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
226 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 226 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -256,7 +256,7 @@ static unsigned char charset2lower[256] = {
256 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 256 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
257}; 257};
258 258
259static unsigned char charset2upper[256] = { 259static const unsigned char charset2upper[256] = {
260 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 260 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
261 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 261 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
262 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 262 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -294,7 +294,7 @@ static unsigned char charset2upper[256] = {
294 294
295static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 295static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
296{ 296{
297 unsigned char *uni2charset; 297 const unsigned char *uni2charset;
298 unsigned char cl = uni & 0x00ff; 298 unsigned char cl = uni & 0x00ff;
299 unsigned char ch = (uni & 0xff00) >> 8; 299 unsigned char ch = (uni & 0xff00) >> 8;
300 300
diff --git a/fs/nls/nls_iso8859-15.c b/fs/nls/nls_iso8859-15.c
index 5c91592779fe..3c7dfc832ef1 100644
--- a/fs/nls/nls_iso8859-15.c
+++ b/fs/nls/nls_iso8859-15.c
@@ -11,7 +11,7 @@
11#include <linux/nls.h> 11#include <linux/nls.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13 13
14static wchar_t charset2uni[256] = { 14static const wchar_t charset2uni[256] = {
15 /* 0x00*/ 15 /* 0x00*/
16 0x0000, 0x0001, 0x0002, 0x0003, 16 0x0000, 0x0001, 0x0002, 0x0003,
17 0x0004, 0x0005, 0x0006, 0x0007, 17 0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
94 0x00fc, 0x00fd, 0x00fe, 0x00ff, 94 0x00fc, 0x00fd, 0x00fe, 0x00ff,
95}; 95};
96 96
97static unsigned char page00[256] = { 97static const unsigned char page00[256] = {
98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -130,7 +130,7 @@ static unsigned char page00[256] = {
130 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 130 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
131}; 131};
132 132
133static unsigned char page01[256] = { 133static const unsigned char page01[256] = {
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -149,7 +149,7 @@ static unsigned char page01[256] = {
149 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ 149 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */
150}; 150};
151 151
152static unsigned char page20[256] = { 152static const unsigned char page20[256] = {
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -175,7 +175,7 @@ static unsigned char page20[256] = {
175 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 175 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
176}; 176};
177 177
178static unsigned char *page_uni2charset[256] = { 178static const unsigned char *const page_uni2charset[256] = {
179 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 179 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
180 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 180 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
181 181
@@ -186,7 +186,7 @@ static unsigned char *page_uni2charset[256] = {
186 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 186 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
187}; 187};
188 188
189static unsigned char charset2lower[256] = { 189static const unsigned char charset2lower[256] = {
190 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 190 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
191 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 191 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
192 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 192 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -222,7 +222,7 @@ static unsigned char charset2lower[256] = {
222 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 222 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
223}; 223};
224 224
225static unsigned char charset2upper[256] = { 225static const unsigned char charset2upper[256] = {
226 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 226 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
227 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 227 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
228 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 228 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -260,7 +260,7 @@ static unsigned char charset2upper[256] = {
260 260
261static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 261static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
262{ 262{
263 unsigned char *uni2charset; 263 const unsigned char *uni2charset;
264 unsigned char cl = uni & 0x00ff; 264 unsigned char cl = uni & 0x00ff;
265 unsigned char ch = (uni & 0xff00) >> 8; 265 unsigned char ch = (uni & 0xff00) >> 8;
266 266
diff --git a/fs/nls/nls_iso8859-2.c b/fs/nls/nls_iso8859-2.c
index 892d38fe9530..a2d2197e4c77 100644
--- a/fs/nls/nls_iso8859-2.c
+++ b/fs/nls/nls_iso8859-2.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00fc, 0x00fd, 0x0163, 0x02d9, 96 0x00fc, 0x00fd, 0x0163, 0x02d9,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */ 136 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */
138 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
151 0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ 151 0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */
152}; 152};
153 153
154static unsigned char page02[256] = { 154static const unsigned char page02[256] = {
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,11 +183,11 @@ static unsigned char page02[256] = {
183 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ 183 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */
184}; 184};
185 185
186static unsigned char *page_uni2charset[256] = { 186static const unsigned char *const page_uni2charset[256] = {
187 page00, page01, page02, NULL, NULL, NULL, NULL, NULL, 187 page00, page01, page02, NULL, NULL, NULL, NULL, NULL,
188}; 188};
189 189
190static unsigned char charset2lower[256] = { 190static const unsigned char charset2lower[256] = {
191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -223,7 +223,7 @@ static unsigned char charset2lower[256] = {
223 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 223 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
224}; 224};
225 225
226static unsigned char charset2upper[256] = { 226static const unsigned char charset2upper[256] = {
227 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 227 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
228 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 228 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
229 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 229 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -261,7 +261,7 @@ static unsigned char charset2upper[256] = {
261 261
262static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 262static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
263{ 263{
264 unsigned char *uni2charset; 264 const unsigned char *uni2charset;
265 unsigned char cl = uni & 0x00ff; 265 unsigned char cl = uni & 0x00ff;
266 unsigned char ch = (uni & 0xff00) >> 8; 266 unsigned char ch = (uni & 0xff00) >> 8;
267 267
diff --git a/fs/nls/nls_iso8859-3.c b/fs/nls/nls_iso8859-3.c
index 49317bcdb4be..a61e0daa3a86 100644
--- a/fs/nls/nls_iso8859-3.c
+++ b/fs/nls/nls_iso8859-3.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00fc, 0x016d, 0x015d, 0x02d9, 96 0x00fc, 0x016d, 0x015d, 0x02d9,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
151 0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 151 0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */
152}; 152};
153 153
154static unsigned char page02[256] = { 154static const unsigned char page02[256] = {
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,11 +183,11 @@ static unsigned char page02[256] = {
183 0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 183 0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
184}; 184};
185 185
186static unsigned char *page_uni2charset[256] = { 186static const unsigned char *const page_uni2charset[256] = {
187 page00, page01, page02, NULL, NULL, NULL, NULL, NULL, 187 page00, page01, page02, NULL, NULL, NULL, NULL, NULL,
188}; 188};
189 189
190static unsigned char charset2lower[256] = { 190static const unsigned char charset2lower[256] = {
191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -223,7 +223,7 @@ static unsigned char charset2lower[256] = {
223 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 223 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
224}; 224};
225 225
226static unsigned char charset2upper[256] = { 226static const unsigned char charset2upper[256] = {
227 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 227 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
228 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 228 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
229 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 229 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -261,7 +261,7 @@ static unsigned char charset2upper[256] = {
261 261
262static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 262static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
263{ 263{
264 unsigned char *uni2charset; 264 const unsigned char *uni2charset;
265 unsigned char cl = uni & 0x00ff; 265 unsigned char cl = uni & 0x00ff;
266 unsigned char ch = (uni & 0xff00) >> 8; 266 unsigned char ch = (uni & 0xff00) >> 8;
267 267
diff --git a/fs/nls/nls_iso8859-4.c b/fs/nls/nls_iso8859-4.c
index 9f3b9368c2cf..e8ff555483b6 100644
--- a/fs/nls/nls_iso8859-4.c
+++ b/fs/nls/nls_iso8859-4.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00fc, 0x0169, 0x016b, 0x02d9, 96 0x00fc, 0x0169, 0x016b, 0x02d9,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 132 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ 136 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
138 0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ 138 0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
151 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ 151 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */
152}; 152};
153 153
154static unsigned char page02[256] = { 154static const unsigned char page02[256] = {
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,11 +183,11 @@ static unsigned char page02[256] = {
183 0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 183 0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
184}; 184};
185 185
186static unsigned char *page_uni2charset[256] = { 186static const unsigned char *const page_uni2charset[256] = {
187 page00, page01, page02, NULL, NULL, NULL, NULL, NULL, 187 page00, page01, page02, NULL, NULL, NULL, NULL, NULL,
188}; 188};
189 189
190static unsigned char charset2lower[256] = { 190static const unsigned char charset2lower[256] = {
191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -223,7 +223,7 @@ static unsigned char charset2lower[256] = {
223 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 223 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
224}; 224};
225 225
226static unsigned char charset2upper[256] = { 226static const unsigned char charset2upper[256] = {
227 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 227 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
228 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 228 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
229 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 229 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -261,7 +261,7 @@ static unsigned char charset2upper[256] = {
261 261
262static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 262static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
263{ 263{
264 unsigned char *uni2charset; 264 const unsigned char *uni2charset;
265 unsigned char cl = uni & 0x00ff; 265 unsigned char cl = uni & 0x00ff;
266 unsigned char ch = (uni & 0xff00) >> 8; 266 unsigned char ch = (uni & 0xff00) >> 8;
267 267
diff --git a/fs/nls/nls_iso8859-5.c b/fs/nls/nls_iso8859-5.c
index 001a2bb132ce..4721e8930124 100644
--- a/fs/nls/nls_iso8859-5.c
+++ b/fs/nls/nls_iso8859-5.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x045c, 0x00a7, 0x045e, 0x045f, 96 0x045c, 0x00a7, 0x045e, 0x045f,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -122,7 +122,7 @@ static unsigned char page00[256] = {
122 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 122 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
123}; 123};
124 124
125static unsigned char page04[256] = { 125static const unsigned char page04[256] = {
126 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 126 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */
127 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ 127 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */
128 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 128 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */
@@ -137,13 +137,13 @@ static unsigned char page04[256] = {
137 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ 137 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */
138}; 138};
139 139
140static unsigned char page21[256] = { 140static const unsigned char page21[256] = {
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, /* 0x10-0x17 */ 143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, /* 0x10-0x17 */
144}; 144};
145 145
146static unsigned char *page_uni2charset[256] = { 146static const unsigned char *const page_uni2charset[256] = {
147 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL, 147 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL,
148 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 148 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
149 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 149 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -151,7 +151,7 @@ static unsigned char *page_uni2charset[256] = {
151 NULL, page21, NULL, NULL, NULL, NULL, NULL, NULL, 151 NULL, page21, NULL, NULL, NULL, NULL, NULL, NULL,
152}; 152};
153 153
154static unsigned char charset2lower[256] = { 154static const unsigned char charset2lower[256] = {
155 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 155 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
156 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 156 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
157 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 157 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -187,7 +187,7 @@ static unsigned char charset2lower[256] = {
187 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 187 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
188}; 188};
189 189
190static unsigned char charset2upper[256] = { 190static const unsigned char charset2upper[256] = {
191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char charset2upper[256] = {
225 225
226static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 226static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
227{ 227{
228 unsigned char *uni2charset; 228 const unsigned char *uni2charset;
229 unsigned char cl = uni & 0x00ff; 229 unsigned char cl = uni & 0x00ff;
230 unsigned char ch = (uni & 0xff00) >> 8; 230 unsigned char ch = (uni & 0xff00) >> 8;
231 231
diff --git a/fs/nls/nls_iso8859-6.c b/fs/nls/nls_iso8859-6.c
index 8cec03d66088..01a517d6d306 100644
--- a/fs/nls/nls_iso8859-6.c
+++ b/fs/nls/nls_iso8859-6.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x0000, 0x0000, 0x0000, 0x0000, 96 0x0000, 0x0000, 0x0000, 0x0000,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -122,7 +122,7 @@ static unsigned char page00[256] = {
122 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 122 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
123}; 123};
124 124
125static unsigned char page06[256] = { 125static const unsigned char page06[256] = {
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
127 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 127 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -139,11 +139,11 @@ static unsigned char page06[256] = {
139 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 139 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
140}; 140};
141 141
142static unsigned char *page_uni2charset[256] = { 142static const unsigned char *const page_uni2charset[256] = {
143 page00, NULL, NULL, NULL, NULL, NULL, page06, NULL, 143 page00, NULL, NULL, NULL, NULL, NULL, page06, NULL,
144}; 144};
145 145
146static unsigned char charset2lower[256] = { 146static const unsigned char charset2lower[256] = {
147 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 147 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
148 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 148 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
149 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 149 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -179,7 +179,7 @@ static unsigned char charset2lower[256] = {
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ 179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
180}; 180};
181 181
182static unsigned char charset2upper[256] = { 182static const unsigned char charset2upper[256] = {
183 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 183 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
184 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 184 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
185 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 185 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -216,7 +216,7 @@ static unsigned char charset2upper[256] = {
216 216
217static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 217static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
218{ 218{
219 unsigned char *uni2charset; 219 const unsigned char *uni2charset;
220 unsigned char cl = uni & 0x00ff; 220 unsigned char cl = uni & 0x00ff;
221 unsigned char ch = (uni & 0xff00) >> 8; 221 unsigned char ch = (uni & 0xff00) >> 8;
222 222
diff --git a/fs/nls/nls_iso8859-7.c b/fs/nls/nls_iso8859-7.c
index 1be707d5ac31..2d27b93ef19e 100644
--- a/fs/nls/nls_iso8859-7.c
+++ b/fs/nls/nls_iso8859-7.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x03cc, 0x03cd, 0x03ce, 0x0000, 96 0x03cc, 0x03cd, 0x03ce, 0x0000,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -124,7 +124,7 @@ static unsigned char page00[256] = {
124 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ 124 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */
125}; 125};
126 126
127static unsigned char page02[256] = { 127static const unsigned char page02[256] = {
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page02[256] = {
152 0x00, 0x00, 0x00, 0x00, 0xa2, 0xa1, 0x00, 0x00, /* 0xb8-0xbf */ 152 0x00, 0x00, 0x00, 0x00, 0xa2, 0xa1, 0x00, 0x00, /* 0xb8-0xbf */
153}; 153};
154 154
155static unsigned char page03[256] = { 155static const unsigned char page03[256] = {
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -182,13 +182,13 @@ static unsigned char page03[256] = {
182 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */ 182 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */
183}; 183};
184 184
185static unsigned char page20[256] = { 185static const unsigned char page20[256] = {
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
188 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */ 188 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */
189}; 189};
190 190
191static unsigned char *page_uni2charset[256] = { 191static const unsigned char *const page_uni2charset[256] = {
192 page00, NULL, page02, page03, NULL, NULL, NULL, NULL, 192 page00, NULL, page02, page03, NULL, NULL, NULL, NULL,
193 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 193 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
194 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 194 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -196,7 +196,7 @@ static unsigned char *page_uni2charset[256] = {
196 page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 196 page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
197}; 197};
198 198
199static unsigned char charset2lower[256] = { 199static const unsigned char charset2lower[256] = {
200 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 200 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
201 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 201 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
202 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 202 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -232,7 +232,7 @@ static unsigned char charset2lower[256] = {
232 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ 232 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
233}; 233};
234 234
235static unsigned char charset2upper[256] = { 235static const unsigned char charset2upper[256] = {
236 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 236 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
237 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 237 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
238 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 238 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -270,7 +270,7 @@ static unsigned char charset2upper[256] = {
270 270
271static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 271static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
272{ 272{
273 unsigned char *uni2charset; 273 const unsigned char *uni2charset;
274 unsigned char cl = uni & 0x00ff; 274 unsigned char cl = uni & 0x00ff;
275 unsigned char ch = (uni & 0xff00) >> 8; 275 unsigned char ch = (uni & 0xff00) >> 8;
276 276
diff --git a/fs/nls/nls_iso8859-9.c b/fs/nls/nls_iso8859-9.c
index 8c0146f73834..694bf070c721 100644
--- a/fs/nls/nls_iso8859-9.c
+++ b/fs/nls/nls_iso8859-9.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x00fc, 0x0131, 0x015f, 0x00ff, 96 0x00fc, 0x0131, 0x015f, 0x00ff,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
132 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ 132 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */
133}; 133};
134 134
135static unsigned char page01[256] = { 135static const unsigned char page01[256] = {
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -147,11 +147,11 @@ static unsigned char page01[256] = {
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ 147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */
148}; 148};
149 149
150static unsigned char *page_uni2charset[256] = { 150static const unsigned char *const page_uni2charset[256] = {
151 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, 151 page00, page01, NULL, NULL, NULL, NULL, NULL, NULL,
152}; 152};
153 153
154static unsigned char charset2lower[256] = { 154static const unsigned char charset2lower[256] = {
155 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 155 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
156 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 156 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
157 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 157 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -187,7 +187,7 @@ static unsigned char charset2lower[256] = {
187 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ 187 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
188}; 188};
189 189
190static unsigned char charset2upper[256] = { 190static const unsigned char charset2upper[256] = {
191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char charset2upper[256] = {
225 225
226static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 226static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
227{ 227{
228 unsigned char *uni2charset; 228 const unsigned char *uni2charset;
229 unsigned char cl = uni & 0x00ff; 229 unsigned char cl = uni & 0x00ff;
230 unsigned char ch = (uni & 0xff00) >> 8; 230 unsigned char ch = (uni & 0xff00) >> 8;
231 231
diff --git a/fs/nls/nls_koi8-r.c b/fs/nls/nls_koi8-r.c
index fefbe0807265..43875310540d 100644
--- a/fs/nls/nls_koi8-r.c
+++ b/fs/nls/nls_koi8-r.c
@@ -13,7 +13,7 @@
13#include <linux/nls.h> 13#include <linux/nls.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15 15
16static wchar_t charset2uni[256] = { 16static const wchar_t charset2uni[256] = {
17 /* 0x00*/ 17 /* 0x00*/
18 0x0000, 0x0001, 0x0002, 0x0003, 18 0x0000, 0x0001, 0x0002, 0x0003,
19 0x0004, 0x0005, 0x0006, 0x0007, 19 0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
96 0x042d, 0x0429, 0x0427, 0x042a, 96 0x042d, 0x0429, 0x0427, 0x042a,
97}; 97};
98 98
99static unsigned char page00[256] = { 99static const unsigned char page00[256] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 101 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -131,7 +131,7 @@ static unsigned char page00[256] = {
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ 131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */
132}; 132};
133 133
134static unsigned char page04[256] = { 134static const unsigned char page04[256] = {
135 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 135 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
137 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ 137 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */
@@ -145,7 +145,7 @@ static unsigned char page04[256] = {
145 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 145 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
146}; 146};
147 147
148static unsigned char page22[256] = { 148static const unsigned char page22[256] = {
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -161,7 +161,7 @@ static unsigned char page22[256] = {
161 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ 161 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */
162}; 162};
163 163
164static unsigned char page23[256] = { 164static const unsigned char page23[256] = {
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -169,7 +169,7 @@ static unsigned char page23[256] = {
169 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 169 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
170}; 170};
171 171
172static unsigned char page25[256] = { 172static const unsigned char page25[256] = {
173 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 173 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
174 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 174 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */
175 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 175 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -194,7 +194,7 @@ static unsigned char page25[256] = {
194 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 194 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
195}; 195};
196 196
197static unsigned char *page_uni2charset[256] = { 197static const unsigned char *const page_uni2charset[256] = {
198 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL, 198 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL,
199 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 199 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
200 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 200 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -202,7 +202,7 @@ static unsigned char *page_uni2charset[256] = {
202 NULL, NULL, page22, page23, NULL, page25, NULL, NULL, 202 NULL, NULL, page22, page23, NULL, page25, NULL, NULL,
203}; 203};
204 204
205static unsigned char charset2lower[256] = { 205static const unsigned char charset2lower[256] = {
206 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 206 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
207 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 207 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
208 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 208 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -238,7 +238,7 @@ static unsigned char charset2lower[256] = {
238 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */ 238 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */
239}; 239};
240 240
241static unsigned char charset2upper[256] = { 241static const unsigned char charset2upper[256] = {
242 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 242 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
243 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 243 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
244 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 244 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -276,7 +276,7 @@ static unsigned char charset2upper[256] = {
276 276
277static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 277static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
278{ 278{
279 unsigned char *uni2charset; 279 const unsigned char *uni2charset;
280 unsigned char cl = uni & 0x00ff; 280 unsigned char cl = uni & 0x00ff;
281 unsigned char ch = (uni & 0xff00) >> 8; 281 unsigned char ch = (uni & 0xff00) >> 8;
282 282
diff --git a/fs/nls/nls_koi8-u.c b/fs/nls/nls_koi8-u.c
index 015070211f22..8c9f0292b5ae 100644
--- a/fs/nls/nls_koi8-u.c
+++ b/fs/nls/nls_koi8-u.c
@@ -11,7 +11,7 @@
11#include <linux/nls.h> 11#include <linux/nls.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13 13
14static wchar_t charset2uni[256] = { 14static const wchar_t charset2uni[256] = {
15 /* 0x00*/ 15 /* 0x00*/
16 0x0000, 0x0001, 0x0002, 0x0003, 16 0x0000, 0x0001, 0x0002, 0x0003,
17 0x0004, 0x0005, 0x0006, 0x0007, 17 0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
94 0x042d, 0x0429, 0x0427, 0x042a, 94 0x042d, 0x0429, 0x0427, 0x042a,
95}; 95};
96 96
97static unsigned char page00[256] = { 97static const unsigned char page00[256] = {
98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 98 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 99 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 100 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -129,7 +129,7 @@ static unsigned char page00[256] = {
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ 129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */
130}; 130};
131 131
132static unsigned char page04[256] = { 132static const unsigned char page04[256] = {
133 0x00, 0xb3, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0xb7, /* 0x00-0x07 */ 133 0x00, 0xb3, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0xb7, /* 0x00-0x07 */
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
135 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ 135 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page04[256] = {
152 0xbd, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 152 0xbd, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
153}; 153};
154 154
155static unsigned char page22[256] = { 155static const unsigned char page22[256] = {
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -168,7 +168,7 @@ static unsigned char page22[256] = {
168 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ 168 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */
169}; 169};
170 170
171static unsigned char page23[256] = { 171static const unsigned char page23[256] = {
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -176,7 +176,7 @@ static unsigned char page23[256] = {
176 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 176 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
177}; 177};
178 178
179static unsigned char page25[256] = { 179static const unsigned char page25[256] = {
180 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 180 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
181 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 181 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */
182 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 182 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -201,7 +201,7 @@ static unsigned char page25[256] = {
201 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 201 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
202}; 202};
203 203
204static unsigned char *page_uni2charset[256] = { 204static const unsigned char *const page_uni2charset[256] = {
205 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL, 205 page00, NULL, NULL, NULL, page04, NULL, NULL, NULL,
206 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 206 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
207 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 207 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -209,7 +209,7 @@ static unsigned char *page_uni2charset[256] = {
209 NULL, NULL, page22, page23, NULL, page25, NULL, NULL, 209 NULL, NULL, page22, page23, NULL, page25, NULL, NULL,
210}; 210};
211 211
212static unsigned char charset2lower[256] = { 212static const unsigned char charset2lower[256] = {
213 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 213 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
214 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 214 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
215 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 215 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -245,7 +245,7 @@ static unsigned char charset2lower[256] = {
245 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */ 245 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */
246}; 246};
247 247
248static unsigned char charset2upper[256] = { 248static const unsigned char charset2upper[256] = {
249 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 249 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
250 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 250 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
251 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 251 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -283,7 +283,7 @@ static unsigned char charset2upper[256] = {
283 283
284static int uni2char(wchar_t uni, unsigned char *out, int boundlen) 284static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
285{ 285{
286 unsigned char *uni2charset; 286 const unsigned char *uni2charset;
287 unsigned char cl = uni & 0x00ff; 287 unsigned char cl = uni & 0x00ff;
288 unsigned char ch = (uni & 0xff00) >> 8; 288 unsigned char ch = (uni & 0xff00) >> 8;
289 289
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index c814204d4ea0..6cd08dfdc2ed 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -61,7 +61,7 @@ static int ntfs_file_open(struct inode *vi, struct file *filp)
61{ 61{
62 if (sizeof(unsigned long) < 8) { 62 if (sizeof(unsigned long) < 8) {
63 if (i_size_read(vi) > MAX_LFS_FILESIZE) 63 if (i_size_read(vi) > MAX_LFS_FILESIZE)
64 return -EFBIG; 64 return -EOVERFLOW;
65 } 65 }
66 return generic_file_open(vi, filp); 66 return generic_file_open(vi, filp);
67} 67}
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 90c4e3a29706..3e76f3b216bc 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -2381,14 +2381,14 @@ static void ntfs_put_super(struct super_block *sb)
2381 */ 2381 */
2382 ntfs_commit_inode(vol->mft_ino); 2382 ntfs_commit_inode(vol->mft_ino);
2383 write_inode_now(vol->mft_ino, 1); 2383 write_inode_now(vol->mft_ino, 1);
2384 if (!list_empty(&sb->s_dirty)) { 2384 if (sb_has_dirty_inodes(sb)) {
2385 const char *s1, *s2; 2385 const char *s1, *s2;
2386 2386
2387 mutex_lock(&vol->mft_ino->i_mutex); 2387 mutex_lock(&vol->mft_ino->i_mutex);
2388 truncate_inode_pages(vol->mft_ino->i_mapping, 0); 2388 truncate_inode_pages(vol->mft_ino->i_mapping, 0);
2389 mutex_unlock(&vol->mft_ino->i_mutex); 2389 mutex_unlock(&vol->mft_ino->i_mutex);
2390 write_inode_now(vol->mft_ino, 1); 2390 write_inode_now(vol->mft_ino, 1);
2391 if (!list_empty(&sb->s_dirty)) { 2391 if (sb_has_dirty_inodes(sb)) {
2392 static const char *_s1 = "inodes"; 2392 static const char *_s1 = "inodes";
2393 static const char *_s2 = ""; 2393 static const char *_s2 = "";
2394 s1 = _s1; 2394 s1 = _s1;
@@ -3080,8 +3080,7 @@ struct kmem_cache *ntfs_inode_cache;
3080struct kmem_cache *ntfs_big_inode_cache; 3080struct kmem_cache *ntfs_big_inode_cache;
3081 3081
3082/* Init once constructor for the inode slab cache. */ 3082/* Init once constructor for the inode slab cache. */
3083static void ntfs_big_inode_init_once(void *foo, struct kmem_cache *cachep, 3083static void ntfs_big_inode_init_once(struct kmem_cache *cachep, void *foo)
3084 unsigned long flags)
3085{ 3084{
3086 ntfs_inode *ni = (ntfs_inode *)foo; 3085 ntfs_inode *ni = (ntfs_inode *)foo;
3087 3086
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 7453b70c1a19..6a2f143e269c 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -586,7 +586,7 @@ bail:
586} 586}
587 587
588static int ocfs2_dir_foreach_blk_id(struct inode *inode, 588static int ocfs2_dir_foreach_blk_id(struct inode *inode,
589 unsigned long *f_version, 589 u64 *f_version,
590 loff_t *f_pos, void *priv, 590 loff_t *f_pos, void *priv,
591 filldir_t filldir, int *filldir_err) 591 filldir_t filldir, int *filldir_err)
592{ 592{
@@ -648,7 +648,7 @@ revalidate:
648 * not the directory has been modified 648 * not the directory has been modified
649 * during the copy operation. 649 * during the copy operation.
650 */ 650 */
651 unsigned long version = *f_version; 651 u64 version = *f_version;
652 unsigned char d_type = DT_UNKNOWN; 652 unsigned char d_type = DT_UNKNOWN;
653 653
654 if (de->file_type < OCFS2_FT_MAX) 654 if (de->file_type < OCFS2_FT_MAX)
@@ -677,7 +677,7 @@ out:
677} 677}
678 678
679static int ocfs2_dir_foreach_blk_el(struct inode *inode, 679static int ocfs2_dir_foreach_blk_el(struct inode *inode,
680 unsigned long *f_version, 680 u64 *f_version,
681 loff_t *f_pos, void *priv, 681 loff_t *f_pos, void *priv,
682 filldir_t filldir, int *filldir_err) 682 filldir_t filldir, int *filldir_err)
683{ 683{
@@ -798,7 +798,7 @@ out:
798 return stored; 798 return stored;
799} 799}
800 800
801static int ocfs2_dir_foreach_blk(struct inode *inode, unsigned long *f_version, 801static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version,
802 loff_t *f_pos, void *priv, filldir_t filldir, 802 loff_t *f_pos, void *priv, filldir_t filldir,
803 int *filldir_err) 803 int *filldir_err)
804{ 804{
@@ -818,7 +818,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
818 filldir_t filldir) 818 filldir_t filldir)
819{ 819{
820 int ret = 0, filldir_err = 0; 820 int ret = 0, filldir_err = 0;
821 unsigned long version = inode->i_version; 821 u64 version = inode->i_version;
822 822
823 while (*f_pos < i_size_read(inode)) { 823 while (*f_pos < i_size_read(inode)) {
824 ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv, 824 ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv,
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 7418dc83de1c..6639baab0798 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -255,9 +255,8 @@ static ssize_t dlmfs_file_write(struct file *filp,
255 return writelen; 255 return writelen;
256} 256}
257 257
258static void dlmfs_init_once(void *foo, 258static void dlmfs_init_once(struct kmem_cache *cachep,
259 struct kmem_cache *cachep, 259 void *foo)
260 unsigned long flags)
261{ 260{
262 struct dlmfs_inode_private *ip = 261 struct dlmfs_inode_private *ip =
263 (struct dlmfs_inode_private *) foo; 262 (struct dlmfs_inode_private *) foo;
@@ -588,13 +587,17 @@ static int __init init_dlmfs_fs(void)
588 587
589 dlmfs_print_version(); 588 dlmfs_print_version();
590 589
590 status = bdi_init(&dlmfs_backing_dev_info);
591 if (status)
592 return status;
593
591 dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache", 594 dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
592 sizeof(struct dlmfs_inode_private), 595 sizeof(struct dlmfs_inode_private),
593 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 596 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
594 SLAB_MEM_SPREAD), 597 SLAB_MEM_SPREAD),
595 dlmfs_init_once); 598 dlmfs_init_once);
596 if (!dlmfs_inode_cache) 599 if (!dlmfs_inode_cache)
597 return -ENOMEM; 600 goto bail;
598 cleanup_inode = 1; 601 cleanup_inode = 1;
599 602
600 user_dlm_worker = create_singlethread_workqueue("user_dlm"); 603 user_dlm_worker = create_singlethread_workqueue("user_dlm");
@@ -611,6 +614,7 @@ bail:
611 kmem_cache_destroy(dlmfs_inode_cache); 614 kmem_cache_destroy(dlmfs_inode_cache);
612 if (cleanup_worker) 615 if (cleanup_worker)
613 destroy_workqueue(user_dlm_worker); 616 destroy_workqueue(user_dlm_worker);
617 bdi_destroy(&dlmfs_backing_dev_info);
614 } else 618 } else
615 printk("OCFS2 User DLM kernel interface loaded\n"); 619 printk("OCFS2 User DLM kernel interface loaded\n");
616 return status; 620 return status;
@@ -624,6 +628,8 @@ static void __exit exit_dlmfs_fs(void)
624 destroy_workqueue(user_dlm_worker); 628 destroy_workqueue(user_dlm_worker);
625 629
626 kmem_cache_destroy(dlmfs_inode_cache); 630 kmem_cache_destroy(dlmfs_inode_cache);
631
632 bdi_destroy(&dlmfs_backing_dev_info);
627} 633}
628 634
629MODULE_AUTHOR("Oracle"); 635MODULE_AUTHOR("Oracle");
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 0e2a1b45bf92..be562ac3e89c 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1000,9 +1000,7 @@ bail:
1000 return status; 1000 return status;
1001} 1001}
1002 1002
1003static void ocfs2_inode_init_once(void *data, 1003static void ocfs2_inode_init_once(struct kmem_cache *cachep, void *data)
1004 struct kmem_cache *cachep,
1005 unsigned long flags)
1006{ 1004{
1007 struct ocfs2_inode_info *oi = data; 1005 struct ocfs2_inode_info *oi = data;
1008 1006
diff --git a/fs/open.c b/fs/open.c
index 044bfa891c94..75385144df7d 100644
--- 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)
658 newattrs.ia_gid = group; 658 newattrs.ia_gid = group;
659 } 659 }
660 if (!S_ISDIR(inode->i_mode)) 660 if (!S_ISDIR(inode->i_mode))
661 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID; 661 newattrs.ia_valid |=
662 ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
662 mutex_lock(&inode->i_mutex); 663 mutex_lock(&inode->i_mutex);
663 error = notify_change(dentry, &newattrs); 664 error = notify_change(dentry, &newattrs);
664 mutex_unlock(&inode->i_mutex); 665 mutex_unlock(&inode->i_mutex);
@@ -1177,7 +1178,7 @@ asmlinkage long sys_vhangup(void)
1177int generic_file_open(struct inode * inode, struct file * filp) 1178int generic_file_open(struct inode * inode, struct file * filp)
1178{ 1179{
1179 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) 1180 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
1180 return -EFBIG; 1181 return -EOVERFLOW;
1181 return 0; 1182 return 0;
1182} 1183}
1183 1184
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index dd86be2aa6c9..d88173840082 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -415,7 +415,7 @@ static struct file_system_type openprom_fs_type = {
415 .kill_sb = kill_anon_super, 415 .kill_sb = kill_anon_super,
416}; 416};
417 417
418static void op_inode_init_once(void *data, struct kmem_cache * cachep, unsigned long flags) 418static void op_inode_init_once(struct kmem_cache * cachep, void *data)
419{ 419{
420 struct op_inode_info *oi = (struct op_inode_info *) data; 420 struct op_inode_info *oi = (struct op_inode_info *) data;
421 421
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 78fdfea1a7f8..4fe74d156416 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -199,27 +199,6 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
199 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \ 199 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
200 security_ptrace(current,task) == 0)) 200 security_ptrace(current,task) == 0))
201 201
202static int proc_pid_environ(struct task_struct *task, char * buffer)
203{
204 int res = 0;
205 struct mm_struct *mm = get_task_mm(task);
206 if (mm) {
207 unsigned int len;
208
209 res = -ESRCH;
210 if (!ptrace_may_attach(task))
211 goto out;
212
213 len = mm->env_end - mm->env_start;
214 if (len > PAGE_SIZE)
215 len = PAGE_SIZE;
216 res = access_process_vm(task, mm->env_start, buffer, len, 0);
217out:
218 mmput(mm);
219 }
220 return res;
221}
222
223static int proc_pid_cmdline(struct task_struct *task, char * buffer) 202static int proc_pid_cmdline(struct task_struct *task, char * buffer)
224{ 203{
225 int res = 0; 204 int res = 0;
@@ -658,6 +637,76 @@ static const struct file_operations proc_mem_operations = {
658 .open = mem_open, 637 .open = mem_open,
659}; 638};
660 639
640static ssize_t environ_read(struct file *file, char __user *buf,
641 size_t count, loff_t *ppos)
642{
643 struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
644 char *page;
645 unsigned long src = *ppos;
646 int ret = -ESRCH;
647 struct mm_struct *mm;
648
649 if (!task)
650 goto out_no_task;
651
652 if (!ptrace_may_attach(task))
653 goto out;
654
655 ret = -ENOMEM;
656 page = (char *)__get_free_page(GFP_TEMPORARY);
657 if (!page)
658 goto out;
659
660 ret = 0;
661
662 mm = get_task_mm(task);
663 if (!mm)
664 goto out_free;
665
666 while (count > 0) {
667 int this_len, retval, max_len;
668
669 this_len = mm->env_end - (mm->env_start + src);
670
671 if (this_len <= 0)
672 break;
673
674 max_len = (count > PAGE_SIZE) ? PAGE_SIZE : count;
675 this_len = (this_len > max_len) ? max_len : this_len;
676
677 retval = access_process_vm(task, (mm->env_start + src),
678 page, this_len, 0);
679
680 if (retval <= 0) {
681 ret = retval;
682 break;
683 }
684
685 if (copy_to_user(buf, page, retval)) {
686 ret = -EFAULT;
687 break;
688 }
689
690 ret += retval;
691 src += retval;
692 buf += retval;
693 count -= retval;
694 }
695 *ppos = src;
696
697 mmput(mm);
698out_free:
699 free_page((unsigned long) page);
700out:
701 put_task_struct(task);
702out_no_task:
703 return ret;
704}
705
706static const struct file_operations proc_environ_operations = {
707 .read = environ_read,
708};
709
661static ssize_t oom_adjust_read(struct file *file, char __user *buf, 710static ssize_t oom_adjust_read(struct file *file, char __user *buf,
662 size_t count, loff_t *ppos) 711 size_t count, loff_t *ppos)
663{ 712{
@@ -2049,7 +2098,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2049 DIR("task", S_IRUGO|S_IXUGO, task), 2098 DIR("task", S_IRUGO|S_IXUGO, task),
2050 DIR("fd", S_IRUSR|S_IXUSR, fd), 2099 DIR("fd", S_IRUSR|S_IXUSR, fd),
2051 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2100 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo),
2052 INF("environ", S_IRUSR, pid_environ), 2101 REG("environ", S_IRUSR, environ),
2053 INF("auxv", S_IRUSR, pid_auxv), 2102 INF("auxv", S_IRUSR, pid_auxv),
2054 INF("status", S_IRUGO, pid_status), 2103 INF("status", S_IRUGO, pid_status),
2055#ifdef CONFIG_SCHED_DEBUG 2104#ifdef CONFIG_SCHED_DEBUG
@@ -2336,7 +2385,7 @@ out_no_task:
2336static const struct pid_entry tid_base_stuff[] = { 2385static const struct pid_entry tid_base_stuff[] = {
2337 DIR("fd", S_IRUSR|S_IXUSR, fd), 2386 DIR("fd", S_IRUSR|S_IXUSR, fd),
2338 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2387 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo),
2339 INF("environ", S_IRUSR, pid_environ), 2388 REG("environ", S_IRUSR, environ),
2340 INF("auxv", S_IRUSR, pid_auxv), 2389 INF("auxv", S_IRUSR, pid_auxv),
2341 INF("status", S_IRUGO, pid_status), 2390 INF("status", S_IRUGO, pid_status),
2342#ifdef CONFIG_SCHED_DEBUG 2391#ifdef CONFIG_SCHED_DEBUG
@@ -2586,7 +2635,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
2586 /* f_version caches the tgid value that the last readdir call couldn't 2635 /* f_version caches the tgid value that the last readdir call couldn't
2587 * return. lseek aka telldir automagically resets f_version to 0. 2636 * return. lseek aka telldir automagically resets f_version to 0.
2588 */ 2637 */
2589 tid = filp->f_version; 2638 tid = (int)filp->f_version;
2590 filp->f_version = 0; 2639 filp->f_version = 0;
2591 for (task = first_tid(leader, tid, pos - 2); 2640 for (task = first_tid(leader, tid, pos - 2);
2592 task; 2641 task;
@@ -2595,7 +2644,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
2595 if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) { 2644 if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) {
2596 /* returning this tgid failed, save it as the first 2645 /* returning this tgid failed, save it as the first
2597 * pid for the next readir call */ 2646 * pid for the next readir call */
2598 filp->f_version = tid; 2647 filp->f_version = (u64)tid;
2599 put_task_struct(task); 2648 put_task_struct(task);
2600 break; 2649 break;
2601 } 2650 }
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 0e4d37c93eea..99ca00485fc3 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -107,7 +107,7 @@ static void proc_destroy_inode(struct inode *inode)
107 kmem_cache_free(proc_inode_cachep, PROC_I(inode)); 107 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
108} 108}
109 109
110static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 110static void init_once(struct kmem_cache * cachep, void *foo)
111{ 111{
112 struct proc_inode *ei = (struct proc_inode *) foo; 112 struct proc_inode *ei = (struct proc_inode *) foo;
113 113
@@ -119,10 +119,8 @@ int __init proc_init_inodecache(void)
119 proc_inode_cachep = kmem_cache_create("proc_inode_cache", 119 proc_inode_cachep = kmem_cache_create("proc_inode_cache",
120 sizeof(struct proc_inode), 120 sizeof(struct proc_inode),
121 0, (SLAB_RECLAIM_ACCOUNT| 121 0, (SLAB_RECLAIM_ACCOUNT|
122 SLAB_MEM_SPREAD), 122 SLAB_MEM_SPREAD|SLAB_PANIC),
123 init_once); 123 init_once);
124 if (proc_inode_cachep == NULL)
125 return -ENOMEM;
126 return 0; 124 return 0;
127} 125}
128 126
diff --git a/fs/proc/mmu.c b/fs/proc/mmu.c
index 25d2d9c6e329..8ae221dfd010 100644
--- a/fs/proc/mmu.c
+++ b/fs/proc/mmu.c
@@ -8,27 +8,10 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11#include <linux/spinlock.h>
12#include <linux/types.h>
13#include <linux/errno.h>
14#include <linux/time.h>
15#include <linux/kernel.h>
16#include <linux/string.h>
17#include <linux/mman.h>
18#include <linux/proc_fs.h>
19#include <linux/mm.h>
20#include <linux/mmzone.h>
21#include <linux/pagemap.h>
22#include <linux/swap.h>
23#include <linux/slab.h>
24#include <linux/smp.h>
25#include <linux/seq_file.h>
26#include <linux/hugetlb.h>
27#include <linux/vmalloc.h> 12#include <linux/vmalloc.h>
28#include <asm/uaccess.h> 13#include <linux/highmem.h>
29#include <asm/pgtable.h> 14#include <asm/pgtable.h>
30#include <asm/tlb.h>
31#include <asm/div64.h>
32#include "internal.h" 15#include "internal.h"
33 16
34void get_vmalloc_info(struct vmalloc_info *vmi) 17void get_vmalloc_info(struct vmalloc_info *vmi)
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5de7f874d95c..d6dc72c78bc1 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -526,11 +526,8 @@ static int show_stat(struct seq_file *p, void *v)
526 } 526 }
527 seq_printf(p, "intr %llu", (unsigned long long)sum); 527 seq_printf(p, "intr %llu", (unsigned long long)sum);
528 528
529#ifndef CONFIG_SMP
530 /* Touches too many cache lines on SMP setups */
531 for (i = 0; i < NR_IRQS; i++) 529 for (i = 0; i < NR_IRQS; i++)
532 seq_printf(p, " %u", per_irq_sum[i]); 530 seq_printf(p, " %u", per_irq_sum[i]);
533#endif
534 531
535 seq_printf(p, 532 seq_printf(p,
536 "\nctxt %llu\n" 533 "\nctxt %llu\n"
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index df8bd87e49b7..638bdb963213 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -536,8 +536,7 @@ static void qnx4_destroy_inode(struct inode *inode)
536 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode)); 536 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode));
537} 537}
538 538
539static void init_once(void *foo, struct kmem_cache * cachep, 539static void init_once(struct kmem_cache *cachep, void *foo)
540 unsigned long flags)
541{ 540{
542 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo; 541 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo;
543 542
diff --git a/fs/ramfs/Makefile b/fs/ramfs/Makefile
index 5a0236e02ee1..c71e65dcad25 100644
--- a/fs/ramfs/Makefile
+++ b/fs/ramfs/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux ramfs routines. 2# Makefile for the linux ramfs routines.
3# 3#
4 4
5obj-$(CONFIG_RAMFS) += ramfs.o 5obj-y += ramfs.o
6 6
7file-mmu-y := file-nommu.o 7file-mmu-y := file-nommu.o
8file-mmu-$(CONFIG_MMU) := file-mmu.o 8file-mmu-$(CONFIG_MMU) := file-mmu.o
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ef2b46d099ff..8428d5b2711d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -223,7 +223,17 @@ module_exit(exit_ramfs_fs)
223 223
224int __init init_rootfs(void) 224int __init init_rootfs(void)
225{ 225{
226 return register_filesystem(&rootfs_fs_type); 226 int err;
227
228 err = bdi_init(&ramfs_backing_dev_info);
229 if (err)
230 return err;
231
232 err = register_filesystem(&rootfs_fs_type);
233 if (err)
234 bdi_destroy(&ramfs_backing_dev_info);
235
236 return err;
227} 237}
228 238
229MODULE_LICENSE("GPL"); 239MODULE_LICENSE("GPL");
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index b286ccb08587..2a5dd34649b3 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -1201,63 +1201,6 @@ int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t * hint, b_blocknr_t * new
1201 return ret; 1201 return ret;
1202} 1202}
1203 1203
1204/* These 2 functions are here to provide blocks reservation to the rest of kernel */
1205/* Reserve @blocks amount of blocks in fs pointed by @sb. Caller must make sure
1206 there are actually this much blocks on the FS available */
1207void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, /* super block of
1208 filesystem where
1209 blocks should be
1210 reserved */
1211 int blocks /* How much to reserve */
1212 )
1213{
1214
1215 /* Fast case, if reservation is zero - exit immediately. */
1216 if (!blocks)
1217 return;
1218
1219 spin_lock(&REISERFS_SB(sb)->bitmap_lock);
1220 REISERFS_SB(sb)->reserved_blocks += blocks;
1221 spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
1222}
1223
1224/* Unreserve @blocks amount of blocks in fs pointed by @sb */
1225void reiserfs_release_claimed_blocks(struct super_block *sb, /* super block of
1226 filesystem where
1227 blocks should be
1228 reserved */
1229 int blocks /* How much to unreserve */
1230 )
1231{
1232
1233 /* Fast case, if unreservation is zero - exit immediately. */
1234 if (!blocks)
1235 return;
1236
1237 spin_lock(&REISERFS_SB(sb)->bitmap_lock);
1238 REISERFS_SB(sb)->reserved_blocks -= blocks;
1239 spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
1240 RFALSE(REISERFS_SB(sb)->reserved_blocks < 0,
1241 "amount of blocks reserved became zero?");
1242}
1243
1244/* This function estimates how much pages we will be able to write to FS
1245 used for reiserfs_file_write() purposes for now. */
1246int reiserfs_can_fit_pages(struct super_block *sb /* superblock of filesystem
1247 to estimate space */ )
1248{
1249 int space;
1250
1251 spin_lock(&REISERFS_SB(sb)->bitmap_lock);
1252 space =
1253 (SB_FREE_BLOCKS(sb) -
1254 REISERFS_SB(sb)->reserved_blocks) >> (PAGE_CACHE_SHIFT -
1255 sb->s_blocksize_bits);
1256 spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
1257
1258 return space > 0 ? space : 0;
1259}
1260
1261void reiserfs_cache_bitmap_metadata(struct super_block *sb, 1204void reiserfs_cache_bitmap_metadata(struct super_block *sb,
1262 struct buffer_head *bh, 1205 struct buffer_head *bh,
1263 struct reiserfs_bitmap_info *info) 1206 struct reiserfs_bitmap_info *info)
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index ffbfc2caaf20..e6b03d2020c1 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -121,6 +121,16 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
121 continue; 121 continue;
122 d_reclen = entry_length(bh, ih, entry_num); 122 d_reclen = entry_length(bh, ih, entry_num);
123 d_name = B_I_DEH_ENTRY_FILE_NAME(bh, ih, deh); 123 d_name = B_I_DEH_ENTRY_FILE_NAME(bh, ih, deh);
124
125 if (d_reclen <= 0 ||
126 d_name + d_reclen > bh->b_data + bh->b_size) {
127 /* There is corrupted data in entry,
128 * We'd better stop here */
129 pathrelse(&path_to_entry);
130 ret = -EIO;
131 goto out;
132 }
133
124 if (!d_name[d_reclen - 1]) 134 if (!d_name[d_reclen - 1])
125 d_reclen = strlen(d_name); 135 d_reclen = strlen(d_name);
126 136
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 95051d44a918..9ea12004fa57 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -208,8 +208,8 @@ static int file_capable(struct inode *inode, long block)
208 return 0; 208 return 0;
209} 209}
210 210
211/*static*/ int restart_transaction(struct reiserfs_transaction_handle *th, 211static int restart_transaction(struct reiserfs_transaction_handle *th,
212 struct inode *inode, struct treepath *path) 212 struct inode *inode, struct treepath *path)
213{ 213{
214 struct super_block *s = th->t_super; 214 struct super_block *s = th->t_super;
215 int len = th->t_blocks_allocated; 215 int len = th->t_blocks_allocated;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index f25086aeef5f..4cad9e75ef56 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -615,6 +615,31 @@ static int journal_list_still_alive(struct super_block *s,
615 return 0; 615 return 0;
616} 616}
617 617
618/*
619 * If page->mapping was null, we failed to truncate this page for
620 * some reason. Most likely because it was truncated after being
621 * logged via data=journal.
622 *
623 * This does a check to see if the buffer belongs to one of these
624 * lost pages before doing the final put_bh. If page->mapping was
625 * null, it tries to free buffers on the page, which should make the
626 * final page_cache_release drop the page from the lru.
627 */
628static void release_buffer_page(struct buffer_head *bh)
629{
630 struct page *page = bh->b_page;
631 if (!page->mapping && !TestSetPageLocked(page)) {
632 page_cache_get(page);
633 put_bh(bh);
634 if (!page->mapping)
635 try_to_free_buffers(page);
636 unlock_page(page);
637 page_cache_release(page);
638 } else {
639 put_bh(bh);
640 }
641}
642
618static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate) 643static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
619{ 644{
620 char b[BDEVNAME_SIZE]; 645 char b[BDEVNAME_SIZE];
@@ -628,8 +653,9 @@ static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
628 set_buffer_uptodate(bh); 653 set_buffer_uptodate(bh);
629 else 654 else
630 clear_buffer_uptodate(bh); 655 clear_buffer_uptodate(bh);
656
631 unlock_buffer(bh); 657 unlock_buffer(bh);
632 put_bh(bh); 658 release_buffer_page(bh);
633} 659}
634 660
635static void reiserfs_end_ordered_io(struct buffer_head *bh, int uptodate) 661static void reiserfs_end_ordered_io(struct buffer_head *bh, int uptodate)
@@ -966,7 +992,8 @@ static int flush_older_commits(struct super_block *s,
966 } 992 }
967 return 0; 993 return 0;
968} 994}
969int reiserfs_async_progress_wait(struct super_block *s) 995
996static int reiserfs_async_progress_wait(struct super_block *s)
970{ 997{
971 DEFINE_WAIT(wait); 998 DEFINE_WAIT(wait);
972 struct reiserfs_journal *j = SB_JOURNAL(s); 999 struct reiserfs_journal *j = SB_JOURNAL(s);
@@ -1546,9 +1573,10 @@ static int flush_journal_list(struct super_block *s,
1546 BUG_ON(!test_clear_buffer_journal_dirty 1573 BUG_ON(!test_clear_buffer_journal_dirty
1547 (cn->bh)); 1574 (cn->bh));
1548 1575
1549 /* undo the inc from journal_mark_dirty */ 1576 /* drop one ref for us */
1550 put_bh(cn->bh); 1577 put_bh(cn->bh);
1551 brelse(cn->bh); 1578 /* drop one ref for journal_mark_dirty */
1579 release_buffer_page(cn->bh);
1552 } 1580 }
1553 cn = cn->next; 1581 cn = cn->next;
1554 } 1582 }
@@ -2621,6 +2649,61 @@ static int journal_init_dev(struct super_block *super,
2621 return result; 2649 return result;
2622} 2650}
2623 2651
2652/**
2653 * When creating/tuning a file system user can assign some
2654 * journal params within boundaries which depend on the ratio
2655 * blocksize/standard_blocksize.
2656 *
2657 * For blocks >= standard_blocksize transaction size should
2658 * be not less then JOURNAL_TRANS_MIN_DEFAULT, and not more
2659 * then JOURNAL_TRANS_MAX_DEFAULT.
2660 *
2661 * For blocks < standard_blocksize these boundaries should be
2662 * decreased proportionally.
2663 */
2664#define REISERFS_STANDARD_BLKSIZE (4096)
2665
2666static int check_advise_trans_params(struct super_block *p_s_sb,
2667 struct reiserfs_journal *journal)
2668{
2669 if (journal->j_trans_max) {
2670 /* Non-default journal params.
2671 Do sanity check for them. */
2672 int ratio = 1;
2673 if (p_s_sb->s_blocksize < REISERFS_STANDARD_BLKSIZE)
2674 ratio = REISERFS_STANDARD_BLKSIZE / p_s_sb->s_blocksize;
2675
2676 if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio ||
2677 journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio ||
2678 SB_ONDISK_JOURNAL_SIZE(p_s_sb) / journal->j_trans_max <
2679 JOURNAL_MIN_RATIO) {
2680 reiserfs_warning(p_s_sb,
2681 "sh-462: bad transaction max size (%u). FSCK?",
2682 journal->j_trans_max);
2683 return 1;
2684 }
2685 if (journal->j_max_batch != (journal->j_trans_max) *
2686 JOURNAL_MAX_BATCH_DEFAULT/JOURNAL_TRANS_MAX_DEFAULT) {
2687 reiserfs_warning(p_s_sb,
2688 "sh-463: bad transaction max batch (%u). FSCK?",
2689 journal->j_max_batch);
2690 return 1;
2691 }
2692 } else {
2693 /* Default journal params.
2694 The file system was created by old version
2695 of mkreiserfs, so some fields contain zeros,
2696 and we need to advise proper values for them */
2697 if (p_s_sb->s_blocksize != REISERFS_STANDARD_BLKSIZE)
2698 reiserfs_panic(p_s_sb, "sh-464: bad blocksize (%u)",
2699 p_s_sb->s_blocksize);
2700 journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT;
2701 journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT;
2702 journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE;
2703 }
2704 return 0;
2705}
2706
2624/* 2707/*
2625** must be called once on fs mount. calls journal_read for you 2708** must be called once on fs mount. calls journal_read for you
2626*/ 2709*/
@@ -2716,49 +2799,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
2716 le32_to_cpu(jh->jh_journal.jp_journal_max_commit_age); 2799 le32_to_cpu(jh->jh_journal.jp_journal_max_commit_age);
2717 journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE; 2800 journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE;
2718 2801
2719 if (journal->j_trans_max) { 2802 if (check_advise_trans_params(p_s_sb, journal) != 0)
2720 /* make sure these parameters are available, assign it if they are not */ 2803 goto free_and_return;
2721 __u32 initial = journal->j_trans_max;
2722 __u32 ratio = 1;
2723
2724 if (p_s_sb->s_blocksize < 4096)
2725 ratio = 4096 / p_s_sb->s_blocksize;
2726
2727 if (SB_ONDISK_JOURNAL_SIZE(p_s_sb) / journal->j_trans_max <
2728 JOURNAL_MIN_RATIO)
2729 journal->j_trans_max =
2730 SB_ONDISK_JOURNAL_SIZE(p_s_sb) / JOURNAL_MIN_RATIO;
2731 if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio)
2732 journal->j_trans_max =
2733 JOURNAL_TRANS_MAX_DEFAULT / ratio;
2734 if (journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio)
2735 journal->j_trans_max =
2736 JOURNAL_TRANS_MIN_DEFAULT / ratio;
2737
2738 if (journal->j_trans_max != initial)
2739 reiserfs_warning(p_s_sb,
2740 "sh-461: journal_init: wrong transaction max size (%u). Changed to %u",
2741 initial, journal->j_trans_max);
2742
2743 journal->j_max_batch = journal->j_trans_max *
2744 JOURNAL_MAX_BATCH_DEFAULT / JOURNAL_TRANS_MAX_DEFAULT;
2745 }
2746
2747 if (!journal->j_trans_max) {
2748 /*we have the file system was created by old version of mkreiserfs
2749 so this field contains zero value */
2750 journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT;
2751 journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT;
2752 journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE;
2753
2754 /* for blocksize >= 4096 - max transaction size is 1024. For block size < 4096
2755 trans max size is decreased proportionally */
2756 if (p_s_sb->s_blocksize < 4096) {
2757 journal->j_trans_max /= (4096 / p_s_sb->s_blocksize);
2758 journal->j_max_batch = (journal->j_trans_max) * 9 / 10;
2759 }
2760 }
2761
2762 journal->j_default_max_commit_age = journal->j_max_commit_age; 2804 journal->j_default_max_commit_age = journal->j_max_commit_age;
2763 2805
2764 if (commit_max_age != 0) { 2806 if (commit_max_age != 0) {
@@ -3708,13 +3750,8 @@ int journal_mark_freed(struct reiserfs_transaction_handle *th,
3708 } 3750 }
3709 } 3751 }
3710 3752
3711 if (bh) { 3753 if (bh)
3712 put_bh(bh); /* get_hash grabs the buffer */ 3754 release_buffer_page(bh); /* get_hash grabs the buffer */
3713 if (atomic_read(&(bh->b_count)) < 0) {
3714 reiserfs_warning(p_s_sb,
3715 "journal-2165: bh->b_count < 0");
3716 }
3717 }
3718 return 0; 3755 return 0;
3719} 3756}
3720 3757
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index a005451930b7..b82897ae090b 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -145,7 +145,7 @@ static int finish_unfinished(struct super_block *s)
145{ 145{
146 INITIALIZE_PATH(path); 146 INITIALIZE_PATH(path);
147 struct cpu_key max_cpu_key, obj_key; 147 struct cpu_key max_cpu_key, obj_key;
148 struct reiserfs_key save_link_key; 148 struct reiserfs_key save_link_key, last_inode_key;
149 int retval = 0; 149 int retval = 0;
150 struct item_head *ih; 150 struct item_head *ih;
151 struct buffer_head *bh; 151 struct buffer_head *bh;
@@ -166,6 +166,8 @@ static int finish_unfinished(struct super_block *s)
166 set_cpu_key_k_offset(&max_cpu_key, ~0U); 166 set_cpu_key_k_offset(&max_cpu_key, ~0U);
167 max_cpu_key.key_length = 3; 167 max_cpu_key.key_length = 3;
168 168
169 memset(&last_inode_key, 0, sizeof(last_inode_key));
170
169#ifdef CONFIG_QUOTA 171#ifdef CONFIG_QUOTA
170 /* Needed for iput() to work correctly and not trash data */ 172 /* Needed for iput() to work correctly and not trash data */
171 if (s->s_flags & MS_ACTIVE) { 173 if (s->s_flags & MS_ACTIVE) {
@@ -278,8 +280,18 @@ static int finish_unfinished(struct super_block *s)
278 REISERFS_I(inode)->i_flags |= i_link_saved_unlink_mask; 280 REISERFS_I(inode)->i_flags |= i_link_saved_unlink_mask;
279 /* not completed unlink (rmdir) found */ 281 /* not completed unlink (rmdir) found */
280 reiserfs_info(s, "Removing %k..", INODE_PKEY(inode)); 282 reiserfs_info(s, "Removing %k..", INODE_PKEY(inode));
281 /* removal gets completed in iput */ 283 if (memcmp(&last_inode_key, INODE_PKEY(inode),
282 retval = 0; 284 sizeof(last_inode_key))){
285 last_inode_key = *INODE_PKEY(inode);
286 /* removal gets completed in iput */
287 retval = 0;
288 } else {
289 reiserfs_warning(s, "Dead loop in "
290 "finish_unfinished detected, "
291 "just remove save link\n");
292 retval = remove_save_link_only(s,
293 &save_link_key, 0);
294 }
283 } 295 }
284 296
285 iput(inode); 297 iput(inode);
@@ -508,7 +520,7 @@ static void reiserfs_destroy_inode(struct inode *inode)
508 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); 520 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
509} 521}
510 522
511static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags) 523static void init_once(struct kmem_cache * cachep, void *foo)
512{ 524{
513 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; 525 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
514 526
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index dae7945f90e4..a49cf5b9a195 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -92,7 +92,7 @@ static inline unsigned long romfs_maxsize(struct super_block *sb)
92 92
93static inline struct romfs_inode_info *ROMFS_I(struct inode *inode) 93static inline struct romfs_inode_info *ROMFS_I(struct inode *inode)
94{ 94{
95 return list_entry(inode, struct romfs_inode_info, vfs_inode); 95 return container_of(inode, struct romfs_inode_info, vfs_inode);
96} 96}
97 97
98static __u32 98static __u32
@@ -555,7 +555,7 @@ static struct kmem_cache * romfs_inode_cachep;
555static struct inode *romfs_alloc_inode(struct super_block *sb) 555static struct inode *romfs_alloc_inode(struct super_block *sb)
556{ 556{
557 struct romfs_inode_info *ei; 557 struct romfs_inode_info *ei;
558 ei = (struct romfs_inode_info *)kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL); 558 ei = kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
559 if (!ei) 559 if (!ei)
560 return NULL; 560 return NULL;
561 return &ei->vfs_inode; 561 return &ei->vfs_inode;
@@ -566,7 +566,7 @@ static void romfs_destroy_inode(struct inode *inode)
566 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode)); 566 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode));
567} 567}
568 568
569static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 569static void init_once(struct kmem_cache *cachep, void *foo)
570{ 570{
571 struct romfs_inode_info *ei = foo; 571 struct romfs_inode_info *ei = foo;
572 572
diff --git a/fs/select.c b/fs/select.c
index 46dca31c607a..7dede89658f5 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -586,7 +586,7 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
586 /* Optimise the no-wait case */ 586 /* Optimise the no-wait case */
587 if (!(*timeout)) 587 if (!(*timeout))
588 pt = NULL; 588 pt = NULL;
589 589
590 for (;;) { 590 for (;;) {
591 struct poll_list *walk; 591 struct poll_list *walk;
592 long __timeout; 592 long __timeout;
@@ -616,10 +616,12 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
616 * a poll_table to them on the next loop iteration. 616 * a poll_table to them on the next loop iteration.
617 */ 617 */
618 pt = NULL; 618 pt = NULL;
619 if (count || !*timeout || signal_pending(current)) 619 if (!count) {
620 break; 620 count = wait->error;
621 count = wait->error; 621 if (signal_pending(current))
622 if (count) 622 count = -EINTR;
623 }
624 if (count || !*timeout)
623 break; 625 break;
624 626
625 if (*timeout < 0) { 627 if (*timeout < 0) {
@@ -651,93 +653,89 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
651int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout) 653int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
652{ 654{
653 struct poll_wqueues table; 655 struct poll_wqueues table;
654 int fdcount, err; 656 int err = -EFAULT, fdcount, len, size;
655 unsigned int i;
656 struct poll_list *head;
657 struct poll_list *walk;
658 /* Allocate small arguments on the stack to save memory and be 657 /* Allocate small arguments on the stack to save memory and be
659 faster - use long to make sure the buffer is aligned properly 658 faster - use long to make sure the buffer is aligned properly
660 on 64 bit archs to avoid unaligned access */ 659 on 64 bit archs to avoid unaligned access */
661 long stack_pps[POLL_STACK_ALLOC/sizeof(long)]; 660 long stack_pps[POLL_STACK_ALLOC/sizeof(long)];
662 struct poll_list *stack_pp = NULL; 661 struct poll_list *const head = (struct poll_list *)stack_pps;
662 struct poll_list *walk = head;
663 unsigned long todo = nfds;
663 664
664 /* Do a sanity check on nfds ... */
665 if (nfds > current->signal->rlim[RLIMIT_NOFILE].rlim_cur) 665 if (nfds > current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
666 return -EINVAL; 666 return -EINVAL;
667 667
668 poll_initwait(&table); 668 len = min_t(unsigned int, nfds, N_STACK_PPS);
669 for (;;) {
670 walk->next = NULL;
671 walk->len = len;
672 if (!len)
673 break;
669 674
670 head = NULL; 675 if (copy_from_user(walk->entries, ufds + nfds-todo,
671 walk = NULL; 676 sizeof(struct pollfd) * walk->len))
672 i = nfds; 677 goto out_fds;
673 err = -ENOMEM; 678
674 while(i!=0) { 679 todo -= walk->len;
675 struct poll_list *pp; 680 if (!todo)
676 int num, size; 681 break;
677 if (stack_pp == NULL)
678 num = N_STACK_PPS;
679 else
680 num = POLLFD_PER_PAGE;
681 if (num > i)
682 num = i;
683 size = sizeof(struct poll_list) + sizeof(struct pollfd)*num;
684 if (!stack_pp)
685 stack_pp = pp = (struct poll_list *)stack_pps;
686 else {
687 pp = kmalloc(size, GFP_KERNEL);
688 if (!pp)
689 goto out_fds;
690 }
691 pp->next=NULL;
692 pp->len = num;
693 if (head == NULL)
694 head = pp;
695 else
696 walk->next = pp;
697 682
698 walk = pp; 683 len = min(todo, POLLFD_PER_PAGE);
699 if (copy_from_user(pp->entries, ufds + nfds-i, 684 size = sizeof(struct poll_list) + sizeof(struct pollfd) * len;
700 sizeof(struct pollfd)*num)) { 685 walk = walk->next = kmalloc(size, GFP_KERNEL);
701 err = -EFAULT; 686 if (!walk) {
687 err = -ENOMEM;
702 goto out_fds; 688 goto out_fds;
703 } 689 }
704 i -= pp->len;
705 } 690 }
706 691
692 poll_initwait(&table);
707 fdcount = do_poll(nfds, head, &table, timeout); 693 fdcount = do_poll(nfds, head, &table, timeout);
694 poll_freewait(&table);
708 695
709 /* OK, now copy the revents fields back to user space. */ 696 for (walk = head; walk; walk = walk->next) {
710 walk = head;
711 err = -EFAULT;
712 while(walk != NULL) {
713 struct pollfd *fds = walk->entries; 697 struct pollfd *fds = walk->entries;
714 int j; 698 int j;
715 699
716 for (j=0; j < walk->len; j++, ufds++) { 700 for (j = 0; j < walk->len; j++, ufds++)
717 if(__put_user(fds[j].revents, &ufds->revents)) 701 if (__put_user(fds[j].revents, &ufds->revents))
718 goto out_fds; 702 goto out_fds;
719 }
720 walk = walk->next;
721 } 703 }
704
722 err = fdcount; 705 err = fdcount;
723 if (!fdcount && signal_pending(current))
724 err = -EINTR;
725out_fds: 706out_fds:
726 walk = head; 707 walk = head->next;
727 while(walk!=NULL) { 708 while (walk) {
728 struct poll_list *pp = walk->next; 709 struct poll_list *pos = walk;
729 if (walk != stack_pp) 710 walk = walk->next;
730 kfree(walk); 711 kfree(pos);
731 walk = pp;
732 } 712 }
733 poll_freewait(&table); 713
734 return err; 714 return err;
735} 715}
736 716
717static long do_restart_poll(struct restart_block *restart_block)
718{
719 struct pollfd __user *ufds = (struct pollfd __user*)restart_block->arg0;
720 int nfds = restart_block->arg1;
721 s64 timeout = ((s64)restart_block->arg3<<32) | (s64)restart_block->arg2;
722 int ret;
723
724 ret = do_sys_poll(ufds, nfds, &timeout);
725 if (ret == -EINTR) {
726 restart_block->fn = do_restart_poll;
727 restart_block->arg2 = timeout & 0xFFFFFFFF;
728 restart_block->arg3 = (u64)timeout >> 32;
729 ret = -ERESTART_RESTARTBLOCK;
730 }
731 return ret;
732}
733
737asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 734asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
738 long timeout_msecs) 735 long timeout_msecs)
739{ 736{
740 s64 timeout_jiffies; 737 s64 timeout_jiffies;
738 int ret;
741 739
742 if (timeout_msecs > 0) { 740 if (timeout_msecs > 0) {
743#if HZ > 1000 741#if HZ > 1000
@@ -752,7 +750,18 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
752 timeout_jiffies = timeout_msecs; 750 timeout_jiffies = timeout_msecs;
753 } 751 }
754 752
755 return do_sys_poll(ufds, nfds, &timeout_jiffies); 753 ret = do_sys_poll(ufds, nfds, &timeout_jiffies);
754 if (ret == -EINTR) {
755 struct restart_block *restart_block;
756 restart_block = &current_thread_info()->restart_block;
757 restart_block->fn = do_restart_poll;
758 restart_block->arg0 = (unsigned long)ufds;
759 restart_block->arg1 = nfds;
760 restart_block->arg2 = timeout_jiffies & 0xFFFFFFFF;
761 restart_block->arg3 = (u64)timeout_jiffies >> 32;
762 ret = -ERESTART_RESTARTBLOCK;
763 }
764 return ret;
756} 765}
757 766
758#ifdef TIF_RESTORE_SIGMASK 767#ifdef TIF_RESTORE_SIGMASK
diff --git a/fs/signalfd.c b/fs/signalfd.c
index aefb0be07942..fb7f7e8034df 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -74,45 +74,45 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo,
74 * If you change siginfo_t structure, please be sure 74 * If you change siginfo_t structure, please be sure
75 * this code is fixed accordingly. 75 * this code is fixed accordingly.
76 */ 76 */
77 err |= __put_user(kinfo->si_signo, &uinfo->signo); 77 err |= __put_user(kinfo->si_signo, &uinfo->ssi_signo);
78 err |= __put_user(kinfo->si_errno, &uinfo->err); 78 err |= __put_user(kinfo->si_errno, &uinfo->ssi_errno);
79 err |= __put_user((short)kinfo->si_code, &uinfo->code); 79 err |= __put_user((short) kinfo->si_code, &uinfo->ssi_code);
80 switch (kinfo->si_code & __SI_MASK) { 80 switch (kinfo->si_code & __SI_MASK) {
81 case __SI_KILL: 81 case __SI_KILL:
82 err |= __put_user(kinfo->si_pid, &uinfo->pid); 82 err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
83 err |= __put_user(kinfo->si_uid, &uinfo->uid); 83 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
84 break; 84 break;
85 case __SI_TIMER: 85 case __SI_TIMER:
86 err |= __put_user(kinfo->si_tid, &uinfo->tid); 86 err |= __put_user(kinfo->si_tid, &uinfo->ssi_tid);
87 err |= __put_user(kinfo->si_overrun, &uinfo->overrun); 87 err |= __put_user(kinfo->si_overrun, &uinfo->ssi_overrun);
88 err |= __put_user((long)kinfo->si_ptr, &uinfo->svptr); 88 err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
89 break; 89 break;
90 case __SI_POLL: 90 case __SI_POLL:
91 err |= __put_user(kinfo->si_band, &uinfo->band); 91 err |= __put_user(kinfo->si_band, &uinfo->ssi_band);
92 err |= __put_user(kinfo->si_fd, &uinfo->fd); 92 err |= __put_user(kinfo->si_fd, &uinfo->ssi_fd);
93 break; 93 break;
94 case __SI_FAULT: 94 case __SI_FAULT:
95 err |= __put_user((long)kinfo->si_addr, &uinfo->addr); 95 err |= __put_user((long) kinfo->si_addr, &uinfo->ssi_addr);
96#ifdef __ARCH_SI_TRAPNO 96#ifdef __ARCH_SI_TRAPNO
97 err |= __put_user(kinfo->si_trapno, &uinfo->trapno); 97 err |= __put_user(kinfo->si_trapno, &uinfo->ssi_trapno);
98#endif 98#endif
99 break; 99 break;
100 case __SI_CHLD: 100 case __SI_CHLD:
101 err |= __put_user(kinfo->si_pid, &uinfo->pid); 101 err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
102 err |= __put_user(kinfo->si_uid, &uinfo->uid); 102 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
103 err |= __put_user(kinfo->si_status, &uinfo->status); 103 err |= __put_user(kinfo->si_status, &uinfo->ssi_status);
104 err |= __put_user(kinfo->si_utime, &uinfo->utime); 104 err |= __put_user(kinfo->si_utime, &uinfo->ssi_utime);
105 err |= __put_user(kinfo->si_stime, &uinfo->stime); 105 err |= __put_user(kinfo->si_stime, &uinfo->ssi_stime);
106 break; 106 break;
107 case __SI_RT: /* This is not generated by the kernel as of now. */ 107 case __SI_RT: /* This is not generated by the kernel as of now. */
108 case __SI_MESGQ: /* But this is */ 108 case __SI_MESGQ: /* But this is */
109 err |= __put_user(kinfo->si_pid, &uinfo->pid); 109 err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
110 err |= __put_user(kinfo->si_uid, &uinfo->uid); 110 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
111 err |= __put_user((long)kinfo->si_ptr, &uinfo->svptr); 111 err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
112 break; 112 break;
113 default: /* this is just in case for now ... */ 113 default: /* this is just in case for now ... */
114 err |= __put_user(kinfo->si_pid, &uinfo->pid); 114 err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
115 err |= __put_user(kinfo->si_uid, &uinfo->uid); 115 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
116 break; 116 break;
117 } 117 }
118 118
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index 73d1450a95d4..ab517755ece0 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -67,7 +67,7 @@ static void smb_destroy_inode(struct inode *inode)
67 kmem_cache_free(smb_inode_cachep, SMB_I(inode)); 67 kmem_cache_free(smb_inode_cachep, SMB_I(inode));
68} 68}
69 69
70static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 70static void init_once(struct kmem_cache *cachep, void *foo)
71{ 71{
72 struct smb_inode_info *ei = (struct smb_inode_info *) foo; 72 struct smb_inode_info *ei = (struct smb_inode_info *) foo;
73 73
diff --git a/fs/splice.c b/fs/splice.c
index 59a941d404d9..6bdcb6107bc3 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -824,13 +824,18 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
824{ 824{
825 struct address_space *mapping = out->f_mapping; 825 struct address_space *mapping = out->f_mapping;
826 struct inode *inode = mapping->host; 826 struct inode *inode = mapping->host;
827 int killsuid, killpriv;
827 ssize_t ret; 828 ssize_t ret;
828 int err; 829 int err = 0;
829 830
830 err = should_remove_suid(out->f_path.dentry); 831 killpriv = security_inode_need_killpriv(out->f_path.dentry);
831 if (unlikely(err)) { 832 killsuid = should_remove_suid(out->f_path.dentry);
833 if (unlikely(killsuid || killpriv)) {
832 mutex_lock(&inode->i_mutex); 834 mutex_lock(&inode->i_mutex);
833 err = __remove_suid(out->f_path.dentry, err); 835 if (killpriv)
836 err = security_inode_killpriv(out->f_path.dentry);
837 if (!err && killsuid)
838 err = __remove_suid(out->f_path.dentry, killsuid);
834 mutex_unlock(&inode->i_mutex); 839 mutex_unlock(&inode->i_mutex);
835 if (err) 840 if (err)
836 return err; 841 return err;
diff --git a/fs/super.c b/fs/super.c
index fc8ebedc6bed..1bfcca2104be 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -67,6 +67,7 @@ static struct super_block *alloc_super(struct file_system_type *type)
67 } 67 }
68 INIT_LIST_HEAD(&s->s_dirty); 68 INIT_LIST_HEAD(&s->s_dirty);
69 INIT_LIST_HEAD(&s->s_io); 69 INIT_LIST_HEAD(&s->s_io);
70 INIT_LIST_HEAD(&s->s_more_io);
70 INIT_LIST_HEAD(&s->s_files); 71 INIT_LIST_HEAD(&s->s_files);
71 INIT_LIST_HEAD(&s->s_instances); 72 INIT_LIST_HEAD(&s->s_instances);
72 INIT_HLIST_HEAD(&s->s_anon); 73 INIT_HLIST_HEAD(&s->s_anon);
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 9161db4d6b5c..7a8ce9e98b32 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -24,9 +24,9 @@
24 24
25DEFINE_MUTEX(sysfs_mutex); 25DEFINE_MUTEX(sysfs_mutex);
26DEFINE_MUTEX(sysfs_rename_mutex); 26DEFINE_MUTEX(sysfs_rename_mutex);
27spinlock_t sysfs_assoc_lock = SPIN_LOCK_UNLOCKED; 27DEFINE_SPINLOCK(sysfs_assoc_lock);
28 28
29static spinlock_t sysfs_ino_lock = SPIN_LOCK_UNLOCKED; 29static DEFINE_SPINLOCK(sysfs_ino_lock);
30static DEFINE_IDA(sysfs_ino_ida); 30static DEFINE_IDA(sysfs_ino_ida);
31 31
32/** 32/**
@@ -112,8 +112,7 @@ struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd)
112 /* look it up */ 112 /* look it up */
113 parent = dentry; 113 parent = dentry;
114 mutex_lock(&parent->d_inode->i_mutex); 114 mutex_lock(&parent->d_inode->i_mutex);
115 dentry = lookup_one_len_kern(cur->s_name, parent, 115 dentry = lookup_one_noperm(cur->s_name, parent);
116 strlen(cur->s_name));
117 mutex_unlock(&parent->d_inode->i_mutex); 116 mutex_unlock(&parent->d_inode->i_mutex);
118 dput(parent); 117 dput(parent);
119 118
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index c4ef945d39c8..d9262f74f94e 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -37,6 +37,11 @@ static const struct inode_operations sysfs_inode_operations ={
37 .setattr = sysfs_setattr, 37 .setattr = sysfs_setattr,
38}; 38};
39 39
40int __init sysfs_inode_init(void)
41{
42 return bdi_init(&sysfs_backing_dev_info);
43}
44
40int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) 45int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
41{ 46{
42 struct inode * inode = dentry->d_inode; 47 struct inode * inode = dentry->d_inode;
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index c76c540be3c8..74168266cd59 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -92,6 +92,10 @@ int __init sysfs_init(void)
92 if (!sysfs_dir_cachep) 92 if (!sysfs_dir_cachep)
93 goto out; 93 goto out;
94 94
95 err = sysfs_inode_init();
96 if (err)
97 goto out_err;
98
95 err = register_filesystem(&sysfs_fs_type); 99 err = register_filesystem(&sysfs_fs_type);
96 if (!err) { 100 if (!err) {
97 sysfs_mount = kern_mount(&sysfs_fs_type); 101 sysfs_mount = kern_mount(&sysfs_fs_type);
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index f0326f281d1c..f8417988f6b0 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -146,6 +146,7 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
146struct inode *sysfs_get_inode(struct sysfs_dirent *sd); 146struct inode *sysfs_get_inode(struct sysfs_dirent *sd);
147int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); 147int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
148int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name); 148int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name);
149int sysfs_inode_init(void);
149 150
150/* 151/*
151 * file.c 152 * file.c
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index 7c4e5d302abb..81ec6c548c07 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -318,7 +318,7 @@ static void sysv_destroy_inode(struct inode *inode)
318 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode)); 318 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode));
319} 319}
320 320
321static void init_once(void *p, struct kmem_cache *cachep, unsigned long flags) 321static void init_once(struct kmem_cache *cachep, void *p)
322{ 322{
323 struct sysv_inode_info *si = (struct sysv_inode_info *)p; 323 struct sysv_inode_info *si = (struct sysv_inode_info *)p;
324 324
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 87e87dcd3f9c..ab26176f6b91 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -689,7 +689,7 @@ static int udf_table_new_block(struct super_block *sb,
689 uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF; 689 uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
690 uint32_t newblock = 0, adsize; 690 uint32_t newblock = 0, adsize;
691 uint32_t elen, goal_elen = 0; 691 uint32_t elen, goal_elen = 0;
692 kernel_lb_addr eloc, goal_eloc; 692 kernel_lb_addr eloc, uninitialized_var(goal_eloc);
693 struct extent_position epos, goal_epos; 693 struct extent_position epos, goal_epos;
694 int8_t etype; 694 int8_t etype;
695 695
diff --git a/fs/udf/super.c b/fs/udf/super.c
index c68a6e730b97..4360c7a05743 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -134,7 +134,7 @@ static void udf_destroy_inode(struct inode *inode)
134 kmem_cache_free(udf_inode_cachep, UDF_I(inode)); 134 kmem_cache_free(udf_inode_cachep, UDF_I(inode));
135} 135}
136 136
137static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 137static void init_once(struct kmem_cache *cachep, void *foo)
138{ 138{
139 struct udf_inode_info *ei = (struct udf_inode_info *)foo; 139 struct udf_inode_info *ei = (struct udf_inode_info *)foo;
140 140
@@ -913,8 +913,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
913 UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table = 913 UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table =
914 udf_iget(sb, loc); 914 udf_iget(sb, loc);
915 if (!UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table) { 915 if (!UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table) {
916 udf_debug("cannot load unallocSpaceTable (part %d)\n", 916 udf_debug("cannot load unallocSpaceTable (part %d)\n", i);
917 i);
918 return 1; 917 return 1;
919 } 918 }
920 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE; 919 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)
944 UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table = 943 UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table =
945 udf_iget(sb, loc); 944 udf_iget(sb, loc);
946 if (!UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table) { 945 if (!UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table) {
947 udf_debug("cannot load freedSpaceTable (part %d)\n", 946 udf_debug("cannot load freedSpaceTable (part %d)\n", i);
948 i);
949 return 1; 947 return 1;
950 } 948 }
951 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE; 949 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)
1293 1291
1294 if (!UDF_SB_LASTBLOCK(sb)) { 1292 if (!UDF_SB_LASTBLOCK(sb)) {
1295 udf_debug("Unable to determine Lastblock (For " 1293 udf_debug("Unable to determine Lastblock (For "
1296 "Virtual Partition)\n"); 1294 "Virtual Partition)\n");
1297 return 1; 1295 return 1;
1298 } 1296 }
1299 1297
1300 for (j = 0; j < UDF_SB_NUMPARTS(sb); j++) { 1298 for (j = 0; j < UDF_SB_NUMPARTS(sb); j++) {
1301 if (j != i && UDF_SB_PARTVSN(sb, i) == 1299 if (j != i &&
1302 UDF_SB_PARTVSN(sb, j) && 1300 UDF_SB_PARTVSN(sb, i) == UDF_SB_PARTVSN(sb, j) &&
1303 UDF_SB_PARTNUM(sb, i) == 1301 UDF_SB_PARTNUM(sb, i) == UDF_SB_PARTNUM(sb, j)) {
1304 UDF_SB_PARTNUM(sb, j)) {
1305 ino.partitionReferenceNum = j; 1302 ino.partitionReferenceNum = j;
1306 ino.logicalBlockNum = 1303 ino.logicalBlockNum = UDF_SB_LASTBLOCK(sb) - UDF_SB_PARTROOT(sb, j);
1307 UDF_SB_LASTBLOCK(sb) -
1308 UDF_SB_PARTROOT(sb, j);
1309 break; 1304 break;
1310 } 1305 }
1311 } 1306 }
@@ -1318,9 +1313,9 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1318 1313
1319 if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) { 1314 if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
1320 UDF_SB_TYPEVIRT(sb, i).s_start_offset = 1315 UDF_SB_TYPEVIRT(sb, i).s_start_offset =
1321 udf_ext0_offset(UDF_SB_VAT(sb)); 1316 udf_ext0_offset(UDF_SB_VAT(sb));
1322 UDF_SB_TYPEVIRT(sb, i).s_num_entries = 1317 UDF_SB_TYPEVIRT(sb, i).s_num_entries =
1323 (UDF_SB_VAT(sb)->i_size - 36) >> 2; 1318 (UDF_SB_VAT(sb)->i_size - 36) >> 2;
1324 } else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) { 1319 } else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) {
1325 struct buffer_head *bh = NULL; 1320 struct buffer_head *bh = NULL;
1326 uint32_t pos; 1321 uint32_t pos;
@@ -1330,19 +1325,15 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1330 if (!bh) 1325 if (!bh)
1331 return 1; 1326 return 1;
1332 UDF_SB_TYPEVIRT(sb, i).s_start_offset = 1327 UDF_SB_TYPEVIRT(sb, i).s_start_offset =
1333 le16_to_cpu(((struct 1328 le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data +
1334 virtualAllocationTable20 *)bh->b_data + 1329 udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) +
1335 udf_ext0_offset(UDF_SB_VAT(sb)))-> 1330 udf_ext0_offset(UDF_SB_VAT(sb));
1336 lengthHeader) + 1331 UDF_SB_TYPEVIRT(sb, i).s_num_entries = (UDF_SB_VAT(sb)->i_size -
1337 udf_ext0_offset(UDF_SB_VAT(sb)); 1332 UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
1338 UDF_SB_TYPEVIRT(sb, i).s_num_entries =
1339 (UDF_SB_VAT(sb)->i_size -
1340 UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
1341 brelse(bh); 1333 brelse(bh);
1342 } 1334 }
1343 UDF_SB_PARTROOT(sb, i) = udf_get_pblock(sb, 0, i, 0); 1335 UDF_SB_PARTROOT(sb, i) = udf_get_pblock(sb, 0, i, 0);
1344 UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb, 1336 UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb, ino.partitionReferenceNum);
1345 ino.partitionReferenceNum);
1346 } 1337 }
1347 } 1338 }
1348 return 0; 1339 return 0;
@@ -1357,21 +1348,17 @@ static void udf_open_lvid(struct super_block *sb)
1357 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1348 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
1358 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; 1349 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
1359 if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) 1350 if (udf_time_to_stamp(&cpu_time, CURRENT_TIME))
1360 UDF_SB_LVID(sb)->recordingDateAndTime = 1351 UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time);
1361 cpu_to_lets(cpu_time);
1362 UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN; 1352 UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN;
1363 1353
1364 UDF_SB_LVID(sb)->descTag.descCRC = 1354 UDF_SB_LVID(sb)->descTag.descCRC = cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag),
1365 cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag), 1355 le16_to_cpu(UDF_SB_LVID(sb)->descTag.descCRCLength), 0));
1366 le16_to_cpu(UDF_SB_LVID(sb)->descTag.
1367 descCRCLength), 0));
1368 1356
1369 UDF_SB_LVID(sb)->descTag.tagChecksum = 0; 1357 UDF_SB_LVID(sb)->descTag.tagChecksum = 0;
1370 for (i = 0; i < 16; i++) 1358 for (i = 0; i < 16; i++)
1371 if (i != 4) 1359 if (i != 4)
1372 UDF_SB_LVID(sb)->descTag.tagChecksum += 1360 UDF_SB_LVID(sb)->descTag.tagChecksum +=
1373 ((uint8_t *) & 1361 ((uint8_t *) &(UDF_SB_LVID(sb)->descTag))[i];
1374 (UDF_SB_LVID(sb)->descTag))[i];
1375 1362
1376 mark_buffer_dirty(UDF_SB_LVIDBH(sb)); 1363 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
1377 } 1364 }
diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c
index 3fd80eb66af3..adcb87c2da7e 100644
--- a/fs/udf/udftime.c
+++ b/fs/udf/udftime.c
@@ -108,10 +108,10 @@ time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src)
108 *dest = year_seconds[src.year - EPOCH_YEAR]; 108 *dest = year_seconds[src.year - EPOCH_YEAR];
109 *dest -= offset * 60; 109 *dest -= offset * 60;
110 110
111 yday = ((__mon_yday[__isleap (src.year)] 111 yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1);
112 [src.month - 1]) + (src.day - 1)); 112 *dest += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second;
113 *dest += ( ( (yday * 24) + src.hour ) * 60 + src.minute ) * 60 + src.second; 113 *dest_usec = src.centiseconds * 10000 +
114 *dest_usec = src.centiseconds * 10000 + src.hundredsOfMicroseconds * 100 + src.microseconds; 114 src.hundredsOfMicroseconds * 100 + src.microseconds;
115 return dest; 115 return dest;
116} 116}
117 117
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 841ac25fd950..f63a09ce8683 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -19,6 +19,7 @@
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21 21
22#include "ufs.h"
22#include "swab.h" 23#include "swab.h"
23#include "util.h" 24#include "util.h"
24 25
diff --git a/fs/ufs/cylinder.c b/fs/ufs/cylinder.c
index 09c39e5e6386..2a815665644f 100644
--- a/fs/ufs/cylinder.c
+++ b/fs/ufs/cylinder.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/byteorder.h> 18#include <asm/byteorder.h>
19 19
20#include "ufs.h"
20#include "swab.h" 21#include "swab.h"
21#include "util.h" 22#include "util.h"
22 23
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 2410ec6002db..30f8c2bb0c3e 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -21,6 +21,7 @@
21#include <linux/ufs_fs.h> 21#include <linux/ufs_fs.h>
22#include <linux/swap.h> 22#include <linux/swap.h>
23 23
24#include "ufs.h"
24#include "swab.h" 25#include "swab.h"
25#include "util.h" 26#include "util.h"
26 27
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index 6705d74c6d2d..a46c97bf023f 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -27,6 +27,9 @@
27#include <linux/ufs_fs.h> 27#include <linux/ufs_fs.h>
28#include <linux/buffer_head.h> /* for sync_mapping_buffers() */ 28#include <linux/buffer_head.h> /* for sync_mapping_buffers() */
29 29
30#include "ufs.h"
31
32
30static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) 33static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
31{ 34{
32 struct inode *inode = dentry->d_inode; 35 struct inode *inode = dentry->d_inode;
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index c28a8b6f2feb..7e260bc0d94f 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -34,6 +34,7 @@
34#include <linux/bitops.h> 34#include <linux/bitops.h>
35#include <asm/byteorder.h> 35#include <asm/byteorder.h>
36 36
37#include "ufs.h"
37#include "swab.h" 38#include "swab.h"
38#include "util.h" 39#include "util.h"
39 40
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index d84d4b0f4779..4320782761ae 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -38,6 +38,7 @@
38#include <linux/smp_lock.h> 38#include <linux/smp_lock.h>
39#include <linux/buffer_head.h> 39#include <linux/buffer_head.h>
40 40
41#include "ufs.h"
41#include "swab.h" 42#include "swab.h"
42#include "util.h" 43#include "util.h"
43 44
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index a059ccd064ea..d8bfbee2fe2b 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -31,7 +31,7 @@
31#include <linux/fs.h> 31#include <linux/fs.h>
32#include <linux/ufs_fs.h> 32#include <linux/ufs_fs.h>
33#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
34#include "swab.h" /* will go away - see comment in mknod() */ 34#include "ufs.h"
35#include "util.h" 35#include "util.h"
36 36
37static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) 37static 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
110 err = PTR_ERR(inode); 110 err = PTR_ERR(inode);
111 if (!IS_ERR(inode)) { 111 if (!IS_ERR(inode)) {
112 init_special_inode(inode, mode, rdev); 112 init_special_inode(inode, mode, rdev);
113 /* NOTE: that'll go when we get wide dev_t */
114 ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev); 113 ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
115 mark_inode_dirty(inode); 114 mark_inode_dirty(inode);
116 lock_kernel(); 115 lock_kernel();
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 38eb0b7a1f3d..584cf12cc40f 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -88,7 +88,10 @@
88#include <linux/buffer_head.h> 88#include <linux/buffer_head.h>
89#include <linux/vfs.h> 89#include <linux/vfs.h>
90#include <linux/log2.h> 90#include <linux/log2.h>
91#include <linux/mount.h>
92#include <linux/seq_file.h>
91 93
94#include "ufs.h"
92#include "swab.h" 95#include "swab.h"
93#include "util.h" 96#include "util.h"
94 97
@@ -286,16 +289,28 @@ void ufs_warning (struct super_block * sb, const char * function,
286} 289}
287 290
288enum { 291enum {
289 Opt_type_old, Opt_type_sunx86, Opt_type_sun, Opt_type_44bsd, 292 Opt_type_old = UFS_MOUNT_UFSTYPE_OLD,
290 Opt_type_ufs2, Opt_type_hp, Opt_type_nextstepcd, Opt_type_nextstep, 293 Opt_type_sunx86 = UFS_MOUNT_UFSTYPE_SUNx86,
291 Opt_type_openstep, Opt_onerror_panic, Opt_onerror_lock, 294 Opt_type_sun = UFS_MOUNT_UFSTYPE_SUN,
292 Opt_onerror_umount, Opt_onerror_repair, Opt_err 295 Opt_type_sunos = UFS_MOUNT_UFSTYPE_SUNOS,
296 Opt_type_44bsd = UFS_MOUNT_UFSTYPE_44BSD,
297 Opt_type_ufs2 = UFS_MOUNT_UFSTYPE_UFS2,
298 Opt_type_hp = UFS_MOUNT_UFSTYPE_HP,
299 Opt_type_nextstepcd = UFS_MOUNT_UFSTYPE_NEXTSTEP_CD,
300 Opt_type_nextstep = UFS_MOUNT_UFSTYPE_NEXTSTEP,
301 Opt_type_openstep = UFS_MOUNT_UFSTYPE_OPENSTEP,
302 Opt_onerror_panic = UFS_MOUNT_ONERROR_PANIC,
303 Opt_onerror_lock = UFS_MOUNT_ONERROR_LOCK,
304 Opt_onerror_umount = UFS_MOUNT_ONERROR_UMOUNT,
305 Opt_onerror_repair = UFS_MOUNT_ONERROR_REPAIR,
306 Opt_err
293}; 307};
294 308
295static match_table_t tokens = { 309static match_table_t tokens = {
296 {Opt_type_old, "ufstype=old"}, 310 {Opt_type_old, "ufstype=old"},
297 {Opt_type_sunx86, "ufstype=sunx86"}, 311 {Opt_type_sunx86, "ufstype=sunx86"},
298 {Opt_type_sun, "ufstype=sun"}, 312 {Opt_type_sun, "ufstype=sun"},
313 {Opt_type_sunos, "ufstype=sunos"},
299 {Opt_type_44bsd, "ufstype=44bsd"}, 314 {Opt_type_44bsd, "ufstype=44bsd"},
300 {Opt_type_ufs2, "ufstype=ufs2"}, 315 {Opt_type_ufs2, "ufstype=ufs2"},
301 {Opt_type_ufs2, "ufstype=5xbsd"}, 316 {Opt_type_ufs2, "ufstype=5xbsd"},
@@ -303,6 +318,7 @@ static match_table_t tokens = {
303 {Opt_type_nextstepcd, "ufstype=nextstep-cd"}, 318 {Opt_type_nextstepcd, "ufstype=nextstep-cd"},
304 {Opt_type_nextstep, "ufstype=nextstep"}, 319 {Opt_type_nextstep, "ufstype=nextstep"},
305 {Opt_type_openstep, "ufstype=openstep"}, 320 {Opt_type_openstep, "ufstype=openstep"},
321/*end of possible ufs types */
306 {Opt_onerror_panic, "onerror=panic"}, 322 {Opt_onerror_panic, "onerror=panic"},
307 {Opt_onerror_lock, "onerror=lock"}, 323 {Opt_onerror_lock, "onerror=lock"},
308 {Opt_onerror_umount, "onerror=umount"}, 324 {Opt_onerror_umount, "onerror=umount"},
@@ -339,6 +355,10 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
339 ufs_clear_opt (*mount_options, UFSTYPE); 355 ufs_clear_opt (*mount_options, UFSTYPE);
340 ufs_set_opt (*mount_options, UFSTYPE_SUN); 356 ufs_set_opt (*mount_options, UFSTYPE_SUN);
341 break; 357 break;
358 case Opt_type_sunos:
359 ufs_clear_opt(*mount_options, UFSTYPE);
360 ufs_set_opt(*mount_options, UFSTYPE_SUNOS);
361 break;
342 case Opt_type_44bsd: 362 case Opt_type_44bsd:
343 ufs_clear_opt (*mount_options, UFSTYPE); 363 ufs_clear_opt (*mount_options, UFSTYPE);
344 ufs_set_opt (*mount_options, UFSTYPE_44BSD); 364 ufs_set_opt (*mount_options, UFSTYPE_44BSD);
@@ -654,8 +674,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
654 ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD); 674 ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD);
655 } 675 }
656 676
657 sbi->s_uspi = uspi = 677 uspi = kzalloc(sizeof(struct ufs_sb_private_info), GFP_KERNEL);
658 kmalloc (sizeof(struct ufs_sb_private_info), GFP_KERNEL); 678 sbi->s_uspi = uspi;
659 if (!uspi) 679 if (!uspi)
660 goto failed; 680 goto failed;
661 uspi->s_dirblksize = UFS_SECTOR_SIZE; 681 uspi->s_dirblksize = UFS_SECTOR_SIZE;
@@ -692,10 +712,22 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
692 uspi->s_fshift = 10; 712 uspi->s_fshift = 10;
693 uspi->s_sbsize = super_block_size = 2048; 713 uspi->s_sbsize = super_block_size = 2048;
694 uspi->s_sbbase = 0; 714 uspi->s_sbbase = 0;
695 uspi->s_maxsymlinklen = 56; 715 uspi->s_maxsymlinklen = 0; /* Not supported on disk */
696 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN; 716 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN;
697 break; 717 break;
698 718
719 case UFS_MOUNT_UFSTYPE_SUNOS:
720 UFSD(("ufstype=sunos\n"))
721 uspi->s_fsize = block_size = 1024;
722 uspi->s_fmask = ~(1024 - 1);
723 uspi->s_fshift = 10;
724 uspi->s_sbsize = 2048;
725 super_block_size = 2048;
726 uspi->s_sbbase = 0;
727 uspi->s_maxsymlinklen = 0; /* Not supported on disk */
728 flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_SUNOS | UFS_CG_SUN;
729 break;
730
699 case UFS_MOUNT_UFSTYPE_SUNx86: 731 case UFS_MOUNT_UFSTYPE_SUNx86:
700 UFSD("ufstype=sunx86\n"); 732 UFSD("ufstype=sunx86\n");
701 uspi->s_fsize = block_size = 1024; 733 uspi->s_fsize = block_size = 1024;
@@ -703,7 +735,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
703 uspi->s_fshift = 10; 735 uspi->s_fshift = 10;
704 uspi->s_sbsize = super_block_size = 2048; 736 uspi->s_sbsize = super_block_size = 2048;
705 uspi->s_sbbase = 0; 737 uspi->s_sbbase = 0;
706 uspi->s_maxsymlinklen = 56; 738 uspi->s_maxsymlinklen = 0; /* Not supported on disk */
707 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN; 739 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN;
708 break; 740 break;
709 741
@@ -805,11 +837,18 @@ again:
805 if (!ubh) 837 if (!ubh)
806 goto failed; 838 goto failed;
807 839
808
809 usb1 = ubh_get_usb_first(uspi); 840 usb1 = ubh_get_usb_first(uspi);
810 usb2 = ubh_get_usb_second(uspi); 841 usb2 = ubh_get_usb_second(uspi);
811 usb3 = ubh_get_usb_third(uspi); 842 usb3 = ubh_get_usb_third(uspi);
812 843
844 /* Sort out mod used on SunOS 4.1.3 for fs_state */
845 uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat);
846 if (((flags & UFS_ST_MASK) == UFS_ST_SUNOS) &&
847 (uspi->s_postblformat != UFS_42POSTBLFMT)) {
848 flags &= ~UFS_ST_MASK;
849 flags |= UFS_ST_SUN;
850 }
851
813 /* 852 /*
814 * Check ufs magic number 853 * Check ufs magic number
815 */ 854 */
@@ -894,18 +933,20 @@ magic_found:
894 goto again; 933 goto again;
895 } 934 }
896 935
897 sbi->s_flags = flags;/*after that line some functions use s_flags*/ 936 /* Set sbi->s_flags here, used by ufs_get_fs_state() below */
937 sbi->s_flags = flags;
898 ufs_print_super_stuff(sb, usb1, usb2, usb3); 938 ufs_print_super_stuff(sb, usb1, usb2, usb3);
899 939
900 /* 940 /*
901 * Check, if file system was correctly unmounted. 941 * Check, if file system was correctly unmounted.
902 * If not, make it read only. 942 * If not, make it read only.
903 */ 943 */
904 if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) || 944 if ((((flags & UFS_ST_MASK) == UFS_ST_44BSD) ||
905 ((flags & UFS_ST_MASK) == UFS_ST_OLD) || 945 ((flags & UFS_ST_MASK) == UFS_ST_OLD) ||
906 (((flags & UFS_ST_MASK) == UFS_ST_SUN || 946 ((flags & UFS_ST_MASK) == UFS_ST_SUN) ||
907 (flags & UFS_ST_MASK) == UFS_ST_SUNx86) && 947 ((flags & UFS_ST_MASK) == UFS_ST_SUNOS) ||
908 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) { 948 ((flags & UFS_ST_MASK) == UFS_ST_SUNx86)) &&
949 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)))) {
909 switch(usb1->fs_clean) { 950 switch(usb1->fs_clean) {
910 case UFS_FSCLEAN: 951 case UFS_FSCLEAN:
911 UFSD("fs is clean\n"); 952 UFSD("fs is clean\n");
@@ -995,7 +1036,6 @@ magic_found:
995 uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize); 1036 uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize);
996 uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3); 1037 uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3);
997 uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3); 1038 uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3);
998 uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat);
999 uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos); 1039 uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos);
1000 uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff); 1040 uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff);
1001 uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff); 1041 uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff);
@@ -1077,6 +1117,7 @@ static void ufs_write_super(struct super_block *sb)
1077 if (!(sb->s_flags & MS_RDONLY)) { 1117 if (!(sb->s_flags & MS_RDONLY)) {
1078 usb1->fs_time = cpu_to_fs32(sb, get_seconds()); 1118 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
1079 if ((flags & UFS_ST_MASK) == UFS_ST_SUN 1119 if ((flags & UFS_ST_MASK) == UFS_ST_SUN
1120 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
1080 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 1121 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1081 ufs_set_fs_state(sb, usb1, usb3, 1122 ufs_set_fs_state(sb, usb1, usb3,
1082 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); 1123 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)
1146 ufs_put_super_internal(sb); 1187 ufs_put_super_internal(sb);
1147 usb1->fs_time = cpu_to_fs32(sb, get_seconds()); 1188 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
1148 if ((flags & UFS_ST_MASK) == UFS_ST_SUN 1189 if ((flags & UFS_ST_MASK) == UFS_ST_SUN
1190 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
1149 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 1191 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1150 ufs_set_fs_state(sb, usb1, usb3, 1192 ufs_set_fs_state(sb, usb1, usb3,
1151 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); 1193 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)
1162 return -EINVAL; 1204 return -EINVAL;
1163#else 1205#else
1164 if (ufstype != UFS_MOUNT_UFSTYPE_SUN && 1206 if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
1207 ufstype != UFS_MOUNT_UFSTYPE_SUNOS &&
1165 ufstype != UFS_MOUNT_UFSTYPE_44BSD && 1208 ufstype != UFS_MOUNT_UFSTYPE_44BSD &&
1166 ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && 1209 ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
1167 ufstype != UFS_MOUNT_UFSTYPE_UFS2) { 1210 ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
@@ -1179,6 +1222,26 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1179 return 0; 1222 return 0;
1180} 1223}
1181 1224
1225static int ufs_show_options(struct seq_file *seq, struct vfsmount *vfs)
1226{
1227 struct ufs_sb_info *sbi = UFS_SB(vfs->mnt_sb);
1228 unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE;
1229 struct match_token *tp = tokens;
1230
1231 while (tp->token != Opt_onerror_panic && tp->token != mval)
1232 ++tp;
1233 BUG_ON(tp->token == Opt_onerror_panic);
1234 seq_printf(seq, ",%s", tp->pattern);
1235
1236 mval = sbi->s_mount_opt & UFS_MOUNT_ONERROR;
1237 while (tp->token != Opt_err && tp->token != mval)
1238 ++tp;
1239 BUG_ON(tp->token == Opt_err);
1240 seq_printf(seq, ",%s", tp->pattern);
1241
1242 return 0;
1243}
1244
1182static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) 1245static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf)
1183{ 1246{
1184 struct super_block *sb = dentry->d_sb; 1247 struct super_block *sb = dentry->d_sb;
@@ -1232,7 +1295,7 @@ static void ufs_destroy_inode(struct inode *inode)
1232 kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); 1295 kmem_cache_free(ufs_inode_cachep, UFS_I(inode));
1233} 1296}
1234 1297
1235static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 1298static void init_once(struct kmem_cache * cachep, void *foo)
1236{ 1299{
1237 struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; 1300 struct ufs_inode_info *ei = (struct ufs_inode_info *) foo;
1238 1301
@@ -1271,6 +1334,7 @@ static const struct super_operations ufs_super_ops = {
1271 .write_super = ufs_write_super, 1334 .write_super = ufs_write_super,
1272 .statfs = ufs_statfs, 1335 .statfs = ufs_statfs,
1273 .remount_fs = ufs_remount, 1336 .remount_fs = ufs_remount,
1337 .show_options = ufs_show_options,
1274#ifdef CONFIG_QUOTA 1338#ifdef CONFIG_QUOTA
1275 .quota_read = ufs_quota_read, 1339 .quota_read = ufs_quota_read,
1276 .quota_write = ufs_quota_write, 1340 .quota_write = ufs_quota_write,
diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c
index d8549f807e80..43ac10e75a4a 100644
--- a/fs/ufs/symlink.c
+++ b/fs/ufs/symlink.c
@@ -28,6 +28,8 @@
28#include <linux/fs.h> 28#include <linux/fs.h>
29#include <linux/namei.h> 29#include <linux/namei.h>
30#include <linux/ufs_fs.h> 30#include <linux/ufs_fs.h>
31#include "ufs.h"
32
31 33
32static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) 34static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd)
33{ 35{
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 79c54c85fb58..311ded34c2b2 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -46,6 +46,7 @@
46#include <linux/blkdev.h> 46#include <linux/blkdev.h>
47#include <linux/sched.h> 47#include <linux/sched.h>
48 48
49#include "ufs.h"
49#include "swab.h" 50#include "swab.h"
50#include "util.h" 51#include "util.h"
51 52
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
new file mode 100644
index 000000000000..7faa4cd71a27
--- /dev/null
+++ b/fs/ufs/ufs.h
@@ -0,0 +1,157 @@
1#ifndef _UFS_UFS_H
2#define _UFS_UFS_H 1
3
4#define UFS_MAX_GROUP_LOADED 8
5#define UFS_CGNO_EMPTY ((unsigned)-1)
6
7struct ufs_sb_private_info;
8struct ufs_cg_private_info;
9struct ufs_csum;
10
11struct ufs_sb_info {
12 struct ufs_sb_private_info * s_uspi;
13 struct ufs_csum * s_csp;
14 unsigned s_bytesex;
15 unsigned s_flags;
16 struct buffer_head ** s_ucg;
17 struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED];
18 unsigned s_cgno[UFS_MAX_GROUP_LOADED];
19 unsigned short s_cg_loaded;
20 unsigned s_mount_opt;
21};
22
23struct ufs_inode_info {
24 union {
25 __fs32 i_data[15];
26 __u8 i_symlink[4*15];
27 __fs64 u2_i_data[15];
28 } i_u1;
29 __u32 i_flags;
30 __u32 i_shadow;
31 __u32 i_unused1;
32 __u32 i_unused2;
33 __u32 i_oeftflag;
34 __u16 i_osync;
35 __u64 i_lastfrag;
36 __u32 i_dir_start_lookup;
37 struct inode vfs_inode;
38};
39
40/* mount options */
41#define UFS_MOUNT_ONERROR 0x0000000F
42#define UFS_MOUNT_ONERROR_PANIC 0x00000001
43#define UFS_MOUNT_ONERROR_LOCK 0x00000002
44#define UFS_MOUNT_ONERROR_UMOUNT 0x00000004
45#define UFS_MOUNT_ONERROR_REPAIR 0x00000008
46
47#define UFS_MOUNT_UFSTYPE 0x0000FFF0
48#define UFS_MOUNT_UFSTYPE_OLD 0x00000010
49#define UFS_MOUNT_UFSTYPE_44BSD 0x00000020
50#define UFS_MOUNT_UFSTYPE_SUN 0x00000040
51#define UFS_MOUNT_UFSTYPE_NEXTSTEP 0x00000080
52#define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD 0x00000100
53#define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000200
54#define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400
55#define UFS_MOUNT_UFSTYPE_HP 0x00000800
56#define UFS_MOUNT_UFSTYPE_UFS2 0x00001000
57#define UFS_MOUNT_UFSTYPE_SUNOS 0x00002000
58
59#define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt
60#define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt
61#define ufs_test_opt(o,opt) ((o) & UFS_MOUNT_##opt)
62
63/*
64 * Debug code
65 */
66#ifdef CONFIG_UFS_DEBUG
67# define UFSD(f, a...) { \
68 printk ("UFSD (%s, %d): %s:", \
69 __FILE__, __LINE__, __FUNCTION__); \
70 printk (f, ## a); \
71 }
72#else
73# define UFSD(f, a...) /**/
74#endif
75
76/* balloc.c */
77extern void ufs_free_fragments (struct inode *, u64, unsigned);
78extern void ufs_free_blocks (struct inode *, u64, unsigned);
79extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
80 unsigned, int *, struct page *);
81
82/* cylinder.c */
83extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
84extern void ufs_put_cylinder (struct super_block *, unsigned);
85
86/* dir.c */
87extern const struct inode_operations ufs_dir_inode_operations;
88extern int ufs_add_link (struct dentry *, struct inode *);
89extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
90extern int ufs_make_empty(struct inode *, struct inode *);
91extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
92extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
93extern int ufs_empty_dir (struct inode *);
94extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
95extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
96 struct page *page, struct inode *inode);
97
98/* file.c */
99extern const struct inode_operations ufs_file_inode_operations;
100extern const struct file_operations ufs_file_operations;
101
102extern const struct address_space_operations ufs_aops;
103
104/* ialloc.c */
105extern void ufs_free_inode (struct inode *inode);
106extern struct inode * ufs_new_inode (struct inode *, int);
107
108/* inode.c */
109extern void ufs_read_inode (struct inode *);
110extern void ufs_put_inode (struct inode *);
111extern int ufs_write_inode (struct inode *, int);
112extern int ufs_sync_inode (struct inode *);
113extern void ufs_delete_inode (struct inode *);
114extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
115extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
116
117/* namei.c */
118extern const struct file_operations ufs_dir_operations;
119
120/* super.c */
121extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
122extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
123extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
124
125/* symlink.c */
126extern const struct inode_operations ufs_fast_symlink_inode_operations;
127
128/* truncate.c */
129extern int ufs_truncate (struct inode *, loff_t);
130
131static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
132{
133 return sb->s_fs_info;
134}
135
136static inline struct ufs_inode_info *UFS_I(struct inode *inode)
137{
138 return container_of(inode, struct ufs_inode_info, vfs_inode);
139}
140
141/*
142 * Give cylinder group number for a file system block.
143 * Give cylinder group block number for a file system block.
144 */
145/* #define ufs_dtog(d) ((d) / uspi->s_fpg) */
146static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b)
147{
148 do_div(b, uspi->s_fpg);
149 return b;
150}
151/* #define ufs_dtogd(d) ((d) % uspi->s_fpg) */
152static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
153{
154 return do_div(b, uspi->s_fpg);
155}
156
157#endif /* _UFS_UFS_H */
diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index 84357f1ff0ec..410084dae389 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -11,6 +11,7 @@
11#include <linux/ufs_fs.h> 11#include <linux/ufs_fs.h>
12#include <linux/buffer_head.h> 12#include <linux/buffer_head.h>
13 13
14#include "ufs.h"
14#include "swab.h" 15#include "swab.h"
15#include "util.h" 16#include "util.h"
16 17
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 79a340a1909e..b26fc4dec1e7 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -38,6 +38,10 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
38 struct ufs_super_block_third *usb3) 38 struct ufs_super_block_third *usb3)
39{ 39{
40 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 40 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
41 case UFS_ST_SUNOS:
42 if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
43 return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
44 /* Fall Through to UFS_ST_SUN */
41 case UFS_ST_SUN: 45 case UFS_ST_SUN:
42 return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state); 46 return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
43 case UFS_ST_SUNx86: 47 case UFS_ST_SUNx86:
@@ -53,6 +57,12 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
53 struct ufs_super_block_third *usb3, s32 value) 57 struct ufs_super_block_third *usb3, s32 value)
54{ 58{
55 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 59 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
60 case UFS_ST_SUNOS:
61 if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) {
62 usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
63 break;
64 }
65 /* Fall Through to UFS_ST_SUN */
56 case UFS_ST_SUN: 66 case UFS_ST_SUN:
57 usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value); 67 usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
58 break; 68 break;
@@ -81,6 +91,7 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
81 __fs64 tmp; 91 __fs64 tmp;
82 92
83 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 93 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
94 case UFS_ST_SUNOS:
84 case UFS_ST_SUN: 95 case UFS_ST_SUN:
85 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0]; 96 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0];
86 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1]; 97 ((__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)
104 __fs64 tmp; 115 __fs64 tmp;
105 116
106 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 117 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
118 case UFS_ST_SUNOS:
107 case UFS_ST_SUN: 119 case UFS_ST_SUN:
108 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0]; 120 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0];
109 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1]; 121 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1];
@@ -179,10 +191,12 @@ static inline u32
179ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode) 191ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
180{ 192{
181 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 193 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
182 case UFS_UID_EFT:
183 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
184 case UFS_UID_44BSD: 194 case UFS_UID_44BSD:
185 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid); 195 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid);
196 case UFS_UID_EFT:
197 if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
198 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
199 /* Fall through */
186 default: 200 default:
187 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid); 201 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid);
188 } 202 }
@@ -192,24 +206,31 @@ static inline void
192ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value) 206ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
193{ 207{
194 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 208 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
195 case UFS_UID_EFT:
196 inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
197 break;
198 case UFS_UID_44BSD: 209 case UFS_UID_44BSD:
199 inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value); 210 inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value);
211 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
212 break;
213 case UFS_UID_EFT:
214 inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
215 if (value > 0xFFFF)
216 value = 0xFFFF;
217 /* Fall through */
218 default:
219 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
200 break; 220 break;
201 } 221 }
202 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
203} 222}
204 223
205static inline u32 224static inline u32
206ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode) 225ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
207{ 226{
208 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 227 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
209 case UFS_UID_EFT:
210 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
211 case UFS_UID_44BSD: 228 case UFS_UID_44BSD:
212 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid); 229 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
230 case UFS_UID_EFT:
231 if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
232 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
233 /* Fall through */
213 default: 234 default:
214 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid); 235 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid);
215 } 236 }
@@ -219,14 +240,19 @@ static inline void
219ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value) 240ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value)
220{ 241{
221 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 242 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
222 case UFS_UID_EFT:
223 inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
224 break;
225 case UFS_UID_44BSD: 243 case UFS_UID_44BSD:
226 inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value); 244 inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value);
245 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
246 break;
247 case UFS_UID_EFT:
248 inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
249 if (value > 0xFFFF)
250 value = 0xFFFF;
251 /* Fall through */
252 default:
253 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
227 break; 254 break;
228 } 255 }
229 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
230} 256}
231 257
232extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *); 258extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *);
diff --git a/fs/utimes.c b/fs/utimes.c
index 682eb63b20ad..b9912ecbee24 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -38,6 +38,14 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times)
38 38
39#endif 39#endif
40 40
41static bool nsec_valid(long nsec)
42{
43 if (nsec == UTIME_OMIT || nsec == UTIME_NOW)
44 return true;
45
46 return nsec >= 0 && nsec <= 999999999;
47}
48
41/* If times==NULL, set access and modification to current time, 49/* If times==NULL, set access and modification to current time,
42 * must be owner or have write permission. 50 * must be owner or have write permission.
43 * Else, update from *times, must be owner or super user. 51 * 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
52 struct file *f = NULL; 60 struct file *f = NULL;
53 61
54 error = -EINVAL; 62 error = -EINVAL;
63 if (times && (!nsec_valid(times[0].tv_nsec) ||
64 !nsec_valid(times[1].tv_nsec))) {
65 goto out;
66 }
67
55 if (flags & ~AT_SYMLINK_NOFOLLOW) 68 if (flags & ~AT_SYMLINK_NOFOLLOW)
56 goto out; 69 goto out;
57 70
diff --git a/fs/xfs/Makefile-linux-2.6 b/fs/xfs/Makefile-linux-2.6
index e7a9a83f0087..d1491aa7a0e2 100644
--- a/fs/xfs/Makefile-linux-2.6
+++ b/fs/xfs/Makefile-linux-2.6
@@ -49,7 +49,6 @@ xfs-y += xfs_alloc.o \
49 xfs_alloc_btree.o \ 49 xfs_alloc_btree.o \
50 xfs_attr.o \ 50 xfs_attr.o \
51 xfs_attr_leaf.o \ 51 xfs_attr_leaf.o \
52 xfs_behavior.o \
53 xfs_bit.o \ 52 xfs_bit.o \
54 xfs_bmap.o \ 53 xfs_bmap.o \
55 xfs_bmap_btree.o \ 54 xfs_bmap_btree.o \
@@ -108,13 +107,11 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
108 xfs_iops.o \ 107 xfs_iops.o \
109 xfs_lrw.o \ 108 xfs_lrw.o \
110 xfs_super.o \ 109 xfs_super.o \
111 xfs_vfs.o \
112 xfs_vnode.o) 110 xfs_vnode.o)
113 111
114# Objects in support/ 112# Objects in support/
115xfs-y += $(addprefix support/, \ 113xfs-y += $(addprefix support/, \
116 debug.o \ 114 debug.o \
117 move.o \
118 uuid.o) 115 uuid.o)
119 116
120xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o 117xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index e6ea293f303c..5e9564902976 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -79,7 +79,7 @@ kmem_zone_init(int size, char *zone_name)
79 79
80static inline kmem_zone_t * 80static inline kmem_zone_t *
81kmem_zone_init_flags(int size, char *zone_name, unsigned long flags, 81kmem_zone_init_flags(int size, char *zone_name, unsigned long flags,
82 void (*construct)(void *, kmem_zone_t *, unsigned long)) 82 void (*construct)(kmem_zone_t *, void *))
83{ 83{
84 return kmem_cache_create(zone_name, size, 0, flags, construct); 84 return kmem_cache_create(zone_name, size, 0, flags, construct);
85} 85}
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 354d68a32d4a..2e34b104107c 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -37,6 +37,7 @@
37#include "xfs_error.h" 37#include "xfs_error.h"
38#include "xfs_rw.h" 38#include "xfs_rw.h"
39#include "xfs_iomap.h" 39#include "xfs_iomap.h"
40#include "xfs_vnodeops.h"
40#include <linux/mpage.h> 41#include <linux/mpage.h>
41#include <linux/pagevec.h> 42#include <linux/pagevec.h>
42#include <linux/writeback.h> 43#include <linux/writeback.h>
@@ -139,9 +140,11 @@ xfs_destroy_ioend(
139 next = bh->b_private; 140 next = bh->b_private;
140 bh->b_end_io(bh, !ioend->io_error); 141 bh->b_end_io(bh, !ioend->io_error);
141 } 142 }
142 if (unlikely(ioend->io_error)) 143 if (unlikely(ioend->io_error)) {
143 vn_ioerror(ioend->io_vnode, ioend->io_error, __FILE__,__LINE__); 144 vn_ioerror(XFS_I(ioend->io_inode), ioend->io_error,
144 vn_iowake(ioend->io_vnode); 145 __FILE__,__LINE__);
146 }
147 vn_iowake(XFS_I(ioend->io_inode));
145 mempool_free(ioend, xfs_ioend_pool); 148 mempool_free(ioend, xfs_ioend_pool);
146} 149}
147 150
@@ -156,14 +159,10 @@ STATIC void
156xfs_setfilesize( 159xfs_setfilesize(
157 xfs_ioend_t *ioend) 160 xfs_ioend_t *ioend)
158{ 161{
159 xfs_inode_t *ip; 162 xfs_inode_t *ip = XFS_I(ioend->io_inode);
160 xfs_fsize_t isize; 163 xfs_fsize_t isize;
161 xfs_fsize_t bsize; 164 xfs_fsize_t bsize;
162 165
163 ip = xfs_vtoi(ioend->io_vnode);
164 if (!ip)
165 return;
166
167 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); 166 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
168 ASSERT(ioend->io_type != IOMAP_READ); 167 ASSERT(ioend->io_type != IOMAP_READ);
169 168
@@ -181,7 +180,7 @@ xfs_setfilesize(
181 ip->i_d.di_size = isize; 180 ip->i_d.di_size = isize;
182 ip->i_update_core = 1; 181 ip->i_update_core = 1;
183 ip->i_update_size = 1; 182 ip->i_update_size = 1;
184 mark_inode_dirty_sync(vn_to_inode(ioend->io_vnode)); 183 mark_inode_dirty_sync(ioend->io_inode);
185 } 184 }
186 185
187 xfs_iunlock(ip, XFS_ILOCK_EXCL); 186 xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -227,12 +226,12 @@ xfs_end_bio_unwritten(
227{ 226{
228 xfs_ioend_t *ioend = 227 xfs_ioend_t *ioend =
229 container_of(work, xfs_ioend_t, io_work); 228 container_of(work, xfs_ioend_t, io_work);
230 bhv_vnode_t *vp = ioend->io_vnode;
231 xfs_off_t offset = ioend->io_offset; 229 xfs_off_t offset = ioend->io_offset;
232 size_t size = ioend->io_size; 230 size_t size = ioend->io_size;
233 231
234 if (likely(!ioend->io_error)) { 232 if (likely(!ioend->io_error)) {
235 bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL); 233 xfs_bmap(XFS_I(ioend->io_inode), offset, size,
234 BMAPI_UNWRITTEN, NULL, NULL);
236 xfs_setfilesize(ioend); 235 xfs_setfilesize(ioend);
237 } 236 }
238 xfs_destroy_ioend(ioend); 237 xfs_destroy_ioend(ioend);
@@ -275,10 +274,10 @@ xfs_alloc_ioend(
275 ioend->io_error = 0; 274 ioend->io_error = 0;
276 ioend->io_list = NULL; 275 ioend->io_list = NULL;
277 ioend->io_type = type; 276 ioend->io_type = type;
278 ioend->io_vnode = vn_from_inode(inode); 277 ioend->io_inode = inode;
279 ioend->io_buffer_head = NULL; 278 ioend->io_buffer_head = NULL;
280 ioend->io_buffer_tail = NULL; 279 ioend->io_buffer_tail = NULL;
281 atomic_inc(&ioend->io_vnode->v_iocount); 280 atomic_inc(&XFS_I(ioend->io_inode)->i_iocount);
282 ioend->io_offset = 0; 281 ioend->io_offset = 0;
283 ioend->io_size = 0; 282 ioend->io_size = 0;
284 283
@@ -302,12 +301,13 @@ xfs_map_blocks(
302 xfs_iomap_t *mapp, 301 xfs_iomap_t *mapp,
303 int flags) 302 int flags)
304{ 303{
305 bhv_vnode_t *vp = vn_from_inode(inode); 304 xfs_inode_t *ip = XFS_I(inode);
306 int error, nmaps = 1; 305 int error, nmaps = 1;
307 306
308 error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps); 307 error = xfs_bmap(ip, offset, count,
308 flags, mapp, &nmaps);
309 if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) 309 if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
310 VMODIFY(vp); 310 xfs_iflags_set(ip, XFS_IMODIFIED);
311 return -error; 311 return -error;
312} 312}
313 313
@@ -402,10 +402,9 @@ xfs_start_page_writeback(
402 clear_page_dirty_for_io(page); 402 clear_page_dirty_for_io(page);
403 set_page_writeback(page); 403 set_page_writeback(page);
404 unlock_page(page); 404 unlock_page(page);
405 if (!buffers) { 405 /* If no buffers on the page are to be written, finish it here */
406 if (!buffers)
406 end_page_writeback(page); 407 end_page_writeback(page);
407 wbc->pages_skipped++; /* We didn't write this page */
408 }
409} 408}
410 409
411static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh) 410static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh)
@@ -498,7 +497,7 @@ xfs_cancel_ioend(
498 unlock_buffer(bh); 497 unlock_buffer(bh);
499 } while ((bh = next_bh) != NULL); 498 } while ((bh = next_bh) != NULL);
500 499
501 vn_iowake(ioend->io_vnode); 500 vn_iowake(XFS_I(ioend->io_inode));
502 mempool_free(ioend, xfs_ioend_pool); 501 mempool_free(ioend, xfs_ioend_pool);
503 } while ((ioend = next) != NULL); 502 } while ((ioend = next) != NULL);
504} 503}
@@ -1238,10 +1237,7 @@ xfs_vm_writepages(
1238 struct address_space *mapping, 1237 struct address_space *mapping,
1239 struct writeback_control *wbc) 1238 struct writeback_control *wbc)
1240{ 1239{
1241 struct bhv_vnode *vp = vn_from_inode(mapping->host); 1240 xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED);
1242
1243 if (VN_TRUNC(vp))
1244 VUNTRUNCATE(vp);
1245 return generic_writepages(mapping, wbc); 1241 return generic_writepages(mapping, wbc);
1246} 1242}
1247 1243
@@ -1318,7 +1314,6 @@ __xfs_get_blocks(
1318 int direct, 1314 int direct,
1319 bmapi_flags_t flags) 1315 bmapi_flags_t flags)
1320{ 1316{
1321 bhv_vnode_t *vp = vn_from_inode(inode);
1322 xfs_iomap_t iomap; 1317 xfs_iomap_t iomap;
1323 xfs_off_t offset; 1318 xfs_off_t offset;
1324 ssize_t size; 1319 ssize_t size;
@@ -1328,7 +1323,7 @@ __xfs_get_blocks(
1328 offset = (xfs_off_t)iblock << inode->i_blkbits; 1323 offset = (xfs_off_t)iblock << inode->i_blkbits;
1329 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); 1324 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
1330 size = bh_result->b_size; 1325 size = bh_result->b_size;
1331 error = bhv_vop_bmap(vp, offset, size, 1326 error = xfs_bmap(XFS_I(inode), offset, size,
1332 create ? flags : BMAPI_READ, &iomap, &niomap); 1327 create ? flags : BMAPI_READ, &iomap, &niomap);
1333 if (error) 1328 if (error)
1334 return -error; 1329 return -error;
@@ -1476,13 +1471,13 @@ xfs_vm_direct_IO(
1476{ 1471{
1477 struct file *file = iocb->ki_filp; 1472 struct file *file = iocb->ki_filp;
1478 struct inode *inode = file->f_mapping->host; 1473 struct inode *inode = file->f_mapping->host;
1479 bhv_vnode_t *vp = vn_from_inode(inode);
1480 xfs_iomap_t iomap; 1474 xfs_iomap_t iomap;
1481 int maps = 1; 1475 int maps = 1;
1482 int error; 1476 int error;
1483 ssize_t ret; 1477 ssize_t ret;
1484 1478
1485 error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps); 1479 error = xfs_bmap(XFS_I(inode), offset, 0,
1480 BMAPI_DEVICE, &iomap, &maps);
1486 if (error) 1481 if (error)
1487 return -error; 1482 return -error;
1488 1483
@@ -1528,12 +1523,13 @@ xfs_vm_bmap(
1528 sector_t block) 1523 sector_t block)
1529{ 1524{
1530 struct inode *inode = (struct inode *)mapping->host; 1525 struct inode *inode = (struct inode *)mapping->host;
1531 bhv_vnode_t *vp = vn_from_inode(inode); 1526 struct xfs_inode *ip = XFS_I(inode);
1532 1527
1533 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 1528 vn_trace_entry(XFS_I(inode), __FUNCTION__,
1534 bhv_vop_rwlock(vp, VRWLOCK_READ); 1529 (inst_t *)__return_address);
1535 bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF); 1530 xfs_rwlock(ip, VRWLOCK_READ);
1536 bhv_vop_rwunlock(vp, VRWLOCK_READ); 1531 xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF);
1532 xfs_rwunlock(ip, VRWLOCK_READ);
1537 return generic_block_bmap(mapping, block, xfs_get_blocks); 1533 return generic_block_bmap(mapping, block, xfs_get_blocks);
1538} 1534}
1539 1535
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
index 2244e516b66a..3ba0631a3818 100644
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -32,7 +32,7 @@ typedef struct xfs_ioend {
32 unsigned int io_type; /* delalloc / unwritten */ 32 unsigned int io_type; /* delalloc / unwritten */
33 int io_error; /* I/O error code */ 33 int io_error; /* I/O error code */
34 atomic_t io_remaining; /* hold count */ 34 atomic_t io_remaining; /* hold count */
35 struct bhv_vnode *io_vnode; /* file being written to */ 35 struct inode *io_inode; /* file being written to */
36 struct buffer_head *io_buffer_head;/* buffer linked list head */ 36 struct buffer_head *io_buffer_head;/* buffer linked list head */
37 struct buffer_head *io_buffer_tail;/* buffer linked list tail */ 37 struct buffer_head *io_buffer_tail;/* buffer linked list tail */
38 size_t io_size; /* size of the extent */ 38 size_t io_size; /* size of the extent */
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 39f44ee572e8..b9c8589e05c2 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -187,6 +187,19 @@ free_address(
187{ 187{
188 a_list_t *aentry; 188 a_list_t *aentry;
189 189
190#ifdef CONFIG_XEN
191 /*
192 * Xen needs to be able to make sure it can get an exclusive
193 * RO mapping of pages it wants to turn into a pagetable. If
194 * a newly allocated page is also still being vmap()ed by xfs,
195 * it will cause pagetable construction to fail. This is a
196 * quick workaround to always eagerly unmap pages so that Xen
197 * is happy.
198 */
199 vunmap(addr);
200 return;
201#endif
202
190 aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT); 203 aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
191 if (likely(aentry)) { 204 if (likely(aentry)) {
192 spin_lock(&as_lock); 205 spin_lock(&as_lock);
@@ -997,7 +1010,18 @@ xfs_buf_iodone_work(
997 xfs_buf_t *bp = 1010 xfs_buf_t *bp =
998 container_of(work, xfs_buf_t, b_iodone_work); 1011 container_of(work, xfs_buf_t, b_iodone_work);
999 1012
1000 if (bp->b_iodone) 1013 /*
1014 * We can get an EOPNOTSUPP to ordered writes. Here we clear the
1015 * ordered flag and reissue them. Because we can't tell the higher
1016 * layers directly that they should not issue ordered I/O anymore, they
1017 * need to check if the ordered flag was cleared during I/O completion.
1018 */
1019 if ((bp->b_error == EOPNOTSUPP) &&
1020 (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
1021 XB_TRACE(bp, "ordered_retry", bp->b_iodone);
1022 bp->b_flags &= ~XBF_ORDERED;
1023 xfs_buf_iorequest(bp);
1024 } else if (bp->b_iodone)
1001 (*(bp->b_iodone))(bp); 1025 (*(bp->b_iodone))(bp);
1002 else if (bp->b_flags & XBF_ASYNC) 1026 else if (bp->b_flags & XBF_ASYNC)
1003 xfs_buf_relse(bp); 1027 xfs_buf_relse(bp);
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index e3a5fedac1ba..726449d4fd22 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -17,12 +17,18 @@
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_types.h" 19#include "xfs_types.h"
20#include "xfs_dmapi.h" 20#include "xfs_inum.h"
21#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_trans.h" 22#include "xfs_trans.h"
23#include "xfs_sb.h" 23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_dmapi.h"
24#include "xfs_mount.h" 26#include "xfs_mount.h"
25#include "xfs_export.h" 27#include "xfs_export.h"
28#include "xfs_vnodeops.h"
29#include "xfs_bmap_btree.h"
30#include "xfs_inode.h"
31#include "xfs_vfsops.h"
26 32
27static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, }; 33static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, };
28 34
@@ -96,9 +102,7 @@ xfs_fs_encode_fh(
96 int len; 102 int len;
97 int is64 = 0; 103 int is64 = 0;
98#if XFS_BIG_INUMS 104#if XFS_BIG_INUMS
99 bhv_vfs_t *vfs = vfs_from_sb(inode->i_sb); 105 if (!(XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_SMALL_INUMS)) {
100
101 if (!(vfs->vfs_flag & VFS_32BITINODES)) {
102 /* filesystem may contain 64bit inode numbers */ 106 /* filesystem may contain 64bit inode numbers */
103 is64 = XFS_FILEID_TYPE_64FLAG; 107 is64 = XFS_FILEID_TYPE_64FLAG;
104 } 108 }
@@ -138,10 +142,9 @@ xfs_fs_get_dentry(
138 bhv_vnode_t *vp; 142 bhv_vnode_t *vp;
139 struct inode *inode; 143 struct inode *inode;
140 struct dentry *result; 144 struct dentry *result;
141 bhv_vfs_t *vfsp = vfs_from_sb(sb);
142 int error; 145 int error;
143 146
144 error = bhv_vfs_vget(vfsp, &vp, (fid_t *)data); 147 error = xfs_vget(XFS_M(sb), &vp, (fid_t *)data);
145 if (error || vp == NULL) 148 if (error || vp == NULL)
146 return ERR_PTR(-ESTALE) ; 149 return ERR_PTR(-ESTALE) ;
147 150
@@ -159,12 +162,11 @@ xfs_fs_get_parent(
159 struct dentry *child) 162 struct dentry *child)
160{ 163{
161 int error; 164 int error;
162 bhv_vnode_t *vp, *cvp; 165 bhv_vnode_t *cvp;
163 struct dentry *parent; 166 struct dentry *parent;
164 167
165 cvp = NULL; 168 cvp = NULL;
166 vp = vn_from_inode(child->d_inode); 169 error = xfs_lookup(XFS_I(child->d_inode), &dotdot, &cvp);
167 error = bhv_vop_lookup(vp, &dotdot, &cvp, 0, NULL, NULL);
168 if (unlikely(error)) 170 if (unlikely(error))
169 return ERR_PTR(-error); 171 return ERR_PTR(-error);
170 172
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 0d4001eafd16..fb8dd34041eb 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -37,6 +37,7 @@
37#include "xfs_error.h" 37#include "xfs_error.h"
38#include "xfs_rw.h" 38#include "xfs_rw.h"
39#include "xfs_ioctl32.h" 39#include "xfs_ioctl32.h"
40#include "xfs_vnodeops.h"
40 41
41#include <linux/dcache.h> 42#include <linux/dcache.h>
42#include <linux/smp_lock.h> 43#include <linux/smp_lock.h>
@@ -55,13 +56,12 @@ __xfs_file_read(
55 loff_t pos) 56 loff_t pos)
56{ 57{
57 struct file *file = iocb->ki_filp; 58 struct file *file = iocb->ki_filp;
58 bhv_vnode_t *vp = vn_from_inode(file->f_path.dentry->d_inode);
59 59
60 BUG_ON(iocb->ki_pos != pos); 60 BUG_ON(iocb->ki_pos != pos);
61 if (unlikely(file->f_flags & O_DIRECT)) 61 if (unlikely(file->f_flags & O_DIRECT))
62 ioflags |= IO_ISDIRECT; 62 ioflags |= IO_ISDIRECT;
63 return bhv_vop_read(vp, iocb, iov, nr_segs, &iocb->ki_pos, 63 return xfs_read(XFS_I(file->f_path.dentry->d_inode), iocb, iov,
64 ioflags, NULL); 64 nr_segs, &iocb->ki_pos, ioflags);
65} 65}
66 66
67STATIC ssize_t 67STATIC ssize_t
@@ -93,14 +93,12 @@ __xfs_file_write(
93 loff_t pos) 93 loff_t pos)
94{ 94{
95 struct file *file = iocb->ki_filp; 95 struct file *file = iocb->ki_filp;
96 struct inode *inode = file->f_mapping->host;
97 bhv_vnode_t *vp = vn_from_inode(inode);
98 96
99 BUG_ON(iocb->ki_pos != pos); 97 BUG_ON(iocb->ki_pos != pos);
100 if (unlikely(file->f_flags & O_DIRECT)) 98 if (unlikely(file->f_flags & O_DIRECT))
101 ioflags |= IO_ISDIRECT; 99 ioflags |= IO_ISDIRECT;
102 return bhv_vop_write(vp, iocb, iov, nr_segs, &iocb->ki_pos, 100 return xfs_write(XFS_I(file->f_mapping->host), iocb, iov, nr_segs,
103 ioflags, NULL); 101 &iocb->ki_pos, ioflags);
104} 102}
105 103
106STATIC ssize_t 104STATIC ssize_t
@@ -131,8 +129,8 @@ xfs_file_splice_read(
131 size_t len, 129 size_t len,
132 unsigned int flags) 130 unsigned int flags)
133{ 131{
134 return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode), 132 return xfs_splice_read(XFS_I(infilp->f_path.dentry->d_inode),
135 infilp, ppos, pipe, len, flags, 0, NULL); 133 infilp, ppos, pipe, len, flags, 0);
136} 134}
137 135
138STATIC ssize_t 136STATIC ssize_t
@@ -143,9 +141,8 @@ xfs_file_splice_read_invis(
143 size_t len, 141 size_t len,
144 unsigned int flags) 142 unsigned int flags)
145{ 143{
146 return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode), 144 return xfs_splice_read(XFS_I(infilp->f_path.dentry->d_inode),
147 infilp, ppos, pipe, len, flags, IO_INVIS, 145 infilp, ppos, pipe, len, flags, IO_INVIS);
148 NULL);
149} 146}
150 147
151STATIC ssize_t 148STATIC ssize_t
@@ -156,8 +153,8 @@ xfs_file_splice_write(
156 size_t len, 153 size_t len,
157 unsigned int flags) 154 unsigned int flags)
158{ 155{
159 return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode), 156 return xfs_splice_write(XFS_I(outfilp->f_path.dentry->d_inode),
160 pipe, outfilp, ppos, len, flags, 0, NULL); 157 pipe, outfilp, ppos, len, flags, 0);
161} 158}
162 159
163STATIC ssize_t 160STATIC ssize_t
@@ -168,9 +165,8 @@ xfs_file_splice_write_invis(
168 size_t len, 165 size_t len,
169 unsigned int flags) 166 unsigned int flags)
170{ 167{
171 return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode), 168 return xfs_splice_write(XFS_I(outfilp->f_path.dentry->d_inode),
172 pipe, outfilp, ppos, len, flags, IO_INVIS, 169 pipe, outfilp, ppos, len, flags, IO_INVIS);
173 NULL);
174} 170}
175 171
176STATIC int 172STATIC int
@@ -180,7 +176,7 @@ xfs_file_open(
180{ 176{
181 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) 177 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
182 return -EFBIG; 178 return -EFBIG;
183 return -bhv_vop_open(vn_from_inode(inode), NULL); 179 return -xfs_open(XFS_I(inode));
184} 180}
185 181
186STATIC int 182STATIC int
@@ -188,11 +184,7 @@ xfs_file_release(
188 struct inode *inode, 184 struct inode *inode,
189 struct file *filp) 185 struct file *filp)
190{ 186{
191 bhv_vnode_t *vp = vn_from_inode(inode); 187 return -xfs_release(XFS_I(inode));
192
193 if (vp)
194 return -bhv_vop_release(vp);
195 return 0;
196} 188}
197 189
198STATIC int 190STATIC int
@@ -201,14 +193,13 @@ xfs_file_fsync(
201 struct dentry *dentry, 193 struct dentry *dentry,
202 int datasync) 194 int datasync)
203{ 195{
204 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
205 int flags = FSYNC_WAIT; 196 int flags = FSYNC_WAIT;
206 197
207 if (datasync) 198 if (datasync)
208 flags |= FSYNC_DATA; 199 flags |= FSYNC_DATA;
209 if (VN_TRUNC(vp)) 200 xfs_iflags_clear(XFS_I(dentry->d_inode), XFS_ITRUNCATED);
210 VUNTRUNCATE(vp); 201 return -xfs_fsync(XFS_I(dentry->d_inode), flags,
211 return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1); 202 (xfs_off_t)0, (xfs_off_t)-1);
212} 203}
213 204
214#ifdef CONFIG_XFS_DMAPI 205#ifdef CONFIG_XFS_DMAPI
@@ -233,74 +224,30 @@ xfs_file_readdir(
233 void *dirent, 224 void *dirent,
234 filldir_t filldir) 225 filldir_t filldir)
235{ 226{
236 int error = 0; 227 struct inode *inode = filp->f_path.dentry->d_inode;
237 bhv_vnode_t *vp = vn_from_inode(filp->f_path.dentry->d_inode); 228 xfs_inode_t *ip = XFS_I(inode);
238 uio_t uio; 229 int error;
239 iovec_t iov; 230 size_t bufsize;
240 int eof = 0; 231
241 caddr_t read_buf; 232 /*
242 int namelen, size = 0; 233 * The Linux API doesn't pass down the total size of the buffer
243 size_t rlen = PAGE_CACHE_SIZE; 234 * we read into down to the filesystem. With the filldir concept
244 xfs_off_t start_offset, curr_offset; 235 * it's not needed for correct information, but the XFS dir2 leaf
245 xfs_dirent_t *dbp = NULL; 236 * code wants an estimate of the buffer size to calculate it's
246 237 * readahead window and size the buffers used for mapping to
247 /* Try fairly hard to get memory */ 238 * physical blocks.
248 do { 239 *
249 if ((read_buf = kmalloc(rlen, GFP_KERNEL))) 240 * Try to give it an estimate that's good enough, maybe at some
250 break; 241 * point we can change the ->readdir prototype to include the
251 rlen >>= 1; 242 * buffer size.
252 } while (rlen >= 1024); 243 */
253 244 bufsize = (size_t)min_t(loff_t, PAGE_SIZE, inode->i_size);
254 if (read_buf == NULL)
255 return -ENOMEM;
256
257 uio.uio_iov = &iov;
258 uio.uio_segflg = UIO_SYSSPACE;
259 curr_offset = filp->f_pos;
260 if (filp->f_pos != 0x7fffffff)
261 uio.uio_offset = filp->f_pos;
262 else
263 uio.uio_offset = 0xffffffff;
264
265 while (!eof) {
266 uio.uio_resid = iov.iov_len = rlen;
267 iov.iov_base = read_buf;
268 uio.uio_iovcnt = 1;
269
270 start_offset = uio.uio_offset;
271
272 error = bhv_vop_readdir(vp, &uio, NULL, &eof);
273 if ((uio.uio_offset == start_offset) || error) {
274 size = 0;
275 break;
276 }
277
278 size = rlen - uio.uio_resid;
279 dbp = (xfs_dirent_t *)read_buf;
280 while (size > 0) {
281 namelen = strlen(dbp->d_name);
282
283 if (filldir(dirent, dbp->d_name, namelen,
284 (loff_t) curr_offset & 0x7fffffff,
285 (ino_t) dbp->d_ino,
286 DT_UNKNOWN)) {
287 goto done;
288 }
289 size -= dbp->d_reclen;
290 curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
291 dbp = (xfs_dirent_t *)((char *)dbp + dbp->d_reclen);
292 }
293 }
294done:
295 if (!error) {
296 if (size == 0)
297 filp->f_pos = uio.uio_offset & 0x7fffffff;
298 else if (dbp)
299 filp->f_pos = curr_offset;
300 }
301 245
302 kfree(read_buf); 246 error = xfs_readdir(ip, dirent, bufsize,
303 return -error; 247 (xfs_off_t *)&filp->f_pos, filldir);
248 if (error)
249 return -error;
250 return 0;
304} 251}
305 252
306STATIC int 253STATIC int
@@ -312,7 +259,7 @@ xfs_file_mmap(
312 vma->vm_flags |= VM_CAN_NONLINEAR; 259 vma->vm_flags |= VM_CAN_NONLINEAR;
313 260
314#ifdef CONFIG_XFS_DMAPI 261#ifdef CONFIG_XFS_DMAPI
315 if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI) 262 if (XFS_M(filp->f_path.dentry->d_inode->i_sb)->m_flags & XFS_MOUNT_DMAPI)
316 vma->vm_ops = &xfs_dmapi_file_vm_ops; 263 vma->vm_ops = &xfs_dmapi_file_vm_ops;
317#endif /* CONFIG_XFS_DMAPI */ 264#endif /* CONFIG_XFS_DMAPI */
318 265
@@ -328,10 +275,9 @@ xfs_file_ioctl(
328{ 275{
329 int error; 276 int error;
330 struct inode *inode = filp->f_path.dentry->d_inode; 277 struct inode *inode = filp->f_path.dentry->d_inode;
331 bhv_vnode_t *vp = vn_from_inode(inode);
332 278
333 error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p); 279 error = xfs_ioctl(XFS_I(inode), filp, 0, cmd, (void __user *)p);
334 VMODIFY(vp); 280 xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED);
335 281
336 /* NOTE: some of the ioctl's return positive #'s as a 282 /* NOTE: some of the ioctl's return positive #'s as a
337 * byte count indicating success, such as 283 * byte count indicating success, such as
@@ -350,10 +296,9 @@ xfs_file_ioctl_invis(
350{ 296{
351 int error; 297 int error;
352 struct inode *inode = filp->f_path.dentry->d_inode; 298 struct inode *inode = filp->f_path.dentry->d_inode;
353 bhv_vnode_t *vp = vn_from_inode(inode);
354 299
355 error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p); 300 error = xfs_ioctl(XFS_I(inode), filp, IO_INVIS, cmd, (void __user *)p);
356 VMODIFY(vp); 301 xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED);
357 302
358 /* NOTE: some of the ioctl's return positive #'s as a 303 /* NOTE: some of the ioctl's return positive #'s as a
359 * byte count indicating success, such as 304 * byte count indicating success, such as
@@ -371,16 +316,14 @@ xfs_vm_mprotect(
371 struct vm_area_struct *vma, 316 struct vm_area_struct *vma,
372 unsigned int newflags) 317 unsigned int newflags)
373{ 318{
374 bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_path.dentry->d_inode); 319 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
320 struct xfs_mount *mp = XFS_M(inode->i_sb);
375 int error = 0; 321 int error = 0;
376 322
377 if (vp->v_vfsp->vfs_flag & VFS_DMI) { 323 if (mp->m_flags & XFS_MOUNT_DMAPI) {
378 if ((vma->vm_flags & VM_MAYSHARE) && 324 if ((vma->vm_flags & VM_MAYSHARE) &&
379 (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) { 325 (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE))
380 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
381
382 error = XFS_SEND_MMAP(mp, vma, VM_WRITE); 326 error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
383 }
384 } 327 }
385 return error; 328 return error;
386} 329}
@@ -397,18 +340,17 @@ STATIC int
397xfs_file_open_exec( 340xfs_file_open_exec(
398 struct inode *inode) 341 struct inode *inode)
399{ 342{
400 bhv_vnode_t *vp = vn_from_inode(inode); 343 struct xfs_mount *mp = XFS_M(inode->i_sb);
401 344
402 if (unlikely(vp->v_vfsp->vfs_flag & VFS_DMI)) { 345 if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI)) {
403 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); 346 if (DM_EVENT_ENABLED(XFS_I(inode), DM_EVENT_READ)) {
404 xfs_inode_t *ip = xfs_vtoi(vp); 347 bhv_vnode_t *vp = vn_from_inode(inode);
405 348
406 if (!ip) 349 return -XFS_SEND_DATA(mp, DM_EVENT_READ,
407 return -EINVAL; 350 vp, 0, 0, 0, NULL);
408 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) 351 }
409 return -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
410 0, 0, 0, NULL);
411 } 352 }
353
412 return 0; 354 return 0;
413} 355}
414#endif /* HAVE_FOP_OPEN_EXEC */ 356#endif /* HAVE_FOP_OPEN_EXEC */
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c
index 2eb87cd082af..ac6d34cc355d 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.c
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.c
@@ -16,66 +16,78 @@
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_vnodeops.h"
20
21/*
22 * The following six includes are needed so that we can include
23 * xfs_inode.h. What a mess..
24 */
25#include "xfs_bmap_btree.h"
26#include "xfs_inum.h"
27#include "xfs_dir2.h"
28#include "xfs_dir2_sf.h"
29#include "xfs_attr_sf.h"
30#include "xfs_dinode.h"
31
32#include "xfs_inode.h"
19 33
20int fs_noerr(void) { return 0; } 34int fs_noerr(void) { return 0; }
21int fs_nosys(void) { return ENOSYS; } 35int fs_nosys(void) { return ENOSYS; }
22void fs_noval(void) { return; } 36void fs_noval(void) { return; }
23 37
24void 38void
25fs_tosspages( 39xfs_tosspages(
26 bhv_desc_t *bdp, 40 xfs_inode_t *ip,
27 xfs_off_t first, 41 xfs_off_t first,
28 xfs_off_t last, 42 xfs_off_t last,
29 int fiopt) 43 int fiopt)
30{ 44{
31 bhv_vnode_t *vp = BHV_TO_VNODE(bdp); 45 bhv_vnode_t *vp = XFS_ITOV(ip);
32 struct inode *ip = vn_to_inode(vp); 46 struct inode *inode = vn_to_inode(vp);
33 47
34 if (VN_CACHED(vp)) 48 if (VN_CACHED(vp))
35 truncate_inode_pages(ip->i_mapping, first); 49 truncate_inode_pages(inode->i_mapping, first);
36} 50}
37 51
38int 52int
39fs_flushinval_pages( 53xfs_flushinval_pages(
40 bhv_desc_t *bdp, 54 xfs_inode_t *ip,
41 xfs_off_t first, 55 xfs_off_t first,
42 xfs_off_t last, 56 xfs_off_t last,
43 int fiopt) 57 int fiopt)
44{ 58{
45 bhv_vnode_t *vp = BHV_TO_VNODE(bdp); 59 bhv_vnode_t *vp = XFS_ITOV(ip);
46 struct inode *ip = vn_to_inode(vp); 60 struct inode *inode = vn_to_inode(vp);
47 int ret = 0; 61 int ret = 0;
48 62
49 if (VN_CACHED(vp)) { 63 if (VN_CACHED(vp)) {
50 if (VN_TRUNC(vp)) 64 xfs_iflags_clear(ip, XFS_ITRUNCATED);
51 VUNTRUNCATE(vp); 65 ret = filemap_write_and_wait(inode->i_mapping);
52 ret = filemap_write_and_wait(ip->i_mapping);
53 if (!ret) 66 if (!ret)
54 truncate_inode_pages(ip->i_mapping, first); 67 truncate_inode_pages(inode->i_mapping, first);
55 } 68 }
56 return ret; 69 return ret;
57} 70}
58 71
59int 72int
60fs_flush_pages( 73xfs_flush_pages(
61 bhv_desc_t *bdp, 74 xfs_inode_t *ip,
62 xfs_off_t first, 75 xfs_off_t first,
63 xfs_off_t last, 76 xfs_off_t last,
64 uint64_t flags, 77 uint64_t flags,
65 int fiopt) 78 int fiopt)
66{ 79{
67 bhv_vnode_t *vp = BHV_TO_VNODE(bdp); 80 bhv_vnode_t *vp = XFS_ITOV(ip);
68 struct inode *ip = vn_to_inode(vp); 81 struct inode *inode = vn_to_inode(vp);
69 int ret = 0; 82 int ret = 0;
70 int ret2; 83 int ret2;
71 84
72 if (VN_DIRTY(vp)) { 85 if (VN_DIRTY(vp)) {
73 if (VN_TRUNC(vp)) 86 xfs_iflags_clear(ip, XFS_ITRUNCATED);
74 VUNTRUNCATE(vp); 87 ret = filemap_fdatawrite(inode->i_mapping);
75 ret = filemap_fdatawrite(ip->i_mapping);
76 if (flags & XFS_B_ASYNC) 88 if (flags & XFS_B_ASYNC)
77 return ret; 89 return ret;
78 ret2 = filemap_fdatawait(ip->i_mapping); 90 ret2 = filemap_fdatawait(inode->i_mapping);
79 if (!ret) 91 if (!ret)
80 ret = ret2; 92 ret = ret2;
81 } 93 }
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.h b/fs/xfs/linux-2.6/xfs_fs_subr.h
index c1b53118a303..82bb19b2599e 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.h
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.h
@@ -18,12 +18,8 @@
18#ifndef __XFS_FS_SUBR_H__ 18#ifndef __XFS_FS_SUBR_H__
19#define __XFS_FS_SUBR_H__ 19#define __XFS_FS_SUBR_H__
20 20
21struct cred;
22extern int fs_noerr(void); 21extern int fs_noerr(void);
23extern int fs_nosys(void); 22extern int fs_nosys(void);
24extern void fs_noval(void); 23extern void fs_noval(void);
25extern void fs_tosspages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
26extern int fs_flushinval_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
27extern int fs_flush_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, uint64_t, int);
28 24
29#endif /* __XFS_FS_SUBR_H__ */ 25#endif /* __XFS_FS_SUBR_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_globals.c b/fs/xfs/linux-2.6/xfs_globals.c
index 81565dea9af7..9febf9dc999d 100644
--- a/fs/xfs/linux-2.6/xfs_globals.c
+++ b/fs/xfs/linux-2.6/xfs_globals.c
@@ -20,11 +20,6 @@
20#include "xfs_sysctl.h" 20#include "xfs_sysctl.h"
21 21
22/* 22/*
23 * System memory size - used to scale certain data structures in XFS.
24 */
25unsigned long xfs_physmem;
26
27/*
28 * Tunable XFS parameters. xfs_params is required even when CONFIG_SYSCTL=n, 23 * Tunable XFS parameters. xfs_params is required even when CONFIG_SYSCTL=n,
29 * other XFS code uses these values. Times are measured in centisecs (i.e. 24 * other XFS code uses these values. Times are measured in centisecs (i.e.
30 * 100ths of a second). 25 * 100ths of a second).
diff --git a/fs/xfs/linux-2.6/xfs_globals.h b/fs/xfs/linux-2.6/xfs_globals.h
index e1a22bfcf865..2770b0085ee8 100644
--- a/fs/xfs/linux-2.6/xfs_globals.h
+++ b/fs/xfs/linux-2.6/xfs_globals.h
@@ -19,7 +19,6 @@
19#define __XFS_GLOBALS_H__ 19#define __XFS_GLOBALS_H__
20 20
21extern uint64_t xfs_panic_mask; /* set to cause more panics */ 21extern uint64_t xfs_panic_mask; /* set to cause more panics */
22extern unsigned long xfs_physmem;
23extern struct cred *sys_cred; 22extern struct cred *sys_cred;
24 23
25#endif /* __XFS_GLOBALS_H__ */ 24#endif /* __XFS_GLOBALS_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 5917808abbd6..ffec630e7db7 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -47,6 +47,7 @@
47#include "xfs_utils.h" 47#include "xfs_utils.h"
48#include "xfs_dfrag.h" 48#include "xfs_dfrag.h"
49#include "xfs_fsops.h" 49#include "xfs_fsops.h"
50#include "xfs_vnodeops.h"
50 51
51#include <linux/capability.h> 52#include <linux/capability.h>
52#include <linux/dcache.h> 53#include <linux/dcache.h>
@@ -137,7 +138,8 @@ xfs_find_handle(
137 vp = vn_from_inode(inode); 138 vp = vn_from_inode(inode);
138 139
139 /* now we can grab the fsid */ 140 /* now we can grab the fsid */
140 memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t)); 141 memcpy(&handle.ha_fsid, XFS_I(inode)->i_mount->m_fixedfsid,
142 sizeof(xfs_fsid_t));
141 hsize = sizeof(xfs_fsid_t); 143 hsize = sizeof(xfs_fsid_t);
142 144
143 if (cmd != XFS_IOC_PATH_TO_FSHANDLE) { 145 if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
@@ -349,19 +351,44 @@ xfs_open_by_handle(
349 return new_fd; 351 return new_fd;
350} 352}
351 353
354/*
355 * This is a copy from fs/namei.c:vfs_readlink(), except for removing it's
356 * unused first argument.
357 */
358STATIC int
359do_readlink(
360 char __user *buffer,
361 int buflen,
362 const char *link)
363{
364 int len;
365
366 len = PTR_ERR(link);
367 if (IS_ERR(link))
368 goto out;
369
370 len = strlen(link);
371 if (len > (unsigned) buflen)
372 len = buflen;
373 if (copy_to_user(buffer, link, len))
374 len = -EFAULT;
375 out:
376 return len;
377}
378
379
352STATIC int 380STATIC int
353xfs_readlink_by_handle( 381xfs_readlink_by_handle(
354 xfs_mount_t *mp, 382 xfs_mount_t *mp,
355 void __user *arg, 383 void __user *arg,
356 struct inode *parinode) 384 struct inode *parinode)
357{ 385{
358 int error;
359 struct iovec aiov;
360 struct uio auio;
361 struct inode *inode; 386 struct inode *inode;
362 xfs_fsop_handlereq_t hreq; 387 xfs_fsop_handlereq_t hreq;
363 bhv_vnode_t *vp; 388 bhv_vnode_t *vp;
364 __u32 olen; 389 __u32 olen;
390 void *link;
391 int error;
365 392
366 if (!capable(CAP_SYS_ADMIN)) 393 if (!capable(CAP_SYS_ADMIN))
367 return -XFS_ERROR(EPERM); 394 return -XFS_ERROR(EPERM);
@@ -374,29 +401,31 @@ xfs_readlink_by_handle(
374 401
375 /* Restrict this handle operation to symlinks only. */ 402 /* Restrict this handle operation to symlinks only. */
376 if (!S_ISLNK(inode->i_mode)) { 403 if (!S_ISLNK(inode->i_mode)) {
377 VN_RELE(vp); 404 error = -XFS_ERROR(EINVAL);
378 return -XFS_ERROR(EINVAL); 405 goto out_iput;
379 } 406 }
380 407
381 if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) { 408 if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) {
382 VN_RELE(vp); 409 error = -XFS_ERROR(EFAULT);
383 return -XFS_ERROR(EFAULT); 410 goto out_iput;
384 } 411 }
385 aiov.iov_len = olen;
386 aiov.iov_base = hreq.ohandle;
387 412
388 auio.uio_iov = (struct kvec *)&aiov; 413 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
389 auio.uio_iovcnt = 1; 414 if (!link)
390 auio.uio_offset = 0; 415 goto out_iput;
391 auio.uio_segflg = UIO_USERSPACE;
392 auio.uio_resid = olen;
393 416
394 error = bhv_vop_readlink(vp, &auio, IO_INVIS, NULL); 417 error = -xfs_readlink(XFS_I(inode), link);
395 VN_RELE(vp);
396 if (error) 418 if (error)
397 return -error; 419 goto out_kfree;
420 error = do_readlink(hreq.ohandle, olen, link);
421 if (error)
422 goto out_kfree;
398 423
399 return (olen - auio.uio_resid); 424 out_kfree:
425 kfree(link);
426 out_iput:
427 iput(inode);
428 return error;
400} 429}
401 430
402STATIC int 431STATIC int
@@ -409,7 +438,6 @@ xfs_fssetdm_by_handle(
409 struct fsdmidata fsd; 438 struct fsdmidata fsd;
410 xfs_fsop_setdm_handlereq_t dmhreq; 439 xfs_fsop_setdm_handlereq_t dmhreq;
411 struct inode *inode; 440 struct inode *inode;
412 bhv_desc_t *bdp;
413 bhv_vnode_t *vp; 441 bhv_vnode_t *vp;
414 442
415 if (!capable(CAP_MKNOD)) 443 if (!capable(CAP_MKNOD))
@@ -431,8 +459,8 @@ xfs_fssetdm_by_handle(
431 return -XFS_ERROR(EFAULT); 459 return -XFS_ERROR(EFAULT);
432 } 460 }
433 461
434 bdp = bhv_base_unlocked(VN_BHV_HEAD(vp)); 462 error = xfs_set_dmattrs(xfs_vtoi(vp),
435 error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL); 463 fsd.fsd_dmevmask, fsd.fsd_dmstate);
436 464
437 VN_RELE(vp); 465 VN_RELE(vp);
438 if (error) 466 if (error)
@@ -470,8 +498,8 @@ xfs_attrlist_by_handle(
470 goto out_vn_rele; 498 goto out_vn_rele;
471 499
472 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; 500 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
473 error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags, 501 error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen,
474 cursor, NULL); 502 al_hreq.flags, cursor);
475 if (error) 503 if (error)
476 goto out_kfree; 504 goto out_kfree;
477 505
@@ -488,7 +516,7 @@ xfs_attrlist_by_handle(
488 516
489STATIC int 517STATIC int
490xfs_attrmulti_attr_get( 518xfs_attrmulti_attr_get(
491 bhv_vnode_t *vp, 519 struct inode *inode,
492 char *name, 520 char *name,
493 char __user *ubuf, 521 char __user *ubuf,
494 __uint32_t *len, 522 __uint32_t *len,
@@ -503,7 +531,7 @@ xfs_attrmulti_attr_get(
503 if (!kbuf) 531 if (!kbuf)
504 return ENOMEM; 532 return ENOMEM;
505 533
506 error = bhv_vop_attr_get(vp, name, kbuf, len, flags, NULL); 534 error = xfs_attr_get(XFS_I(inode), name, kbuf, len, flags, NULL);
507 if (error) 535 if (error)
508 goto out_kfree; 536 goto out_kfree;
509 537
@@ -517,7 +545,7 @@ xfs_attrmulti_attr_get(
517 545
518STATIC int 546STATIC int
519xfs_attrmulti_attr_set( 547xfs_attrmulti_attr_set(
520 bhv_vnode_t *vp, 548 struct inode *inode,
521 char *name, 549 char *name,
522 const char __user *ubuf, 550 const char __user *ubuf,
523 __uint32_t len, 551 __uint32_t len,
@@ -526,9 +554,9 @@ xfs_attrmulti_attr_set(
526 char *kbuf; 554 char *kbuf;
527 int error = EFAULT; 555 int error = EFAULT;
528 556
529 if (IS_RDONLY(&vp->v_inode)) 557 if (IS_RDONLY(inode))
530 return -EROFS; 558 return -EROFS;
531 if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) 559 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
532 return EPERM; 560 return EPERM;
533 if (len > XATTR_SIZE_MAX) 561 if (len > XATTR_SIZE_MAX)
534 return EINVAL; 562 return EINVAL;
@@ -540,7 +568,7 @@ xfs_attrmulti_attr_set(
540 if (copy_from_user(kbuf, ubuf, len)) 568 if (copy_from_user(kbuf, ubuf, len))
541 goto out_kfree; 569 goto out_kfree;
542 570
543 error = bhv_vop_attr_set(vp, name, kbuf, len, flags, NULL); 571 error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
544 572
545 out_kfree: 573 out_kfree:
546 kfree(kbuf); 574 kfree(kbuf);
@@ -549,15 +577,15 @@ xfs_attrmulti_attr_set(
549 577
550STATIC int 578STATIC int
551xfs_attrmulti_attr_remove( 579xfs_attrmulti_attr_remove(
552 bhv_vnode_t *vp, 580 struct inode *inode,
553 char *name, 581 char *name,
554 __uint32_t flags) 582 __uint32_t flags)
555{ 583{
556 if (IS_RDONLY(&vp->v_inode)) 584 if (IS_RDONLY(inode))
557 return -EROFS; 585 return -EROFS;
558 if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) 586 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
559 return EPERM; 587 return EPERM;
560 return bhv_vop_attr_remove(vp, name, flags, NULL); 588 return xfs_attr_remove(XFS_I(inode), name, flags);
561} 589}
562 590
563STATIC int 591STATIC int
@@ -613,17 +641,17 @@ xfs_attrmulti_by_handle(
613 641
614 switch (ops[i].am_opcode) { 642 switch (ops[i].am_opcode) {
615 case ATTR_OP_GET: 643 case ATTR_OP_GET:
616 ops[i].am_error = xfs_attrmulti_attr_get(vp, 644 ops[i].am_error = xfs_attrmulti_attr_get(inode,
617 attr_name, ops[i].am_attrvalue, 645 attr_name, ops[i].am_attrvalue,
618 &ops[i].am_length, ops[i].am_flags); 646 &ops[i].am_length, ops[i].am_flags);
619 break; 647 break;
620 case ATTR_OP_SET: 648 case ATTR_OP_SET:
621 ops[i].am_error = xfs_attrmulti_attr_set(vp, 649 ops[i].am_error = xfs_attrmulti_attr_set(inode,
622 attr_name, ops[i].am_attrvalue, 650 attr_name, ops[i].am_attrvalue,
623 ops[i].am_length, ops[i].am_flags); 651 ops[i].am_length, ops[i].am_flags);
624 break; 652 break;
625 case ATTR_OP_REMOVE: 653 case ATTR_OP_REMOVE:
626 ops[i].am_error = xfs_attrmulti_attr_remove(vp, 654 ops[i].am_error = xfs_attrmulti_attr_remove(inode,
627 attr_name, ops[i].am_flags); 655 attr_name, ops[i].am_flags);
628 break; 656 break;
629 default: 657 default:
@@ -649,7 +677,7 @@ xfs_attrmulti_by_handle(
649 677
650STATIC int 678STATIC int
651xfs_ioc_space( 679xfs_ioc_space(
652 bhv_desc_t *bdp, 680 struct xfs_inode *ip,
653 struct inode *inode, 681 struct inode *inode,
654 struct file *filp, 682 struct file *filp,
655 int flags, 683 int flags,
@@ -681,37 +709,37 @@ xfs_ioc_xattr(
681 void __user *arg); 709 void __user *arg);
682 710
683STATIC int 711STATIC int
712xfs_ioc_fsgetxattr(
713 xfs_inode_t *ip,
714 int attr,
715 void __user *arg);
716
717STATIC int
684xfs_ioc_getbmap( 718xfs_ioc_getbmap(
685 bhv_desc_t *bdp, 719 struct xfs_inode *ip,
686 int flags, 720 int flags,
687 unsigned int cmd, 721 unsigned int cmd,
688 void __user *arg); 722 void __user *arg);
689 723
690STATIC int 724STATIC int
691xfs_ioc_getbmapx( 725xfs_ioc_getbmapx(
692 bhv_desc_t *bdp, 726 struct xfs_inode *ip,
693 void __user *arg); 727 void __user *arg);
694 728
695int 729int
696xfs_ioctl( 730xfs_ioctl(
697 bhv_desc_t *bdp, 731 xfs_inode_t *ip,
698 struct inode *inode,
699 struct file *filp, 732 struct file *filp,
700 int ioflags, 733 int ioflags,
701 unsigned int cmd, 734 unsigned int cmd,
702 void __user *arg) 735 void __user *arg)
703{ 736{
737 struct inode *inode = filp->f_path.dentry->d_inode;
738 bhv_vnode_t *vp = vn_from_inode(inode);
739 xfs_mount_t *mp = ip->i_mount;
704 int error; 740 int error;
705 bhv_vnode_t *vp;
706 xfs_inode_t *ip;
707 xfs_mount_t *mp;
708 741
709 vp = vn_from_inode(inode); 742 vn_trace_entry(XFS_I(inode), "xfs_ioctl", (inst_t *)__return_address);
710
711 vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
712
713 ip = XFS_BHVTOI(bdp);
714 mp = ip->i_mount;
715 743
716 switch (cmd) { 744 switch (cmd) {
717 745
@@ -731,7 +759,7 @@ xfs_ioctl(
731 !capable(CAP_SYS_ADMIN)) 759 !capable(CAP_SYS_ADMIN))
732 return -EPERM; 760 return -EPERM;
733 761
734 return xfs_ioc_space(bdp, inode, filp, ioflags, cmd, arg); 762 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, arg);
735 763
736 case XFS_IOC_DIOINFO: { 764 case XFS_IOC_DIOINFO: {
737 struct dioattr da; 765 struct dioattr da;
@@ -761,11 +789,13 @@ xfs_ioctl(
761 case XFS_IOC_GETVERSION: 789 case XFS_IOC_GETVERSION:
762 return put_user(inode->i_generation, (int __user *)arg); 790 return put_user(inode->i_generation, (int __user *)arg);
763 791
792 case XFS_IOC_FSGETXATTR:
793 return xfs_ioc_fsgetxattr(ip, 0, arg);
794 case XFS_IOC_FSGETXATTRA:
795 return xfs_ioc_fsgetxattr(ip, 1, arg);
764 case XFS_IOC_GETXFLAGS: 796 case XFS_IOC_GETXFLAGS:
765 case XFS_IOC_SETXFLAGS: 797 case XFS_IOC_SETXFLAGS:
766 case XFS_IOC_FSGETXATTR:
767 case XFS_IOC_FSSETXATTR: 798 case XFS_IOC_FSSETXATTR:
768 case XFS_IOC_FSGETXATTRA:
769 return xfs_ioc_xattr(vp, ip, filp, cmd, arg); 799 return xfs_ioc_xattr(vp, ip, filp, cmd, arg);
770 800
771 case XFS_IOC_FSSETDM: { 801 case XFS_IOC_FSSETDM: {
@@ -774,17 +804,17 @@ xfs_ioctl(
774 if (copy_from_user(&dmi, arg, sizeof(dmi))) 804 if (copy_from_user(&dmi, arg, sizeof(dmi)))
775 return -XFS_ERROR(EFAULT); 805 return -XFS_ERROR(EFAULT);
776 806
777 error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate, 807 error = xfs_set_dmattrs(ip, dmi.fsd_dmevmask,
778 NULL); 808 dmi.fsd_dmstate);
779 return -error; 809 return -error;
780 } 810 }
781 811
782 case XFS_IOC_GETBMAP: 812 case XFS_IOC_GETBMAP:
783 case XFS_IOC_GETBMAPA: 813 case XFS_IOC_GETBMAPA:
784 return xfs_ioc_getbmap(bdp, ioflags, cmd, arg); 814 return xfs_ioc_getbmap(ip, ioflags, cmd, arg);
785 815
786 case XFS_IOC_GETBMAPX: 816 case XFS_IOC_GETBMAPX:
787 return xfs_ioc_getbmapx(bdp, arg); 817 return xfs_ioc_getbmapx(ip, arg);
788 818
789 case XFS_IOC_FD_TO_HANDLE: 819 case XFS_IOC_FD_TO_HANDLE:
790 case XFS_IOC_PATH_TO_HANDLE: 820 case XFS_IOC_PATH_TO_HANDLE:
@@ -944,7 +974,7 @@ xfs_ioctl(
944 if (!capable(CAP_SYS_ADMIN)) 974 if (!capable(CAP_SYS_ADMIN))
945 return -EPERM; 975 return -EPERM;
946 976
947 error = xfs_errortag_clearall(mp); 977 error = xfs_errortag_clearall(mp, 1);
948 return -error; 978 return -error;
949 979
950 default: 980 default:
@@ -954,7 +984,7 @@ xfs_ioctl(
954 984
955STATIC int 985STATIC int
956xfs_ioc_space( 986xfs_ioc_space(
957 bhv_desc_t *bdp, 987 struct xfs_inode *ip,
958 struct inode *inode, 988 struct inode *inode,
959 struct file *filp, 989 struct file *filp,
960 int ioflags, 990 int ioflags,
@@ -982,7 +1012,7 @@ xfs_ioc_space(
982 if (ioflags & IO_INVIS) 1012 if (ioflags & IO_INVIS)
983 attr_flags |= ATTR_DMI; 1013 attr_flags |= ATTR_DMI;
984 1014
985 error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos, 1015 error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
986 NULL, attr_flags); 1016 NULL, attr_flags);
987 return -error; 1017 return -error;
988} 1018}
@@ -1140,6 +1170,42 @@ xfs_di2lxflags(
1140} 1170}
1141 1171
1142STATIC int 1172STATIC int
1173xfs_ioc_fsgetxattr(
1174 xfs_inode_t *ip,
1175 int attr,
1176 void __user *arg)
1177{
1178 struct fsxattr fa;
1179
1180 xfs_ilock(ip, XFS_ILOCK_SHARED);
1181 fa.fsx_xflags = xfs_ip2xflags(ip);
1182 fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
1183 fa.fsx_projid = ip->i_d.di_projid;
1184
1185 if (attr) {
1186 if (ip->i_afp) {
1187 if (ip->i_afp->if_flags & XFS_IFEXTENTS)
1188 fa.fsx_nextents = ip->i_afp->if_bytes /
1189 sizeof(xfs_bmbt_rec_t);
1190 else
1191 fa.fsx_nextents = ip->i_d.di_anextents;
1192 } else
1193 fa.fsx_nextents = 0;
1194 } else {
1195 if (ip->i_df.if_flags & XFS_IFEXTENTS)
1196 fa.fsx_nextents = ip->i_df.if_bytes /
1197 sizeof(xfs_bmbt_rec_t);
1198 else
1199 fa.fsx_nextents = ip->i_d.di_nextents;
1200 }
1201 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1202
1203 if (copy_to_user(arg, &fa, sizeof(fa)))
1204 return -EFAULT;
1205 return 0;
1206}
1207
1208STATIC int
1143xfs_ioc_xattr( 1209xfs_ioc_xattr(
1144 bhv_vnode_t *vp, 1210 bhv_vnode_t *vp,
1145 xfs_inode_t *ip, 1211 xfs_inode_t *ip,
@@ -1158,27 +1224,6 @@ xfs_ioc_xattr(
1158 return -ENOMEM; 1224 return -ENOMEM;
1159 1225
1160 switch (cmd) { 1226 switch (cmd) {
1161 case XFS_IOC_FSGETXATTR: {
1162 vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
1163 XFS_AT_NEXTENTS | XFS_AT_PROJID;
1164 error = bhv_vop_getattr(vp, vattr, 0, NULL);
1165 if (unlikely(error)) {
1166 error = -error;
1167 break;
1168 }
1169
1170 fa.fsx_xflags = vattr->va_xflags;
1171 fa.fsx_extsize = vattr->va_extsize;
1172 fa.fsx_nextents = vattr->va_nextents;
1173 fa.fsx_projid = vattr->va_projid;
1174
1175 if (copy_to_user(arg, &fa, sizeof(fa))) {
1176 error = -EFAULT;
1177 break;
1178 }
1179 break;
1180 }
1181
1182 case XFS_IOC_FSSETXATTR: { 1227 case XFS_IOC_FSSETXATTR: {
1183 if (copy_from_user(&fa, arg, sizeof(fa))) { 1228 if (copy_from_user(&fa, arg, sizeof(fa))) {
1184 error = -EFAULT; 1229 error = -EFAULT;
@@ -1194,34 +1239,13 @@ xfs_ioc_xattr(
1194 vattr->va_extsize = fa.fsx_extsize; 1239 vattr->va_extsize = fa.fsx_extsize;
1195 vattr->va_projid = fa.fsx_projid; 1240 vattr->va_projid = fa.fsx_projid;
1196 1241
1197 error = bhv_vop_setattr(vp, vattr, attr_flags, NULL); 1242 error = xfs_setattr(ip, vattr, attr_flags, NULL);
1198 if (likely(!error)) 1243 if (likely(!error))
1199 __vn_revalidate(vp, vattr); /* update flags */ 1244 __vn_revalidate(vp, vattr); /* update flags */
1200 error = -error; 1245 error = -error;
1201 break; 1246 break;
1202 } 1247 }
1203 1248
1204 case XFS_IOC_FSGETXATTRA: {
1205 vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
1206 XFS_AT_ANEXTENTS | XFS_AT_PROJID;
1207 error = bhv_vop_getattr(vp, vattr, 0, NULL);
1208 if (unlikely(error)) {
1209 error = -error;
1210 break;
1211 }
1212
1213 fa.fsx_xflags = vattr->va_xflags;
1214 fa.fsx_extsize = vattr->va_extsize;
1215 fa.fsx_nextents = vattr->va_anextents;
1216 fa.fsx_projid = vattr->va_projid;
1217
1218 if (copy_to_user(arg, &fa, sizeof(fa))) {
1219 error = -EFAULT;
1220 break;
1221 }
1222 break;
1223 }
1224
1225 case XFS_IOC_GETXFLAGS: { 1249 case XFS_IOC_GETXFLAGS: {
1226 flags = xfs_di2lxflags(ip->i_d.di_flags); 1250 flags = xfs_di2lxflags(ip->i_d.di_flags);
1227 if (copy_to_user(arg, &flags, sizeof(flags))) 1251 if (copy_to_user(arg, &flags, sizeof(flags)))
@@ -1250,7 +1274,7 @@ xfs_ioc_xattr(
1250 vattr->va_xflags = xfs_merge_ioc_xflags(flags, 1274 vattr->va_xflags = xfs_merge_ioc_xflags(flags,
1251 xfs_ip2xflags(ip)); 1275 xfs_ip2xflags(ip));
1252 1276
1253 error = bhv_vop_setattr(vp, vattr, attr_flags, NULL); 1277 error = xfs_setattr(ip, vattr, attr_flags, NULL);
1254 if (likely(!error)) 1278 if (likely(!error))
1255 __vn_revalidate(vp, vattr); /* update flags */ 1279 __vn_revalidate(vp, vattr); /* update flags */
1256 error = -error; 1280 error = -error;
@@ -1268,7 +1292,7 @@ xfs_ioc_xattr(
1268 1292
1269STATIC int 1293STATIC int
1270xfs_ioc_getbmap( 1294xfs_ioc_getbmap(
1271 bhv_desc_t *bdp, 1295 struct xfs_inode *ip,
1272 int ioflags, 1296 int ioflags,
1273 unsigned int cmd, 1297 unsigned int cmd,
1274 void __user *arg) 1298 void __user *arg)
@@ -1287,7 +1311,7 @@ xfs_ioc_getbmap(
1287 if (ioflags & IO_INVIS) 1311 if (ioflags & IO_INVIS)
1288 iflags |= BMV_IF_NO_DMAPI_READ; 1312 iflags |= BMV_IF_NO_DMAPI_READ;
1289 1313
1290 error = xfs_getbmap(bdp, &bm, (struct getbmap __user *)arg+1, iflags); 1314 error = xfs_getbmap(ip, &bm, (struct getbmap __user *)arg+1, iflags);
1291 if (error) 1315 if (error)
1292 return -error; 1316 return -error;
1293 1317
@@ -1298,7 +1322,7 @@ xfs_ioc_getbmap(
1298 1322
1299STATIC int 1323STATIC int
1300xfs_ioc_getbmapx( 1324xfs_ioc_getbmapx(
1301 bhv_desc_t *bdp, 1325 struct xfs_inode *ip,
1302 void __user *arg) 1326 void __user *arg)
1303{ 1327{
1304 struct getbmapx bmx; 1328 struct getbmapx bmx;
@@ -1325,7 +1349,7 @@ xfs_ioc_getbmapx(
1325 1349
1326 iflags |= BMV_IF_EXTENDED; 1350 iflags |= BMV_IF_EXTENDED;
1327 1351
1328 error = xfs_getbmap(bdp, &bm, (struct getbmapx __user *)arg+1, iflags); 1352 error = xfs_getbmap(ip, &bm, (struct getbmapx __user *)arg+1, iflags);
1329 if (error) 1353 if (error)
1330 return -error; 1354 return -error;
1331 1355
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 42319d75aaab..0046bdd5b7f1 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -43,6 +43,7 @@
43#include "xfs_itable.h" 43#include "xfs_itable.h"
44#include "xfs_error.h" 44#include "xfs_error.h"
45#include "xfs_dfrag.h" 45#include "xfs_dfrag.h"
46#include "xfs_vnodeops.h"
46 47
47#define _NATIVE_IOC(cmd, type) \ 48#define _NATIVE_IOC(cmd, type) \
48 _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type)) 49 _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
@@ -370,7 +371,6 @@ xfs_compat_ioctl(
370 unsigned long arg) 371 unsigned long arg)
371{ 372{
372 struct inode *inode = file->f_path.dentry->d_inode; 373 struct inode *inode = file->f_path.dentry->d_inode;
373 bhv_vnode_t *vp = vn_from_inode(inode);
374 int error; 374 int error;
375 375
376 switch (cmd) { 376 switch (cmd) {
@@ -443,7 +443,7 @@ xfs_compat_ioctl(
443 case XFS_IOC_FSBULKSTAT_SINGLE_32: 443 case XFS_IOC_FSBULKSTAT_SINGLE_32:
444 case XFS_IOC_FSINUMBERS_32: 444 case XFS_IOC_FSINUMBERS_32:
445 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq); 445 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq);
446 return xfs_ioc_bulkstat_compat(XFS_BHVTOI(VNHEAD(vp))->i_mount, 446 return xfs_ioc_bulkstat_compat(XFS_I(inode)->i_mount,
447 cmd, (void __user*)arg); 447 cmd, (void __user*)arg);
448 case XFS_IOC_FD_TO_HANDLE_32: 448 case XFS_IOC_FD_TO_HANDLE_32:
449 case XFS_IOC_PATH_TO_HANDLE_32: 449 case XFS_IOC_PATH_TO_HANDLE_32:
@@ -457,8 +457,8 @@ xfs_compat_ioctl(
457 return -ENOIOCTLCMD; 457 return -ENOIOCTLCMD;
458 } 458 }
459 459
460 error = bhv_vop_ioctl(vp, inode, file, mode, cmd, (void __user *)arg); 460 error = xfs_ioctl(XFS_I(inode), file, mode, cmd, (void __user *)arg);
461 VMODIFY(vp); 461 xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED);
462 462
463 return error; 463 return error;
464} 464}
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 0b5fa124bef2..ac50f8a37582 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -46,6 +46,7 @@
46#include "xfs_attr.h" 46#include "xfs_attr.h"
47#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
48#include "xfs_utils.h" 48#include "xfs_utils.h"
49#include "xfs_vnodeops.h"
49 50
50#include <linux/capability.h> 51#include <linux/capability.h>
51#include <linux/xattr.h> 52#include <linux/xattr.h>
@@ -53,22 +54,6 @@
53#include <linux/security.h> 54#include <linux/security.h>
54 55
55/* 56/*
56 * Get a XFS inode from a given vnode.
57 */
58xfs_inode_t *
59xfs_vtoi(
60 bhv_vnode_t *vp)
61{
62 bhv_desc_t *bdp;
63
64 bdp = bhv_lookup_range(VN_BHV_HEAD(vp),
65 VNODE_POSITION_XFS, VNODE_POSITION_XFS);
66 if (unlikely(bdp == NULL))
67 return NULL;
68 return XFS_BHVTOI(bdp);
69}
70
71/*
72 * Bring the atime in the XFS inode uptodate. 57 * Bring the atime in the XFS inode uptodate.
73 * Used before logging the inode to disk or when the Linux inode goes away. 58 * Used before logging the inode to disk or when the Linux inode goes away.
74 */ 59 */
@@ -80,9 +65,8 @@ xfs_synchronize_atime(
80 65
81 vp = XFS_ITOV_NULL(ip); 66 vp = XFS_ITOV_NULL(ip);
82 if (vp) { 67 if (vp) {
83 struct inode *inode = &vp->v_inode; 68 ip->i_d.di_atime.t_sec = (__int32_t)vp->i_atime.tv_sec;
84 ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; 69 ip->i_d.di_atime.t_nsec = (__int32_t)vp->i_atime.tv_nsec;
85 ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec;
86 } 70 }
87} 71}
88 72
@@ -133,7 +117,7 @@ xfs_ichgtime(
133 */ 117 */
134 SYNCHRONIZE(); 118 SYNCHRONIZE();
135 ip->i_update_core = 1; 119 ip->i_update_core = 1;
136 if (!(inode->i_state & I_LOCK)) 120 if (!(inode->i_state & I_SYNC))
137 mark_inode_dirty_sync(inode); 121 mark_inode_dirty_sync(inode);
138} 122}
139 123
@@ -185,7 +169,7 @@ xfs_ichgtime_fast(
185 */ 169 */
186 SYNCHRONIZE(); 170 SYNCHRONIZE();
187 ip->i_update_core = 1; 171 ip->i_update_core = 1;
188 if (!(inode->i_state & I_LOCK)) 172 if (!(inode->i_state & I_SYNC))
189 mark_inode_dirty_sync(inode); 173 mark_inode_dirty_sync(inode);
190} 174}
191 175
@@ -195,18 +179,19 @@ xfs_ichgtime_fast(
195 */ 179 */
196STATIC void 180STATIC void
197xfs_validate_fields( 181xfs_validate_fields(
198 struct inode *ip, 182 struct inode *inode)
199 bhv_vattr_t *vattr)
200{ 183{
201 vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; 184 struct xfs_inode *ip = XFS_I(inode);
202 if (!bhv_vop_getattr(vn_from_inode(ip), vattr, ATTR_LAZY, NULL)) { 185 loff_t size;
203 ip->i_nlink = vattr->va_nlink; 186
204 ip->i_blocks = vattr->va_nblocks; 187 inode->i_nlink = ip->i_d.di_nlink;
205 188 inode->i_blocks =
206 /* we're under i_sem so i_size can't change under us */ 189 XFS_FSB_TO_BB(ip->i_mount, ip->i_d.di_nblocks +
207 if (i_size_read(ip) != vattr->va_size) 190 ip->i_delayed_blks);
208 i_size_write(ip, vattr->va_size); 191 /* we're under i_sem so i_size can't change under us */
209 } 192 size = XFS_ISIZE(ip);
193 if (i_size_read(inode) != size)
194 i_size_write(inode, size);
210} 195}
211 196
212/* 197/*
@@ -233,9 +218,10 @@ xfs_init_security(
233 return -error; 218 return -error;
234 } 219 }
235 220
236 error = bhv_vop_attr_set(vp, name, value, length, ATTR_SECURE, NULL); 221 error = xfs_attr_set(XFS_I(ip), name, value,
222 length, ATTR_SECURE);
237 if (!error) 223 if (!error)
238 VMODIFY(vp); 224 xfs_iflags_set(XFS_I(ip), XFS_IMODIFIED);
239 225
240 kfree(name); 226 kfree(name);
241 kfree(value); 227 kfree(value);
@@ -256,7 +242,7 @@ xfs_has_fs_struct(struct task_struct *task)
256 242
257STATIC void 243STATIC void
258xfs_cleanup_inode( 244xfs_cleanup_inode(
259 bhv_vnode_t *dvp, 245 struct inode *dir,
260 bhv_vnode_t *vp, 246 bhv_vnode_t *vp,
261 struct dentry *dentry, 247 struct dentry *dentry,
262 int mode) 248 int mode)
@@ -272,9 +258,9 @@ xfs_cleanup_inode(
272 teardown.d_name = dentry->d_name; 258 teardown.d_name = dentry->d_name;
273 259
274 if (S_ISDIR(mode)) 260 if (S_ISDIR(mode))
275 bhv_vop_rmdir(dvp, &teardown, NULL); 261 xfs_rmdir(XFS_I(dir), &teardown);
276 else 262 else
277 bhv_vop_remove(dvp, &teardown, NULL); 263 xfs_remove(XFS_I(dir), &teardown);
278 VN_RELE(vp); 264 VN_RELE(vp);
279} 265}
280 266
@@ -286,7 +272,6 @@ xfs_vn_mknod(
286 dev_t rdev) 272 dev_t rdev)
287{ 273{
288 struct inode *ip; 274 struct inode *ip;
289 bhv_vattr_t vattr = { 0 };
290 bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir); 275 bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir);
291 xfs_acl_t *default_acl = NULL; 276 xfs_acl_t *default_acl = NULL;
292 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; 277 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
@@ -312,19 +297,14 @@ xfs_vn_mknod(
312 if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current)) 297 if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current))
313 mode &= ~current->fs->umask; 298 mode &= ~current->fs->umask;
314 299
315 vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
316 vattr.va_mode = mode;
317
318 switch (mode & S_IFMT) { 300 switch (mode & S_IFMT) {
319 case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: 301 case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
320 vattr.va_rdev = sysv_encode_dev(rdev); 302 rdev = sysv_encode_dev(rdev);
321 vattr.va_mask |= XFS_AT_RDEV;
322 /*FALLTHROUGH*/
323 case S_IFREG: 303 case S_IFREG:
324 error = bhv_vop_create(dvp, dentry, &vattr, &vp, NULL); 304 error = xfs_create(XFS_I(dir), dentry, mode, rdev, &vp, NULL);
325 break; 305 break;
326 case S_IFDIR: 306 case S_IFDIR:
327 error = bhv_vop_mkdir(dvp, dentry, &vattr, &vp, NULL); 307 error = xfs_mkdir(XFS_I(dir), dentry, mode, &vp, NULL);
328 break; 308 break;
329 default: 309 default:
330 error = EINVAL; 310 error = EINVAL;
@@ -334,16 +314,16 @@ xfs_vn_mknod(
334 if (unlikely(!error)) { 314 if (unlikely(!error)) {
335 error = xfs_init_security(vp, dir); 315 error = xfs_init_security(vp, dir);
336 if (error) 316 if (error)
337 xfs_cleanup_inode(dvp, vp, dentry, mode); 317 xfs_cleanup_inode(dir, vp, dentry, mode);
338 } 318 }
339 319
340 if (unlikely(default_acl)) { 320 if (unlikely(default_acl)) {
341 if (!error) { 321 if (!error) {
342 error = _ACL_INHERIT(vp, &vattr, default_acl); 322 error = _ACL_INHERIT(vp, mode, default_acl);
343 if (!error) 323 if (!error)
344 VMODIFY(vp); 324 xfs_iflags_set(XFS_I(vp), XFS_IMODIFIED);
345 else 325 else
346 xfs_cleanup_inode(dvp, vp, dentry, mode); 326 xfs_cleanup_inode(dir, vp, dentry, mode);
347 } 327 }
348 _ACL_FREE(default_acl); 328 _ACL_FREE(default_acl);
349 } 329 }
@@ -355,9 +335,9 @@ xfs_vn_mknod(
355 if (S_ISCHR(mode) || S_ISBLK(mode)) 335 if (S_ISCHR(mode) || S_ISBLK(mode))
356 ip->i_rdev = rdev; 336 ip->i_rdev = rdev;
357 else if (S_ISDIR(mode)) 337 else if (S_ISDIR(mode))
358 xfs_validate_fields(ip, &vattr); 338 xfs_validate_fields(ip);
359 d_instantiate(dentry, ip); 339 d_instantiate(dentry, ip);
360 xfs_validate_fields(dir, &vattr); 340 xfs_validate_fields(dir);
361 } 341 }
362 return -error; 342 return -error;
363} 343}
@@ -387,13 +367,13 @@ xfs_vn_lookup(
387 struct dentry *dentry, 367 struct dentry *dentry,
388 struct nameidata *nd) 368 struct nameidata *nd)
389{ 369{
390 bhv_vnode_t *vp = vn_from_inode(dir), *cvp; 370 bhv_vnode_t *cvp;
391 int error; 371 int error;
392 372
393 if (dentry->d_name.len >= MAXNAMELEN) 373 if (dentry->d_name.len >= MAXNAMELEN)
394 return ERR_PTR(-ENAMETOOLONG); 374 return ERR_PTR(-ENAMETOOLONG);
395 375
396 error = bhv_vop_lookup(vp, dentry, &cvp, 0, NULL, NULL); 376 error = xfs_lookup(XFS_I(dir), dentry, &cvp);
397 if (unlikely(error)) { 377 if (unlikely(error)) {
398 if (unlikely(error != ENOENT)) 378 if (unlikely(error != ENOENT))
399 return ERR_PTR(-error); 379 return ERR_PTR(-error);
@@ -411,22 +391,19 @@ xfs_vn_link(
411 struct dentry *dentry) 391 struct dentry *dentry)
412{ 392{
413 struct inode *ip; /* inode of guy being linked to */ 393 struct inode *ip; /* inode of guy being linked to */
414 bhv_vnode_t *tdvp; /* target directory for new name/link */
415 bhv_vnode_t *vp; /* vp of name being linked */ 394 bhv_vnode_t *vp; /* vp of name being linked */
416 bhv_vattr_t vattr;
417 int error; 395 int error;
418 396
419 ip = old_dentry->d_inode; /* inode being linked to */ 397 ip = old_dentry->d_inode; /* inode being linked to */
420 tdvp = vn_from_inode(dir);
421 vp = vn_from_inode(ip); 398 vp = vn_from_inode(ip);
422 399
423 VN_HOLD(vp); 400 VN_HOLD(vp);
424 error = bhv_vop_link(tdvp, vp, dentry, NULL); 401 error = xfs_link(XFS_I(dir), vp, dentry);
425 if (unlikely(error)) { 402 if (unlikely(error)) {
426 VN_RELE(vp); 403 VN_RELE(vp);
427 } else { 404 } else {
428 VMODIFY(tdvp); 405 xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED);
429 xfs_validate_fields(ip, &vattr); 406 xfs_validate_fields(ip);
430 d_instantiate(dentry, ip); 407 d_instantiate(dentry, ip);
431 } 408 }
432 return -error; 409 return -error;
@@ -438,17 +415,14 @@ xfs_vn_unlink(
438 struct dentry *dentry) 415 struct dentry *dentry)
439{ 416{
440 struct inode *inode; 417 struct inode *inode;
441 bhv_vnode_t *dvp; /* directory containing name to remove */
442 bhv_vattr_t vattr;
443 int error; 418 int error;
444 419
445 inode = dentry->d_inode; 420 inode = dentry->d_inode;
446 dvp = vn_from_inode(dir);
447 421
448 error = bhv_vop_remove(dvp, dentry, NULL); 422 error = xfs_remove(XFS_I(dir), dentry);
449 if (likely(!error)) { 423 if (likely(!error)) {
450 xfs_validate_fields(dir, &vattr); /* size needs update */ 424 xfs_validate_fields(dir); /* size needs update */
451 xfs_validate_fields(inode, &vattr); 425 xfs_validate_fields(inode);
452 } 426 }
453 return -error; 427 return -error;
454} 428}
@@ -460,28 +434,26 @@ xfs_vn_symlink(
460 const char *symname) 434 const char *symname)
461{ 435{
462 struct inode *ip; 436 struct inode *ip;
463 bhv_vattr_t va = { 0 };
464 bhv_vnode_t *dvp; /* directory containing name of symlink */
465 bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */ 437 bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */
466 int error; 438 int error;
439 mode_t mode;
467 440
468 dvp = vn_from_inode(dir);
469 cvp = NULL; 441 cvp = NULL;
470 442
471 va.va_mode = S_IFLNK | 443 mode = S_IFLNK |
472 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); 444 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
473 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
474 445
475 error = bhv_vop_symlink(dvp, dentry, &va, (char *)symname, &cvp, NULL); 446 error = xfs_symlink(XFS_I(dir), dentry, (char *)symname, mode,
447 &cvp, NULL);
476 if (likely(!error && cvp)) { 448 if (likely(!error && cvp)) {
477 error = xfs_init_security(cvp, dir); 449 error = xfs_init_security(cvp, dir);
478 if (likely(!error)) { 450 if (likely(!error)) {
479 ip = vn_to_inode(cvp); 451 ip = vn_to_inode(cvp);
480 d_instantiate(dentry, ip); 452 d_instantiate(dentry, ip);
481 xfs_validate_fields(dir, &va); 453 xfs_validate_fields(dir);
482 xfs_validate_fields(ip, &va); 454 xfs_validate_fields(ip);
483 } else { 455 } else {
484 xfs_cleanup_inode(dvp, cvp, dentry, 0); 456 xfs_cleanup_inode(dir, cvp, dentry, 0);
485 } 457 }
486 } 458 }
487 return -error; 459 return -error;
@@ -493,14 +465,12 @@ xfs_vn_rmdir(
493 struct dentry *dentry) 465 struct dentry *dentry)
494{ 466{
495 struct inode *inode = dentry->d_inode; 467 struct inode *inode = dentry->d_inode;
496 bhv_vnode_t *dvp = vn_from_inode(dir);
497 bhv_vattr_t vattr;
498 int error; 468 int error;
499 469
500 error = bhv_vop_rmdir(dvp, dentry, NULL); 470 error = xfs_rmdir(XFS_I(dir), dentry);
501 if (likely(!error)) { 471 if (likely(!error)) {
502 xfs_validate_fields(inode, &vattr); 472 xfs_validate_fields(inode);
503 xfs_validate_fields(dir, &vattr); 473 xfs_validate_fields(dir);
504 } 474 }
505 return -error; 475 return -error;
506} 476}
@@ -513,21 +483,18 @@ xfs_vn_rename(
513 struct dentry *ndentry) 483 struct dentry *ndentry)
514{ 484{
515 struct inode *new_inode = ndentry->d_inode; 485 struct inode *new_inode = ndentry->d_inode;
516 bhv_vnode_t *fvp; /* from directory */
517 bhv_vnode_t *tvp; /* target directory */ 486 bhv_vnode_t *tvp; /* target directory */
518 bhv_vattr_t vattr;
519 int error; 487 int error;
520 488
521 fvp = vn_from_inode(odir);
522 tvp = vn_from_inode(ndir); 489 tvp = vn_from_inode(ndir);
523 490
524 error = bhv_vop_rename(fvp, odentry, tvp, ndentry, NULL); 491 error = xfs_rename(XFS_I(odir), odentry, tvp, ndentry);
525 if (likely(!error)) { 492 if (likely(!error)) {
526 if (new_inode) 493 if (new_inode)
527 xfs_validate_fields(new_inode, &vattr); 494 xfs_validate_fields(new_inode);
528 xfs_validate_fields(odir, &vattr); 495 xfs_validate_fields(odir);
529 if (ndir != odir) 496 if (ndir != odir)
530 xfs_validate_fields(ndir, &vattr); 497 xfs_validate_fields(ndir);
531 } 498 }
532 return -error; 499 return -error;
533} 500}
@@ -542,50 +509,25 @@ xfs_vn_follow_link(
542 struct dentry *dentry, 509 struct dentry *dentry,
543 struct nameidata *nd) 510 struct nameidata *nd)
544{ 511{
545 bhv_vnode_t *vp;
546 uio_t *uio;
547 iovec_t iov;
548 int error;
549 char *link; 512 char *link;
550 513 int error = -ENOMEM;
551 ASSERT(dentry);
552 ASSERT(nd);
553 514
554 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); 515 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
555 if (!link) { 516 if (!link)
556 nd_set_link(nd, ERR_PTR(-ENOMEM)); 517 goto out_err;
557 return NULL;
558 }
559
560 uio = kmalloc(sizeof(uio_t), GFP_KERNEL);
561 if (!uio) {
562 kfree(link);
563 nd_set_link(nd, ERR_PTR(-ENOMEM));
564 return NULL;
565 }
566
567 vp = vn_from_inode(dentry->d_inode);
568
569 iov.iov_base = link;
570 iov.iov_len = MAXPATHLEN;
571 518
572 uio->uio_iov = &iov; 519 error = -xfs_readlink(XFS_I(dentry->d_inode), link);
573 uio->uio_offset = 0; 520 if (unlikely(error))
574 uio->uio_segflg = UIO_SYSSPACE; 521 goto out_kfree;
575 uio->uio_resid = MAXPATHLEN;
576 uio->uio_iovcnt = 1;
577
578 error = bhv_vop_readlink(vp, uio, 0, NULL);
579 if (unlikely(error)) {
580 kfree(link);
581 link = ERR_PTR(-error);
582 } else {
583 link[MAXPATHLEN - uio->uio_resid] = '\0';
584 }
585 kfree(uio);
586 522
587 nd_set_link(nd, link); 523 nd_set_link(nd, link);
588 return NULL; 524 return NULL;
525
526 out_kfree:
527 kfree(link);
528 out_err:
529 nd_set_link(nd, ERR_PTR(error));
530 return NULL;
589} 531}
590 532
591STATIC void 533STATIC void
@@ -607,7 +549,7 @@ xfs_vn_permission(
607 int mode, 549 int mode,
608 struct nameidata *nd) 550 struct nameidata *nd)
609{ 551{
610 return -bhv_vop_access(vn_from_inode(inode), mode << 6, NULL); 552 return -xfs_access(XFS_I(inode), mode << 6, NULL);
611} 553}
612#else 554#else
613#define xfs_vn_permission NULL 555#define xfs_vn_permission NULL
@@ -620,11 +562,10 @@ xfs_vn_getattr(
620 struct kstat *stat) 562 struct kstat *stat)
621{ 563{
622 struct inode *inode = dentry->d_inode; 564 struct inode *inode = dentry->d_inode;
623 bhv_vnode_t *vp = vn_from_inode(inode);
624 bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT }; 565 bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT };
625 int error; 566 int error;
626 567
627 error = bhv_vop_getattr(vp, &vattr, ATTR_LAZY, NULL); 568 error = xfs_getattr(XFS_I(inode), &vattr, ATTR_LAZY);
628 if (likely(!error)) { 569 if (likely(!error)) {
629 stat->size = i_size_read(inode); 570 stat->size = i_size_read(inode);
630 stat->dev = inode->i_sb->s_dev; 571 stat->dev = inode->i_sb->s_dev;
@@ -652,7 +593,6 @@ xfs_vn_setattr(
652{ 593{
653 struct inode *inode = dentry->d_inode; 594 struct inode *inode = dentry->d_inode;
654 unsigned int ia_valid = attr->ia_valid; 595 unsigned int ia_valid = attr->ia_valid;
655 bhv_vnode_t *vp = vn_from_inode(inode);
656 bhv_vattr_t vattr = { 0 }; 596 bhv_vattr_t vattr = { 0 };
657 int flags = 0; 597 int flags = 0;
658 int error; 598 int error;
@@ -696,9 +636,9 @@ xfs_vn_setattr(
696 flags |= ATTR_NONBLOCK; 636 flags |= ATTR_NONBLOCK;
697#endif 637#endif
698 638
699 error = bhv_vop_setattr(vp, &vattr, flags, NULL); 639 error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL);
700 if (likely(!error)) 640 if (likely(!error))
701 __vn_revalidate(vp, &vattr); 641 __vn_revalidate(vn_from_inode(inode), &vattr);
702 return -error; 642 return -error;
703} 643}
704 644
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/linux-2.6/xfs_iops.h
index 95a69398fce0..14d0deb7afff 100644
--- a/fs/xfs/linux-2.6/xfs_iops.h
+++ b/fs/xfs/linux-2.6/xfs_iops.h
@@ -26,11 +26,15 @@ extern const struct file_operations xfs_file_operations;
26extern const struct file_operations xfs_dir_file_operations; 26extern const struct file_operations xfs_dir_file_operations;
27extern const struct file_operations xfs_invis_file_operations; 27extern const struct file_operations xfs_invis_file_operations;
28 28
29extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
30 int, unsigned int, void __user *);
31 29
32struct xfs_inode; 30struct xfs_inode;
33extern void xfs_ichgtime(struct xfs_inode *, int); 31extern void xfs_ichgtime(struct xfs_inode *, int);
34extern void xfs_ichgtime_fast(struct xfs_inode *, struct inode *, int); 32extern void xfs_ichgtime_fast(struct xfs_inode *, struct inode *, int);
35 33
34#define xfs_vtoi(vp) \
35 ((struct xfs_inode *)vn_to_inode(vp)->i_private)
36
37#define XFS_I(inode) \
38 ((struct xfs_inode *)(inode)->i_private)
39
36#endif /* __XFS_IOPS_H__ */ 40#endif /* __XFS_IOPS_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
index 330c4ba9d404..dc3752de22da 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/linux-2.6/xfs_linux.h
@@ -51,7 +51,6 @@
51 51
52#include <support/ktrace.h> 52#include <support/ktrace.h>
53#include <support/debug.h> 53#include <support/debug.h>
54#include <support/move.h>
55#include <support/uuid.h> 54#include <support/uuid.h>
56 55
57#include <linux/mm.h> 56#include <linux/mm.h>
@@ -75,6 +74,7 @@
75#include <linux/cpu.h> 74#include <linux/cpu.h>
76#include <linux/notifier.h> 75#include <linux/notifier.h>
77#include <linux/delay.h> 76#include <linux/delay.h>
77#include <linux/log2.h>
78 78
79#include <asm/page.h> 79#include <asm/page.h>
80#include <asm/div64.h> 80#include <asm/div64.h>
@@ -83,7 +83,6 @@
83#include <asm/byteorder.h> 83#include <asm/byteorder.h>
84#include <asm/unaligned.h> 84#include <asm/unaligned.h>
85 85
86#include <xfs_behavior.h>
87#include <xfs_vfs.h> 86#include <xfs_vfs.h>
88#include <xfs_cred.h> 87#include <xfs_cred.h>
89#include <xfs_vnode.h> 88#include <xfs_vnode.h>
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 7e7aeb4c8a08..d6a8dddb2268 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -48,6 +48,7 @@
48#include "xfs_buf_item.h" 48#include "xfs_buf_item.h"
49#include "xfs_utils.h" 49#include "xfs_utils.h"
50#include "xfs_iomap.h" 50#include "xfs_iomap.h"
51#include "xfs_vnodeops.h"
51 52
52#include <linux/capability.h> 53#include <linux/capability.h>
53#include <linux/writeback.h> 54#include <linux/writeback.h>
@@ -169,27 +170,22 @@ xfs_iozero(
169 170
170ssize_t /* bytes read, or (-) error */ 171ssize_t /* bytes read, or (-) error */
171xfs_read( 172xfs_read(
172 bhv_desc_t *bdp, 173 xfs_inode_t *ip,
173 struct kiocb *iocb, 174 struct kiocb *iocb,
174 const struct iovec *iovp, 175 const struct iovec *iovp,
175 unsigned int segs, 176 unsigned int segs,
176 loff_t *offset, 177 loff_t *offset,
177 int ioflags, 178 int ioflags)
178 cred_t *credp)
179{ 179{
180 struct file *file = iocb->ki_filp; 180 struct file *file = iocb->ki_filp;
181 struct inode *inode = file->f_mapping->host; 181 struct inode *inode = file->f_mapping->host;
182 bhv_vnode_t *vp = XFS_ITOV(ip);
183 xfs_mount_t *mp = ip->i_mount;
182 size_t size = 0; 184 size_t size = 0;
183 ssize_t ret = 0; 185 ssize_t ret = 0;
184 xfs_fsize_t n; 186 xfs_fsize_t n;
185 xfs_inode_t *ip;
186 xfs_mount_t *mp;
187 bhv_vnode_t *vp;
188 unsigned long seg; 187 unsigned long seg;
189 188
190 ip = XFS_BHVTOI(bdp);
191 vp = BHV_TO_VNODE(bdp);
192 mp = ip->i_mount;
193 189
194 XFS_STATS_INC(xs_read_calls); 190 XFS_STATS_INC(xs_read_calls);
195 191
@@ -234,13 +230,11 @@ xfs_read(
234 mutex_lock(&inode->i_mutex); 230 mutex_lock(&inode->i_mutex);
235 xfs_ilock(ip, XFS_IOLOCK_SHARED); 231 xfs_ilock(ip, XFS_IOLOCK_SHARED);
236 232
237 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && 233 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
238 !(ioflags & IO_INVIS)) {
239 bhv_vrwlock_t locktype = VRWLOCK_READ; 234 bhv_vrwlock_t locktype = VRWLOCK_READ;
240 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); 235 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
241 236
242 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, 237 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size,
243 BHV_TO_VNODE(bdp), *offset, size,
244 dmflags, &locktype); 238 dmflags, &locktype);
245 if (ret) { 239 if (ret) {
246 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 240 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -252,8 +246,9 @@ xfs_read(
252 246
253 if (unlikely(ioflags & IO_ISDIRECT)) { 247 if (unlikely(ioflags & IO_ISDIRECT)) {
254 if (VN_CACHED(vp)) 248 if (VN_CACHED(vp))
255 ret = bhv_vop_flushinval_pages(vp, ctooff(offtoct(*offset)), 249 ret = xfs_flushinval_pages(ip,
256 -1, FI_REMAPF_LOCKED); 250 ctooff(offtoct(*offset)),
251 -1, FI_REMAPF_LOCKED);
257 mutex_unlock(&inode->i_mutex); 252 mutex_unlock(&inode->i_mutex);
258 if (ret) { 253 if (ret) {
259 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 254 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -277,16 +272,15 @@ xfs_read(
277 272
278ssize_t 273ssize_t
279xfs_splice_read( 274xfs_splice_read(
280 bhv_desc_t *bdp, 275 xfs_inode_t *ip,
281 struct file *infilp, 276 struct file *infilp,
282 loff_t *ppos, 277 loff_t *ppos,
283 struct pipe_inode_info *pipe, 278 struct pipe_inode_info *pipe,
284 size_t count, 279 size_t count,
285 int flags, 280 int flags,
286 int ioflags, 281 int ioflags)
287 cred_t *credp)
288{ 282{
289 xfs_inode_t *ip = XFS_BHVTOI(bdp); 283 bhv_vnode_t *vp = XFS_ITOV(ip);
290 xfs_mount_t *mp = ip->i_mount; 284 xfs_mount_t *mp = ip->i_mount;
291 ssize_t ret; 285 ssize_t ret;
292 286
@@ -296,13 +290,11 @@ xfs_splice_read(
296 290
297 xfs_ilock(ip, XFS_IOLOCK_SHARED); 291 xfs_ilock(ip, XFS_IOLOCK_SHARED);
298 292
299 if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) && 293 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
300 (!(ioflags & IO_INVIS))) {
301 bhv_vrwlock_t locktype = VRWLOCK_READ; 294 bhv_vrwlock_t locktype = VRWLOCK_READ;
302 int error; 295 int error;
303 296
304 error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), 297 error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count,
305 *ppos, count,
306 FILP_DELAY_FLAG(infilp), &locktype); 298 FILP_DELAY_FLAG(infilp), &locktype);
307 if (error) { 299 if (error) {
308 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 300 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -321,16 +313,15 @@ xfs_splice_read(
321 313
322ssize_t 314ssize_t
323xfs_splice_write( 315xfs_splice_write(
324 bhv_desc_t *bdp, 316 xfs_inode_t *ip,
325 struct pipe_inode_info *pipe, 317 struct pipe_inode_info *pipe,
326 struct file *outfilp, 318 struct file *outfilp,
327 loff_t *ppos, 319 loff_t *ppos,
328 size_t count, 320 size_t count,
329 int flags, 321 int flags,
330 int ioflags, 322 int ioflags)
331 cred_t *credp)
332{ 323{
333 xfs_inode_t *ip = XFS_BHVTOI(bdp); 324 bhv_vnode_t *vp = XFS_ITOV(ip);
334 xfs_mount_t *mp = ip->i_mount; 325 xfs_mount_t *mp = ip->i_mount;
335 xfs_iocore_t *io = &ip->i_iocore; 326 xfs_iocore_t *io = &ip->i_iocore;
336 ssize_t ret; 327 ssize_t ret;
@@ -343,13 +334,11 @@ xfs_splice_write(
343 334
344 xfs_ilock(ip, XFS_IOLOCK_EXCL); 335 xfs_ilock(ip, XFS_IOLOCK_EXCL);
345 336
346 if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_WRITE) && 337 if (DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) && !(ioflags & IO_INVIS)) {
347 (!(ioflags & IO_INVIS))) {
348 bhv_vrwlock_t locktype = VRWLOCK_WRITE; 338 bhv_vrwlock_t locktype = VRWLOCK_WRITE;
349 int error; 339 int error;
350 340
351 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp), 341 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count,
352 *ppos, count,
353 FILP_DELAY_FLAG(outfilp), &locktype); 342 FILP_DELAY_FLAG(outfilp), &locktype);
354 if (error) { 343 if (error) {
355 xfs_iunlock(ip, XFS_IOLOCK_EXCL); 344 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
@@ -583,24 +572,22 @@ out_lock:
583 572
584ssize_t /* bytes written, or (-) error */ 573ssize_t /* bytes written, or (-) error */
585xfs_write( 574xfs_write(
586 bhv_desc_t *bdp, 575 struct xfs_inode *xip,
587 struct kiocb *iocb, 576 struct kiocb *iocb,
588 const struct iovec *iovp, 577 const struct iovec *iovp,
589 unsigned int nsegs, 578 unsigned int nsegs,
590 loff_t *offset, 579 loff_t *offset,
591 int ioflags, 580 int ioflags)
592 cred_t *credp)
593{ 581{
594 struct file *file = iocb->ki_filp; 582 struct file *file = iocb->ki_filp;
595 struct address_space *mapping = file->f_mapping; 583 struct address_space *mapping = file->f_mapping;
596 struct inode *inode = mapping->host; 584 struct inode *inode = mapping->host;
585 bhv_vnode_t *vp = XFS_ITOV(xip);
597 unsigned long segs = nsegs; 586 unsigned long segs = nsegs;
598 xfs_inode_t *xip;
599 xfs_mount_t *mp; 587 xfs_mount_t *mp;
600 ssize_t ret = 0, error = 0; 588 ssize_t ret = 0, error = 0;
601 xfs_fsize_t isize, new_size; 589 xfs_fsize_t isize, new_size;
602 xfs_iocore_t *io; 590 xfs_iocore_t *io;
603 bhv_vnode_t *vp;
604 int iolock; 591 int iolock;
605 int eventsent = 0; 592 int eventsent = 0;
606 bhv_vrwlock_t locktype; 593 bhv_vrwlock_t locktype;
@@ -610,9 +597,6 @@ xfs_write(
610 597
611 XFS_STATS_INC(xs_write_calls); 598 XFS_STATS_INC(xs_write_calls);
612 599
613 vp = BHV_TO_VNODE(bdp);
614 xip = XFS_BHVTOI(bdp);
615
616 error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ); 600 error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ);
617 if (error) 601 if (error)
618 return error; 602 return error;
@@ -626,7 +610,7 @@ xfs_write(
626 io = &xip->i_iocore; 610 io = &xip->i_iocore;
627 mp = io->io_mount; 611 mp = io->io_mount;
628 612
629 vfs_wait_for_freeze(vp->v_vfsp, SB_FREEZE_WRITE); 613 xfs_wait_for_freeze(mp, SB_FREEZE_WRITE);
630 614
631 if (XFS_FORCED_SHUTDOWN(mp)) 615 if (XFS_FORCED_SHUTDOWN(mp))
632 return -EIO; 616 return -EIO;
@@ -653,7 +637,7 @@ start:
653 goto out_unlock_mutex; 637 goto out_unlock_mutex;
654 } 638 }
655 639
656 if ((DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_WRITE) && 640 if ((DM_EVENT_ENABLED(xip, DM_EVENT_WRITE) &&
657 !(ioflags & IO_INVIS) && !eventsent)) { 641 !(ioflags & IO_INVIS) && !eventsent)) {
658 int dmflags = FILP_DELAY_FLAG(file); 642 int dmflags = FILP_DELAY_FLAG(file);
659 643
@@ -722,7 +706,7 @@ start:
722 */ 706 */
723 707
724 if (pos > xip->i_size) { 708 if (pos > xip->i_size) {
725 error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, pos, xip->i_size); 709 error = xfs_zero_eof(vp, io, pos, xip->i_size);
726 if (error) { 710 if (error) {
727 xfs_iunlock(xip, XFS_ILOCK_EXCL); 711 xfs_iunlock(xip, XFS_ILOCK_EXCL);
728 goto out_unlock_internal; 712 goto out_unlock_internal;
@@ -758,7 +742,8 @@ retry:
758 WARN_ON(need_i_mutex == 0); 742 WARN_ON(need_i_mutex == 0);
759 xfs_inval_cached_trace(io, pos, -1, 743 xfs_inval_cached_trace(io, pos, -1,
760 ctooff(offtoct(pos)), -1); 744 ctooff(offtoct(pos)), -1);
761 error = bhv_vop_flushinval_pages(vp, ctooff(offtoct(pos)), 745 error = xfs_flushinval_pages(xip,
746 ctooff(offtoct(pos)),
762 -1, FI_REMAPF_LOCKED); 747 -1, FI_REMAPF_LOCKED);
763 if (error) 748 if (error)
764 goto out_unlock_internal; 749 goto out_unlock_internal;
@@ -805,11 +790,9 @@ retry:
805 if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO)) 790 if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO))
806 ret = wait_on_sync_kiocb(iocb); 791 ret = wait_on_sync_kiocb(iocb);
807 792
808 if ((ret == -ENOSPC) && 793 if (ret == -ENOSPC &&
809 DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) && 794 DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) {
810 !(ioflags & IO_INVIS)) { 795 xfs_rwunlock(xip, locktype);
811
812 xfs_rwunlock(bdp, locktype);
813 if (need_i_mutex) 796 if (need_i_mutex)
814 mutex_unlock(&inode->i_mutex); 797 mutex_unlock(&inode->i_mutex);
815 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, 798 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
@@ -817,7 +800,7 @@ retry:
817 0, 0, 0); /* Delay flag intentionally unused */ 800 0, 0, 0); /* Delay flag intentionally unused */
818 if (need_i_mutex) 801 if (need_i_mutex)
819 mutex_lock(&inode->i_mutex); 802 mutex_lock(&inode->i_mutex);
820 xfs_rwlock(bdp, locktype); 803 xfs_rwlock(xip, locktype);
821 if (error) 804 if (error)
822 goto out_unlock_internal; 805 goto out_unlock_internal;
823 pos = xip->i_size; 806 pos = xip->i_size;
@@ -844,20 +827,19 @@ retry:
844 827
845 /* Handle various SYNC-type writes */ 828 /* Handle various SYNC-type writes */
846 if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) { 829 if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
847 error = xfs_write_sync_logforce(mp, xip); 830 int error2;
848 if (error) 831 xfs_rwunlock(xip, locktype);
849 goto out_unlock_internal;
850
851 xfs_rwunlock(bdp, locktype);
852 if (need_i_mutex) 832 if (need_i_mutex)
853 mutex_unlock(&inode->i_mutex); 833 mutex_unlock(&inode->i_mutex);
854 834 error2 = sync_page_range(inode, mapping, pos, ret);
855 error = sync_page_range(inode, mapping, pos, ret);
856 if (!error) 835 if (!error)
857 error = -ret; 836 error = error2;
858 if (need_i_mutex) 837 if (need_i_mutex)
859 mutex_lock(&inode->i_mutex); 838 mutex_lock(&inode->i_mutex);
860 xfs_rwlock(bdp, locktype); 839 xfs_rwlock(xip, locktype);
840 error2 = xfs_write_sync_logforce(mp, xip);
841 if (!error)
842 error = error2;
861 } 843 }
862 844
863 out_unlock_internal: 845 out_unlock_internal:
@@ -875,7 +857,7 @@ retry:
875 xip->i_d.di_size = xip->i_size; 857 xip->i_d.di_size = xip->i_size;
876 xfs_iunlock(xip, XFS_ILOCK_EXCL); 858 xfs_iunlock(xip, XFS_ILOCK_EXCL);
877 } 859 }
878 xfs_rwunlock(bdp, locktype); 860 xfs_rwunlock(xip, locktype);
879 out_unlock_mutex: 861 out_unlock_mutex:
880 if (need_i_mutex) 862 if (need_i_mutex)
881 mutex_unlock(&inode->i_mutex); 863 mutex_unlock(&inode->i_mutex);
@@ -914,14 +896,14 @@ xfs_bdstrat_cb(struct xfs_buf *bp)
914 896
915 897
916int 898int
917xfs_bmap(bhv_desc_t *bdp, 899xfs_bmap(
900 xfs_inode_t *ip,
918 xfs_off_t offset, 901 xfs_off_t offset,
919 ssize_t count, 902 ssize_t count,
920 int flags, 903 int flags,
921 xfs_iomap_t *iomapp, 904 xfs_iomap_t *iomapp,
922 int *niomaps) 905 int *niomaps)
923{ 906{
924 xfs_inode_t *ip = XFS_BHVTOI(bdp);
925 xfs_iocore_t *io = &ip->i_iocore; 907 xfs_iocore_t *io = &ip->i_iocore;
926 908
927 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); 909 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index 7c60a1eed88b..4b7747a828d9 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -18,8 +18,6 @@
18#ifndef __XFS_LRW_H__ 18#ifndef __XFS_LRW_H__
19#define __XFS_LRW_H__ 19#define __XFS_LRW_H__
20 20
21struct bhv_desc;
22struct bhv_vnode;
23struct xfs_mount; 21struct xfs_mount;
24struct xfs_iocore; 22struct xfs_iocore;
25struct xfs_inode; 23struct xfs_inode;
@@ -71,30 +69,11 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *,
71#define xfs_inval_cached_trace(io, offset, len, first, last) 69#define xfs_inval_cached_trace(io, offset, len, first, last)
72#endif 70#endif
73 71
74/*
75 * Maximum count of bmaps used by read and write paths.
76 */
77#define XFS_MAX_RW_NBMAPS 4
78
79extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
80 struct xfs_iomap *, int *);
81extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 72extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
82extern int xfs_bdstrat_cb(struct xfs_buf *); 73extern int xfs_bdstrat_cb(struct xfs_buf *);
83extern int xfs_dev_is_read_only(struct xfs_mount *, char *); 74extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
84 75
85extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t, 76extern int xfs_zero_eof(struct inode *, struct xfs_iocore *, xfs_off_t,
86 xfs_fsize_t); 77 xfs_fsize_t);
87extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
88 const struct iovec *, unsigned int,
89 loff_t *, int, struct cred *);
90extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
91 const struct iovec *, unsigned int,
92 loff_t *, int, struct cred *);
93extern ssize_t xfs_splice_read(struct bhv_desc *, struct file *, loff_t *,
94 struct pipe_inode_info *, size_t, int, int,
95 struct cred *);
96extern ssize_t xfs_splice_write(struct bhv_desc *, struct pipe_inode_info *,
97 struct file *, loff_t *, size_t, int, int,
98 struct cred *);
99 78
100#endif /* __XFS_LRW_H__ */ 79#endif /* __XFS_LRW_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 491d1f4f202d..8cb63c60c048 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -46,6 +46,8 @@
46#include "xfs_attr.h" 46#include "xfs_attr.h"
47#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
48#include "xfs_utils.h" 48#include "xfs_utils.h"
49#include "xfs_vnodeops.h"
50#include "xfs_vfsops.h"
49#include "xfs_version.h" 51#include "xfs_version.h"
50 52
51#include <linux/namei.h> 53#include <linux/namei.h>
@@ -196,23 +198,20 @@ xfs_revalidate_inode(
196 inode->i_flags |= S_NOATIME; 198 inode->i_flags |= S_NOATIME;
197 else 199 else
198 inode->i_flags &= ~S_NOATIME; 200 inode->i_flags &= ~S_NOATIME;
199 vp->v_flag &= ~VMODIFIED; 201 xfs_iflags_clear(ip, XFS_IMODIFIED);
200} 202}
201 203
202void 204void
203xfs_initialize_vnode( 205xfs_initialize_vnode(
204 bhv_desc_t *bdp, 206 struct xfs_mount *mp,
205 bhv_vnode_t *vp, 207 bhv_vnode_t *vp,
206 bhv_desc_t *inode_bhv, 208 struct xfs_inode *ip)
207 int unlock)
208{ 209{
209 xfs_inode_t *ip = XFS_BHVTOI(inode_bhv);
210 struct inode *inode = vn_to_inode(vp); 210 struct inode *inode = vn_to_inode(vp);
211 211
212 if (!inode_bhv->bd_vobj) { 212 if (!ip->i_vnode) {
213 vp->v_vfsp = bhvtovfs(bdp); 213 ip->i_vnode = vp;
214 bhv_desc_init(inode_bhv, ip, vp, &xfs_vnodeops); 214 inode->i_private = ip;
215 bhv_insert(VN_BHV_HEAD(vp), inode_bhv);
216 } 215 }
217 216
218 /* 217 /*
@@ -222,8 +221,8 @@ xfs_initialize_vnode(
222 * second time once the inode is properly set up, and then we can 221 * second time once the inode is properly set up, and then we can
223 * finish our work. 222 * finish our work.
224 */ 223 */
225 if (ip->i_d.di_mode != 0 && unlock && (inode->i_state & I_NEW)) { 224 if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) {
226 xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip); 225 xfs_revalidate_inode(mp, vp, ip);
227 xfs_set_inodeops(inode); 226 xfs_set_inodeops(inode);
228 227
229 xfs_iflags_clear(ip, XFS_INEW); 228 xfs_iflags_clear(ip, XFS_INEW);
@@ -356,9 +355,8 @@ xfs_fs_destroy_inode(
356 355
357STATIC void 356STATIC void
358xfs_fs_inode_init_once( 357xfs_fs_inode_init_once(
359 void *vnode,
360 kmem_zone_t *zonep, 358 kmem_zone_t *zonep,
361 unsigned long flags) 359 void *vnode)
362{ 360{
363 inode_init_once(vn_to_inode((bhv_vnode_t *)vnode)); 361 inode_init_once(vn_to_inode((bhv_vnode_t *)vnode));
364} 362}
@@ -410,19 +408,22 @@ xfs_fs_write_inode(
410 struct inode *inode, 408 struct inode *inode,
411 int sync) 409 int sync)
412{ 410{
413 bhv_vnode_t *vp = vn_from_inode(inode);
414 int error = 0, flags = FLUSH_INODE; 411 int error = 0, flags = FLUSH_INODE;
415 412
416 if (vp) { 413 vn_trace_entry(XFS_I(inode), __FUNCTION__,
417 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 414 (inst_t *)__return_address);
418 if (sync) { 415 if (sync) {
419 filemap_fdatawait(inode->i_mapping); 416 filemap_fdatawait(inode->i_mapping);
420 flags |= FLUSH_SYNC; 417 flags |= FLUSH_SYNC;
421 }
422 error = bhv_vop_iflush(vp, flags);
423 if (error == EAGAIN)
424 error = sync? bhv_vop_iflush(vp, flags | FLUSH_LOG) : 0;
425 } 418 }
419 error = xfs_inode_flush(XFS_I(inode), flags);
420 /*
421 * if we failed to write out the inode then mark
422 * it dirty again so we'll try again later.
423 */
424 if (error)
425 mark_inode_dirty_sync(inode);
426
426 return -error; 427 return -error;
427} 428}
428 429
@@ -430,35 +431,27 @@ STATIC void
430xfs_fs_clear_inode( 431xfs_fs_clear_inode(
431 struct inode *inode) 432 struct inode *inode)
432{ 433{
433 bhv_vnode_t *vp = vn_from_inode(inode); 434 xfs_inode_t *ip = XFS_I(inode);
434
435 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
436
437 XFS_STATS_INC(vn_rele);
438 XFS_STATS_INC(vn_remove);
439 XFS_STATS_INC(vn_reclaim);
440 XFS_STATS_DEC(vn_active);
441 435
442 /* 436 /*
443 * This can happen because xfs_iget_core calls xfs_idestroy if we 437 * ip can be null when xfs_iget_core calls xfs_idestroy if we
444 * find an inode with di_mode == 0 but without IGET_CREATE set. 438 * find an inode with di_mode == 0 but without IGET_CREATE set.
445 */ 439 */
446 if (VNHEAD(vp)) 440 if (ip) {
447 bhv_vop_inactive(vp, NULL); 441 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
448 442
449 VN_LOCK(vp); 443 XFS_STATS_INC(vn_rele);
450 vp->v_flag &= ~VMODIFIED; 444 XFS_STATS_INC(vn_remove);
451 VN_UNLOCK(vp, 0); 445 XFS_STATS_INC(vn_reclaim);
452 446 XFS_STATS_DEC(vn_active);
453 if (VNHEAD(vp)) 447
454 if (bhv_vop_reclaim(vp)) 448 xfs_inactive(ip);
455 panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp); 449 xfs_iflags_clear(ip, XFS_IMODIFIED);
456 450 if (xfs_reclaim(ip))
457 ASSERT(VNHEAD(vp) == NULL); 451 panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, inode);
452 }
458 453
459#ifdef XFS_VNODE_TRACE 454 ASSERT(XFS_I(inode) == NULL);
460 ktrace_free(vp->v_trace);
461#endif
462} 455}
463 456
464/* 457/*
@@ -470,9 +463,9 @@ xfs_fs_clear_inode(
470 */ 463 */
471STATIC void 464STATIC void
472xfs_syncd_queue_work( 465xfs_syncd_queue_work(
473 struct bhv_vfs *vfs, 466 struct xfs_mount *mp,
474 void *data, 467 void *data,
475 void (*syncer)(bhv_vfs_t *, void *)) 468 void (*syncer)(struct xfs_mount *, void *))
476{ 469{
477 struct bhv_vfs_sync_work *work; 470 struct bhv_vfs_sync_work *work;
478 471
@@ -480,11 +473,11 @@ xfs_syncd_queue_work(
480 INIT_LIST_HEAD(&work->w_list); 473 INIT_LIST_HEAD(&work->w_list);
481 work->w_syncer = syncer; 474 work->w_syncer = syncer;
482 work->w_data = data; 475 work->w_data = data;
483 work->w_vfs = vfs; 476 work->w_mount = mp;
484 spin_lock(&vfs->vfs_sync_lock); 477 spin_lock(&mp->m_sync_lock);
485 list_add_tail(&work->w_list, &vfs->vfs_sync_list); 478 list_add_tail(&work->w_list, &mp->m_sync_list);
486 spin_unlock(&vfs->vfs_sync_lock); 479 spin_unlock(&mp->m_sync_lock);
487 wake_up_process(vfs->vfs_sync_task); 480 wake_up_process(mp->m_sync_task);
488} 481}
489 482
490/* 483/*
@@ -495,22 +488,22 @@ xfs_syncd_queue_work(
495 */ 488 */
496STATIC void 489STATIC void
497xfs_flush_inode_work( 490xfs_flush_inode_work(
498 bhv_vfs_t *vfs, 491 struct xfs_mount *mp,
499 void *inode) 492 void *arg)
500{ 493{
501 filemap_flush(((struct inode *)inode)->i_mapping); 494 struct inode *inode = arg;
502 iput((struct inode *)inode); 495 filemap_flush(inode->i_mapping);
496 iput(inode);
503} 497}
504 498
505void 499void
506xfs_flush_inode( 500xfs_flush_inode(
507 xfs_inode_t *ip) 501 xfs_inode_t *ip)
508{ 502{
509 struct inode *inode = vn_to_inode(XFS_ITOV(ip)); 503 struct inode *inode = ip->i_vnode;
510 struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount);
511 504
512 igrab(inode); 505 igrab(inode);
513 xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work); 506 xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inode_work);
514 delay(msecs_to_jiffies(500)); 507 delay(msecs_to_jiffies(500));
515} 508}
516 509
@@ -520,11 +513,12 @@ xfs_flush_inode(
520 */ 513 */
521STATIC void 514STATIC void
522xfs_flush_device_work( 515xfs_flush_device_work(
523 bhv_vfs_t *vfs, 516 struct xfs_mount *mp,
524 void *inode) 517 void *arg)
525{ 518{
526 sync_blockdev(vfs->vfs_super->s_bdev); 519 struct inode *inode = arg;
527 iput((struct inode *)inode); 520 sync_blockdev(mp->m_super->s_bdev);
521 iput(inode);
528} 522}
529 523
530void 524void
@@ -532,35 +526,33 @@ xfs_flush_device(
532 xfs_inode_t *ip) 526 xfs_inode_t *ip)
533{ 527{
534 struct inode *inode = vn_to_inode(XFS_ITOV(ip)); 528 struct inode *inode = vn_to_inode(XFS_ITOV(ip));
535 struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount);
536 529
537 igrab(inode); 530 igrab(inode);
538 xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work); 531 xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_device_work);
539 delay(msecs_to_jiffies(500)); 532 delay(msecs_to_jiffies(500));
540 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC); 533 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
541} 534}
542 535
543STATIC void 536STATIC void
544vfs_sync_worker( 537xfs_sync_worker(
545 bhv_vfs_t *vfsp, 538 struct xfs_mount *mp,
546 void *unused) 539 void *unused)
547{ 540{
548 int error; 541 int error;
549 542
550 if (!(vfsp->vfs_flag & VFS_RDONLY)) 543 if (!(mp->m_flags & XFS_MOUNT_RDONLY))
551 error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \ 544 error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR |
552 SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER, 545 SYNC_REFCACHE | SYNC_SUPER);
553 NULL); 546 mp->m_sync_seq++;
554 vfsp->vfs_sync_seq++; 547 wake_up(&mp->m_wait_single_sync_task);
555 wake_up(&vfsp->vfs_wait_single_sync_task);
556} 548}
557 549
558STATIC int 550STATIC int
559xfssyncd( 551xfssyncd(
560 void *arg) 552 void *arg)
561{ 553{
554 struct xfs_mount *mp = arg;
562 long timeleft; 555 long timeleft;
563 bhv_vfs_t *vfsp = (bhv_vfs_t *) arg;
564 bhv_vfs_sync_work_t *work, *n; 556 bhv_vfs_sync_work_t *work, *n;
565 LIST_HEAD (tmp); 557 LIST_HEAD (tmp);
566 558
@@ -570,31 +562,31 @@ xfssyncd(
570 timeleft = schedule_timeout_interruptible(timeleft); 562 timeleft = schedule_timeout_interruptible(timeleft);
571 /* swsusp */ 563 /* swsusp */
572 try_to_freeze(); 564 try_to_freeze();
573 if (kthread_should_stop() && list_empty(&vfsp->vfs_sync_list)) 565 if (kthread_should_stop() && list_empty(&mp->m_sync_list))
574 break; 566 break;
575 567
576 spin_lock(&vfsp->vfs_sync_lock); 568 spin_lock(&mp->m_sync_lock);
577 /* 569 /*
578 * We can get woken by laptop mode, to do a sync - 570 * We can get woken by laptop mode, to do a sync -
579 * that's the (only!) case where the list would be 571 * that's the (only!) case where the list would be
580 * empty with time remaining. 572 * empty with time remaining.
581 */ 573 */
582 if (!timeleft || list_empty(&vfsp->vfs_sync_list)) { 574 if (!timeleft || list_empty(&mp->m_sync_list)) {
583 if (!timeleft) 575 if (!timeleft)
584 timeleft = xfs_syncd_centisecs * 576 timeleft = xfs_syncd_centisecs *
585 msecs_to_jiffies(10); 577 msecs_to_jiffies(10);
586 INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list); 578 INIT_LIST_HEAD(&mp->m_sync_work.w_list);
587 list_add_tail(&vfsp->vfs_sync_work.w_list, 579 list_add_tail(&mp->m_sync_work.w_list,
588 &vfsp->vfs_sync_list); 580 &mp->m_sync_list);
589 } 581 }
590 list_for_each_entry_safe(work, n, &vfsp->vfs_sync_list, w_list) 582 list_for_each_entry_safe(work, n, &mp->m_sync_list, w_list)
591 list_move(&work->w_list, &tmp); 583 list_move(&work->w_list, &tmp);
592 spin_unlock(&vfsp->vfs_sync_lock); 584 spin_unlock(&mp->m_sync_lock);
593 585
594 list_for_each_entry_safe(work, n, &tmp, w_list) { 586 list_for_each_entry_safe(work, n, &tmp, w_list) {
595 (*work->w_syncer)(vfsp, work->w_data); 587 (*work->w_syncer)(mp, work->w_data);
596 list_del(&work->w_list); 588 list_del(&work->w_list);
597 if (work == &vfsp->vfs_sync_work) 589 if (work == &mp->m_sync_work)
598 continue; 590 continue;
599 kmem_free(work, sizeof(struct bhv_vfs_sync_work)); 591 kmem_free(work, sizeof(struct bhv_vfs_sync_work));
600 } 592 }
@@ -603,41 +595,19 @@ xfssyncd(
603 return 0; 595 return 0;
604} 596}
605 597
606STATIC int
607xfs_fs_start_syncd(
608 bhv_vfs_t *vfsp)
609{
610 vfsp->vfs_sync_work.w_syncer = vfs_sync_worker;
611 vfsp->vfs_sync_work.w_vfs = vfsp;
612 vfsp->vfs_sync_task = kthread_run(xfssyncd, vfsp, "xfssyncd");
613 if (IS_ERR(vfsp->vfs_sync_task))
614 return -PTR_ERR(vfsp->vfs_sync_task);
615 return 0;
616}
617
618STATIC void
619xfs_fs_stop_syncd(
620 bhv_vfs_t *vfsp)
621{
622 kthread_stop(vfsp->vfs_sync_task);
623}
624
625STATIC void 598STATIC void
626xfs_fs_put_super( 599xfs_fs_put_super(
627 struct super_block *sb) 600 struct super_block *sb)
628{ 601{
629 bhv_vfs_t *vfsp = vfs_from_sb(sb); 602 struct xfs_mount *mp = XFS_M(sb);
630 int error; 603 int error;
631 604
632 xfs_fs_stop_syncd(vfsp); 605 kthread_stop(mp->m_sync_task);
633 bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL); 606
634 error = bhv_vfs_unmount(vfsp, 0, NULL); 607 xfs_sync(mp, SYNC_ATTR | SYNC_DELWRI);
635 if (error) { 608 error = xfs_unmount(mp, 0, NULL);
609 if (error)
636 printk("XFS: unmount got error=%d\n", error); 610 printk("XFS: unmount got error=%d\n", error);
637 printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp);
638 } else {
639 vfs_deallocate(vfsp);
640 }
641} 611}
642 612
643STATIC void 613STATIC void
@@ -645,7 +615,7 @@ xfs_fs_write_super(
645 struct super_block *sb) 615 struct super_block *sb)
646{ 616{
647 if (!(sb->s_flags & MS_RDONLY)) 617 if (!(sb->s_flags & MS_RDONLY))
648 bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL); 618 xfs_sync(XFS_M(sb), SYNC_FSDATA);
649 sb->s_dirt = 0; 619 sb->s_dirt = 0;
650} 620}
651 621
@@ -654,11 +624,23 @@ xfs_fs_sync_super(
654 struct super_block *sb, 624 struct super_block *sb,
655 int wait) 625 int wait)
656{ 626{
657 bhv_vfs_t *vfsp = vfs_from_sb(sb); 627 struct xfs_mount *mp = XFS_M(sb);
658 int error; 628 int error;
659 int flags; 629 int flags;
660 630
661 if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) { 631 /*
632 * Treat a sync operation like a freeze. This is to work
633 * around a race in sync_inodes() which works in two phases
634 * - an asynchronous flush, which can write out an inode
635 * without waiting for file size updates to complete, and a
636 * synchronous flush, which wont do anything because the
637 * async flush removed the inode's dirty flag. Also
638 * sync_inodes() will not see any files that just have
639 * outstanding transactions to be flushed because we don't
640 * dirty the Linux inode until after the transaction I/O
641 * completes.
642 */
643 if (wait || unlikely(sb->s_frozen == SB_FREEZE_WRITE)) {
662 /* 644 /*
663 * First stage of freeze - no more writers will make progress 645 * First stage of freeze - no more writers will make progress
664 * now we are here, so we flush delwri and delalloc buffers 646 * now we are here, so we flush delwri and delalloc buffers
@@ -669,28 +651,28 @@ xfs_fs_sync_super(
669 */ 651 */
670 flags = SYNC_DATA_QUIESCE; 652 flags = SYNC_DATA_QUIESCE;
671 } else 653 } else
672 flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); 654 flags = SYNC_FSDATA;
673 655
674 error = bhv_vfs_sync(vfsp, flags, NULL); 656 error = xfs_sync(mp, flags);
675 sb->s_dirt = 0; 657 sb->s_dirt = 0;
676 658
677 if (unlikely(laptop_mode)) { 659 if (unlikely(laptop_mode)) {
678 int prev_sync_seq = vfsp->vfs_sync_seq; 660 int prev_sync_seq = mp->m_sync_seq;
679 661
680 /* 662 /*
681 * The disk must be active because we're syncing. 663 * The disk must be active because we're syncing.
682 * We schedule xfssyncd now (now that the disk is 664 * We schedule xfssyncd now (now that the disk is
683 * active) instead of later (when it might not be). 665 * active) instead of later (when it might not be).
684 */ 666 */
685 wake_up_process(vfsp->vfs_sync_task); 667 wake_up_process(mp->m_sync_task);
686 /* 668 /*
687 * We have to wait for the sync iteration to complete. 669 * We have to wait for the sync iteration to complete.
688 * If we don't, the disk activity caused by the sync 670 * If we don't, the disk activity caused by the sync
689 * will come after the sync is completed, and that 671 * will come after the sync is completed, and that
690 * triggers another sync from laptop mode. 672 * triggers another sync from laptop mode.
691 */ 673 */
692 wait_event(vfsp->vfs_wait_single_sync_task, 674 wait_event(mp->m_wait_single_sync_task,
693 vfsp->vfs_sync_seq != prev_sync_seq); 675 mp->m_sync_seq != prev_sync_seq);
694 } 676 }
695 677
696 return -error; 678 return -error;
@@ -701,7 +683,7 @@ xfs_fs_statfs(
701 struct dentry *dentry, 683 struct dentry *dentry,
702 struct kstatfs *statp) 684 struct kstatfs *statp)
703{ 685{
704 return -bhv_vfs_statvfs(vfs_from_sb(dentry->d_sb), statp, 686 return -xfs_statvfs(XFS_M(dentry->d_sb), statp,
705 vn_from_inode(dentry->d_inode)); 687 vn_from_inode(dentry->d_inode));
706} 688}
707 689
@@ -711,13 +693,13 @@ xfs_fs_remount(
711 int *flags, 693 int *flags,
712 char *options) 694 char *options)
713{ 695{
714 bhv_vfs_t *vfsp = vfs_from_sb(sb); 696 struct xfs_mount *mp = XFS_M(sb);
715 struct xfs_mount_args *args = xfs_args_allocate(sb, 0); 697 struct xfs_mount_args *args = xfs_args_allocate(sb, 0);
716 int error; 698 int error;
717 699
718 error = bhv_vfs_parseargs(vfsp, options, args, 1); 700 error = xfs_parseargs(mp, options, args, 1);
719 if (!error) 701 if (!error)
720 error = bhv_vfs_mntupdate(vfsp, flags, args); 702 error = xfs_mntupdate(mp, flags, args);
721 kmem_free(args, sizeof(*args)); 703 kmem_free(args, sizeof(*args));
722 return -error; 704 return -error;
723} 705}
@@ -726,7 +708,7 @@ STATIC void
726xfs_fs_lockfs( 708xfs_fs_lockfs(
727 struct super_block *sb) 709 struct super_block *sb)
728{ 710{
729 bhv_vfs_freeze(vfs_from_sb(sb)); 711 xfs_freeze(XFS_M(sb));
730} 712}
731 713
732STATIC int 714STATIC int
@@ -734,7 +716,7 @@ xfs_fs_show_options(
734 struct seq_file *m, 716 struct seq_file *m,
735 struct vfsmount *mnt) 717 struct vfsmount *mnt)
736{ 718{
737 return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m); 719 return -xfs_showargs(XFS_M(mnt->mnt_sb), m);
738} 720}
739 721
740STATIC int 722STATIC int
@@ -742,7 +724,7 @@ xfs_fs_quotasync(
742 struct super_block *sb, 724 struct super_block *sb,
743 int type) 725 int type)
744{ 726{
745 return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL); 727 return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
746} 728}
747 729
748STATIC int 730STATIC int
@@ -750,7 +732,7 @@ xfs_fs_getxstate(
750 struct super_block *sb, 732 struct super_block *sb,
751 struct fs_quota_stat *fqs) 733 struct fs_quota_stat *fqs)
752{ 734{
753 return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs); 735 return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
754} 736}
755 737
756STATIC int 738STATIC int
@@ -759,7 +741,7 @@ xfs_fs_setxstate(
759 unsigned int flags, 741 unsigned int flags,
760 int op) 742 int op)
761{ 743{
762 return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags); 744 return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
763} 745}
764 746
765STATIC int 747STATIC int
@@ -769,7 +751,7 @@ xfs_fs_getxquota(
769 qid_t id, 751 qid_t id,
770 struct fs_disk_quota *fdq) 752 struct fs_disk_quota *fdq)
771{ 753{
772 return -bhv_vfs_quotactl(vfs_from_sb(sb), 754 return -XFS_QM_QUOTACTL(XFS_M(sb),
773 (type == USRQUOTA) ? Q_XGETQUOTA : 755 (type == USRQUOTA) ? Q_XGETQUOTA :
774 ((type == GRPQUOTA) ? Q_XGETGQUOTA : 756 ((type == GRPQUOTA) ? Q_XGETGQUOTA :
775 Q_XGETPQUOTA), id, (caddr_t)fdq); 757 Q_XGETPQUOTA), id, (caddr_t)fdq);
@@ -782,7 +764,7 @@ xfs_fs_setxquota(
782 qid_t id, 764 qid_t id,
783 struct fs_disk_quota *fdq) 765 struct fs_disk_quota *fdq)
784{ 766{
785 return -bhv_vfs_quotactl(vfs_from_sb(sb), 767 return -XFS_QM_QUOTACTL(XFS_M(sb),
786 (type == USRQUOTA) ? Q_XSETQLIM : 768 (type == USRQUOTA) ? Q_XSETQLIM :
787 ((type == GRPQUOTA) ? Q_XSETGQLIM : 769 ((type == GRPQUOTA) ? Q_XSETGQLIM :
788 Q_XSETPQLIM), id, (caddr_t)fdq); 770 Q_XSETPQLIM), id, (caddr_t)fdq);
@@ -794,32 +776,38 @@ xfs_fs_fill_super(
794 void *data, 776 void *data,
795 int silent) 777 int silent)
796{ 778{
797 struct bhv_vnode *rootvp; 779 struct inode *rootvp;
798 struct bhv_vfs *vfsp = vfs_allocate(sb); 780 struct xfs_mount *mp = NULL;
799 struct xfs_mount_args *args = xfs_args_allocate(sb, silent); 781 struct xfs_mount_args *args = xfs_args_allocate(sb, silent);
800 struct kstatfs statvfs; 782 struct kstatfs statvfs;
801 int error; 783 int error;
802 784
803 bhv_insert_all_vfsops(vfsp); 785 mp = xfs_mount_init();
804 786
805 error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0); 787 INIT_LIST_HEAD(&mp->m_sync_list);
806 if (error) { 788 spin_lock_init(&mp->m_sync_lock);
807 bhv_remove_all_vfsops(vfsp, 1); 789 init_waitqueue_head(&mp->m_wait_single_sync_task);
790
791 mp->m_super = sb;
792 sb->s_fs_info = mp;
793
794 if (sb->s_flags & MS_RDONLY)
795 mp->m_flags |= XFS_MOUNT_RDONLY;
796
797 error = xfs_parseargs(mp, (char *)data, args, 0);
798 if (error)
808 goto fail_vfsop; 799 goto fail_vfsop;
809 }
810 800
811 sb_min_blocksize(sb, BBSIZE); 801 sb_min_blocksize(sb, BBSIZE);
812 sb->s_export_op = &xfs_export_operations; 802 sb->s_export_op = &xfs_export_operations;
813 sb->s_qcop = &xfs_quotactl_operations; 803 sb->s_qcop = &xfs_quotactl_operations;
814 sb->s_op = &xfs_super_operations; 804 sb->s_op = &xfs_super_operations;
815 805
816 error = bhv_vfs_mount(vfsp, args, NULL); 806 error = xfs_mount(mp, args, NULL);
817 if (error) { 807 if (error)
818 bhv_remove_all_vfsops(vfsp, 1);
819 goto fail_vfsop; 808 goto fail_vfsop;
820 }
821 809
822 error = bhv_vfs_statvfs(vfsp, &statvfs, NULL); 810 error = xfs_statvfs(mp, &statvfs, NULL);
823 if (error) 811 if (error)
824 goto fail_unmount; 812 goto fail_unmount;
825 813
@@ -831,7 +819,7 @@ xfs_fs_fill_super(
831 sb->s_time_gran = 1; 819 sb->s_time_gran = 1;
832 set_posix_acl_flag(sb); 820 set_posix_acl_flag(sb);
833 821
834 error = bhv_vfs_root(vfsp, &rootvp); 822 error = xfs_root(mp, &rootvp);
835 if (error) 823 if (error)
836 goto fail_unmount; 824 goto fail_unmount;
837 825
@@ -844,9 +832,17 @@ xfs_fs_fill_super(
844 error = EINVAL; 832 error = EINVAL;
845 goto fail_vnrele; 833 goto fail_vnrele;
846 } 834 }
847 if ((error = xfs_fs_start_syncd(vfsp))) 835
836 mp->m_sync_work.w_syncer = xfs_sync_worker;
837 mp->m_sync_work.w_mount = mp;
838 mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd");
839 if (IS_ERR(mp->m_sync_task)) {
840 error = -PTR_ERR(mp->m_sync_task);
848 goto fail_vnrele; 841 goto fail_vnrele;
849 vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address); 842 }
843
844 vn_trace_exit(XFS_I(sb->s_root->d_inode), __FUNCTION__,
845 (inst_t *)__return_address);
850 846
851 kmem_free(args, sizeof(*args)); 847 kmem_free(args, sizeof(*args));
852 return 0; 848 return 0;
@@ -860,10 +856,9 @@ fail_vnrele:
860 } 856 }
861 857
862fail_unmount: 858fail_unmount:
863 bhv_vfs_unmount(vfsp, 0, NULL); 859 xfs_unmount(mp, 0, NULL);
864 860
865fail_vfsop: 861fail_vfsop:
866 vfs_deallocate(vfsp);
867 kmem_free(args, sizeof(*args)); 862 kmem_free(args, sizeof(*args));
868 return -error; 863 return -error;
869} 864}
@@ -915,15 +910,11 @@ STATIC int __init
915init_xfs_fs( void ) 910init_xfs_fs( void )
916{ 911{
917 int error; 912 int error;
918 struct sysinfo si;
919 static char message[] __initdata = KERN_INFO \ 913 static char message[] __initdata = KERN_INFO \
920 XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n"; 914 XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
921 915
922 printk(message); 916 printk(message);
923 917
924 si_meminfo(&si);
925 xfs_physmem = si.totalram;
926
927 ktrace_init(64); 918 ktrace_init(64);
928 919
929 error = xfs_init_zones(); 920 error = xfs_init_zones();
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/linux-2.6/xfs_super.h
index 201cc3273c84..c78c23310fe8 100644
--- a/fs/xfs/linux-2.6/xfs_super.h
+++ b/fs/xfs/linux-2.6/xfs_super.h
@@ -107,7 +107,8 @@ struct block_device;
107 107
108extern __uint64_t xfs_max_file_offset(unsigned int); 108extern __uint64_t xfs_max_file_offset(unsigned int);
109 109
110extern void xfs_initialize_vnode(bhv_desc_t *, bhv_vnode_t *, bhv_desc_t *, int); 110extern void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp,
111 struct xfs_inode *ip);
111 112
112extern void xfs_flush_inode(struct xfs_inode *); 113extern void xfs_flush_inode(struct xfs_inode *);
113extern void xfs_flush_device(struct xfs_inode *); 114extern void xfs_flush_device(struct xfs_inode *);
@@ -119,4 +120,6 @@ extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
119 120
120extern struct export_operations xfs_export_operations; 121extern struct export_operations xfs_export_operations;
121 122
123#define XFS_M(sb) ((struct xfs_mount *)((sb)->s_fs_info))
124
122#endif /* __XFS_SUPER_H__ */ 125#endif /* __XFS_SUPER_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c
deleted file mode 100644
index 6145e8bd0be2..000000000000
--- a/fs/xfs/linux-2.6/xfs_vfs.c
+++ /dev/null
@@ -1,327 +0,0 @@
1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include "xfs.h"
19#include "xfs_fs.h"
20#include "xfs_inum.h"
21#include "xfs_log.h"
22#include "xfs_clnt.h"
23#include "xfs_trans.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_dir2.h"
27#include "xfs_imap.h"
28#include "xfs_alloc.h"
29#include "xfs_dmapi.h"
30#include "xfs_mount.h"
31#include "xfs_quota.h"
32
33int
34vfs_mount(
35 struct bhv_desc *bdp,
36 struct xfs_mount_args *args,
37 struct cred *cr)
38{
39 struct bhv_desc *next = bdp;
40
41 ASSERT(next);
42 while (! (bhvtovfsops(next))->vfs_mount)
43 next = BHV_NEXT(next);
44 return ((*bhvtovfsops(next)->vfs_mount)(next, args, cr));
45}
46
47int
48vfs_parseargs(
49 struct bhv_desc *bdp,
50 char *s,
51 struct xfs_mount_args *args,
52 int f)
53{
54 struct bhv_desc *next = bdp;
55
56 ASSERT(next);
57 while (! (bhvtovfsops(next))->vfs_parseargs)
58 next = BHV_NEXT(next);
59 return ((*bhvtovfsops(next)->vfs_parseargs)(next, s, args, f));
60}
61
62int
63vfs_showargs(
64 struct bhv_desc *bdp,
65 struct seq_file *m)
66{
67 struct bhv_desc *next = bdp;
68
69 ASSERT(next);
70 while (! (bhvtovfsops(next))->vfs_showargs)
71 next = BHV_NEXT(next);
72 return ((*bhvtovfsops(next)->vfs_showargs)(next, m));
73}
74
75int
76vfs_unmount(
77 struct bhv_desc *bdp,
78 int fl,
79 struct cred *cr)
80{
81 struct bhv_desc *next = bdp;
82
83 ASSERT(next);
84 while (! (bhvtovfsops(next))->vfs_unmount)
85 next = BHV_NEXT(next);
86 return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
87}
88
89int
90vfs_mntupdate(
91 struct bhv_desc *bdp,
92 int *fl,
93 struct xfs_mount_args *args)
94{
95 struct bhv_desc *next = bdp;
96
97 ASSERT(next);
98 while (! (bhvtovfsops(next))->vfs_mntupdate)
99 next = BHV_NEXT(next);
100 return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args));
101}
102
103int
104vfs_root(
105 struct bhv_desc *bdp,
106 struct bhv_vnode **vpp)
107{
108 struct bhv_desc *next = bdp;
109
110 ASSERT(next);
111 while (! (bhvtovfsops(next))->vfs_root)
112 next = BHV_NEXT(next);
113 return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
114}
115
116int
117vfs_statvfs(
118 struct bhv_desc *bdp,
119 bhv_statvfs_t *statp,
120 struct bhv_vnode *vp)
121{
122 struct bhv_desc *next = bdp;
123
124 ASSERT(next);
125 while (! (bhvtovfsops(next))->vfs_statvfs)
126 next = BHV_NEXT(next);
127 return ((*bhvtovfsops(next)->vfs_statvfs)(next, statp, vp));
128}
129
130int
131vfs_sync(
132 struct bhv_desc *bdp,
133 int fl,
134 struct cred *cr)
135{
136 struct bhv_desc *next = bdp;
137
138 ASSERT(next);
139 while (! (bhvtovfsops(next))->vfs_sync)
140 next = BHV_NEXT(next);
141 return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
142}
143
144int
145vfs_vget(
146 struct bhv_desc *bdp,
147 struct bhv_vnode **vpp,
148 struct fid *fidp)
149{
150 struct bhv_desc *next = bdp;
151
152 ASSERT(next);
153 while (! (bhvtovfsops(next))->vfs_vget)
154 next = BHV_NEXT(next);
155 return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
156}
157
158int
159vfs_dmapiops(
160 struct bhv_desc *bdp,
161 caddr_t addr)
162{
163 struct bhv_desc *next = bdp;
164
165 ASSERT(next);
166 while (! (bhvtovfsops(next))->vfs_dmapiops)
167 next = BHV_NEXT(next);
168 return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
169}
170
171int
172vfs_quotactl(
173 struct bhv_desc *bdp,
174 int cmd,
175 int id,
176 caddr_t addr)
177{
178 struct bhv_desc *next = bdp;
179
180 ASSERT(next);
181 while (! (bhvtovfsops(next))->vfs_quotactl)
182 next = BHV_NEXT(next);
183 return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
184}
185
186void
187vfs_init_vnode(
188 struct bhv_desc *bdp,
189 struct bhv_vnode *vp,
190 struct bhv_desc *bp,
191 int unlock)
192{
193 struct bhv_desc *next = bdp;
194
195 ASSERT(next);
196 while (! (bhvtovfsops(next))->vfs_init_vnode)
197 next = BHV_NEXT(next);
198 ((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
199}
200
201void
202vfs_force_shutdown(
203 struct bhv_desc *bdp,
204 int fl,
205 char *file,
206 int line)
207{
208 struct bhv_desc *next = bdp;
209
210 ASSERT(next);
211 while (! (bhvtovfsops(next))->vfs_force_shutdown)
212 next = BHV_NEXT(next);
213 ((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
214}
215
216void
217vfs_freeze(
218 struct bhv_desc *bdp)
219{
220 struct bhv_desc *next = bdp;
221
222 ASSERT(next);
223 while (! (bhvtovfsops(next))->vfs_freeze)
224 next = BHV_NEXT(next);
225 ((*bhvtovfsops(next)->vfs_freeze)(next));
226}
227
228bhv_vfs_t *
229vfs_allocate(
230 struct super_block *sb)
231{
232 struct bhv_vfs *vfsp;
233
234 vfsp = kmem_zalloc(sizeof(bhv_vfs_t), KM_SLEEP);
235 bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
236 INIT_LIST_HEAD(&vfsp->vfs_sync_list);
237 spin_lock_init(&vfsp->vfs_sync_lock);
238 init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
239
240 vfsp->vfs_super = sb;
241 sb->s_fs_info = vfsp;
242
243 if (sb->s_flags & MS_RDONLY)
244 vfsp->vfs_flag |= VFS_RDONLY;
245
246 return vfsp;
247}
248
249bhv_vfs_t *
250vfs_from_sb(
251 struct super_block *sb)
252{
253 return (bhv_vfs_t *)sb->s_fs_info;
254}
255
256void
257vfs_deallocate(
258 struct bhv_vfs *vfsp)
259{
260 bhv_head_destroy(VFS_BHVHEAD(vfsp));
261 kmem_free(vfsp, sizeof(bhv_vfs_t));
262}
263
264void
265vfs_insertops(
266 struct bhv_vfs *vfsp,
267 struct bhv_module_vfsops *vfsops)
268{
269 struct bhv_desc *bdp;
270
271 bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
272 bhv_desc_init(bdp, NULL, vfsp, vfsops);
273 bhv_insert(&vfsp->vfs_bh, bdp);
274}
275
276void
277vfs_insertbhv(
278 struct bhv_vfs *vfsp,
279 struct bhv_desc *bdp,
280 struct bhv_vfsops *vfsops,
281 void *mount)
282{
283 bhv_desc_init(bdp, mount, vfsp, vfsops);
284 bhv_insert_initial(&vfsp->vfs_bh, bdp);
285}
286
287void
288bhv_remove_vfsops(
289 struct bhv_vfs *vfsp,
290 int pos)
291{
292 struct bhv_desc *bhv;
293
294 bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
295 if (!bhv)
296 return;
297 bhv_remove(&vfsp->vfs_bh, bhv);
298 kmem_free(bhv, sizeof(*bhv));
299}
300
301void
302bhv_remove_all_vfsops(
303 struct bhv_vfs *vfsp,
304 int freebase)
305{
306 struct xfs_mount *mp;
307
308 bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
309 bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
310 if (!freebase)
311 return;
312 mp = XFS_VFSTOM(vfsp);
313 VFS_REMOVEBHV(vfsp, &mp->m_bhv);
314 xfs_mount_free(mp, 0);
315}
316
317void
318bhv_insert_all_vfsops(
319 struct bhv_vfs *vfsp)
320{
321 struct xfs_mount *mp;
322
323 mp = xfs_mount_init();
324 vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
325 vfs_insertdmapi(vfsp);
326 vfs_insertquota(vfsp);
327}
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h
index dca3481aaafa..4da03a4e3520 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.h
+++ b/fs/xfs/linux-2.6/xfs_vfs.h
@@ -21,68 +21,25 @@
21#include <linux/vfs.h> 21#include <linux/vfs.h>
22#include "xfs_fs.h" 22#include "xfs_fs.h"
23 23
24struct bhv_vfs; 24struct inode;
25struct bhv_vnode;
26 25
27struct fid; 26struct fid;
28struct cred; 27struct cred;
29struct seq_file; 28struct seq_file;
30struct super_block; 29struct super_block;
30struct xfs_inode;
31struct xfs_mount;
31struct xfs_mount_args; 32struct xfs_mount_args;
32 33
33typedef struct kstatfs bhv_statvfs_t; 34typedef struct kstatfs bhv_statvfs_t;
34 35
35typedef struct bhv_vfs_sync_work { 36typedef struct bhv_vfs_sync_work {
36 struct list_head w_list; 37 struct list_head w_list;
37 struct bhv_vfs *w_vfs; 38 struct xfs_mount *w_mount;
38 void *w_data; /* syncer routine argument */ 39 void *w_data; /* syncer routine argument */
39 void (*w_syncer)(struct bhv_vfs *, void *); 40 void (*w_syncer)(struct xfs_mount *, void *);
40} bhv_vfs_sync_work_t; 41} bhv_vfs_sync_work_t;
41 42
42typedef struct bhv_vfs {
43 u_int vfs_flag; /* flags */
44 xfs_fsid_t vfs_fsid; /* file system ID */
45 xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */
46 bhv_head_t vfs_bh; /* head of vfs behavior chain */
47 struct super_block *vfs_super; /* generic superblock pointer */
48 struct task_struct *vfs_sync_task; /* generalised sync thread */
49 bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */
50 struct list_head vfs_sync_list; /* sync thread work item list */
51 spinlock_t vfs_sync_lock; /* work item list lock */
52 int vfs_sync_seq; /* sync thread generation no. */
53 wait_queue_head_t vfs_wait_single_sync_task;
54} bhv_vfs_t;
55
56#define bhvtovfs(bdp) ( (struct bhv_vfs *)BHV_VOBJ(bdp) )
57#define bhvtovfsops(bdp) ( (struct bhv_vfsops *)BHV_OPS(bdp) )
58#define VFS_BHVHEAD(vfs) ( &(vfs)->vfs_bh )
59#define VFS_REMOVEBHV(vfs, bdp) ( bhv_remove(VFS_BHVHEAD(vfs), bdp) )
60
61#define VFS_POSITION_BASE BHV_POSITION_BASE /* chain bottom */
62#define VFS_POSITION_TOP BHV_POSITION_TOP /* chain top */
63#define VFS_POSITION_INVALID BHV_POSITION_INVALID /* invalid pos. num */
64
65typedef enum {
66 VFS_BHV_UNKNOWN, /* not specified */
67 VFS_BHV_XFS, /* xfs */
68 VFS_BHV_DM, /* data migration */
69 VFS_BHV_QM, /* quota manager */
70 VFS_BHV_IO, /* IO path */
71 VFS_BHV_END /* housekeeping end-of-range */
72} bhv_vfs_type_t;
73
74#define VFS_POSITION_XFS (BHV_POSITION_BASE)
75#define VFS_POSITION_DM (VFS_POSITION_BASE+10)
76#define VFS_POSITION_QM (VFS_POSITION_BASE+20)
77#define VFS_POSITION_IO (VFS_POSITION_BASE+30)
78
79#define VFS_RDONLY 0x0001 /* read-only vfs */
80#define VFS_GRPID 0x0002 /* group-ID assigned from directory */
81#define VFS_DMI 0x0004 /* filesystem has the DMI enabled */
82/* ---- VFS_UMOUNT ---- 0x0008 -- unneeded, fixed via kthread APIs */
83#define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */
84#define VFS_END 0x0010 /* max flag */
85
86#define SYNC_ATTR 0x0001 /* sync attributes */ 43#define SYNC_ATTR 0x0001 /* sync attributes */
87#define SYNC_CLOSE 0x0002 /* close file system down */ 44#define SYNC_CLOSE 0x0002 /* close file system down */
88#define SYNC_DELWRI 0x0004 /* look at delayed writes */ 45#define SYNC_DELWRI 0x0004 /* look at delayed writes */
@@ -115,118 +72,7 @@ typedef enum {
115#define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */ 72#define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */
116#define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */ 73#define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */
117 74
118typedef int (*vfs_mount_t)(bhv_desc_t *, 75#define xfs_test_for_freeze(mp) ((mp)->m_super->s_frozen)
119 struct xfs_mount_args *, struct cred *); 76#define xfs_wait_for_freeze(mp,l) vfs_check_frozen((mp)->m_super, (l))
120typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *,
121 struct xfs_mount_args *, int);
122typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *);
123typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *);
124typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *,
125 struct xfs_mount_args *);
126typedef int (*vfs_root_t)(bhv_desc_t *, struct bhv_vnode **);
127typedef int (*vfs_statvfs_t)(bhv_desc_t *, bhv_statvfs_t *,
128 struct bhv_vnode *);
129typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
130typedef int (*vfs_vget_t)(bhv_desc_t *, struct bhv_vnode **, struct fid *);
131typedef int (*vfs_dmapiops_t)(bhv_desc_t *, caddr_t);
132typedef int (*vfs_quotactl_t)(bhv_desc_t *, int, int, caddr_t);
133typedef void (*vfs_init_vnode_t)(bhv_desc_t *,
134 struct bhv_vnode *, bhv_desc_t *, int);
135typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
136typedef void (*vfs_freeze_t)(bhv_desc_t *);
137
138typedef struct bhv_vfsops {
139 bhv_position_t vf_position; /* behavior chain position */
140 vfs_mount_t vfs_mount; /* mount file system */
141 vfs_parseargs_t vfs_parseargs; /* parse mount options */
142 vfs_showargs_t vfs_showargs; /* unparse mount options */
143 vfs_unmount_t vfs_unmount; /* unmount file system */
144 vfs_mntupdate_t vfs_mntupdate; /* update file system options */
145 vfs_root_t vfs_root; /* get root vnode */
146 vfs_statvfs_t vfs_statvfs; /* file system statistics */
147 vfs_sync_t vfs_sync; /* flush files */
148 vfs_vget_t vfs_vget; /* get vnode from fid */
149 vfs_dmapiops_t vfs_dmapiops; /* data migration */
150 vfs_quotactl_t vfs_quotactl; /* disk quota */
151 vfs_init_vnode_t vfs_init_vnode; /* initialize a new vnode */
152 vfs_force_shutdown_t vfs_force_shutdown; /* crash and burn */
153 vfs_freeze_t vfs_freeze; /* freeze fs for snapshot */
154} bhv_vfsops_t;
155
156/*
157 * Virtual filesystem operations, operating from head bhv.
158 */
159#define VFSHEAD(v) ((v)->vfs_bh.bh_first)
160#define bhv_vfs_mount(v, ma,cr) vfs_mount(VFSHEAD(v), ma,cr)
161#define bhv_vfs_parseargs(v, o,ma,f) vfs_parseargs(VFSHEAD(v), o,ma,f)
162#define bhv_vfs_showargs(v, m) vfs_showargs(VFSHEAD(v), m)
163#define bhv_vfs_unmount(v, f,cr) vfs_unmount(VFSHEAD(v), f,cr)
164#define bhv_vfs_mntupdate(v, fl,args) vfs_mntupdate(VFSHEAD(v), fl,args)
165#define bhv_vfs_root(v, vpp) vfs_root(VFSHEAD(v), vpp)
166#define bhv_vfs_statvfs(v, sp,vp) vfs_statvfs(VFSHEAD(v), sp,vp)
167#define bhv_vfs_sync(v, flag,cr) vfs_sync(VFSHEAD(v), flag,cr)
168#define bhv_vfs_vget(v, vpp,fidp) vfs_vget(VFSHEAD(v), vpp,fidp)
169#define bhv_vfs_dmapiops(v, p) vfs_dmapiops(VFSHEAD(v), p)
170#define bhv_vfs_quotactl(v, c,id,p) vfs_quotactl(VFSHEAD(v), c,id,p)
171#define bhv_vfs_init_vnode(v, vp,b,ul) vfs_init_vnode(VFSHEAD(v), vp,b,ul)
172#define bhv_vfs_force_shutdown(v,u,f,l) vfs_force_shutdown(VFSHEAD(v), u,f,l)
173#define bhv_vfs_freeze(v) vfs_freeze(VFSHEAD(v))
174
175/*
176 * Virtual filesystem operations, operating from next bhv.
177 */
178#define bhv_next_vfs_mount(b, ma,cr) vfs_mount(b, ma,cr)
179#define bhv_next_vfs_parseargs(b, o,ma,f) vfs_parseargs(b, o,ma,f)
180#define bhv_next_vfs_showargs(b, m) vfs_showargs(b, m)
181#define bhv_next_vfs_unmount(b, f,cr) vfs_unmount(b, f,cr)
182#define bhv_next_vfs_mntupdate(b, fl,args) vfs_mntupdate(b, fl, args)
183#define bhv_next_vfs_root(b, vpp) vfs_root(b, vpp)
184#define bhv_next_vfs_statvfs(b, sp,vp) vfs_statvfs(b, sp,vp)
185#define bhv_next_vfs_sync(b, flag,cr) vfs_sync(b, flag,cr)
186#define bhv_next_vfs_vget(b, vpp,fidp) vfs_vget(b, vpp,fidp)
187#define bhv_next_vfs_dmapiops(b, p) vfs_dmapiops(b, p)
188#define bhv_next_vfs_quotactl(b, c,id,p) vfs_quotactl(b, c,id,p)
189#define bhv_next_vfs_init_vnode(b, vp,b2,ul) vfs_init_vnode(b, vp,b2,ul)
190#define bhv_next_force_shutdown(b, fl,f,l) vfs_force_shutdown(b, fl,f,l)
191#define bhv_next_vfs_freeze(b) vfs_freeze(b)
192
193extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *);
194extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int);
195extern int vfs_showargs(bhv_desc_t *, struct seq_file *);
196extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
197extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
198extern int vfs_root(bhv_desc_t *, struct bhv_vnode **);
199extern int vfs_statvfs(bhv_desc_t *, bhv_statvfs_t *, struct bhv_vnode *);
200extern int vfs_sync(bhv_desc_t *, int, struct cred *);
201extern int vfs_vget(bhv_desc_t *, struct bhv_vnode **, struct fid *);
202extern int vfs_dmapiops(bhv_desc_t *, caddr_t);
203extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t);
204extern void vfs_init_vnode(bhv_desc_t *, struct bhv_vnode *, bhv_desc_t *, int);
205extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
206extern void vfs_freeze(bhv_desc_t *);
207
208#define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen)
209#define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l))
210
211typedef struct bhv_module_vfsops {
212 struct bhv_vfsops bhv_common;
213 void * bhv_custom;
214} bhv_module_vfsops_t;
215
216#define vfs_bhv_lookup(v, id) (bhv_lookup_range(&(v)->vfs_bh, (id), (id)))
217#define vfs_bhv_custom(b) (((bhv_module_vfsops_t*)BHV_OPS(b))->bhv_custom)
218#define vfs_bhv_set_custom(b,o) ((b)->bhv_custom = (void *)(o))
219#define vfs_bhv_clr_custom(b) ((b)->bhv_custom = NULL)
220
221extern bhv_vfs_t *vfs_allocate(struct super_block *);
222extern bhv_vfs_t *vfs_from_sb(struct super_block *);
223extern void vfs_deallocate(bhv_vfs_t *);
224extern void vfs_insertbhv(bhv_vfs_t *, bhv_desc_t *, bhv_vfsops_t *, void *);
225
226extern void vfs_insertops(bhv_vfs_t *, bhv_module_vfsops_t *);
227
228extern void bhv_insert_all_vfsops(struct bhv_vfs *);
229extern void bhv_remove_all_vfsops(struct bhv_vfs *, int);
230extern void bhv_remove_vfsops(struct bhv_vfs *, int);
231 77
232#endif /* __XFS_VFS_H__ */ 78#endif /* __XFS_VFS_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index ada24baf88de..814169fd7e1e 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -16,9 +16,21 @@
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_vnodeops.h"
20#include "xfs_bmap_btree.h"
21#include "xfs_inode.h"
22
23/*
24 * And this gunk is needed for xfs_mount.h"
25 */
26#include "xfs_log.h"
27#include "xfs_trans.h"
28#include "xfs_sb.h"
29#include "xfs_dmapi.h"
30#include "xfs_inum.h"
31#include "xfs_ag.h"
32#include "xfs_mount.h"
19 33
20uint64_t vn_generation; /* vnode generation number */
21DEFINE_SPINLOCK(vnumber_lock);
22 34
23/* 35/*
24 * Dedicated vnode inactive/reclaim sync semaphores. 36 * Dedicated vnode inactive/reclaim sync semaphores.
@@ -39,19 +51,19 @@ vn_init(void)
39 51
40void 52void
41vn_iowait( 53vn_iowait(
42 bhv_vnode_t *vp) 54 xfs_inode_t *ip)
43{ 55{
44 wait_queue_head_t *wq = vptosync(vp); 56 wait_queue_head_t *wq = vptosync(ip);
45 57
46 wait_event(*wq, (atomic_read(&vp->v_iocount) == 0)); 58 wait_event(*wq, (atomic_read(&ip->i_iocount) == 0));
47} 59}
48 60
49void 61void
50vn_iowake( 62vn_iowake(
51 bhv_vnode_t *vp) 63 xfs_inode_t *ip)
52{ 64{
53 if (atomic_dec_and_test(&vp->v_iocount)) 65 if (atomic_dec_and_test(&ip->i_iocount))
54 wake_up(vptosync(vp)); 66 wake_up(vptosync(ip));
55} 67}
56 68
57/* 69/*
@@ -61,13 +73,13 @@ vn_iowake(
61 */ 73 */
62void 74void
63vn_ioerror( 75vn_ioerror(
64 bhv_vnode_t *vp, 76 xfs_inode_t *ip,
65 int error, 77 int error,
66 char *f, 78 char *f,
67 int l) 79 int l)
68{ 80{
69 if (unlikely(error == -ENODEV)) 81 if (unlikely(error == -ENODEV))
70 bhv_vfs_force_shutdown(vp->v_vfsp, SHUTDOWN_DEVICE_REQ, f, l); 82 xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l);
71} 83}
72 84
73bhv_vnode_t * 85bhv_vnode_t *
@@ -79,27 +91,8 @@ vn_initialize(
79 XFS_STATS_INC(vn_active); 91 XFS_STATS_INC(vn_active);
80 XFS_STATS_INC(vn_alloc); 92 XFS_STATS_INC(vn_alloc);
81 93
82 vp->v_flag = VMODIFIED;
83 spinlock_init(&vp->v_lock, "v_lock");
84
85 spin_lock(&vnumber_lock);
86 if (!++vn_generation) /* v_number shouldn't be zero */
87 vn_generation++;
88 vp->v_number = vn_generation;
89 spin_unlock(&vnumber_lock);
90
91 ASSERT(VN_CACHED(vp) == 0); 94 ASSERT(VN_CACHED(vp) == 0);
92 95
93 /* Initialize the first behavior and the behavior chain head. */
94 vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode");
95
96 atomic_set(&vp->v_iocount, 0);
97
98#ifdef XFS_VNODE_TRACE
99 vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
100#endif /* XFS_VNODE_TRACE */
101
102 vn_trace_exit(vp, __FUNCTION__, (inst_t *)__return_address);
103 return vp; 96 return vp;
104} 97}
105 98
@@ -150,12 +143,12 @@ __vn_revalidate(
150{ 143{
151 int error; 144 int error;
152 145
153 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 146 vn_trace_entry(xfs_vtoi(vp), __FUNCTION__, (inst_t *)__return_address);
154 vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS; 147 vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS;
155 error = bhv_vop_getattr(vp, vattr, 0, NULL); 148 error = xfs_getattr(xfs_vtoi(vp), vattr, 0);
156 if (likely(!error)) { 149 if (likely(!error)) {
157 vn_revalidate_core(vp, vattr); 150 vn_revalidate_core(vp, vattr);
158 VUNMODIFY(vp); 151 xfs_iflags_clear(xfs_vtoi(vp), XFS_IMODIFIED);
159 } 152 }
160 return -error; 153 return -error;
161} 154}
@@ -180,24 +173,35 @@ vn_hold(
180 173
181 XFS_STATS_INC(vn_hold); 174 XFS_STATS_INC(vn_hold);
182 175
183 VN_LOCK(vp);
184 inode = igrab(vn_to_inode(vp)); 176 inode = igrab(vn_to_inode(vp));
185 ASSERT(inode); 177 ASSERT(inode);
186 VN_UNLOCK(vp, 0);
187 178
188 return vp; 179 return vp;
189} 180}
190 181
191#ifdef XFS_VNODE_TRACE 182#ifdef XFS_VNODE_TRACE
192 183
193#define KTRACE_ENTER(vp, vk, s, line, ra) \ 184/*
194 ktrace_enter( (vp)->v_trace, \ 185 * Reference count of Linux inode if present, -1 if the xfs_inode
186 * has no associated Linux inode.
187 */
188static inline int xfs_icount(struct xfs_inode *ip)
189{
190 bhv_vnode_t *vp = XFS_ITOV_NULL(ip);
191
192 if (vp)
193 return vn_count(vp);
194 return -1;
195}
196
197#define KTRACE_ENTER(ip, vk, s, line, ra) \
198 ktrace_enter( (ip)->i_trace, \
195/* 0 */ (void *)(__psint_t)(vk), \ 199/* 0 */ (void *)(__psint_t)(vk), \
196/* 1 */ (void *)(s), \ 200/* 1 */ (void *)(s), \
197/* 2 */ (void *)(__psint_t) line, \ 201/* 2 */ (void *)(__psint_t) line, \
198/* 3 */ (void *)(__psint_t)(vn_count(vp)), \ 202/* 3 */ (void *)(__psint_t)xfs_icount(ip), \
199/* 4 */ (void *)(ra), \ 203/* 4 */ (void *)(ra), \
200/* 5 */ (void *)(__psunsigned_t)(vp)->v_flag, \ 204/* 5 */ NULL, \
201/* 6 */ (void *)(__psint_t)current_cpu(), \ 205/* 6 */ (void *)(__psint_t)current_cpu(), \
202/* 7 */ (void *)(__psint_t)current_pid(), \ 206/* 7 */ (void *)(__psint_t)current_pid(), \
203/* 8 */ (void *)__return_address, \ 207/* 8 */ (void *)__return_address, \
@@ -207,32 +211,32 @@ vn_hold(
207 * Vnode tracing code. 211 * Vnode tracing code.
208 */ 212 */
209void 213void
210vn_trace_entry(bhv_vnode_t *vp, const char *func, inst_t *ra) 214vn_trace_entry(xfs_inode_t *ip, const char *func, inst_t *ra)
211{ 215{
212 KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra); 216 KTRACE_ENTER(ip, VNODE_KTRACE_ENTRY, func, 0, ra);
213} 217}
214 218
215void 219void
216vn_trace_exit(bhv_vnode_t *vp, const char *func, inst_t *ra) 220vn_trace_exit(xfs_inode_t *ip, const char *func, inst_t *ra)
217{ 221{
218 KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra); 222 KTRACE_ENTER(ip, VNODE_KTRACE_EXIT, func, 0, ra);
219} 223}
220 224
221void 225void
222vn_trace_hold(bhv_vnode_t *vp, char *file, int line, inst_t *ra) 226vn_trace_hold(xfs_inode_t *ip, char *file, int line, inst_t *ra)
223{ 227{
224 KTRACE_ENTER(vp, VNODE_KTRACE_HOLD, file, line, ra); 228 KTRACE_ENTER(ip, VNODE_KTRACE_HOLD, file, line, ra);
225} 229}
226 230
227void 231void
228vn_trace_ref(bhv_vnode_t *vp, char *file, int line, inst_t *ra) 232vn_trace_ref(xfs_inode_t *ip, char *file, int line, inst_t *ra)
229{ 233{
230 KTRACE_ENTER(vp, VNODE_KTRACE_REF, file, line, ra); 234 KTRACE_ENTER(ip, VNODE_KTRACE_REF, file, line, ra);
231} 235}
232 236
233void 237void
234vn_trace_rele(bhv_vnode_t *vp, char *file, int line, inst_t *ra) 238vn_trace_rele(xfs_inode_t *ip, char *file, int line, inst_t *ra)
235{ 239{
236 KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra); 240 KTRACE_ENTER(ip, VNODE_KTRACE_RELE, file, line, ra);
237} 241}
238#endif /* XFS_VNODE_TRACE */ 242#endif /* XFS_VNODE_TRACE */
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 5742d65f0785..55fb46948589 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -18,84 +18,31 @@
18#ifndef __XFS_VNODE_H__ 18#ifndef __XFS_VNODE_H__
19#define __XFS_VNODE_H__ 19#define __XFS_VNODE_H__
20 20
21struct uio;
22struct file; 21struct file;
23struct bhv_vfs;
24struct bhv_vattr; 22struct bhv_vattr;
25struct xfs_iomap; 23struct xfs_iomap;
26struct attrlist_cursor_kern; 24struct attrlist_cursor_kern;
27 25
28typedef struct dentry bhv_vname_t; 26typedef struct dentry bhv_vname_t;
29typedef __u64 bhv_vnumber_t; 27typedef __u64 bhv_vnumber_t;
28typedef struct inode bhv_vnode_t;
30 29
31typedef enum bhv_vflags { 30#define VN_ISLNK(vp) S_ISLNK((vp)->i_mode)
32 VMODIFIED = 0x08, /* XFS inode state possibly differs */ 31#define VN_ISREG(vp) S_ISREG((vp)->i_mode)
33 /* to the Linux inode state. */ 32#define VN_ISDIR(vp) S_ISDIR((vp)->i_mode)
34 VTRUNCATED = 0x40, /* truncated down so flush-on-close */ 33#define VN_ISCHR(vp) S_ISCHR((vp)->i_mode)
35} bhv_vflags_t; 34#define VN_ISBLK(vp) S_ISBLK((vp)->i_mode)
36
37/*
38 * MP locking protocols:
39 * v_flag, v_vfsp VN_LOCK/VN_UNLOCK
40 */
41typedef struct bhv_vnode {
42 bhv_vflags_t v_flag; /* vnode flags (see above) */
43 bhv_vfs_t *v_vfsp; /* ptr to containing VFS */
44 bhv_vnumber_t v_number; /* in-core vnode number */
45 bhv_head_t v_bh; /* behavior head */
46 spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */
47 atomic_t v_iocount; /* outstanding I/O count */
48#ifdef XFS_VNODE_TRACE
49 struct ktrace *v_trace; /* trace header structure */
50#endif
51 struct inode v_inode; /* Linux inode */
52 /* inode MUST be last */
53} bhv_vnode_t;
54
55#define VN_ISLNK(vp) S_ISLNK((vp)->v_inode.i_mode)
56#define VN_ISREG(vp) S_ISREG((vp)->v_inode.i_mode)
57#define VN_ISDIR(vp) S_ISDIR((vp)->v_inode.i_mode)
58#define VN_ISCHR(vp) S_ISCHR((vp)->v_inode.i_mode)
59#define VN_ISBLK(vp) S_ISBLK((vp)->v_inode.i_mode)
60
61#define VNODE_POSITION_BASE BHV_POSITION_BASE /* chain bottom */
62#define VNODE_POSITION_TOP BHV_POSITION_TOP /* chain top */
63#define VNODE_POSITION_INVALID BHV_POSITION_INVALID /* invalid pos. num */
64
65typedef enum {
66 VN_BHV_UNKNOWN, /* not specified */
67 VN_BHV_XFS, /* xfs */
68 VN_BHV_DM, /* data migration */
69 VN_BHV_QM, /* quota manager */
70 VN_BHV_IO, /* IO path */
71 VN_BHV_END /* housekeeping end-of-range */
72} vn_bhv_t;
73
74#define VNODE_POSITION_XFS (VNODE_POSITION_BASE)
75#define VNODE_POSITION_DM (VNODE_POSITION_BASE+10)
76#define VNODE_POSITION_QM (VNODE_POSITION_BASE+20)
77#define VNODE_POSITION_IO (VNODE_POSITION_BASE+30)
78
79/*
80 * Macros for dealing with the behavior descriptor inside of the vnode.
81 */
82#define BHV_TO_VNODE(bdp) ((bhv_vnode_t *)BHV_VOBJ(bdp))
83#define BHV_TO_VNODE_NULL(bdp) ((bhv_vnode_t *)BHV_VOBJNULL(bdp))
84
85#define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh)))
86#define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name)
87#define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp)
88 35
89/* 36/*
90 * Vnode to Linux inode mapping. 37 * Vnode to Linux inode mapping.
91 */ 38 */
92static inline struct bhv_vnode *vn_from_inode(struct inode *inode) 39static inline bhv_vnode_t *vn_from_inode(struct inode *inode)
93{ 40{
94 return container_of(inode, bhv_vnode_t, v_inode); 41 return inode;
95} 42}
96static inline struct inode *vn_to_inode(struct bhv_vnode *vnode) 43static inline struct inode *vn_to_inode(bhv_vnode_t *vnode)
97{ 44{
98 return &vnode->v_inode; 45 return vnode;
99} 46}
100 47
101/* 48/*
@@ -111,7 +58,7 @@ typedef enum bhv_vrwlock {
111} bhv_vrwlock_t; 58} bhv_vrwlock_t;
112 59
113/* 60/*
114 * Return values for bhv_vop_inactive. A return value of 61 * Return values for xfs_inactive. A return value of
115 * VN_INACTIVE_NOCACHE implies that the file system behavior 62 * VN_INACTIVE_NOCACHE implies that the file system behavior
116 * has disassociated its state and bhv_desc_t from the vnode. 63 * has disassociated its state and bhv_desc_t from the vnode.
117 */ 64 */
@@ -119,193 +66,6 @@ typedef enum bhv_vrwlock {
119#define VN_INACTIVE_NOCACHE 1 66#define VN_INACTIVE_NOCACHE 1
120 67
121/* 68/*
122 * Values for the cmd code given to vop_vnode_change.
123 */
124typedef enum bhv_vchange {
125 VCHANGE_FLAGS_FRLOCKS = 0,
126 VCHANGE_FLAGS_ENF_LOCKING = 1,
127 VCHANGE_FLAGS_TRUNCATED = 2,
128 VCHANGE_FLAGS_PAGE_DIRTY = 3,
129 VCHANGE_FLAGS_IOEXCL_COUNT = 4
130} bhv_vchange_t;
131
132typedef int (*vop_open_t)(bhv_desc_t *, struct cred *);
133typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *,
134 const struct iovec *, unsigned int,
135 loff_t *, int, struct cred *);
136typedef ssize_t (*vop_write_t)(bhv_desc_t *, struct kiocb *,
137 const struct iovec *, unsigned int,
138 loff_t *, int, struct cred *);
139typedef ssize_t (*vop_splice_read_t)(bhv_desc_t *, struct file *, loff_t *,
140 struct pipe_inode_info *, size_t, int, int,
141 struct cred *);
142typedef ssize_t (*vop_splice_write_t)(bhv_desc_t *, struct pipe_inode_info *,
143 struct file *, loff_t *, size_t, int, int,
144 struct cred *);
145typedef int (*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *,
146 int, unsigned int, void __user *);
147typedef int (*vop_getattr_t)(bhv_desc_t *, struct bhv_vattr *, int,
148 struct cred *);
149typedef int (*vop_setattr_t)(bhv_desc_t *, struct bhv_vattr *, int,
150 struct cred *);
151typedef int (*vop_access_t)(bhv_desc_t *, int, struct cred *);
152typedef int (*vop_lookup_t)(bhv_desc_t *, bhv_vname_t *, bhv_vnode_t **,
153 int, bhv_vnode_t *, struct cred *);
154typedef int (*vop_create_t)(bhv_desc_t *, bhv_vname_t *, struct bhv_vattr *,
155 bhv_vnode_t **, struct cred *);
156typedef int (*vop_remove_t)(bhv_desc_t *, bhv_vname_t *, struct cred *);
157typedef int (*vop_link_t)(bhv_desc_t *, bhv_vnode_t *, bhv_vname_t *,
158 struct cred *);
159typedef int (*vop_rename_t)(bhv_desc_t *, bhv_vname_t *, bhv_vnode_t *,
160 bhv_vname_t *, struct cred *);
161typedef int (*vop_mkdir_t)(bhv_desc_t *, bhv_vname_t *, struct bhv_vattr *,
162 bhv_vnode_t **, struct cred *);
163typedef int (*vop_rmdir_t)(bhv_desc_t *, bhv_vname_t *, struct cred *);
164typedef int (*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *,
165 int *);
166typedef int (*vop_symlink_t)(bhv_desc_t *, bhv_vname_t *, struct bhv_vattr*,
167 char *, bhv_vnode_t **, struct cred *);
168typedef int (*vop_readlink_t)(bhv_desc_t *, struct uio *, int,
169 struct cred *);
170typedef int (*vop_fsync_t)(bhv_desc_t *, int, struct cred *,
171 xfs_off_t, xfs_off_t);
172typedef int (*vop_inactive_t)(bhv_desc_t *, struct cred *);
173typedef int (*vop_fid2_t)(bhv_desc_t *, struct fid *);
174typedef int (*vop_release_t)(bhv_desc_t *);
175typedef int (*vop_rwlock_t)(bhv_desc_t *, bhv_vrwlock_t);
176typedef void (*vop_rwunlock_t)(bhv_desc_t *, bhv_vrwlock_t);
177typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int,
178 struct xfs_iomap *, int *);
179typedef int (*vop_reclaim_t)(bhv_desc_t *);
180typedef int (*vop_attr_get_t)(bhv_desc_t *, const char *, char *, int *,
181 int, struct cred *);
182typedef int (*vop_attr_set_t)(bhv_desc_t *, const char *, char *, int,
183 int, struct cred *);
184typedef int (*vop_attr_remove_t)(bhv_desc_t *, const char *,
185 int, struct cred *);
186typedef int (*vop_attr_list_t)(bhv_desc_t *, char *, int, int,
187 struct attrlist_cursor_kern *, struct cred *);
188typedef void (*vop_link_removed_t)(bhv_desc_t *, bhv_vnode_t *, int);
189typedef void (*vop_vnode_change_t)(bhv_desc_t *, bhv_vchange_t, __psint_t);
190typedef void (*vop_ptossvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
191typedef int (*vop_pflushinvalvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
192typedef int (*vop_pflushvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t,
193 uint64_t, int);
194typedef int (*vop_iflush_t)(bhv_desc_t *, int);
195
196
197typedef struct bhv_vnodeops {
198 bhv_position_t vn_position; /* position within behavior chain */
199 vop_open_t vop_open;
200 vop_read_t vop_read;
201 vop_write_t vop_write;
202 vop_splice_read_t vop_splice_read;
203 vop_splice_write_t vop_splice_write;
204 vop_ioctl_t vop_ioctl;
205 vop_getattr_t vop_getattr;
206 vop_setattr_t vop_setattr;
207 vop_access_t vop_access;
208 vop_lookup_t vop_lookup;
209 vop_create_t vop_create;
210 vop_remove_t vop_remove;
211 vop_link_t vop_link;
212 vop_rename_t vop_rename;
213 vop_mkdir_t vop_mkdir;
214 vop_rmdir_t vop_rmdir;
215 vop_readdir_t vop_readdir;
216 vop_symlink_t vop_symlink;
217 vop_readlink_t vop_readlink;
218 vop_fsync_t vop_fsync;
219 vop_inactive_t vop_inactive;
220 vop_fid2_t vop_fid2;
221 vop_rwlock_t vop_rwlock;
222 vop_rwunlock_t vop_rwunlock;
223 vop_bmap_t vop_bmap;
224 vop_reclaim_t vop_reclaim;
225 vop_attr_get_t vop_attr_get;
226 vop_attr_set_t vop_attr_set;
227 vop_attr_remove_t vop_attr_remove;
228 vop_attr_list_t vop_attr_list;
229 vop_link_removed_t vop_link_removed;
230 vop_vnode_change_t vop_vnode_change;
231 vop_ptossvp_t vop_tosspages;
232 vop_pflushinvalvp_t vop_flushinval_pages;
233 vop_pflushvp_t vop_flush_pages;
234 vop_release_t vop_release;
235 vop_iflush_t vop_iflush;
236} bhv_vnodeops_t;
237
238/*
239 * Virtual node operations, operating from head bhv.
240 */
241#define VNHEAD(vp) ((vp)->v_bh.bh_first)
242#define VOP(op, vp) (*((bhv_vnodeops_t *)VNHEAD(vp)->bd_ops)->op)
243#define bhv_vop_open(vp, cr) VOP(vop_open, vp)(VNHEAD(vp),cr)
244#define bhv_vop_read(vp,file,iov,segs,offset,ioflags,cr) \
245 VOP(vop_read, vp)(VNHEAD(vp),file,iov,segs,offset,ioflags,cr)
246#define bhv_vop_write(vp,file,iov,segs,offset,ioflags,cr) \
247 VOP(vop_write, vp)(VNHEAD(vp),file,iov,segs,offset,ioflags,cr)
248#define bhv_vop_splice_read(vp,f,o,pipe,cnt,fl,iofl,cr) \
249 VOP(vop_splice_read, vp)(VNHEAD(vp),f,o,pipe,cnt,fl,iofl,cr)
250#define bhv_vop_splice_write(vp,f,o,pipe,cnt,fl,iofl,cr) \
251 VOP(vop_splice_write, vp)(VNHEAD(vp),f,o,pipe,cnt,fl,iofl,cr)
252#define bhv_vop_bmap(vp,of,sz,rw,b,n) \
253 VOP(vop_bmap, vp)(VNHEAD(vp),of,sz,rw,b,n)
254#define bhv_vop_getattr(vp, vap,f,cr) \
255 VOP(vop_getattr, vp)(VNHEAD(vp), vap,f,cr)
256#define bhv_vop_setattr(vp, vap,f,cr) \
257 VOP(vop_setattr, vp)(VNHEAD(vp), vap,f,cr)
258#define bhv_vop_access(vp, mode,cr) VOP(vop_access, vp)(VNHEAD(vp), mode,cr)
259#define bhv_vop_lookup(vp,d,vpp,f,rdir,cr) \
260 VOP(vop_lookup, vp)(VNHEAD(vp),d,vpp,f,rdir,cr)
261#define bhv_vop_create(dvp,d,vap,vpp,cr) \
262 VOP(vop_create, dvp)(VNHEAD(dvp),d,vap,vpp,cr)
263#define bhv_vop_remove(dvp,d,cr) VOP(vop_remove, dvp)(VNHEAD(dvp),d,cr)
264#define bhv_vop_link(dvp,fvp,d,cr) VOP(vop_link, dvp)(VNHEAD(dvp),fvp,d,cr)
265#define bhv_vop_rename(fvp,fnm,tdvp,tnm,cr) \
266 VOP(vop_rename, fvp)(VNHEAD(fvp),fnm,tdvp,tnm,cr)
267#define bhv_vop_mkdir(dp,d,vap,vpp,cr) \
268 VOP(vop_mkdir, dp)(VNHEAD(dp),d,vap,vpp,cr)
269#define bhv_vop_rmdir(dp,d,cr) VOP(vop_rmdir, dp)(VNHEAD(dp),d,cr)
270#define bhv_vop_readdir(vp,uiop,cr,eofp) \
271 VOP(vop_readdir, vp)(VNHEAD(vp),uiop,cr,eofp)
272#define bhv_vop_symlink(dvp,d,vap,tnm,vpp,cr) \
273 VOP(vop_symlink, dvp)(VNHEAD(dvp),d,vap,tnm,vpp,cr)
274#define bhv_vop_readlink(vp,uiop,fl,cr) \
275 VOP(vop_readlink, vp)(VNHEAD(vp),uiop,fl,cr)
276#define bhv_vop_fsync(vp,f,cr,b,e) VOP(vop_fsync, vp)(VNHEAD(vp),f,cr,b,e)
277#define bhv_vop_inactive(vp,cr) VOP(vop_inactive, vp)(VNHEAD(vp),cr)
278#define bhv_vop_release(vp) VOP(vop_release, vp)(VNHEAD(vp))
279#define bhv_vop_fid2(vp,fidp) VOP(vop_fid2, vp)(VNHEAD(vp),fidp)
280#define bhv_vop_rwlock(vp,i) VOP(vop_rwlock, vp)(VNHEAD(vp),i)
281#define bhv_vop_rwlock_try(vp,i) VOP(vop_rwlock, vp)(VNHEAD(vp),i)
282#define bhv_vop_rwunlock(vp,i) VOP(vop_rwunlock, vp)(VNHEAD(vp),i)
283#define bhv_vop_frlock(vp,c,fl,flags,offset,fr) \
284 VOP(vop_frlock, vp)(VNHEAD(vp),c,fl,flags,offset,fr)
285#define bhv_vop_reclaim(vp) VOP(vop_reclaim, vp)(VNHEAD(vp))
286#define bhv_vop_attr_get(vp, name, val, vallenp, fl, cred) \
287 VOP(vop_attr_get, vp)(VNHEAD(vp),name,val,vallenp,fl,cred)
288#define bhv_vop_attr_set(vp, name, val, vallen, fl, cred) \
289 VOP(vop_attr_set, vp)(VNHEAD(vp),name,val,vallen,fl,cred)
290#define bhv_vop_attr_remove(vp, name, flags, cred) \
291 VOP(vop_attr_remove, vp)(VNHEAD(vp),name,flags,cred)
292#define bhv_vop_attr_list(vp, buf, buflen, fl, cursor, cred) \
293 VOP(vop_attr_list, vp)(VNHEAD(vp),buf,buflen,fl,cursor,cred)
294#define bhv_vop_link_removed(vp, dvp, linkzero) \
295 VOP(vop_link_removed, vp)(VNHEAD(vp), dvp, linkzero)
296#define bhv_vop_vnode_change(vp, cmd, val) \
297 VOP(vop_vnode_change, vp)(VNHEAD(vp), cmd, val)
298#define bhv_vop_toss_pages(vp, first, last, fiopt) \
299 VOP(vop_tosspages, vp)(VNHEAD(vp), first, last, fiopt)
300#define bhv_vop_flushinval_pages(vp, first, last, fiopt) \
301 VOP(vop_flushinval_pages, vp)(VNHEAD(vp),first,last,fiopt)
302#define bhv_vop_flush_pages(vp, first, last, flags, fiopt) \
303 VOP(vop_flush_pages, vp)(VNHEAD(vp),first,last,flags,fiopt)
304#define bhv_vop_ioctl(vp, inode, filp, fl, cmd, arg) \
305 VOP(vop_ioctl, vp)(VNHEAD(vp),inode,filp,fl,cmd,arg)
306#define bhv_vop_iflush(vp, flags) VOP(vop_iflush, vp)(VNHEAD(vp), flags)
307
308/*
309 * Flags for read/write calls - same values as IRIX 69 * Flags for read/write calls - same values as IRIX
310 */ 70 */
311#define IO_ISAIO 0x00001 /* don't wait for completion */ 71#define IO_ISAIO 0x00001 /* don't wait for completion */
@@ -428,16 +188,19 @@ typedef struct bhv_vattr {
428 188
429extern void vn_init(void); 189extern void vn_init(void);
430extern bhv_vnode_t *vn_initialize(struct inode *); 190extern bhv_vnode_t *vn_initialize(struct inode *);
431extern int vn_revalidate(struct bhv_vnode *); 191extern int vn_revalidate(bhv_vnode_t *);
432extern int __vn_revalidate(struct bhv_vnode *, bhv_vattr_t *); 192extern int __vn_revalidate(bhv_vnode_t *, bhv_vattr_t *);
433extern void vn_revalidate_core(struct bhv_vnode *, bhv_vattr_t *); 193extern void vn_revalidate_core(bhv_vnode_t *, bhv_vattr_t *);
434
435extern void vn_iowait(struct bhv_vnode *vp);
436extern void vn_iowake(struct bhv_vnode *vp);
437 194
438extern void vn_ioerror(struct bhv_vnode *vp, int error, char *f, int l); 195/*
196 * Yeah, these don't take vnode anymore at all, all this should be
197 * cleaned up at some point.
198 */
199extern void vn_iowait(struct xfs_inode *ip);
200extern void vn_iowake(struct xfs_inode *ip);
201extern void vn_ioerror(struct xfs_inode *ip, int error, char *f, int l);
439 202
440static inline int vn_count(struct bhv_vnode *vp) 203static inline int vn_count(bhv_vnode_t *vp)
441{ 204{
442 return atomic_read(&vn_to_inode(vp)->i_count); 205 return atomic_read(&vn_to_inode(vp)->i_count);
443} 206}
@@ -445,21 +208,21 @@ static inline int vn_count(struct bhv_vnode *vp)
445/* 208/*
446 * Vnode reference counting functions (and macros for compatibility). 209 * Vnode reference counting functions (and macros for compatibility).
447 */ 210 */
448extern bhv_vnode_t *vn_hold(struct bhv_vnode *); 211extern bhv_vnode_t *vn_hold(bhv_vnode_t *);
449 212
450#if defined(XFS_VNODE_TRACE) 213#if defined(XFS_VNODE_TRACE)
451#define VN_HOLD(vp) \ 214#define VN_HOLD(vp) \
452 ((void)vn_hold(vp), \ 215 ((void)vn_hold(vp), \
453 vn_trace_hold(vp, __FILE__, __LINE__, (inst_t *)__return_address)) 216 vn_trace_hold(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address))
454#define VN_RELE(vp) \ 217#define VN_RELE(vp) \
455 (vn_trace_rele(vp, __FILE__, __LINE__, (inst_t *)__return_address), \ 218 (vn_trace_rele(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address), \
456 iput(vn_to_inode(vp))) 219 iput(vn_to_inode(vp)))
457#else 220#else
458#define VN_HOLD(vp) ((void)vn_hold(vp)) 221#define VN_HOLD(vp) ((void)vn_hold(vp))
459#define VN_RELE(vp) (iput(vn_to_inode(vp))) 222#define VN_RELE(vp) (iput(vn_to_inode(vp)))
460#endif 223#endif
461 224
462static inline struct bhv_vnode *vn_grab(struct bhv_vnode *vp) 225static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp)
463{ 226{
464 struct inode *inode = igrab(vn_to_inode(vp)); 227 struct inode *inode = igrab(vn_to_inode(vp));
465 return inode ? vn_from_inode(inode) : NULL; 228 return inode ? vn_from_inode(inode) : NULL;
@@ -473,43 +236,14 @@ static inline struct bhv_vnode *vn_grab(struct bhv_vnode *vp)
473#define VNAME_TO_VNODE(dentry) (vn_from_inode((dentry)->d_inode)) 236#define VNAME_TO_VNODE(dentry) (vn_from_inode((dentry)->d_inode))
474 237
475/* 238/*
476 * Vnode spinlock manipulation.
477 */
478#define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock)
479#define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s)
480
481STATIC_INLINE void vn_flagset(struct bhv_vnode *vp, uint flag)
482{
483 spin_lock(&vp->v_lock);
484 vp->v_flag |= flag;
485 spin_unlock(&vp->v_lock);
486}
487
488STATIC_INLINE uint vn_flagclr(struct bhv_vnode *vp, uint flag)
489{
490 uint cleared;
491
492 spin_lock(&vp->v_lock);
493 cleared = (vp->v_flag & flag);
494 vp->v_flag &= ~flag;
495 spin_unlock(&vp->v_lock);
496 return cleared;
497}
498
499#define VMODIFY(vp) vn_flagset(vp, VMODIFIED)
500#define VUNMODIFY(vp) vn_flagclr(vp, VMODIFIED)
501#define VTRUNCATE(vp) vn_flagset(vp, VTRUNCATED)
502#define VUNTRUNCATE(vp) vn_flagclr(vp, VTRUNCATED)
503
504/*
505 * Dealing with bad inodes 239 * Dealing with bad inodes
506 */ 240 */
507static inline void vn_mark_bad(struct bhv_vnode *vp) 241static inline void vn_mark_bad(bhv_vnode_t *vp)
508{ 242{
509 make_bad_inode(vn_to_inode(vp)); 243 make_bad_inode(vn_to_inode(vp));
510} 244}
511 245
512static inline int VN_BAD(struct bhv_vnode *vp) 246static inline int VN_BAD(bhv_vnode_t *vp)
513{ 247{
514 return is_bad_inode(vn_to_inode(vp)); 248 return is_bad_inode(vn_to_inode(vp));
515} 249}
@@ -519,18 +253,18 @@ static inline int VN_BAD(struct bhv_vnode *vp)
519 */ 253 */
520static inline void vn_atime_to_bstime(bhv_vnode_t *vp, xfs_bstime_t *bs_atime) 254static inline void vn_atime_to_bstime(bhv_vnode_t *vp, xfs_bstime_t *bs_atime)
521{ 255{
522 bs_atime->tv_sec = vp->v_inode.i_atime.tv_sec; 256 bs_atime->tv_sec = vp->i_atime.tv_sec;
523 bs_atime->tv_nsec = vp->v_inode.i_atime.tv_nsec; 257 bs_atime->tv_nsec = vp->i_atime.tv_nsec;
524} 258}
525 259
526static inline void vn_atime_to_timespec(bhv_vnode_t *vp, struct timespec *ts) 260static inline void vn_atime_to_timespec(bhv_vnode_t *vp, struct timespec *ts)
527{ 261{
528 *ts = vp->v_inode.i_atime; 262 *ts = vp->i_atime;
529} 263}
530 264
531static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) 265static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
532{ 266{
533 *tt = vp->v_inode.i_atime.tv_sec; 267 *tt = vp->i_atime.tv_sec;
534} 268}
535 269
536/* 270/*
@@ -540,7 +274,6 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
540#define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) 274#define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages)
541#define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ 275#define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \
542 PAGECACHE_TAG_DIRTY) 276 PAGECACHE_TAG_DIRTY)
543#define VN_TRUNC(vp) ((vp)->v_flag & VTRUNCATED)
544 277
545/* 278/*
546 * Flags to vop_setattr/getattr. 279 * Flags to vop_setattr/getattr.
@@ -572,21 +305,17 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
572#define VNODE_KTRACE_REF 4 305#define VNODE_KTRACE_REF 4
573#define VNODE_KTRACE_RELE 5 306#define VNODE_KTRACE_RELE 5
574 307
575extern void vn_trace_entry(struct bhv_vnode *, const char *, inst_t *); 308extern void vn_trace_entry(struct xfs_inode *, const char *, inst_t *);
576extern void vn_trace_exit(struct bhv_vnode *, const char *, inst_t *); 309extern void vn_trace_exit(struct xfs_inode *, const char *, inst_t *);
577extern void vn_trace_hold(struct bhv_vnode *, char *, int, inst_t *); 310extern void vn_trace_hold(struct xfs_inode *, char *, int, inst_t *);
578extern void vn_trace_ref(struct bhv_vnode *, char *, int, inst_t *); 311extern void vn_trace_ref(struct xfs_inode *, char *, int, inst_t *);
579extern void vn_trace_rele(struct bhv_vnode *, char *, int, inst_t *); 312extern void vn_trace_rele(struct xfs_inode *, char *, int, inst_t *);
580
581#define VN_TRACE(vp) \
582 vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address)
583#else 313#else
584#define vn_trace_entry(a,b,c) 314#define vn_trace_entry(a,b,c)
585#define vn_trace_exit(a,b,c) 315#define vn_trace_exit(a,b,c)
586#define vn_trace_hold(a,b,c,d) 316#define vn_trace_hold(a,b,c,d)
587#define vn_trace_ref(a,b,c,d) 317#define vn_trace_ref(a,b,c,d)
588#define vn_trace_rele(a,b,c,d) 318#define vn_trace_rele(a,b,c,d)
589#define VN_TRACE(vp)
590#endif 319#endif
591 320
592#endif /* __XFS_VNODE_H__ */ 321#endif /* __XFS_VNODE_H__ */
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 6ff0f4de1630..b5f91281b707 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -288,45 +288,6 @@ xfs_qm_rele_quotafs_ref(
288} 288}
289 289
290/* 290/*
291 * This is called at mount time from xfs_mountfs to initialize the quotainfo
292 * structure and start the global quota manager (xfs_Gqm) if it hasn't done
293 * so already. Note that the superblock has not been read in yet.
294 */
295void
296xfs_qm_mount_quotainit(
297 xfs_mount_t *mp,
298 uint flags)
299{
300 /*
301 * User, projects or group quotas has to be on.
302 */
303 ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA));
304
305 /*
306 * Initialize the flags in the mount structure. From this point
307 * onwards we look at m_qflags to figure out if quotas's ON/OFF, etc.
308 * Note that we enforce nothing if accounting is off.
309 * ie. XFSMNT_*QUOTA must be ON for XFSMNT_*QUOTAENF.
310 * It isn't necessary to take the quotaoff lock to do this; this is
311 * called from mount.
312 */
313 if (flags & XFSMNT_UQUOTA) {
314 mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE);
315 if (flags & XFSMNT_UQUOTAENF)
316 mp->m_qflags |= XFS_UQUOTA_ENFD;
317 }
318 if (flags & XFSMNT_GQUOTA) {
319 mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
320 if (flags & XFSMNT_GQUOTAENF)
321 mp->m_qflags |= XFS_OQUOTA_ENFD;
322 } else if (flags & XFSMNT_PQUOTA) {
323 mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
324 if (flags & XFSMNT_PQUOTAENF)
325 mp->m_qflags |= XFS_OQUOTA_ENFD;
326 }
327}
328
329/*
330 * Just destroy the quotainfo structure. 291 * Just destroy the quotainfo structure.
331 */ 292 */
332void 293void
@@ -1039,7 +1000,7 @@ xfs_qm_dqdetach(
1039int 1000int
1040xfs_qm_sync( 1001xfs_qm_sync(
1041 xfs_mount_t *mp, 1002 xfs_mount_t *mp,
1042 short flags) 1003 int flags)
1043{ 1004{
1044 int recl, restarts; 1005 int recl, restarts;
1045 xfs_dquot_t *dqp; 1006 xfs_dquot_t *dqp;
@@ -1717,7 +1678,6 @@ xfs_qm_get_rtblks(
1717 xfs_extnum_t idx; /* extent record index */ 1678 xfs_extnum_t idx; /* extent record index */
1718 xfs_ifork_t *ifp; /* inode fork pointer */ 1679 xfs_ifork_t *ifp; /* inode fork pointer */
1719 xfs_extnum_t nextents; /* number of extent entries */ 1680 xfs_extnum_t nextents; /* number of extent entries */
1720 xfs_bmbt_rec_t *ep; /* pointer to an extent entry */
1721 int error; 1681 int error;
1722 1682
1723 ASSERT(XFS_IS_REALTIME_INODE(ip)); 1683 ASSERT(XFS_IS_REALTIME_INODE(ip));
@@ -1728,10 +1688,8 @@ xfs_qm_get_rtblks(
1728 } 1688 }
1729 rtblks = 0; 1689 rtblks = 0;
1730 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); 1690 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
1731 for (idx = 0; idx < nextents; idx++) { 1691 for (idx = 0; idx < nextents; idx++)
1732 ep = xfs_iext_get_ext(ifp, idx); 1692 rtblks += xfs_bmbt_get_blockcount(xfs_iext_get_ext(ifp, idx));
1733 rtblks += xfs_bmbt_get_blockcount(ep);
1734 }
1735 *O_rtblks = (xfs_qcnt_t)rtblks; 1693 *O_rtblks = (xfs_qcnt_t)rtblks;
1736 return 0; 1694 return 0;
1737} 1695}
@@ -2459,8 +2417,7 @@ xfs_qm_vop_dqalloc(
2459 lockflags = XFS_ILOCK_EXCL; 2417 lockflags = XFS_ILOCK_EXCL;
2460 xfs_ilock(ip, lockflags); 2418 xfs_ilock(ip, lockflags);
2461 2419
2462 if ((flags & XFS_QMOPT_INHERIT) && 2420 if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
2463 XFS_INHERIT_GID(ip, XFS_MTOVFS(mp)))
2464 gid = ip->i_d.di_gid; 2421 gid = ip->i_d.di_gid;
2465 2422
2466 /* 2423 /*
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h
index 689407de0a20..23ccaa5fceaf 100644
--- a/fs/xfs/quota/xfs_qm.h
+++ b/fs/xfs/quota/xfs_qm.h
@@ -166,12 +166,11 @@ typedef struct xfs_dquot_acct {
166 166
167extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); 167extern void xfs_qm_destroy_quotainfo(xfs_mount_t *);
168extern int xfs_qm_mount_quotas(xfs_mount_t *, int); 168extern int xfs_qm_mount_quotas(xfs_mount_t *, int);
169extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint);
170extern int xfs_qm_quotacheck(xfs_mount_t *); 169extern int xfs_qm_quotacheck(xfs_mount_t *);
171extern void xfs_qm_unmount_quotadestroy(xfs_mount_t *); 170extern void xfs_qm_unmount_quotadestroy(xfs_mount_t *);
172extern int xfs_qm_unmount_quotas(xfs_mount_t *); 171extern int xfs_qm_unmount_quotas(xfs_mount_t *);
173extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); 172extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t);
174extern int xfs_qm_sync(xfs_mount_t *, short); 173extern int xfs_qm_sync(xfs_mount_t *, int);
175 174
176/* dquot stuff */ 175/* dquot stuff */
177extern boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **); 176extern boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **);
@@ -199,7 +198,8 @@ extern void xfs_qm_freelist_unlink(xfs_dquot_t *);
199extern int xfs_qm_freelist_lock_nowait(xfs_qm_t *); 198extern int xfs_qm_freelist_lock_nowait(xfs_qm_t *);
200 199
201/* system call interface */ 200/* system call interface */
202extern int xfs_qm_quotactl(bhv_desc_t *, int, int, xfs_caddr_t); 201extern int xfs_qm_quotactl(struct xfs_mount *, int, int,
202 xfs_caddr_t);
203 203
204#ifdef DEBUG 204#ifdef DEBUG
205extern int xfs_qm_internalqcheck(xfs_mount_t *); 205extern int xfs_qm_internalqcheck(xfs_mount_t *);
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c
index d2cdb8a2aad6..97bb32937585 100644
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/quota/xfs_qm_bhv.c
@@ -48,172 +48,13 @@
48#include "xfs_buf_item.h" 48#include "xfs_buf_item.h"
49#include "xfs_qm.h" 49#include "xfs_qm.h"
50 50
51#define MNTOPT_QUOTA "quota" /* disk quotas (user) */
52#define MNTOPT_NOQUOTA "noquota" /* no quotas */
53#define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */
54#define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */
55#define MNTOPT_PRJQUOTA "prjquota" /* project quota enabled */
56#define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */
57#define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */
58#define MNTOPT_PQUOTA "pquota" /* project quota (IRIX variant) */
59#define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */
60#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */
61#define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */
62#define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */
63 51
64STATIC int 52STATIC void
65xfs_qm_parseargs( 53xfs_fill_statvfs_from_dquot(
66 struct bhv_desc *bhv,
67 char *options,
68 struct xfs_mount_args *args,
69 int update)
70{
71 size_t length;
72 char *local_options = options;
73 char *this_char;
74 int error;
75 int referenced = update;
76
77 while ((this_char = strsep(&local_options, ",")) != NULL) {
78 length = strlen(this_char);
79 if (local_options)
80 length++;
81
82 if (!strcmp(this_char, MNTOPT_NOQUOTA)) {
83 args->flags &= ~(XFSMNT_UQUOTAENF|XFSMNT_UQUOTA);
84 args->flags &= ~(XFSMNT_GQUOTAENF|XFSMNT_GQUOTA);
85 referenced = update;
86 } else if (!strcmp(this_char, MNTOPT_QUOTA) ||
87 !strcmp(this_char, MNTOPT_UQUOTA) ||
88 !strcmp(this_char, MNTOPT_USRQUOTA)) {
89 args->flags |= XFSMNT_UQUOTA | XFSMNT_UQUOTAENF;
90 referenced = 1;
91 } else if (!strcmp(this_char, MNTOPT_QUOTANOENF) ||
92 !strcmp(this_char, MNTOPT_UQUOTANOENF)) {
93 args->flags |= XFSMNT_UQUOTA;
94 args->flags &= ~XFSMNT_UQUOTAENF;
95 referenced = 1;
96 } else if (!strcmp(this_char, MNTOPT_PQUOTA) ||
97 !strcmp(this_char, MNTOPT_PRJQUOTA)) {
98 args->flags |= XFSMNT_PQUOTA | XFSMNT_PQUOTAENF;
99 referenced = 1;
100 } else if (!strcmp(this_char, MNTOPT_PQUOTANOENF)) {
101 args->flags |= XFSMNT_PQUOTA;
102 args->flags &= ~XFSMNT_PQUOTAENF;
103 referenced = 1;
104 } else if (!strcmp(this_char, MNTOPT_GQUOTA) ||
105 !strcmp(this_char, MNTOPT_GRPQUOTA)) {
106 args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF;
107 referenced = 1;
108 } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) {
109 args->flags |= XFSMNT_GQUOTA;
110 args->flags &= ~XFSMNT_GQUOTAENF;
111 referenced = 1;
112 } else {
113 if (local_options)
114 *(local_options-1) = ',';
115 continue;
116 }
117
118 while (length--)
119 *this_char++ = ',';
120 }
121
122 if ((args->flags & XFSMNT_GQUOTA) && (args->flags & XFSMNT_PQUOTA)) {
123 cmn_err(CE_WARN,
124 "XFS: cannot mount with both project and group quota");
125 return XFS_ERROR(EINVAL);
126 }
127
128 error = bhv_next_vfs_parseargs(BHV_NEXT(bhv), options, args, update);
129 if (!error && !referenced)
130 bhv_remove_vfsops(bhvtovfs(bhv), VFS_POSITION_QM);
131 return error;
132}
133
134STATIC int
135xfs_qm_showargs(
136 struct bhv_desc *bhv,
137 struct seq_file *m)
138{
139 struct bhv_vfs *vfsp = bhvtovfs(bhv);
140 struct xfs_mount *mp = XFS_VFSTOM(vfsp);
141
142 if (mp->m_qflags & XFS_UQUOTA_ACCT) {
143 (mp->m_qflags & XFS_UQUOTA_ENFD) ?
144 seq_puts(m, "," MNTOPT_USRQUOTA) :
145 seq_puts(m, "," MNTOPT_UQUOTANOENF);
146 }
147
148 if (mp->m_qflags & XFS_PQUOTA_ACCT) {
149 (mp->m_qflags & XFS_OQUOTA_ENFD) ?
150 seq_puts(m, "," MNTOPT_PRJQUOTA) :
151 seq_puts(m, "," MNTOPT_PQUOTANOENF);
152 }
153
154 if (mp->m_qflags & XFS_GQUOTA_ACCT) {
155 (mp->m_qflags & XFS_OQUOTA_ENFD) ?
156 seq_puts(m, "," MNTOPT_GRPQUOTA) :
157 seq_puts(m, "," MNTOPT_GQUOTANOENF);
158 }
159
160 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
161 seq_puts(m, "," MNTOPT_NOQUOTA);
162
163 return bhv_next_vfs_showargs(BHV_NEXT(bhv), m);
164}
165
166STATIC int
167xfs_qm_mount(
168 struct bhv_desc *bhv,
169 struct xfs_mount_args *args,
170 struct cred *cr)
171{
172 struct bhv_vfs *vfsp = bhvtovfs(bhv);
173 struct xfs_mount *mp = XFS_VFSTOM(vfsp);
174
175 if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA | XFSMNT_PQUOTA))
176 xfs_qm_mount_quotainit(mp, args->flags);
177 return bhv_next_vfs_mount(BHV_NEXT(bhv), args, cr);
178}
179
180/*
181 * Directory tree accounting is implemented using project quotas, where
182 * the project identifier is inherited from parent directories.
183 * A statvfs (df, etc.) of a directory that is using project quota should
184 * return a statvfs of the project, not the entire filesystem.
185 * This makes such trees appear as if they are filesystems in themselves.
186 */
187STATIC int
188xfs_qm_statvfs(
189 struct bhv_desc *bhv,
190 bhv_statvfs_t *statp, 54 bhv_statvfs_t *statp,
191 struct bhv_vnode *vnode) 55 xfs_disk_dquot_t *dp)
192{ 56{
193 xfs_mount_t *mp;
194 xfs_inode_t *ip;
195 xfs_dquot_t *dqp;
196 xfs_disk_dquot_t *dp;
197 __uint64_t limit; 57 __uint64_t limit;
198 int error;
199
200 error = bhv_next_vfs_statvfs(BHV_NEXT(bhv), statp, vnode);
201 if (error || !vnode)
202 return error;
203
204 mp = xfs_vfstom(bhvtovfs(bhv));
205 ip = xfs_vtoi(vnode);
206
207 if (!(ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT))
208 return 0;
209 if (!(mp->m_qflags & XFS_PQUOTA_ACCT))
210 return 0;
211 if (!(mp->m_qflags & XFS_OQUOTA_ENFD))
212 return 0;
213
214 if (xfs_qm_dqget(mp, NULL, ip->i_d.di_projid, XFS_DQ_PROJ, 0, &dqp))
215 return 0;
216 dp = &dqp->q_core;
217 58
218 limit = dp->d_blk_softlimit ? 59 limit = dp->d_blk_softlimit ?
219 be64_to_cpu(dp->d_blk_softlimit) : 60 be64_to_cpu(dp->d_blk_softlimit) :
@@ -234,37 +75,35 @@ xfs_qm_statvfs(
234 (statp->f_files > be64_to_cpu(dp->d_icount)) ? 75 (statp->f_files > be64_to_cpu(dp->d_icount)) ?
235 (statp->f_ffree - be64_to_cpu(dp->d_icount)) : 0; 76 (statp->f_ffree - be64_to_cpu(dp->d_icount)) : 0;
236 } 77 }
237
238 xfs_qm_dqput(dqp);
239 return 0;
240} 78}
241 79
242STATIC int 80
243xfs_qm_syncall( 81/*
244 struct bhv_desc *bhv, 82 * Directory tree accounting is implemented using project quotas, where
245 int flags, 83 * the project identifier is inherited from parent directories.
246 cred_t *credp) 84 * A statvfs (df, etc.) of a directory that is using project quota should
85 * return a statvfs of the project, not the entire filesystem.
86 * This makes such trees appear as if they are filesystems in themselves.
87 */
88STATIC void
89xfs_qm_statvfs(
90 xfs_inode_t *ip,
91 bhv_statvfs_t *statp)
247{ 92{
248 struct bhv_vfs *vfsp = bhvtovfs(bhv); 93 xfs_mount_t *mp = ip->i_mount;
249 struct xfs_mount *mp = XFS_VFSTOM(vfsp); 94 xfs_dquot_t *dqp;
250 int error;
251 95
252 /* 96 if (!(ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) ||
253 * Get the Quota Manager to flush the dquots. 97 !((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))) ==
254 */ 98 (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
255 if (XFS_IS_QUOTA_ON(mp)) { 99 return;
256 if ((error = xfs_qm_sync(mp, flags))) { 100
257 /* 101 if (!xfs_qm_dqget(mp, NULL, ip->i_d.di_projid, XFS_DQ_PROJ, 0, &dqp)) {
258 * If we got an IO error, we will be shutting down. 102 xfs_disk_dquot_t *dp = &dqp->q_core;
259 * So, there's nothing more for us to do here. 103
260 */ 104 xfs_fill_statvfs_from_dquot(statp, dp);
261 ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp)); 105 xfs_qm_dqput(dqp);
262 if (XFS_FORCED_SHUTDOWN(mp)) {
263 return XFS_ERROR(error);
264 }
265 }
266 } 106 }
267 return bhv_next_vfs_sync(BHV_NEXT(bhv), flags, credp);
268} 107}
269 108
270STATIC int 109STATIC int
@@ -382,7 +221,7 @@ xfs_qm_dqrele_null(
382} 221}
383 222
384 223
385static struct xfs_qmops xfs_qmcore_xfs = { 224struct xfs_qmops xfs_qmcore_xfs = {
386 .xfs_qminit = xfs_qm_newmount, 225 .xfs_qminit = xfs_qm_newmount,
387 .xfs_qmdone = xfs_qm_unmount_quotadestroy, 226 .xfs_qmdone = xfs_qm_unmount_quotadestroy,
388 .xfs_qmmount = xfs_qm_endmount, 227 .xfs_qmmount = xfs_qm_endmount,
@@ -396,36 +235,24 @@ static struct xfs_qmops xfs_qmcore_xfs = {
396 .xfs_dqvoprename = xfs_qm_vop_rename_dqattach, 235 .xfs_dqvoprename = xfs_qm_vop_rename_dqattach,
397 .xfs_dqvopchown = xfs_qm_vop_chown, 236 .xfs_dqvopchown = xfs_qm_vop_chown,
398 .xfs_dqvopchownresv = xfs_qm_vop_chown_reserve, 237 .xfs_dqvopchownresv = xfs_qm_vop_chown_reserve,
238 .xfs_dqstatvfs = xfs_qm_statvfs,
239 .xfs_dqsync = xfs_qm_sync,
240 .xfs_quotactl = xfs_qm_quotactl,
399 .xfs_dqtrxops = &xfs_trans_dquot_ops, 241 .xfs_dqtrxops = &xfs_trans_dquot_ops,
400}; 242};
401 243EXPORT_SYMBOL(xfs_qmcore_xfs);
402struct bhv_module_vfsops xfs_qmops = { {
403 BHV_IDENTITY_INIT(VFS_BHV_QM, VFS_POSITION_QM),
404 .vfs_parseargs = xfs_qm_parseargs,
405 .vfs_showargs = xfs_qm_showargs,
406 .vfs_mount = xfs_qm_mount,
407 .vfs_statvfs = xfs_qm_statvfs,
408 .vfs_sync = xfs_qm_syncall,
409 .vfs_quotactl = xfs_qm_quotactl, },
410};
411
412 244
413void __init 245void __init
414xfs_qm_init(void) 246xfs_qm_init(void)
415{ 247{
416 static char message[] __initdata = 248 printk(KERN_INFO "SGI XFS Quota Management subsystem\n");
417 KERN_INFO "SGI XFS Quota Management subsystem\n";
418
419 printk(message);
420 mutex_init(&xfs_Gqm_lock); 249 mutex_init(&xfs_Gqm_lock);
421 vfs_bhv_set_custom(&xfs_qmops, &xfs_qmcore_xfs);
422 xfs_qm_init_procfs(); 250 xfs_qm_init_procfs();
423} 251}
424 252
425void __exit 253void __exit
426xfs_qm_exit(void) 254xfs_qm_exit(void)
427{ 255{
428 vfs_bhv_clr_custom(&xfs_qmops);
429 xfs_qm_cleanup_procfs(); 256 xfs_qm_cleanup_procfs();
430 if (qm_dqzone) 257 if (qm_dqzone)
431 kmem_zone_destroy(qm_dqzone); 258 kmem_zone_destroy(qm_dqzone);
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 2df67fd913e5..ad5579d4eac4 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -81,18 +81,13 @@ STATIC void xfs_qm_export_dquot(xfs_mount_t *, xfs_disk_dquot_t *,
81 */ 81 */
82int 82int
83xfs_qm_quotactl( 83xfs_qm_quotactl(
84 struct bhv_desc *bdp, 84 xfs_mount_t *mp,
85 int cmd, 85 int cmd,
86 int id, 86 int id,
87 xfs_caddr_t addr) 87 xfs_caddr_t addr)
88{ 88{
89 xfs_mount_t *mp;
90 bhv_vfs_t *vfsp;
91 int error; 89 int error;
92 90
93 vfsp = bhvtovfs(bdp);
94 mp = XFS_VFSTOM(vfsp);
95
96 ASSERT(addr != NULL || cmd == Q_XQUOTASYNC); 91 ASSERT(addr != NULL || cmd == Q_XQUOTASYNC);
97 92
98 /* 93 /*
@@ -105,7 +100,7 @@ xfs_qm_quotactl(
105 */ 100 */
106 if (XFS_IS_QUOTA_ON(mp)) 101 if (XFS_IS_QUOTA_ON(mp))
107 return XFS_ERROR(EINVAL); 102 return XFS_ERROR(EINVAL);
108 if (vfsp->vfs_flag & VFS_RDONLY) 103 if (mp->m_flags & XFS_MOUNT_RDONLY)
109 return XFS_ERROR(EROFS); 104 return XFS_ERROR(EROFS);
110 return (xfs_qm_scall_trunc_qfiles(mp, 105 return (xfs_qm_scall_trunc_qfiles(mp,
111 xfs_qm_import_qtype_flags(*(uint *)addr))); 106 xfs_qm_import_qtype_flags(*(uint *)addr)));
@@ -121,13 +116,13 @@ xfs_qm_quotactl(
121 * QUOTAON - enabling quota enforcement. 116 * QUOTAON - enabling quota enforcement.
122 * Quota accounting must be turned on at mount time. 117 * Quota accounting must be turned on at mount time.
123 */ 118 */
124 if (vfsp->vfs_flag & VFS_RDONLY) 119 if (mp->m_flags & XFS_MOUNT_RDONLY)
125 return XFS_ERROR(EROFS); 120 return XFS_ERROR(EROFS);
126 return (xfs_qm_scall_quotaon(mp, 121 return (xfs_qm_scall_quotaon(mp,
127 xfs_qm_import_flags(*(uint *)addr))); 122 xfs_qm_import_flags(*(uint *)addr)));
128 123
129 case Q_XQUOTAOFF: 124 case Q_XQUOTAOFF:
130 if (vfsp->vfs_flag & VFS_RDONLY) 125 if (mp->m_flags & XFS_MOUNT_RDONLY)
131 return XFS_ERROR(EROFS); 126 return XFS_ERROR(EROFS);
132 break; 127 break;
133 128
@@ -143,7 +138,7 @@ xfs_qm_quotactl(
143 138
144 switch (cmd) { 139 switch (cmd) {
145 case Q_XQUOTAOFF: 140 case Q_XQUOTAOFF:
146 if (vfsp->vfs_flag & VFS_RDONLY) 141 if (mp->m_flags & XFS_MOUNT_RDONLY)
147 return XFS_ERROR(EROFS); 142 return XFS_ERROR(EROFS);
148 error = xfs_qm_scall_quotaoff(mp, 143 error = xfs_qm_scall_quotaoff(mp,
149 xfs_qm_import_flags(*(uint *)addr), 144 xfs_qm_import_flags(*(uint *)addr),
@@ -164,19 +159,19 @@ xfs_qm_quotactl(
164 break; 159 break;
165 160
166 case Q_XSETQLIM: 161 case Q_XSETQLIM:
167 if (vfsp->vfs_flag & VFS_RDONLY) 162 if (mp->m_flags & XFS_MOUNT_RDONLY)
168 return XFS_ERROR(EROFS); 163 return XFS_ERROR(EROFS);
169 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER, 164 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,
170 (fs_disk_quota_t *)addr); 165 (fs_disk_quota_t *)addr);
171 break; 166 break;
172 case Q_XSETGQLIM: 167 case Q_XSETGQLIM:
173 if (vfsp->vfs_flag & VFS_RDONLY) 168 if (mp->m_flags & XFS_MOUNT_RDONLY)
174 return XFS_ERROR(EROFS); 169 return XFS_ERROR(EROFS);
175 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 170 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
176 (fs_disk_quota_t *)addr); 171 (fs_disk_quota_t *)addr);
177 break; 172 break;
178 case Q_XSETPQLIM: 173 case Q_XSETPQLIM:
179 if (vfsp->vfs_flag & VFS_RDONLY) 174 if (mp->m_flags & XFS_MOUNT_RDONLY)
180 return XFS_ERROR(EROFS); 175 return XFS_ERROR(EROFS);
181 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ, 176 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
182 (fs_disk_quota_t *)addr); 177 (fs_disk_quota_t *)addr);
diff --git a/fs/xfs/support/move.c b/fs/xfs/support/move.c
deleted file mode 100644
index ac8617ca3909..000000000000
--- a/fs/xfs/support/move.c
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include <xfs.h>
19
20/* Read from kernel buffer at src to user/kernel buffer defined
21 * by the uio structure. Advance the pointer in the uio struct
22 * as we go.
23 */
24int
25xfs_uio_read(caddr_t src, size_t len, struct uio *uio)
26{
27 size_t count;
28
29 if (!len || !uio->uio_resid)
30 return 0;
31
32 count = uio->uio_iov->iov_len;
33 if (!count)
34 return 0;
35 if (count > len)
36 count = len;
37
38 if (uio->uio_segflg == UIO_USERSPACE) {
39 if (copy_to_user(uio->uio_iov->iov_base, src, count))
40 return EFAULT;
41 } else {
42 ASSERT(uio->uio_segflg == UIO_SYSSPACE);
43 memcpy(uio->uio_iov->iov_base, src, count);
44 }
45
46 uio->uio_iov->iov_base = (void*)((char*)uio->uio_iov->iov_base + count);
47 uio->uio_iov->iov_len -= count;
48 uio->uio_offset += count;
49 uio->uio_resid -= count;
50 return 0;
51}
diff --git a/fs/xfs/support/move.h b/fs/xfs/support/move.h
deleted file mode 100644
index 324e413deadd..000000000000
--- a/fs/xfs/support/move.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * Portions Copyright (c) 1982, 1986, 1993, 1994
19 * The Regents of the University of California. All rights reserved.
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions
23 * are met:
24 * 1. Redistributions of source code must retain the above copyright
25 * notice, this list of conditions and the following disclaimer.
26 * 2. Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in the
28 * documentation and/or other materials provided with the distribution.
29 * 3. Neither the name of the University nor the names of its contributors
30 * may be used to endorse or promote products derived from this software
31 * without specific prior written permission.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
34 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
37 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 * SUCH DAMAGE.
44 */
45#ifndef __XFS_SUPPORT_MOVE_H__
46#define __XFS_SUPPORT_MOVE_H__
47
48#include <linux/uio.h>
49#include <asm/uaccess.h>
50
51/* Segment flag values. */
52enum uio_seg {
53 UIO_USERSPACE, /* from user data space */
54 UIO_SYSSPACE, /* from system space */
55};
56
57struct uio {
58 struct kvec *uio_iov; /* pointer to array of iovecs */
59 int uio_iovcnt; /* number of iovecs in array */
60 xfs_off_t uio_offset; /* offset in file this uio corresponds to */
61 int uio_resid; /* residual i/o count */
62 enum uio_seg uio_segflg; /* see above */
63};
64
65typedef struct uio uio_t;
66typedef struct kvec iovec_t;
67
68extern int xfs_uio_read (caddr_t, size_t, uio_t *);
69
70#endif /* __XFS_SUPPORT_MOVE_H__ */
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 4ca4beb7bb54..5bfb66f33caf 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -32,6 +32,7 @@
32#include "xfs_btree.h" 32#include "xfs_btree.h"
33#include "xfs_acl.h" 33#include "xfs_acl.h"
34#include "xfs_attr.h" 34#include "xfs_attr.h"
35#include "xfs_vnodeops.h"
35 36
36#include <linux/capability.h> 37#include <linux/capability.h>
37#include <linux/posix_acl_xattr.h> 38#include <linux/posix_acl_xattr.h>
@@ -241,7 +242,7 @@ xfs_acl_vget(
241 bhv_vattr_t va; 242 bhv_vattr_t va;
242 243
243 va.va_mask = XFS_AT_MODE; 244 va.va_mask = XFS_AT_MODE;
244 error = bhv_vop_getattr(vp, &va, 0, sys_cred); 245 error = xfs_getattr(xfs_vtoi(vp), &va, 0);
245 if (error) 246 if (error)
246 goto out; 247 goto out;
247 xfs_acl_sync_mode(va.va_mode, xfs_acl); 248 xfs_acl_sync_mode(va.va_mode, xfs_acl);
@@ -265,9 +266,10 @@ xfs_acl_vremove(
265 VN_HOLD(vp); 266 VN_HOLD(vp);
266 error = xfs_acl_allow_set(vp, kind); 267 error = xfs_acl_allow_set(vp, kind);
267 if (!error) { 268 if (!error) {
268 error = bhv_vop_attr_remove(vp, kind == _ACL_TYPE_DEFAULT? 269 error = xfs_attr_remove(xfs_vtoi(vp),
270 kind == _ACL_TYPE_DEFAULT?
269 SGI_ACL_DEFAULT: SGI_ACL_FILE, 271 SGI_ACL_DEFAULT: SGI_ACL_FILE,
270 ATTR_ROOT, sys_cred); 272 ATTR_ROOT);
271 if (error == ENOATTR) 273 if (error == ENOATTR)
272 error = 0; /* 'scool */ 274 error = 0; /* 'scool */
273 } 275 }
@@ -370,17 +372,18 @@ xfs_acl_allow_set(
370 bhv_vnode_t *vp, 372 bhv_vnode_t *vp,
371 int kind) 373 int kind)
372{ 374{
375 xfs_inode_t *ip = xfs_vtoi(vp);
373 bhv_vattr_t va; 376 bhv_vattr_t va;
374 int error; 377 int error;
375 378
376 if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND)) 379 if (vp->i_flags & (S_IMMUTABLE|S_APPEND))
377 return EPERM; 380 return EPERM;
378 if (kind == _ACL_TYPE_DEFAULT && !VN_ISDIR(vp)) 381 if (kind == _ACL_TYPE_DEFAULT && !VN_ISDIR(vp))
379 return ENOTDIR; 382 return ENOTDIR;
380 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 383 if (vp->i_sb->s_flags & MS_RDONLY)
381 return EROFS; 384 return EROFS;
382 va.va_mask = XFS_AT_UID; 385 va.va_mask = XFS_AT_UID;
383 error = bhv_vop_getattr(vp, &va, 0, NULL); 386 error = xfs_getattr(ip, &va, 0);
384 if (error) 387 if (error)
385 return error; 388 return error;
386 if (va.va_uid != current->fsuid && !capable(CAP_FOWNER)) 389 if (va.va_uid != current->fsuid && !capable(CAP_FOWNER))
@@ -613,7 +616,8 @@ xfs_acl_get_attr(
613 616
614 ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1); 617 ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1);
615 flags |= ATTR_ROOT; 618 flags |= ATTR_ROOT;
616 *error = bhv_vop_attr_get(vp, kind == _ACL_TYPE_ACCESS ? 619 *error = xfs_attr_get(xfs_vtoi(vp),
620 kind == _ACL_TYPE_ACCESS ?
617 SGI_ACL_FILE : SGI_ACL_DEFAULT, 621 SGI_ACL_FILE : SGI_ACL_DEFAULT,
618 (char *)aclp, &len, flags, sys_cred); 622 (char *)aclp, &len, flags, sys_cred);
619 if (*error || (flags & ATTR_KERNOVAL)) 623 if (*error || (flags & ATTR_KERNOVAL))
@@ -651,9 +655,10 @@ xfs_acl_set_attr(
651 INT_SET(newace->ae_perm, ARCH_CONVERT, ace->ae_perm); 655 INT_SET(newace->ae_perm, ARCH_CONVERT, ace->ae_perm);
652 } 656 }
653 INT_SET(newacl->acl_cnt, ARCH_CONVERT, aclp->acl_cnt); 657 INT_SET(newacl->acl_cnt, ARCH_CONVERT, aclp->acl_cnt);
654 *error = bhv_vop_attr_set(vp, kind == _ACL_TYPE_ACCESS ? 658 *error = xfs_attr_set(xfs_vtoi(vp),
659 kind == _ACL_TYPE_ACCESS ?
655 SGI_ACL_FILE: SGI_ACL_DEFAULT, 660 SGI_ACL_FILE: SGI_ACL_DEFAULT,
656 (char *)newacl, len, ATTR_ROOT, sys_cred); 661 (char *)newacl, len, ATTR_ROOT);
657 _ACL_FREE(newacl); 662 _ACL_FREE(newacl);
658} 663}
659 664
@@ -675,7 +680,7 @@ xfs_acl_vtoacl(
675 if (!error) { 680 if (!error) {
676 /* Got the ACL, need the mode... */ 681 /* Got the ACL, need the mode... */
677 va.va_mask = XFS_AT_MODE; 682 va.va_mask = XFS_AT_MODE;
678 error = bhv_vop_getattr(vp, &va, 0, sys_cred); 683 error = xfs_getattr(xfs_vtoi(vp), &va, 0);
679 } 684 }
680 685
681 if (error) 686 if (error)
@@ -699,7 +704,7 @@ xfs_acl_vtoacl(
699int 704int
700xfs_acl_inherit( 705xfs_acl_inherit(
701 bhv_vnode_t *vp, 706 bhv_vnode_t *vp,
702 bhv_vattr_t *vap, 707 mode_t mode,
703 xfs_acl_t *pdaclp) 708 xfs_acl_t *pdaclp)
704{ 709{
705 xfs_acl_t *cacl; 710 xfs_acl_t *cacl;
@@ -727,7 +732,7 @@ xfs_acl_inherit(
727 return ENOMEM; 732 return ENOMEM;
728 733
729 memcpy(cacl, pdaclp, sizeof(xfs_acl_t)); 734 memcpy(cacl, pdaclp, sizeof(xfs_acl_t));
730 xfs_acl_filter_mode(vap->va_mode, cacl); 735 xfs_acl_filter_mode(mode, cacl);
731 xfs_acl_setmode(vp, cacl, &basicperms); 736 xfs_acl_setmode(vp, cacl, &basicperms);
732 737
733 /* 738 /*
@@ -773,7 +778,7 @@ xfs_acl_setmode(
773 * mode. The m:: bits take precedence over the g:: bits. 778 * mode. The m:: bits take precedence over the g:: bits.
774 */ 779 */
775 va.va_mask = XFS_AT_MODE; 780 va.va_mask = XFS_AT_MODE;
776 error = bhv_vop_getattr(vp, &va, 0, sys_cred); 781 error = xfs_getattr(xfs_vtoi(vp), &va, 0);
777 if (error) 782 if (error)
778 return error; 783 return error;
779 784
@@ -807,7 +812,7 @@ xfs_acl_setmode(
807 if (gap && nomask) 812 if (gap && nomask)
808 va.va_mode |= gap->ae_perm << 3; 813 va.va_mode |= gap->ae_perm << 3;
809 814
810 return bhv_vop_setattr(vp, &va, 0, sys_cred); 815 return xfs_setattr(xfs_vtoi(vp), &va, 0, sys_cred);
811} 816}
812 817
813/* 818/*
diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h
index f853cf1a6270..34b7d3391299 100644
--- a/fs/xfs/xfs_acl.h
+++ b/fs/xfs/xfs_acl.h
@@ -50,7 +50,6 @@ typedef struct xfs_acl {
50#ifdef CONFIG_XFS_POSIX_ACL 50#ifdef CONFIG_XFS_POSIX_ACL
51 51
52struct vattr; 52struct vattr;
53struct bhv_vnode;
54struct xfs_inode; 53struct xfs_inode;
55 54
56extern struct kmem_zone *xfs_acl_zone; 55extern struct kmem_zone *xfs_acl_zone;
@@ -58,20 +57,20 @@ extern struct kmem_zone *xfs_acl_zone;
58 (zone) = kmem_zone_init(sizeof(xfs_acl_t), (name)) 57 (zone) = kmem_zone_init(sizeof(xfs_acl_t), (name))
59#define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone) 58#define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone)
60 59
61extern int xfs_acl_inherit(struct bhv_vnode *, struct bhv_vattr *, xfs_acl_t *); 60extern int xfs_acl_inherit(bhv_vnode_t *, mode_t mode, xfs_acl_t *);
62extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *); 61extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *);
63extern int xfs_acl_vtoacl(struct bhv_vnode *, xfs_acl_t *, xfs_acl_t *); 62extern int xfs_acl_vtoacl(bhv_vnode_t *, xfs_acl_t *, xfs_acl_t *);
64extern int xfs_acl_vhasacl_access(struct bhv_vnode *); 63extern int xfs_acl_vhasacl_access(bhv_vnode_t *);
65extern int xfs_acl_vhasacl_default(struct bhv_vnode *); 64extern int xfs_acl_vhasacl_default(bhv_vnode_t *);
66extern int xfs_acl_vset(struct bhv_vnode *, void *, size_t, int); 65extern int xfs_acl_vset(bhv_vnode_t *, void *, size_t, int);
67extern int xfs_acl_vget(struct bhv_vnode *, void *, size_t, int); 66extern int xfs_acl_vget(bhv_vnode_t *, void *, size_t, int);
68extern int xfs_acl_vremove(struct bhv_vnode *, int); 67extern int xfs_acl_vremove(bhv_vnode_t *, int);
69 68
70#define _ACL_TYPE_ACCESS 1 69#define _ACL_TYPE_ACCESS 1
71#define _ACL_TYPE_DEFAULT 2 70#define _ACL_TYPE_DEFAULT 2
72#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)) 71#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
73 72
74#define _ACL_INHERIT(c,v,d) (xfs_acl_inherit(c,v,d)) 73#define _ACL_INHERIT(c,m,d) (xfs_acl_inherit(c,m,d))
75#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0) 74#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0)
76#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0) 75#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
77#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access 76#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access
@@ -91,7 +90,7 @@ extern int xfs_acl_vremove(struct bhv_vnode *, int);
91#define xfs_acl_vhasacl_default(v) (0) 90#define xfs_acl_vhasacl_default(v) (0)
92#define _ACL_ALLOC(a) (1) /* successfully allocate nothing */ 91#define _ACL_ALLOC(a) (1) /* successfully allocate nothing */
93#define _ACL_FREE(a) ((void)0) 92#define _ACL_FREE(a) ((void)0)
94#define _ACL_INHERIT(c,v,d) (0) 93#define _ACL_INHERIT(c,m,d) (0)
95#define _ACL_GET_ACCESS(pv,pa) (0) 94#define _ACL_GET_ACCESS(pv,pa) (0)
96#define _ACL_GET_DEFAULT(pv,pd) (0) 95#define _ACL_GET_DEFAULT(pv,pd) (0)
97#define _ACL_ACCESS_EXISTS (NULL) 96#define _ACL_ACCESS_EXISTS (NULL)
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index 51c09c114a20..9381b0360c4b 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -197,6 +197,10 @@ typedef struct xfs_perag
197#endif 197#endif
198 xfs_perag_busy_t *pagb_list; /* unstable blocks */ 198 xfs_perag_busy_t *pagb_list; /* unstable blocks */
199 atomic_t pagf_fstrms; /* # of filestreams active in this AG */ 199 atomic_t pagf_fstrms; /* # of filestreams active in this AG */
200
201 int pag_ici_init; /* incore inode cache initialised */
202 rwlock_t pag_ici_lock; /* incore inode lock */
203 struct radix_tree_root pag_ici_root; /* incore inode cache root */
200} xfs_perag_t; 204} xfs_perag_t;
201 205
202#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) 206#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 7ce44a7b88a2..93fa64dd1be6 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -49,6 +49,7 @@
49#include "xfs_trans_space.h" 49#include "xfs_trans_space.h"
50#include "xfs_acl.h" 50#include "xfs_acl.h"
51#include "xfs_rw.h" 51#include "xfs_rw.h"
52#include "xfs_vnodeops.h"
52 53
53/* 54/*
54 * xfs_attr.c 55 * xfs_attr.c
@@ -156,10 +157,14 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen,
156} 157}
157 158
158int 159int
159xfs_attr_get(bhv_desc_t *bdp, const char *name, char *value, int *valuelenp, 160xfs_attr_get(
160 int flags, struct cred *cred) 161 xfs_inode_t *ip,
162 const char *name,
163 char *value,
164 int *valuelenp,
165 int flags,
166 cred_t *cred)
161{ 167{
162 xfs_inode_t *ip = XFS_BHVTOI(bdp);
163 int error, namelen; 168 int error, namelen;
164 169
165 XFS_STATS_INC(xs_attr_get); 170 XFS_STATS_INC(xs_attr_get);
@@ -417,10 +422,13 @@ out:
417} 422}
418 423
419int 424int
420xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int flags, 425xfs_attr_set(
421 struct cred *cred) 426 xfs_inode_t *dp,
427 const char *name,
428 char *value,
429 int valuelen,
430 int flags)
422{ 431{
423 xfs_inode_t *dp;
424 int namelen; 432 int namelen;
425 433
426 namelen = strlen(name); 434 namelen = strlen(name);
@@ -429,7 +437,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f
429 437
430 XFS_STATS_INC(xs_attr_set); 438 XFS_STATS_INC(xs_attr_set);
431 439
432 dp = XFS_BHVTOI(bdp);
433 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 440 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
434 return (EIO); 441 return (EIO);
435 442
@@ -563,10 +570,12 @@ out:
563} 570}
564 571
565int 572int
566xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) 573xfs_attr_remove(
574 xfs_inode_t *dp,
575 const char *name,
576 int flags)
567{ 577{
568 xfs_inode_t *dp; 578 int namelen;
569 int namelen;
570 579
571 namelen = strlen(name); 580 namelen = strlen(name);
572 if (namelen >= MAXNAMELEN) 581 if (namelen >= MAXNAMELEN)
@@ -574,7 +583,6 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred)
574 583
575 XFS_STATS_INC(xs_attr_remove); 584 XFS_STATS_INC(xs_attr_remove);
576 585
577 dp = XFS_BHVTOI(bdp);
578 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 586 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
579 return (EIO); 587 return (EIO);
580 588
@@ -702,11 +710,14 @@ xfs_attr_kern_list_sizes(xfs_attr_list_context_t *context, attrnames_t *namesp,
702 * success. 710 * success.
703 */ 711 */
704int 712int
705xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, 713xfs_attr_list(
706 attrlist_cursor_kern_t *cursor, struct cred *cred) 714 xfs_inode_t *dp,
715 char *buffer,
716 int bufsize,
717 int flags,
718 attrlist_cursor_kern_t *cursor)
707{ 719{
708 xfs_attr_list_context_t context; 720 xfs_attr_list_context_t context;
709 xfs_inode_t *dp;
710 int error; 721 int error;
711 722
712 XFS_STATS_INC(xs_attr_list); 723 XFS_STATS_INC(xs_attr_list);
@@ -731,7 +742,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
731 /* 742 /*
732 * Initialize the output buffer. 743 * Initialize the output buffer.
733 */ 744 */
734 context.dp = dp = XFS_BHVTOI(bdp); 745 context.dp = dp;
735 context.cursor = cursor; 746 context.cursor = cursor;
736 context.count = 0; 747 context.count = 0;
737 context.dupcnt = 0; 748 context.dupcnt = 0;
@@ -2502,7 +2513,7 @@ STATIC int
2502attr_generic_set( 2513attr_generic_set(
2503 bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) 2514 bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
2504{ 2515{
2505 return -bhv_vop_attr_set(vp, name, data, size, xflags, NULL); 2516 return -xfs_attr_set(xfs_vtoi(vp), name, data, size, xflags);
2506} 2517}
2507 2518
2508STATIC int 2519STATIC int
@@ -2511,7 +2522,8 @@ attr_generic_get(
2511{ 2522{
2512 int error, asize = size; 2523 int error, asize = size;
2513 2524
2514 error = bhv_vop_attr_get(vp, name, data, &asize, xflags, NULL); 2525 error = xfs_attr_get(xfs_vtoi(vp), name, data,
2526 &asize, xflags, NULL);
2515 if (!error) 2527 if (!error)
2516 return asize; 2528 return asize;
2517 return -error; 2529 return -error;
@@ -2521,7 +2533,7 @@ STATIC int
2521attr_generic_remove( 2533attr_generic_remove(
2522 bhv_vnode_t *vp, char *name, int xflags) 2534 bhv_vnode_t *vp, char *name, int xflags)
2523{ 2535{
2524 return -bhv_vop_attr_remove(vp, name, xflags, NULL); 2536 return -xfs_attr_remove(xfs_vtoi(vp), name, xflags);
2525} 2537}
2526 2538
2527STATIC int 2539STATIC int
@@ -2576,7 +2588,7 @@ attr_generic_list(
2576 attrlist_cursor_kern_t cursor = { 0 }; 2588 attrlist_cursor_kern_t cursor = { 0 };
2577 int error; 2589 int error;
2578 2590
2579 error = bhv_vop_attr_list(vp, data, size, xflags, &cursor, NULL); 2591 error = xfs_attr_list(xfs_vtoi(vp), data, size, xflags, &cursor);
2580 if (error > 0) 2592 if (error > 0)
2581 return -error; 2593 return -error;
2582 *result = -error; 2594 *result = -error;
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
index 783977d3ea71..786eba3121c4 100644
--- a/fs/xfs/xfs_attr.h
+++ b/fs/xfs/xfs_attr.h
@@ -36,14 +36,13 @@
36 *========================================================================*/ 36 *========================================================================*/
37 37
38struct cred; 38struct cred;
39struct bhv_vnode;
40struct xfs_attr_list_context; 39struct xfs_attr_list_context;
41 40
42typedef int (*attrset_t)(struct bhv_vnode *, char *, void *, size_t, int); 41typedef int (*attrset_t)(bhv_vnode_t *, char *, void *, size_t, int);
43typedef int (*attrget_t)(struct bhv_vnode *, char *, void *, size_t, int); 42typedef int (*attrget_t)(bhv_vnode_t *, char *, void *, size_t, int);
44typedef int (*attrremove_t)(struct bhv_vnode *, char *, int); 43typedef int (*attrremove_t)(bhv_vnode_t *, char *, int);
45typedef int (*attrexists_t)(struct bhv_vnode *); 44typedef int (*attrexists_t)(bhv_vnode_t *);
46typedef int (*attrcapable_t)(struct bhv_vnode *, struct cred *); 45typedef int (*attrcapable_t)(bhv_vnode_t *, struct cred *);
47 46
48typedef struct attrnames { 47typedef struct attrnames {
49 char * attr_name; 48 char * attr_name;
@@ -64,7 +63,7 @@ extern struct attrnames attr_trusted;
64extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT]; 63extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT];
65 64
66extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int); 65extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int);
67extern int attr_generic_list(struct bhv_vnode *, void *, size_t, int, ssize_t *); 66extern int attr_generic_list(bhv_vnode_t *, void *, size_t, int, ssize_t *);
68 67
69#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */ 68#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */
70#define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */ 69#define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */
@@ -159,12 +158,8 @@ struct xfs_da_args;
159/* 158/*
160 * Overall external interface routines. 159 * Overall external interface routines.
161 */ 160 */
162int xfs_attr_get(bhv_desc_t *, const char *, char *, int *, int, struct cred *);
163int xfs_attr_set(bhv_desc_t *, const char *, char *, int, int, struct cred *);
164int xfs_attr_set_int(struct xfs_inode *, const char *, int, char *, int, int); 161int xfs_attr_set_int(struct xfs_inode *, const char *, int, char *, int, int);
165int xfs_attr_remove(bhv_desc_t *, const char *, int, struct cred *);
166int xfs_attr_remove_int(struct xfs_inode *, const char *, int, int); 162int xfs_attr_remove_int(struct xfs_inode *, const char *, int, int);
167int xfs_attr_list(bhv_desc_t *, char *, int, int, struct attrlist_cursor_kern *, struct cred *);
168int xfs_attr_list_int(struct xfs_attr_list_context *); 163int xfs_attr_list_int(struct xfs_attr_list_context *);
169int xfs_attr_inactive(struct xfs_inode *dp); 164int xfs_attr_inactive(struct xfs_inode *dp);
170 165
diff --git a/fs/xfs/xfs_behavior.c b/fs/xfs/xfs_behavior.c
deleted file mode 100644
index 0dc17219d412..000000000000
--- a/fs/xfs/xfs_behavior.c
+++ /dev/null
@@ -1,183 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include "xfs.h"
19
20/*
21 * Source file used to associate/disassociate behaviors with virtualized
22 * objects. See xfs_behavior.h for more information about behaviors, etc.
23 *
24 * The implementation is split between functions in this file and macros
25 * in xfs_behavior.h.
26 */
27
28/*
29 * Insert a new behavior descriptor into a behavior chain.
30 *
31 * The behavior chain is ordered based on the 'position' number which
32 * lives in the first field of the ops vector (higher numbers first).
33 *
34 * Attempts to insert duplicate ops result in an EINVAL return code.
35 * Otherwise, return 0 to indicate success.
36 */
37int
38bhv_insert(bhv_head_t *bhp, bhv_desc_t *bdp)
39{
40 bhv_desc_t *curdesc, *prev;
41 int position;
42
43 /*
44 * Validate the position value of the new behavior.
45 */
46 position = BHV_POSITION(bdp);
47 ASSERT(position >= BHV_POSITION_BASE && position <= BHV_POSITION_TOP);
48
49 /*
50 * Find location to insert behavior. Check for duplicates.
51 */
52 prev = NULL;
53 for (curdesc = bhp->bh_first;
54 curdesc != NULL;
55 curdesc = curdesc->bd_next) {
56
57 /* Check for duplication. */
58 if (curdesc->bd_ops == bdp->bd_ops) {
59 ASSERT(0);
60 return EINVAL;
61 }
62
63 /* Find correct position */
64 if (position >= BHV_POSITION(curdesc)) {
65 ASSERT(position != BHV_POSITION(curdesc));
66 break; /* found it */
67 }
68
69 prev = curdesc;
70 }
71
72 if (prev == NULL) {
73 /* insert at front of chain */
74 bdp->bd_next = bhp->bh_first;
75 bhp->bh_first = bdp;
76 } else {
77 /* insert after prev */
78 bdp->bd_next = prev->bd_next;
79 prev->bd_next = bdp;
80 }
81
82 return 0;
83}
84
85/*
86 * Remove a behavior descriptor from a position in a behavior chain;
87 * the position is guaranteed not to be the first position.
88 * Should only be called by the bhv_remove() macro.
89 */
90void
91bhv_remove_not_first(bhv_head_t *bhp, bhv_desc_t *bdp)
92{
93 bhv_desc_t *curdesc, *prev;
94
95 ASSERT(bhp->bh_first != NULL);
96 ASSERT(bhp->bh_first->bd_next != NULL);
97
98 prev = bhp->bh_first;
99 for (curdesc = bhp->bh_first->bd_next;
100 curdesc != NULL;
101 curdesc = curdesc->bd_next) {
102
103 if (curdesc == bdp)
104 break; /* found it */
105 prev = curdesc;
106 }
107
108 ASSERT(curdesc == bdp);
109 prev->bd_next = bdp->bd_next; /* remove from after prev */
110}
111
112/*
113 * Looks for the first behavior within a specified range of positions.
114 * Return the associated behavior descriptor. Or NULL, if none found.
115 */
116bhv_desc_t *
117bhv_lookup_range(bhv_head_t *bhp, int low, int high)
118{
119 bhv_desc_t *curdesc;
120
121 for (curdesc = bhp->bh_first;
122 curdesc != NULL;
123 curdesc = curdesc->bd_next) {
124
125 int position = BHV_POSITION(curdesc);
126
127 if (position <= high) {
128 if (position >= low)
129 return curdesc;
130 return NULL;
131 }
132 }
133
134 return NULL;
135}
136
137/*
138 * Return the base behavior in the chain, or NULL if the chain
139 * is empty.
140 *
141 * The caller has not read locked the behavior chain, so acquire the
142 * lock before traversing the chain.
143 */
144bhv_desc_t *
145bhv_base(bhv_head_t *bhp)
146{
147 bhv_desc_t *curdesc;
148
149 for (curdesc = bhp->bh_first;
150 curdesc != NULL;
151 curdesc = curdesc->bd_next) {
152
153 if (curdesc->bd_next == NULL) {
154 return curdesc;
155 }
156 }
157
158 return NULL;
159}
160
161void
162bhv_head_init(
163 bhv_head_t *bhp,
164 char *name)
165{
166 bhp->bh_first = NULL;
167}
168
169void
170bhv_insert_initial(
171 bhv_head_t *bhp,
172 bhv_desc_t *bdp)
173{
174 ASSERT(bhp->bh_first == NULL);
175 (bhp)->bh_first = bdp;
176}
177
178void
179bhv_head_destroy(
180 bhv_head_t *bhp)
181{
182 ASSERT(bhp->bh_first == NULL);
183}
diff --git a/fs/xfs/xfs_behavior.h b/fs/xfs/xfs_behavior.h
deleted file mode 100644
index e7ca1fed955a..000000000000
--- a/fs/xfs/xfs_behavior.h
+++ /dev/null
@@ -1,185 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_BEHAVIOR_H__
19#define __XFS_BEHAVIOR_H__
20
21/*
22 * Header file used to associate behaviors with virtualized objects.
23 *
24 * A virtualized object is an internal, virtualized representation of
25 * OS entities such as persistent files, processes, or sockets. Examples
26 * of virtualized objects include vnodes, vprocs, and vsockets. Often
27 * a virtualized object is referred to simply as an "object."
28 *
29 * A behavior is essentially an implementation layer associated with
30 * an object. Multiple behaviors for an object are chained together,
31 * the order of chaining determining the order of invocation. Each
32 * behavior of a given object implements the same set of interfaces
33 * (e.g., the VOP interfaces).
34 *
35 * Behaviors may be dynamically inserted into an object's behavior chain,
36 * such that the addition is transparent to consumers that already have
37 * references to the object. Typically, a given behavior will be inserted
38 * at a particular location in the behavior chain. Insertion of new
39 * behaviors is synchronized with operations-in-progress (oip's) so that
40 * the oip's always see a consistent view of the chain.
41 *
42 * The term "interposition" is used to refer to the act of inserting
43 * a behavior such that it interposes on (i.e., is inserted in front
44 * of) a particular other behavior. A key example of this is when a
45 * system implementing distributed single system image wishes to
46 * interpose a distribution layer (providing distributed coherency)
47 * in front of an object that is otherwise only accessed locally.
48 *
49 * Note that the traditional vnode/inode combination is simply a virtualized
50 * object that has exactly one associated behavior.
51 *
52 * Behavior synchronization is logic which is necessary under certain
53 * circumstances that there is no conflict between ongoing operations
54 * traversing the behavior chain and those dynamically modifying the
55 * behavior chain. Because behavior synchronization adds extra overhead
56 * to virtual operation invocation, we want to restrict, as much as
57 * we can, the requirement for this extra code, to those situations
58 * in which it is truly necessary.
59 *
60 * Behavior synchronization is needed whenever there's at least one class
61 * of object in the system for which:
62 * 1) multiple behaviors for a given object are supported,
63 * -- AND --
64 * 2a) insertion of a new behavior can happen dynamically at any time during
65 * the life of an active object,
66 * -- AND --
67 * 3a) insertion of a new behavior needs to synchronize with existing
68 * ops-in-progress.
69 * -- OR --
70 * 3b) multiple different behaviors can be dynamically inserted at
71 * any time during the life of an active object
72 * -- OR --
73 * 3c) removal of a behavior can occur at any time during the life of
74 * an active object.
75 * -- OR --
76 * 2b) removal of a behavior can occur at any time during the life of an
77 * active object
78 *
79 */
80
81/*
82 * Behavior head. Head of the chain of behaviors.
83 * Contained within each virtualized object data structure.
84 */
85typedef struct bhv_head {
86 struct bhv_desc *bh_first; /* first behavior in chain */
87} bhv_head_t;
88
89/*
90 * Behavior descriptor. Descriptor associated with each behavior.
91 * Contained within the behavior's private data structure.
92 */
93typedef struct bhv_desc {
94 void *bd_pdata; /* private data for this behavior */
95 void *bd_vobj; /* virtual object associated with */
96 void *bd_ops; /* ops for this behavior */
97 struct bhv_desc *bd_next; /* next behavior in chain */
98} bhv_desc_t;
99
100/*
101 * Behavior identity field. A behavior's identity determines the position
102 * where it lives within a behavior chain, and it's always the first field
103 * of the behavior's ops vector. The optional id field further identifies the
104 * subsystem responsible for the behavior.
105 */
106typedef struct bhv_identity {
107 __u16 bi_id; /* owning subsystem id */
108 __u16 bi_position; /* position in chain */
109} bhv_identity_t;
110
111typedef bhv_identity_t bhv_position_t;
112
113#define BHV_IDENTITY_INIT(id,pos) {id, pos}
114#define BHV_IDENTITY_INIT_POSITION(pos) BHV_IDENTITY_INIT(0, pos)
115
116/*
117 * Define boundaries of position values.
118 */
119#define BHV_POSITION_INVALID 0 /* invalid position number */
120#define BHV_POSITION_BASE 1 /* base (last) implementation layer */
121#define BHV_POSITION_TOP 63 /* top (first) implementation layer */
122
123/*
124 * Plumbing macros.
125 */
126#define BHV_HEAD_FIRST(bhp) (ASSERT((bhp)->bh_first), (bhp)->bh_first)
127#define BHV_NEXT(bdp) (ASSERT((bdp)->bd_next), (bdp)->bd_next)
128#define BHV_NEXTNULL(bdp) ((bdp)->bd_next)
129#define BHV_VOBJ(bdp) (ASSERT((bdp)->bd_vobj), (bdp)->bd_vobj)
130#define BHV_VOBJNULL(bdp) ((bdp)->bd_vobj)
131#define BHV_PDATA(bdp) (bdp)->bd_pdata
132#define BHV_OPS(bdp) (bdp)->bd_ops
133#define BHV_IDENTITY(bdp) ((bhv_identity_t *)(bdp)->bd_ops)
134#define BHV_POSITION(bdp) (BHV_IDENTITY(bdp)->bi_position)
135
136extern void bhv_head_init(bhv_head_t *, char *);
137extern void bhv_head_destroy(bhv_head_t *);
138extern int bhv_insert(bhv_head_t *, bhv_desc_t *);
139extern void bhv_insert_initial(bhv_head_t *, bhv_desc_t *);
140
141/*
142 * Initialize a new behavior descriptor.
143 * Arguments:
144 * bdp - pointer to behavior descriptor
145 * pdata - pointer to behavior's private data
146 * vobj - pointer to associated virtual object
147 * ops - pointer to ops for this behavior
148 */
149#define bhv_desc_init(bdp, pdata, vobj, ops) \
150 { \
151 (bdp)->bd_pdata = pdata; \
152 (bdp)->bd_vobj = vobj; \
153 (bdp)->bd_ops = ops; \
154 (bdp)->bd_next = NULL; \
155 }
156
157/*
158 * Remove a behavior descriptor from a behavior chain.
159 */
160#define bhv_remove(bhp, bdp) \
161 { \
162 if ((bhp)->bh_first == (bdp)) { \
163 /* \
164 * Remove from front of chain. \
165 * Atomic wrt oip's. \
166 */ \
167 (bhp)->bh_first = (bdp)->bd_next; \
168 } else { \
169 /* remove from non-front of chain */ \
170 bhv_remove_not_first(bhp, bdp); \
171 } \
172 (bdp)->bd_vobj = NULL; \
173 }
174
175/*
176 * Behavior module prototypes.
177 */
178extern void bhv_remove_not_first(bhv_head_t *bhp, bhv_desc_t *bdp);
179extern bhv_desc_t * bhv_lookup_range(bhv_head_t *bhp, int low, int high);
180extern bhv_desc_t * bhv_base(bhv_head_t *bhp);
181
182/* No bhv locking on Linux */
183#define bhv_base_unlocked bhv_base
184
185#endif /* __XFS_BEHAVIOR_H__ */
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 94b5c5fe2681..2e9b34b7344b 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -53,6 +53,7 @@
53#include "xfs_trans_space.h" 53#include "xfs_trans_space.h"
54#include "xfs_buf_item.h" 54#include "xfs_buf_item.h"
55#include "xfs_filestream.h" 55#include "xfs_filestream.h"
56#include "xfs_vnodeops.h"
56 57
57 58
58#ifdef DEBUG 59#ifdef DEBUG
@@ -248,7 +249,7 @@ xfs_bmap_local_to_extents(
248 * Else, *lastxp will be set to the index of the found 249 * Else, *lastxp will be set to the index of the found
249 * entry; *gotp will contain the entry. 250 * entry; *gotp will contain the entry.
250 */ 251 */
251STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ 252STATIC xfs_bmbt_rec_host_t * /* pointer to found extent entry */
252xfs_bmap_search_extents( 253xfs_bmap_search_extents(
253 xfs_inode_t *ip, /* incore inode pointer */ 254 xfs_inode_t *ip, /* incore inode pointer */
254 xfs_fileoff_t bno, /* block number searched for */ 255 xfs_fileoff_t bno, /* block number searched for */
@@ -273,21 +274,6 @@ xfs_bmap_isaeof(
273 274
274#ifdef XFS_BMAP_TRACE 275#ifdef XFS_BMAP_TRACE
275/* 276/*
276 * Add a bmap trace buffer entry. Base routine for the others.
277 */
278STATIC void
279xfs_bmap_trace_addentry(
280 int opcode, /* operation */
281 const char *fname, /* function name */
282 char *desc, /* operation description */
283 xfs_inode_t *ip, /* incore inode pointer */
284 xfs_extnum_t idx, /* index of entry(ies) */
285 xfs_extnum_t cnt, /* count of entries, 1 or 2 */
286 xfs_bmbt_rec_t *r1, /* first record */
287 xfs_bmbt_rec_t *r2, /* second record or null */
288 int whichfork); /* data or attr fork */
289
290/*
291 * Add bmap trace entry prior to a call to xfs_iext_remove. 277 * Add bmap trace entry prior to a call to xfs_iext_remove.
292 */ 278 */
293STATIC void 279STATIC void
@@ -714,7 +700,7 @@ xfs_bmap_add_extent_delay_real(
714{ 700{
715 xfs_btree_cur_t *cur; /* btree cursor */ 701 xfs_btree_cur_t *cur; /* btree cursor */
716 int diff; /* temp value */ 702 int diff; /* temp value */
717 xfs_bmbt_rec_t *ep; /* extent entry for idx */ 703 xfs_bmbt_rec_host_t *ep; /* extent entry for idx */
718 int error; /* error return value */ 704 int error; /* error return value */
719 int i; /* temp state */ 705 int i; /* temp state */
720 xfs_ifork_t *ifp; /* inode fork pointer */ 706 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -1270,7 +1256,7 @@ xfs_bmap_add_extent_unwritten_real(
1270 xfs_extdelta_t *delta) /* Change made to incore extents */ 1256 xfs_extdelta_t *delta) /* Change made to incore extents */
1271{ 1257{
1272 xfs_btree_cur_t *cur; /* btree cursor */ 1258 xfs_btree_cur_t *cur; /* btree cursor */
1273 xfs_bmbt_rec_t *ep; /* extent entry for idx */ 1259 xfs_bmbt_rec_host_t *ep; /* extent entry for idx */
1274 int error; /* error return value */ 1260 int error; /* error return value */
1275 int i; /* temp state */ 1261 int i; /* temp state */
1276 xfs_ifork_t *ifp; /* inode fork pointer */ 1262 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -1823,7 +1809,7 @@ xfs_bmap_add_extent_hole_delay(
1823 xfs_extdelta_t *delta, /* Change made to incore extents */ 1809 xfs_extdelta_t *delta, /* Change made to incore extents */
1824 int rsvd) /* OK to allocate reserved blocks */ 1810 int rsvd) /* OK to allocate reserved blocks */
1825{ 1811{
1826 xfs_bmbt_rec_t *ep; /* extent record for idx */ 1812 xfs_bmbt_rec_host_t *ep; /* extent record for idx */
1827 xfs_ifork_t *ifp; /* inode fork pointer */ 1813 xfs_ifork_t *ifp; /* inode fork pointer */
1828 xfs_bmbt_irec_t left; /* left neighbor extent entry */ 1814 xfs_bmbt_irec_t left; /* left neighbor extent entry */
1829 xfs_filblks_t newlen=0; /* new indirect size */ 1815 xfs_filblks_t newlen=0; /* new indirect size */
@@ -2012,7 +1998,7 @@ xfs_bmap_add_extent_hole_real(
2012 xfs_extdelta_t *delta, /* Change made to incore extents */ 1998 xfs_extdelta_t *delta, /* Change made to incore extents */
2013 int whichfork) /* data or attr fork */ 1999 int whichfork) /* data or attr fork */
2014{ 2000{
2015 xfs_bmbt_rec_t *ep; /* pointer to extent entry ins. point */ 2001 xfs_bmbt_rec_host_t *ep; /* pointer to extent entry ins. point */
2016 int error; /* error return value */ 2002 int error; /* error return value */
2017 int i; /* temp state */ 2003 int i; /* temp state */
2018 xfs_ifork_t *ifp; /* inode fork pointer */ 2004 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -3070,7 +3056,7 @@ xfs_bmap_del_extent(
3070 xfs_fileoff_t del_endoff; /* first offset past del */ 3056 xfs_fileoff_t del_endoff; /* first offset past del */
3071 int delay; /* current block is delayed allocated */ 3057 int delay; /* current block is delayed allocated */
3072 int do_fx; /* free extent at end of routine */ 3058 int do_fx; /* free extent at end of routine */
3073 xfs_bmbt_rec_t *ep; /* current extent entry pointer */ 3059 xfs_bmbt_rec_host_t *ep; /* current extent entry pointer */
3074 int error; /* error return value */ 3060 int error; /* error return value */
3075 int flags; /* inode logging flags */ 3061 int flags; /* inode logging flags */
3076 xfs_bmbt_irec_t got; /* current extent entry */ 3062 xfs_bmbt_irec_t got; /* current extent entry */
@@ -3418,7 +3404,7 @@ xfs_bmap_extents_to_btree(
3418 xfs_bmbt_rec_t *arp; /* child record pointer */ 3404 xfs_bmbt_rec_t *arp; /* child record pointer */
3419 xfs_bmbt_block_t *block; /* btree root block */ 3405 xfs_bmbt_block_t *block; /* btree root block */
3420 xfs_btree_cur_t *cur; /* bmap btree cursor */ 3406 xfs_btree_cur_t *cur; /* bmap btree cursor */
3421 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3407 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
3422 int error; /* error return value */ 3408 int error; /* error return value */
3423 xfs_extnum_t i, cnt; /* extent record index */ 3409 xfs_extnum_t i, cnt; /* extent record index */
3424 xfs_ifork_t *ifp; /* inode fork pointer */ 3410 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -3507,8 +3493,8 @@ xfs_bmap_extents_to_btree(
3507 for (cnt = i = 0; i < nextents; i++) { 3493 for (cnt = i = 0; i < nextents; i++) {
3508 ep = xfs_iext_get_ext(ifp, i); 3494 ep = xfs_iext_get_ext(ifp, i);
3509 if (!ISNULLSTARTBLOCK(xfs_bmbt_get_startblock(ep))) { 3495 if (!ISNULLSTARTBLOCK(xfs_bmbt_get_startblock(ep))) {
3510 arp->l0 = INT_GET(ep->l0, ARCH_CONVERT); 3496 arp->l0 = cpu_to_be64(ep->l0);
3511 arp->l1 = INT_GET(ep->l1, ARCH_CONVERT); 3497 arp->l1 = cpu_to_be64(ep->l1);
3512 arp++; cnt++; 3498 arp++; cnt++;
3513 } 3499 }
3514 } 3500 }
@@ -3590,7 +3576,7 @@ xfs_bmap_local_to_extents(
3590 if (ifp->if_bytes) { 3576 if (ifp->if_bytes) {
3591 xfs_alloc_arg_t args; /* allocation arguments */ 3577 xfs_alloc_arg_t args; /* allocation arguments */
3592 xfs_buf_t *bp; /* buffer for extent block */ 3578 xfs_buf_t *bp; /* buffer for extent block */
3593 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3579 xfs_bmbt_rec_host_t *ep;/* extent record pointer */
3594 3580
3595 args.tp = tp; 3581 args.tp = tp;
3596 args.mp = ip->i_mount; 3582 args.mp = ip->i_mount;
@@ -3655,7 +3641,7 @@ done:
3655 * entry (null if none). Else, *lastxp will be set to the index 3641 * entry (null if none). Else, *lastxp will be set to the index
3656 * of the found entry; *gotp will contain the entry. 3642 * of the found entry; *gotp will contain the entry.
3657 */ 3643 */
3658xfs_bmbt_rec_t * /* pointer to found extent entry */ 3644xfs_bmbt_rec_host_t * /* pointer to found extent entry */
3659xfs_bmap_search_multi_extents( 3645xfs_bmap_search_multi_extents(
3660 xfs_ifork_t *ifp, /* inode fork pointer */ 3646 xfs_ifork_t *ifp, /* inode fork pointer */
3661 xfs_fileoff_t bno, /* block number searched for */ 3647 xfs_fileoff_t bno, /* block number searched for */
@@ -3664,7 +3650,7 @@ xfs_bmap_search_multi_extents(
3664 xfs_bmbt_irec_t *gotp, /* out: extent entry found */ 3650 xfs_bmbt_irec_t *gotp, /* out: extent entry found */
3665 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ 3651 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
3666{ 3652{
3667 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3653 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
3668 xfs_extnum_t lastx; /* last extent index */ 3654 xfs_extnum_t lastx; /* last extent index */
3669 3655
3670 /* 3656 /*
@@ -3706,7 +3692,7 @@ xfs_bmap_search_multi_extents(
3706 * Else, *lastxp will be set to the index of the found 3692 * Else, *lastxp will be set to the index of the found
3707 * entry; *gotp will contain the entry. 3693 * entry; *gotp will contain the entry.
3708 */ 3694 */
3709STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ 3695STATIC xfs_bmbt_rec_host_t * /* pointer to found extent entry */
3710xfs_bmap_search_extents( 3696xfs_bmap_search_extents(
3711 xfs_inode_t *ip, /* incore inode pointer */ 3697 xfs_inode_t *ip, /* incore inode pointer */
3712 xfs_fileoff_t bno, /* block number searched for */ 3698 xfs_fileoff_t bno, /* block number searched for */
@@ -3717,7 +3703,7 @@ xfs_bmap_search_extents(
3717 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ 3703 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
3718{ 3704{
3719 xfs_ifork_t *ifp; /* inode fork pointer */ 3705 xfs_ifork_t *ifp; /* inode fork pointer */
3720 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3706 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
3721 3707
3722 XFS_STATS_INC(xs_look_exlist); 3708 XFS_STATS_INC(xs_look_exlist);
3723 ifp = XFS_IFORK_PTR(ip, fork); 3709 ifp = XFS_IFORK_PTR(ip, fork);
@@ -3757,11 +3743,11 @@ xfs_bmap_trace_addentry(
3757 xfs_inode_t *ip, /* incore inode pointer */ 3743 xfs_inode_t *ip, /* incore inode pointer */
3758 xfs_extnum_t idx, /* index of entry(ies) */ 3744 xfs_extnum_t idx, /* index of entry(ies) */
3759 xfs_extnum_t cnt, /* count of entries, 1 or 2 */ 3745 xfs_extnum_t cnt, /* count of entries, 1 or 2 */
3760 xfs_bmbt_rec_t *r1, /* first record */ 3746 xfs_bmbt_rec_host_t *r1, /* first record */
3761 xfs_bmbt_rec_t *r2, /* second record or null */ 3747 xfs_bmbt_rec_host_t *r2, /* second record or null */
3762 int whichfork) /* data or attr fork */ 3748 int whichfork) /* data or attr fork */
3763{ 3749{
3764 xfs_bmbt_rec_t tr2; 3750 xfs_bmbt_rec_host_t tr2;
3765 3751
3766 ASSERT(cnt == 1 || cnt == 2); 3752 ASSERT(cnt == 1 || cnt == 2);
3767 ASSERT(r1 != NULL); 3753 ASSERT(r1 != NULL);
@@ -3842,8 +3828,8 @@ xfs_bmap_trace_insert(
3842 xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ 3828 xfs_bmbt_irec_t *r2, /* inserted record 2 or null */
3843 int whichfork) /* data or attr fork */ 3829 int whichfork) /* data or attr fork */
3844{ 3830{
3845 xfs_bmbt_rec_t tr1; /* compressed record 1 */ 3831 xfs_bmbt_rec_host_t tr1; /* compressed record 1 */
3846 xfs_bmbt_rec_t tr2; /* compressed record 2 if needed */ 3832 xfs_bmbt_rec_host_t tr2; /* compressed record 2 if needed */
3847 3833
3848 xfs_bmbt_set_all(&tr1, r1); 3834 xfs_bmbt_set_all(&tr1, r1);
3849 if (cnt == 2) { 3835 if (cnt == 2) {
@@ -4316,7 +4302,6 @@ xfs_bmap_first_unused(
4316 xfs_fileoff_t *first_unused, /* unused block */ 4302 xfs_fileoff_t *first_unused, /* unused block */
4317 int whichfork) /* data or attr fork */ 4303 int whichfork) /* data or attr fork */
4318{ 4304{
4319 xfs_bmbt_rec_t *ep; /* pointer to an extent entry */
4320 int error; /* error return value */ 4305 int error; /* error return value */
4321 int idx; /* extent record index */ 4306 int idx; /* extent record index */
4322 xfs_ifork_t *ifp; /* inode fork pointer */ 4307 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -4340,7 +4325,7 @@ xfs_bmap_first_unused(
4340 lowest = *first_unused; 4325 lowest = *first_unused;
4341 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); 4326 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
4342 for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) { 4327 for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) {
4343 ep = xfs_iext_get_ext(ifp, idx); 4328 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
4344 off = xfs_bmbt_get_startoff(ep); 4329 off = xfs_bmbt_get_startoff(ep);
4345 /* 4330 /*
4346 * See if the hole before this extent will work. 4331 * See if the hole before this extent will work.
@@ -4371,7 +4356,7 @@ xfs_bmap_last_before(
4371{ 4356{
4372 xfs_fileoff_t bno; /* input file offset */ 4357 xfs_fileoff_t bno; /* input file offset */
4373 int eof; /* hit end of file */ 4358 int eof; /* hit end of file */
4374 xfs_bmbt_rec_t *ep; /* pointer to last extent */ 4359 xfs_bmbt_rec_host_t *ep; /* pointer to last extent */
4375 int error; /* error return value */ 4360 int error; /* error return value */
4376 xfs_bmbt_irec_t got; /* current extent value */ 4361 xfs_bmbt_irec_t got; /* current extent value */
4377 xfs_ifork_t *ifp; /* inode fork pointer */ 4362 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -4417,7 +4402,7 @@ xfs_bmap_last_offset(
4417 xfs_fileoff_t *last_block, /* last block */ 4402 xfs_fileoff_t *last_block, /* last block */
4418 int whichfork) /* data or attr fork */ 4403 int whichfork) /* data or attr fork */
4419{ 4404{
4420 xfs_bmbt_rec_t *ep; /* pointer to last extent */ 4405 xfs_bmbt_rec_host_t *ep; /* pointer to last extent */
4421 int error; /* error return value */ 4406 int error; /* error return value */
4422 xfs_ifork_t *ifp; /* inode fork pointer */ 4407 xfs_ifork_t *ifp; /* inode fork pointer */
4423 xfs_extnum_t nextents; /* number of extent entries */ 4408 xfs_extnum_t nextents; /* number of extent entries */
@@ -4454,7 +4439,7 @@ xfs_bmap_one_block(
4454 xfs_inode_t *ip, /* incore inode */ 4439 xfs_inode_t *ip, /* incore inode */
4455 int whichfork) /* data or attr fork */ 4440 int whichfork) /* data or attr fork */
4456{ 4441{
4457 xfs_bmbt_rec_t *ep; /* ptr to fork's extent */ 4442 xfs_bmbt_rec_host_t *ep; /* ptr to fork's extent */
4458 xfs_ifork_t *ifp; /* inode fork pointer */ 4443 xfs_ifork_t *ifp; /* inode fork pointer */
4459 int rval; /* return value */ 4444 int rval; /* return value */
4460 xfs_bmbt_irec_t s; /* internal version of extent */ 4445 xfs_bmbt_irec_t s; /* internal version of extent */
@@ -4549,7 +4534,7 @@ xfs_bmap_read_extents(
4549 * Loop over all leaf nodes. Copy information to the extent records. 4534 * Loop over all leaf nodes. Copy information to the extent records.
4550 */ 4535 */
4551 for (;;) { 4536 for (;;) {
4552 xfs_bmbt_rec_t *frp, *trp; 4537 xfs_bmbt_rec_t *frp;
4553 xfs_fsblock_t nextbno; 4538 xfs_fsblock_t nextbno;
4554 xfs_extnum_t num_recs; 4539 xfs_extnum_t num_recs;
4555 xfs_extnum_t start; 4540 xfs_extnum_t start;
@@ -4581,9 +4566,9 @@ xfs_bmap_read_extents(
4581 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1); 4566 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1);
4582 start = i; 4567 start = i;
4583 for (j = 0; j < num_recs; j++, i++, frp++) { 4568 for (j = 0; j < num_recs; j++, i++, frp++) {
4584 trp = xfs_iext_get_ext(ifp, i); 4569 xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i);
4585 trp->l0 = INT_GET(frp->l0, ARCH_CONVERT); 4570 trp->l0 = be64_to_cpu(frp->l0);
4586 trp->l1 = INT_GET(frp->l1, ARCH_CONVERT); 4571 trp->l1 = be64_to_cpu(frp->l1);
4587 } 4572 }
4588 if (exntf == XFS_EXTFMT_NOSTATE) { 4573 if (exntf == XFS_EXTFMT_NOSTATE) {
4589 /* 4574 /*
@@ -4631,7 +4616,7 @@ xfs_bmap_trace_exlist(
4631 xfs_extnum_t cnt, /* count of entries in the list */ 4616 xfs_extnum_t cnt, /* count of entries in the list */
4632 int whichfork) /* data or attr fork */ 4617 int whichfork) /* data or attr fork */
4633{ 4618{
4634 xfs_bmbt_rec_t *ep; /* current extent record */ 4619 xfs_bmbt_rec_host_t *ep; /* current extent record */
4635 xfs_extnum_t idx; /* extent record index */ 4620 xfs_extnum_t idx; /* extent record index */
4636 xfs_ifork_t *ifp; /* inode fork pointer */ 4621 xfs_ifork_t *ifp; /* inode fork pointer */
4637 xfs_bmbt_irec_t s; /* file extent record */ 4622 xfs_bmbt_irec_t s; /* file extent record */
@@ -4727,7 +4712,7 @@ xfs_bmapi(
4727 xfs_btree_cur_t *cur; /* bmap btree cursor */ 4712 xfs_btree_cur_t *cur; /* bmap btree cursor */
4728 xfs_fileoff_t end; /* end of mapped file region */ 4713 xfs_fileoff_t end; /* end of mapped file region */
4729 int eof; /* we've hit the end of extents */ 4714 int eof; /* we've hit the end of extents */
4730 xfs_bmbt_rec_t *ep; /* extent record pointer */ 4715 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
4731 int error; /* error return */ 4716 int error; /* error return */
4732 xfs_bmbt_irec_t got; /* current file extent record */ 4717 xfs_bmbt_irec_t got; /* current file extent record */
4733 xfs_ifork_t *ifp; /* inode fork pointer */ 4718 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -5378,7 +5363,7 @@ xfs_bunmapi(
5378 xfs_btree_cur_t *cur; /* bmap btree cursor */ 5363 xfs_btree_cur_t *cur; /* bmap btree cursor */
5379 xfs_bmbt_irec_t del; /* extent being deleted */ 5364 xfs_bmbt_irec_t del; /* extent being deleted */
5380 int eof; /* is deleting at eof */ 5365 int eof; /* is deleting at eof */
5381 xfs_bmbt_rec_t *ep; /* extent record pointer */ 5366 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
5382 int error; /* error return value */ 5367 int error; /* error return value */
5383 xfs_extnum_t extno; /* extent number in list */ 5368 xfs_extnum_t extno; /* extent number in list */
5384 xfs_bmbt_irec_t got; /* current extent record */ 5369 xfs_bmbt_irec_t got; /* current extent record */
@@ -5743,11 +5728,44 @@ error0:
5743} 5728}
5744 5729
5745/* 5730/*
5731 * returns 1 for success, 0 if we failed to map the extent.
5732 */
5733STATIC int
5734xfs_getbmapx_fix_eof_hole(
5735 xfs_inode_t *ip, /* xfs incore inode pointer */
5736 struct getbmap *out, /* output structure */
5737 int prealloced, /* this is a file with
5738 * preallocated data space */
5739 __int64_t end, /* last block requested */
5740 xfs_fsblock_t startblock)
5741{
5742 __int64_t fixlen;
5743 xfs_mount_t *mp; /* file system mount point */
5744
5745 if (startblock == HOLESTARTBLOCK) {
5746 mp = ip->i_mount;
5747 out->bmv_block = -1;
5748 fixlen = XFS_FSB_TO_BB(mp, XFS_B_TO_FSB(mp, ip->i_size));
5749 fixlen -= out->bmv_offset;
5750 if (prealloced && out->bmv_offset + out->bmv_length == end) {
5751 /* Came to hole at EOF. Trim it. */
5752 if (fixlen <= 0)
5753 return 0;
5754 out->bmv_length = fixlen;
5755 }
5756 } else {
5757 out->bmv_block = XFS_FSB_TO_DB(ip, startblock);
5758 }
5759
5760 return 1;
5761}
5762
5763/*
5746 * Fcntl interface to xfs_bmapi. 5764 * Fcntl interface to xfs_bmapi.
5747 */ 5765 */
5748int /* error code */ 5766int /* error code */
5749xfs_getbmap( 5767xfs_getbmap(
5750 bhv_desc_t *bdp, /* XFS behavior descriptor*/ 5768 xfs_inode_t *ip,
5751 struct getbmap *bmv, /* user bmap structure */ 5769 struct getbmap *bmv, /* user bmap structure */
5752 void __user *ap, /* pointer to user's array */ 5770 void __user *ap, /* pointer to user's array */
5753 int interface) /* interface flags */ 5771 int interface) /* interface flags */
@@ -5756,7 +5774,6 @@ xfs_getbmap(
5756 int error; /* return value */ 5774 int error; /* return value */
5757 __int64_t fixlen; /* length for -1 case */ 5775 __int64_t fixlen; /* length for -1 case */
5758 int i; /* extent number */ 5776 int i; /* extent number */
5759 xfs_inode_t *ip; /* xfs incore inode pointer */
5760 bhv_vnode_t *vp; /* corresponding vnode */ 5777 bhv_vnode_t *vp; /* corresponding vnode */
5761 int lock; /* lock state */ 5778 int lock; /* lock state */
5762 xfs_bmbt_irec_t *map; /* buffer for user's data */ 5779 xfs_bmbt_irec_t *map; /* buffer for user's data */
@@ -5774,8 +5791,7 @@ xfs_getbmap(
5774 int bmapi_flags; /* flags for xfs_bmapi */ 5791 int bmapi_flags; /* flags for xfs_bmapi */
5775 __int32_t oflags; /* getbmapx bmv_oflags field */ 5792 __int32_t oflags; /* getbmapx bmv_oflags field */
5776 5793
5777 vp = BHV_TO_VNODE(bdp); 5794 vp = XFS_ITOV(ip);
5778 ip = XFS_BHVTOI(bdp);
5779 mp = ip->i_mount; 5795 mp = ip->i_mount;
5780 5796
5781 whichfork = interface & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK; 5797 whichfork = interface & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK;
@@ -5794,10 +5810,9 @@ xfs_getbmap(
5794 * could misinterpret holes in a DMAPI file as true holes, 5810 * could misinterpret holes in a DMAPI file as true holes,
5795 * when in fact they may represent offline user data. 5811 * when in fact they may represent offline user data.
5796 */ 5812 */
5797 if ( (interface & BMV_IF_NO_DMAPI_READ) == 0 5813 if ((interface & BMV_IF_NO_DMAPI_READ) == 0 &&
5798 && DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) 5814 DM_EVENT_ENABLED(ip, DM_EVENT_READ) &&
5799 && whichfork == XFS_DATA_FORK) { 5815 whichfork == XFS_DATA_FORK) {
5800
5801 error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, 0, 0, 0, NULL); 5816 error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, 0, 0, 0, NULL);
5802 if (error) 5817 if (error)
5803 return XFS_ERROR(error); 5818 return XFS_ERROR(error);
@@ -5854,7 +5869,8 @@ xfs_getbmap(
5854 if (whichfork == XFS_DATA_FORK && 5869 if (whichfork == XFS_DATA_FORK &&
5855 (ip->i_delayed_blks || ip->i_size > ip->i_d.di_size)) { 5870 (ip->i_delayed_blks || ip->i_size > ip->i_d.di_size)) {
5856 /* xfs_fsize_t last_byte = xfs_file_last_byte(ip); */ 5871 /* xfs_fsize_t last_byte = xfs_file_last_byte(ip); */
5857 error = bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF); 5872 error = xfs_flush_pages(ip, (xfs_off_t)0,
5873 -1, 0, FI_REMAPF);
5858 } 5874 }
5859 5875
5860 ASSERT(whichfork == XFS_ATTR_FORK || ip->i_delayed_blks == 0); 5876 ASSERT(whichfork == XFS_ATTR_FORK || ip->i_delayed_blks == 0);
@@ -5904,18 +5920,15 @@ xfs_getbmap(
5904 out.bmv_length = XFS_FSB_TO_BB(mp, map[i].br_blockcount); 5920 out.bmv_length = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
5905 ASSERT(map[i].br_startblock != DELAYSTARTBLOCK); 5921 ASSERT(map[i].br_startblock != DELAYSTARTBLOCK);
5906 if (map[i].br_startblock == HOLESTARTBLOCK && 5922 if (map[i].br_startblock == HOLESTARTBLOCK &&
5907 ((prealloced && out.bmv_offset + out.bmv_length == bmvend) || 5923 whichfork == XFS_ATTR_FORK) {
5908 whichfork == XFS_ATTR_FORK )) { 5924 /* came to the end of attribute fork */
5909 /*
5910 * came to hole at end of file or the end of
5911 attribute fork
5912 */
5913 goto unlock_and_return; 5925 goto unlock_and_return;
5914 } else { 5926 } else {
5915 out.bmv_block = 5927 if (!xfs_getbmapx_fix_eof_hole(ip, &out,
5916 (map[i].br_startblock == HOLESTARTBLOCK) ? 5928 prealloced, bmvend,
5917 -1 : 5929 map[i].br_startblock)) {
5918 XFS_FSB_TO_DB(ip, map[i].br_startblock); 5930 goto unlock_and_return;
5931 }
5919 5932
5920 /* return either getbmap/getbmapx structure. */ 5933 /* return either getbmap/getbmapx structure. */
5921 if (interface & BMV_IF_EXTENDED) { 5934 if (interface & BMV_IF_EXTENDED) {
@@ -5974,7 +5987,7 @@ xfs_bmap_isaeof(
5974{ 5987{
5975 int error; /* error return value */ 5988 int error; /* error return value */
5976 xfs_ifork_t *ifp; /* inode fork pointer */ 5989 xfs_ifork_t *ifp; /* inode fork pointer */
5977 xfs_bmbt_rec_t *lastrec; /* extent record pointer */ 5990 xfs_bmbt_rec_host_t *lastrec; /* extent record pointer */
5978 xfs_extnum_t nextents; /* number of file extents */ 5991 xfs_extnum_t nextents; /* number of file extents */
5979 xfs_bmbt_irec_t s; /* expanded extent record */ 5992 xfs_bmbt_irec_t s; /* expanded extent record */
5980 5993
@@ -6018,7 +6031,7 @@ xfs_bmap_eof(
6018 xfs_fsblock_t blockcount; /* extent block count */ 6031 xfs_fsblock_t blockcount; /* extent block count */
6019 int error; /* error return value */ 6032 int error; /* error return value */
6020 xfs_ifork_t *ifp; /* inode fork pointer */ 6033 xfs_ifork_t *ifp; /* inode fork pointer */
6021 xfs_bmbt_rec_t *lastrec; /* extent record pointer */ 6034 xfs_bmbt_rec_host_t *lastrec; /* extent record pointer */
6022 xfs_extnum_t nextents; /* number of file extents */ 6035 xfs_extnum_t nextents; /* number of file extents */
6023 xfs_fileoff_t startoff; /* extent starting file offset */ 6036 xfs_fileoff_t startoff; /* extent starting file offset */
6024 6037
@@ -6465,10 +6478,9 @@ xfs_bmap_count_leaves(
6465 int *count) 6478 int *count)
6466{ 6479{
6467 int b; 6480 int b;
6468 xfs_bmbt_rec_t *frp;
6469 6481
6470 for (b = 0; b < numrecs; b++) { 6482 for (b = 0; b < numrecs; b++) {
6471 frp = xfs_iext_get_ext(ifp, idx + b); 6483 xfs_bmbt_rec_host_t *frp = xfs_iext_get_ext(ifp, idx + b);
6472 *count += xfs_bmbt_get_blockcount(frp); 6484 *count += xfs_bmbt_get_blockcount(frp);
6473 } 6485 }
6474 return 0; 6486 return 0;
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index 524b1c9d5246..68267d75ff19 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -335,7 +335,7 @@ xfs_bunmapi(
335 */ 335 */
336int /* error code */ 336int /* error code */
337xfs_getbmap( 337xfs_getbmap(
338 bhv_desc_t *bdp, /* XFS behavior descriptor*/ 338 xfs_inode_t *ip,
339 struct getbmap *bmv, /* user bmap structure */ 339 struct getbmap *bmv, /* user bmap structure */
340 void __user *ap, /* pointer to user's array */ 340 void __user *ap, /* pointer to user's array */
341 int iflags); /* interface flags */ 341 int iflags); /* interface flags */
@@ -378,7 +378,7 @@ xfs_check_nostate_extents(
378 * entry (null if none). Else, *lastxp will be set to the index 378 * entry (null if none). Else, *lastxp will be set to the index
379 * of the found entry; *gotp will contain the entry. 379 * of the found entry; *gotp will contain the entry.
380 */ 380 */
381xfs_bmbt_rec_t * 381xfs_bmbt_rec_host_t *
382xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *, 382xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *,
383 xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); 383 xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
384 384
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 89b891f51cfb..32b49ec00fb5 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -260,13 +260,14 @@ xfs_bmbt_trace_cursor(
260 char *s, 260 char *s,
261 int line) 261 int line)
262{ 262{
263 xfs_bmbt_rec_t r; 263 xfs_bmbt_rec_host_t r;
264 264
265 xfs_bmbt_set_all(&r, &cur->bc_rec.b); 265 xfs_bmbt_set_all(&r, &cur->bc_rec.b);
266 xfs_bmbt_trace_enter(func, cur, s, XFS_BMBT_KTRACE_CUR, line, 266 xfs_bmbt_trace_enter(func, cur, s, XFS_BMBT_KTRACE_CUR, line,
267 (cur->bc_nlevels << 24) | (cur->bc_private.b.flags << 16) | 267 (cur->bc_nlevels << 24) | (cur->bc_private.b.flags << 16) |
268 cur->bc_private.b.allocated, 268 cur->bc_private.b.allocated,
269 INT_GET(r.l0, ARCH_CONVERT) >> 32, (int)INT_GET(r.l0, ARCH_CONVERT), INT_GET(r.l1, ARCH_CONVERT) >> 32, (int)INT_GET(r.l1, ARCH_CONVERT), 269 r.l0 >> 32, (int)r.l0,
270 r.l1 >> 32, (int)r.l1,
270 (unsigned long)cur->bc_bufs[0], (unsigned long)cur->bc_bufs[1], 271 (unsigned long)cur->bc_bufs[0], (unsigned long)cur->bc_bufs[1],
271 (unsigned long)cur->bc_bufs[2], (unsigned long)cur->bc_bufs[3], 272 (unsigned long)cur->bc_bufs[2], (unsigned long)cur->bc_bufs[3],
272 (cur->bc_ptrs[0] << 16) | cur->bc_ptrs[1], 273 (cur->bc_ptrs[0] << 16) | cur->bc_ptrs[1],
@@ -383,7 +384,7 @@ xfs_bmbt_delrec(
383 if (ptr < numrecs) { 384 if (ptr < numrecs) {
384 memmove(&kp[ptr - 1], &kp[ptr], 385 memmove(&kp[ptr - 1], &kp[ptr],
385 (numrecs - ptr) * sizeof(*kp)); 386 (numrecs - ptr) * sizeof(*kp));
386 memmove(&pp[ptr - 1], &pp[ptr], /* INT_: direct copy */ 387 memmove(&pp[ptr - 1], &pp[ptr],
387 (numrecs - ptr) * sizeof(*pp)); 388 (numrecs - ptr) * sizeof(*pp));
388 xfs_bmbt_log_ptrs(cur, bp, ptr, numrecs - 1); 389 xfs_bmbt_log_ptrs(cur, bp, ptr, numrecs - 1);
389 xfs_bmbt_log_keys(cur, bp, ptr, numrecs - 1); 390 xfs_bmbt_log_keys(cur, bp, ptr, numrecs - 1);
@@ -815,7 +816,7 @@ xfs_bmbt_insrec(
815#endif 816#endif
816 memmove(&kp[ptr], &kp[ptr - 1], 817 memmove(&kp[ptr], &kp[ptr - 1],
817 (numrecs - ptr + 1) * sizeof(*kp)); 818 (numrecs - ptr + 1) * sizeof(*kp));
818 memmove(&pp[ptr], &pp[ptr - 1], /* INT_: direct copy */ 819 memmove(&pp[ptr], &pp[ptr - 1],
819 (numrecs - ptr + 1) * sizeof(*pp)); 820 (numrecs - ptr + 1) * sizeof(*pp));
820#ifdef DEBUG 821#ifdef DEBUG
821 if ((error = xfs_btree_check_lptr(cur, *bnop, level))) { 822 if ((error = xfs_btree_check_lptr(cur, *bnop, level))) {
@@ -1250,7 +1251,7 @@ xfs_bmbt_lshift(
1250 return error; 1251 return error;
1251 } 1252 }
1252#endif 1253#endif
1253 *lpp = *rpp; /* INT_: direct copy */ 1254 *lpp = *rpp;
1254 xfs_bmbt_log_ptrs(cur, lbp, lrecs, lrecs); 1255 xfs_bmbt_log_ptrs(cur, lbp, lrecs, lrecs);
1255 } else { 1256 } else {
1256 lrp = XFS_BMAP_REC_IADDR(left, lrecs, cur); 1257 lrp = XFS_BMAP_REC_IADDR(left, lrecs, cur);
@@ -1388,7 +1389,7 @@ xfs_bmbt_rshift(
1388 } 1389 }
1389#endif 1390#endif
1390 *rkp = *lkp; 1391 *rkp = *lkp;
1391 *rpp = *lpp; /* INT_: direct copy */ 1392 *rpp = *lpp;
1392 xfs_bmbt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1); 1393 xfs_bmbt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1393 xfs_bmbt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1); 1394 xfs_bmbt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1394 } else { 1395 } else {
@@ -1826,7 +1827,7 @@ __xfs_bmbt_get_all(
1826 1827
1827void 1828void
1828xfs_bmbt_get_all( 1829xfs_bmbt_get_all(
1829 xfs_bmbt_rec_t *r, 1830 xfs_bmbt_rec_host_t *r,
1830 xfs_bmbt_irec_t *s) 1831 xfs_bmbt_irec_t *s)
1831{ 1832{
1832 __xfs_bmbt_get_all(r->l0, r->l1, s); 1833 __xfs_bmbt_get_all(r->l0, r->l1, s);
@@ -1862,7 +1863,7 @@ xfs_bmbt_get_block(
1862 */ 1863 */
1863xfs_filblks_t 1864xfs_filblks_t
1864xfs_bmbt_get_blockcount( 1865xfs_bmbt_get_blockcount(
1865 xfs_bmbt_rec_t *r) 1866 xfs_bmbt_rec_host_t *r)
1866{ 1867{
1867 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21)); 1868 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21));
1868} 1869}
@@ -1872,7 +1873,7 @@ xfs_bmbt_get_blockcount(
1872 */ 1873 */
1873xfs_fsblock_t 1874xfs_fsblock_t
1874xfs_bmbt_get_startblock( 1875xfs_bmbt_get_startblock(
1875 xfs_bmbt_rec_t *r) 1876 xfs_bmbt_rec_host_t *r)
1876{ 1877{
1877#if XFS_BIG_BLKNOS 1878#if XFS_BIG_BLKNOS
1878 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) | 1879 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) |
@@ -1896,7 +1897,7 @@ xfs_bmbt_get_startblock(
1896 */ 1897 */
1897xfs_fileoff_t 1898xfs_fileoff_t
1898xfs_bmbt_get_startoff( 1899xfs_bmbt_get_startoff(
1899 xfs_bmbt_rec_t *r) 1900 xfs_bmbt_rec_host_t *r)
1900{ 1901{
1901 return ((xfs_fileoff_t)r->l0 & 1902 return ((xfs_fileoff_t)r->l0 &
1902 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 1903 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
@@ -1904,7 +1905,7 @@ xfs_bmbt_get_startoff(
1904 1905
1905xfs_exntst_t 1906xfs_exntst_t
1906xfs_bmbt_get_state( 1907xfs_bmbt_get_state(
1907 xfs_bmbt_rec_t *r) 1908 xfs_bmbt_rec_host_t *r)
1908{ 1909{
1909 int ext_flag; 1910 int ext_flag;
1910 1911
@@ -1913,19 +1914,13 @@ xfs_bmbt_get_state(
1913 ext_flag); 1914 ext_flag);
1914} 1915}
1915 1916
1916#ifndef XFS_NATIVE_HOST
1917/* Endian flipping versions of the bmbt extraction functions */ 1917/* Endian flipping versions of the bmbt extraction functions */
1918void 1918void
1919xfs_bmbt_disk_get_all( 1919xfs_bmbt_disk_get_all(
1920 xfs_bmbt_rec_t *r, 1920 xfs_bmbt_rec_t *r,
1921 xfs_bmbt_irec_t *s) 1921 xfs_bmbt_irec_t *s)
1922{ 1922{
1923 __uint64_t l0, l1; 1923 __xfs_bmbt_get_all(be64_to_cpu(r->l0), be64_to_cpu(r->l1), s);
1924
1925 l0 = INT_GET(r->l0, ARCH_CONVERT);
1926 l1 = INT_GET(r->l1, ARCH_CONVERT);
1927
1928 __xfs_bmbt_get_all(l0, l1, s);
1929} 1924}
1930 1925
1931/* 1926/*
@@ -1935,7 +1930,7 @@ xfs_filblks_t
1935xfs_bmbt_disk_get_blockcount( 1930xfs_bmbt_disk_get_blockcount(
1936 xfs_bmbt_rec_t *r) 1931 xfs_bmbt_rec_t *r)
1937{ 1932{
1938 return (xfs_filblks_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK64LO(21)); 1933 return (xfs_filblks_t)(be64_to_cpu(r->l1) & XFS_MASK64LO(21));
1939} 1934}
1940 1935
1941/* 1936/*
@@ -1945,11 +1940,9 @@ xfs_fileoff_t
1945xfs_bmbt_disk_get_startoff( 1940xfs_bmbt_disk_get_startoff(
1946 xfs_bmbt_rec_t *r) 1941 xfs_bmbt_rec_t *r)
1947{ 1942{
1948 return ((xfs_fileoff_t)INT_GET(r->l0, ARCH_CONVERT) & 1943 return ((xfs_fileoff_t)be64_to_cpu(r->l0) &
1949 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 1944 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
1950} 1945}
1951#endif /* XFS_NATIVE_HOST */
1952
1953 1946
1954/* 1947/*
1955 * Increment cursor by one record at the level. 1948 * Increment cursor by one record at the level.
@@ -2290,185 +2283,131 @@ xfs_bmbt_newroot(
2290} 2283}
2291 2284
2292/* 2285/*
2293 * Set all the fields in a bmap extent record from the uncompressed form.
2294 */
2295void
2296xfs_bmbt_set_all(
2297 xfs_bmbt_rec_t *r,
2298 xfs_bmbt_irec_t *s)
2299{
2300 int extent_flag;
2301
2302 ASSERT((s->br_state == XFS_EXT_NORM) ||
2303 (s->br_state == XFS_EXT_UNWRITTEN));
2304 extent_flag = (s->br_state == XFS_EXT_NORM) ? 0 : 1;
2305 ASSERT((s->br_startoff & XFS_MASK64HI(9)) == 0);
2306 ASSERT((s->br_blockcount & XFS_MASK64HI(43)) == 0);
2307#if XFS_BIG_BLKNOS
2308 ASSERT((s->br_startblock & XFS_MASK64HI(12)) == 0);
2309 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2310 ((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
2311 ((xfs_bmbt_rec_base_t)s->br_startblock >> 43);
2312 r->l1 = ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
2313 ((xfs_bmbt_rec_base_t)s->br_blockcount &
2314 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
2315#else /* !XFS_BIG_BLKNOS */
2316 if (ISNULLSTARTBLOCK(s->br_startblock)) {
2317 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2318 ((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
2319 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9);
2320 r->l1 = XFS_MASK64HI(11) |
2321 ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
2322 ((xfs_bmbt_rec_base_t)s->br_blockcount &
2323 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
2324 } else {
2325 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2326 ((xfs_bmbt_rec_base_t)s->br_startoff << 9);
2327 r->l1 = ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
2328 ((xfs_bmbt_rec_base_t)s->br_blockcount &
2329 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
2330 }
2331#endif /* XFS_BIG_BLKNOS */
2332}
2333
2334/*
2335 * Set all the fields in a bmap extent record from the arguments. 2286 * Set all the fields in a bmap extent record from the arguments.
2336 */ 2287 */
2337void 2288void
2338xfs_bmbt_set_allf( 2289xfs_bmbt_set_allf(
2339 xfs_bmbt_rec_t *r, 2290 xfs_bmbt_rec_host_t *r,
2340 xfs_fileoff_t o, 2291 xfs_fileoff_t startoff,
2341 xfs_fsblock_t b, 2292 xfs_fsblock_t startblock,
2342 xfs_filblks_t c, 2293 xfs_filblks_t blockcount,
2343 xfs_exntst_t v) 2294 xfs_exntst_t state)
2344{ 2295{
2345 int extent_flag; 2296 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
2297
2298 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
2299 ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
2300 ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
2346 2301
2347 ASSERT((v == XFS_EXT_NORM) || (v == XFS_EXT_UNWRITTEN));
2348 extent_flag = (v == XFS_EXT_NORM) ? 0 : 1;
2349 ASSERT((o & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
2350 ASSERT((c & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
2351#if XFS_BIG_BLKNOS 2302#if XFS_BIG_BLKNOS
2352 ASSERT((b & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 2303 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
2304
2353 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2305 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2354 ((xfs_bmbt_rec_base_t)o << 9) | 2306 ((xfs_bmbt_rec_base_t)startoff << 9) |
2355 ((xfs_bmbt_rec_base_t)b >> 43); 2307 ((xfs_bmbt_rec_base_t)startblock >> 43);
2356 r->l1 = ((xfs_bmbt_rec_base_t)b << 21) | 2308 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
2357 ((xfs_bmbt_rec_base_t)c & 2309 ((xfs_bmbt_rec_base_t)blockcount &
2358 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 2310 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
2359#else /* !XFS_BIG_BLKNOS */ 2311#else /* !XFS_BIG_BLKNOS */
2360 if (ISNULLSTARTBLOCK(b)) { 2312 if (ISNULLSTARTBLOCK(startblock)) {
2361 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2313 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2362 ((xfs_bmbt_rec_base_t)o << 9) | 2314 ((xfs_bmbt_rec_base_t)startoff << 9) |
2363 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 2315 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9);
2364 r->l1 = XFS_MASK64HI(11) | 2316 r->l1 = XFS_MASK64HI(11) |
2365 ((xfs_bmbt_rec_base_t)b << 21) | 2317 ((xfs_bmbt_rec_base_t)startblock << 21) |
2366 ((xfs_bmbt_rec_base_t)c & 2318 ((xfs_bmbt_rec_base_t)blockcount &
2367 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 2319 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
2368 } else { 2320 } else {
2369 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2321 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2370 ((xfs_bmbt_rec_base_t)o << 9); 2322 ((xfs_bmbt_rec_base_t)startoff << 9);
2371 r->l1 = ((xfs_bmbt_rec_base_t)b << 21) | 2323 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
2372 ((xfs_bmbt_rec_base_t)c & 2324 ((xfs_bmbt_rec_base_t)blockcount &
2373 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 2325 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
2374 } 2326 }
2375#endif /* XFS_BIG_BLKNOS */ 2327#endif /* XFS_BIG_BLKNOS */
2376} 2328}
2377 2329
2378#ifndef XFS_NATIVE_HOST
2379/* 2330/*
2380 * Set all the fields in a bmap extent record from the uncompressed form. 2331 * Set all the fields in a bmap extent record from the uncompressed form.
2381 */ 2332 */
2382void 2333void
2383xfs_bmbt_disk_set_all( 2334xfs_bmbt_set_all(
2384 xfs_bmbt_rec_t *r, 2335 xfs_bmbt_rec_host_t *r,
2385 xfs_bmbt_irec_t *s) 2336 xfs_bmbt_irec_t *s)
2386{ 2337{
2387 int extent_flag; 2338 xfs_bmbt_set_allf(r, s->br_startoff, s->br_startblock,
2388 2339 s->br_blockcount, s->br_state);
2389 ASSERT((s->br_state == XFS_EXT_NORM) ||
2390 (s->br_state == XFS_EXT_UNWRITTEN));
2391 extent_flag = (s->br_state == XFS_EXT_NORM) ? 0 : 1;
2392 ASSERT((s->br_startoff & XFS_MASK64HI(9)) == 0);
2393 ASSERT((s->br_blockcount & XFS_MASK64HI(43)) == 0);
2394#if XFS_BIG_BLKNOS
2395 ASSERT((s->br_startblock & XFS_MASK64HI(12)) == 0);
2396 INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2397 ((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
2398 ((xfs_bmbt_rec_base_t)s->br_startblock >> 43));
2399 INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
2400 ((xfs_bmbt_rec_base_t)s->br_blockcount &
2401 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2402#else /* !XFS_BIG_BLKNOS */
2403 if (ISNULLSTARTBLOCK(s->br_startblock)) {
2404 INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2405 ((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
2406 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9));
2407 INT_SET(r->l1, ARCH_CONVERT, XFS_MASK64HI(11) |
2408 ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
2409 ((xfs_bmbt_rec_base_t)s->br_blockcount &
2410 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2411 } else {
2412 INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2413 ((xfs_bmbt_rec_base_t)s->br_startoff << 9));
2414 INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
2415 ((xfs_bmbt_rec_base_t)s->br_blockcount &
2416 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2417 }
2418#endif /* XFS_BIG_BLKNOS */
2419} 2340}
2420 2341
2342
2421/* 2343/*
2422 * Set all the fields in a disk format bmap extent record from the arguments. 2344 * Set all the fields in a disk format bmap extent record from the arguments.
2423 */ 2345 */
2424void 2346void
2425xfs_bmbt_disk_set_allf( 2347xfs_bmbt_disk_set_allf(
2426 xfs_bmbt_rec_t *r, 2348 xfs_bmbt_rec_t *r,
2427 xfs_fileoff_t o, 2349 xfs_fileoff_t startoff,
2428 xfs_fsblock_t b, 2350 xfs_fsblock_t startblock,
2429 xfs_filblks_t c, 2351 xfs_filblks_t blockcount,
2430 xfs_exntst_t v) 2352 xfs_exntst_t state)
2431{ 2353{
2432 int extent_flag; 2354 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
2355
2356 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
2357 ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
2358 ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
2433 2359
2434 ASSERT((v == XFS_EXT_NORM) || (v == XFS_EXT_UNWRITTEN));
2435 extent_flag = (v == XFS_EXT_NORM) ? 0 : 1;
2436 ASSERT((o & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
2437 ASSERT((c & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
2438#if XFS_BIG_BLKNOS 2360#if XFS_BIG_BLKNOS
2439 ASSERT((b & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 2361 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
2440 INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2362
2441 ((xfs_bmbt_rec_base_t)o << 9) | 2363 r->l0 = cpu_to_be64(
2442 ((xfs_bmbt_rec_base_t)b >> 43)); 2364 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2443 INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) | 2365 ((xfs_bmbt_rec_base_t)startoff << 9) |
2444 ((xfs_bmbt_rec_base_t)c & 2366 ((xfs_bmbt_rec_base_t)startblock >> 43));
2445 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 2367 r->l1 = cpu_to_be64(
2368 ((xfs_bmbt_rec_base_t)startblock << 21) |
2369 ((xfs_bmbt_rec_base_t)blockcount &
2370 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2446#else /* !XFS_BIG_BLKNOS */ 2371#else /* !XFS_BIG_BLKNOS */
2447 if (ISNULLSTARTBLOCK(b)) { 2372 if (ISNULLSTARTBLOCK(startblock)) {
2448 INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2373 r->l0 = cpu_to_be64(
2449 ((xfs_bmbt_rec_base_t)o << 9) | 2374 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2450 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); 2375 ((xfs_bmbt_rec_base_t)startoff << 9) |
2451 INT_SET(r->l1, ARCH_CONVERT, XFS_MASK64HI(11) | 2376 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9));
2452 ((xfs_bmbt_rec_base_t)b << 21) | 2377 r->l1 = cpu_to_be64(XFS_MASK64HI(11) |
2453 ((xfs_bmbt_rec_base_t)c & 2378 ((xfs_bmbt_rec_base_t)startblock << 21) |
2379 ((xfs_bmbt_rec_base_t)blockcount &
2454 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 2380 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2455 } else { 2381 } else {
2456 INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2382 r->l0 = cpu_to_be64(
2457 ((xfs_bmbt_rec_base_t)o << 9)); 2383 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2458 INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) | 2384 ((xfs_bmbt_rec_base_t)startoff << 9));
2459 ((xfs_bmbt_rec_base_t)c & 2385 r->l1 = cpu_to_be64(
2460 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 2386 ((xfs_bmbt_rec_base_t)startblock << 21) |
2387 ((xfs_bmbt_rec_base_t)blockcount &
2388 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2461 } 2389 }
2462#endif /* XFS_BIG_BLKNOS */ 2390#endif /* XFS_BIG_BLKNOS */
2463} 2391}
2464#endif /* XFS_NATIVE_HOST */ 2392
2393/*
2394 * Set all the fields in a bmap extent record from the uncompressed form.
2395 */
2396void
2397xfs_bmbt_disk_set_all(
2398 xfs_bmbt_rec_t *r,
2399 xfs_bmbt_irec_t *s)
2400{
2401 xfs_bmbt_disk_set_allf(r, s->br_startoff, s->br_startblock,
2402 s->br_blockcount, s->br_state);
2403}
2465 2404
2466/* 2405/*
2467 * Set the blockcount field in a bmap extent record. 2406 * Set the blockcount field in a bmap extent record.
2468 */ 2407 */
2469void 2408void
2470xfs_bmbt_set_blockcount( 2409xfs_bmbt_set_blockcount(
2471 xfs_bmbt_rec_t *r, 2410 xfs_bmbt_rec_host_t *r,
2472 xfs_filblks_t v) 2411 xfs_filblks_t v)
2473{ 2412{
2474 ASSERT((v & XFS_MASK64HI(43)) == 0); 2413 ASSERT((v & XFS_MASK64HI(43)) == 0);
@@ -2481,7 +2420,7 @@ xfs_bmbt_set_blockcount(
2481 */ 2420 */
2482void 2421void
2483xfs_bmbt_set_startblock( 2422xfs_bmbt_set_startblock(
2484 xfs_bmbt_rec_t *r, 2423 xfs_bmbt_rec_host_t *r,
2485 xfs_fsblock_t v) 2424 xfs_fsblock_t v)
2486{ 2425{
2487#if XFS_BIG_BLKNOS 2426#if XFS_BIG_BLKNOS
@@ -2509,7 +2448,7 @@ xfs_bmbt_set_startblock(
2509 */ 2448 */
2510void 2449void
2511xfs_bmbt_set_startoff( 2450xfs_bmbt_set_startoff(
2512 xfs_bmbt_rec_t *r, 2451 xfs_bmbt_rec_host_t *r,
2513 xfs_fileoff_t v) 2452 xfs_fileoff_t v)
2514{ 2453{
2515 ASSERT((v & XFS_MASK64HI(9)) == 0); 2454 ASSERT((v & XFS_MASK64HI(9)) == 0);
@@ -2523,7 +2462,7 @@ xfs_bmbt_set_startoff(
2523 */ 2462 */
2524void 2463void
2525xfs_bmbt_set_state( 2464xfs_bmbt_set_state(
2526 xfs_bmbt_rec_t *r, 2465 xfs_bmbt_rec_host_t *r,
2527 xfs_exntst_t v) 2466 xfs_exntst_t v)
2528{ 2467{
2529 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN); 2468 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN);
@@ -2624,10 +2563,8 @@ xfs_check_nostate_extents(
2624 xfs_extnum_t idx, 2563 xfs_extnum_t idx,
2625 xfs_extnum_t num) 2564 xfs_extnum_t num)
2626{ 2565{
2627 xfs_bmbt_rec_t *ep;
2628
2629 for (; num > 0; num--, idx++) { 2566 for (; num > 0; num--, idx++) {
2630 ep = xfs_iext_get_ext(ifp, idx); 2567 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
2631 if ((ep->l0 >> 2568 if ((ep->l0 >>
2632 (64 - BMBT_EXNTFLAG_BITLEN)) != 0) { 2569 (64 - BMBT_EXNTFLAG_BITLEN)) != 0) {
2633 ASSERT(0); 2570 ASSERT(0);
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index a77b1b753d0c..2d950e975918 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -35,45 +35,16 @@ typedef struct xfs_bmdr_block {
35 35
36/* 36/*
37 * Bmap btree record and extent descriptor. 37 * Bmap btree record and extent descriptor.
38 * For 32-bit kernels,
39 * l0:31 is an extent flag (value 1 indicates non-normal).
40 * l0:0-30 and l1:9-31 are startoff.
41 * l1:0-8, l2:0-31, and l3:21-31 are startblock.
42 * l3:0-20 are blockcount.
43 * For 64-bit kernels,
44 * l0:63 is an extent flag (value 1 indicates non-normal). 38 * l0:63 is an extent flag (value 1 indicates non-normal).
45 * l0:9-62 are startoff. 39 * l0:9-62 are startoff.
46 * l0:0-8 and l1:21-63 are startblock. 40 * l0:0-8 and l1:21-63 are startblock.
47 * l1:0-20 are blockcount. 41 * l1:0-20 are blockcount.
48 */ 42 */
49
50#ifndef XFS_NATIVE_HOST
51
52#define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */
53#define BMBT_EXNTFLAG_BITOFF 0
54#define BMBT_EXNTFLAG_BITLEN 1 43#define BMBT_EXNTFLAG_BITLEN 1
55#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF + BMBT_EXNTFLAG_BITLEN)
56#define BMBT_STARTOFF_BITLEN 54 44#define BMBT_STARTOFF_BITLEN 54
57#define BMBT_STARTBLOCK_BITOFF (BMBT_STARTOFF_BITOFF + BMBT_STARTOFF_BITLEN)
58#define BMBT_STARTBLOCK_BITLEN 52 45#define BMBT_STARTBLOCK_BITLEN 52
59#define BMBT_BLOCKCOUNT_BITOFF \
60 (BMBT_STARTBLOCK_BITOFF + BMBT_STARTBLOCK_BITLEN)
61#define BMBT_BLOCKCOUNT_BITLEN (BMBT_TOTAL_BITLEN - BMBT_BLOCKCOUNT_BITOFF)
62
63#else
64
65#define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */
66#define BMBT_EXNTFLAG_BITOFF 63
67#define BMBT_EXNTFLAG_BITLEN 1
68#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF - BMBT_STARTOFF_BITLEN)
69#define BMBT_STARTOFF_BITLEN 54
70#define BMBT_STARTBLOCK_BITOFF 85 /* 128 - 43 (other 9 is in first word) */
71#define BMBT_STARTBLOCK_BITLEN 52
72#define BMBT_BLOCKCOUNT_BITOFF 64 /* Start of second 64 bit container */
73#define BMBT_BLOCKCOUNT_BITLEN 21 46#define BMBT_BLOCKCOUNT_BITLEN 21
74 47
75#endif /* XFS_NATIVE_HOST */
76
77 48
78#define BMBT_USE_64 1 49#define BMBT_USE_64 1
79 50
@@ -83,12 +54,16 @@ typedef struct xfs_bmbt_rec_32
83} xfs_bmbt_rec_32_t; 54} xfs_bmbt_rec_32_t;
84typedef struct xfs_bmbt_rec_64 55typedef struct xfs_bmbt_rec_64
85{ 56{
86 __uint64_t l0, l1; 57 __be64 l0, l1;
87} xfs_bmbt_rec_64_t; 58} xfs_bmbt_rec_64_t;
88 59
89typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ 60typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */
90typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; 61typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
91 62
63typedef struct xfs_bmbt_rec_host {
64 __uint64_t l0, l1;
65} xfs_bmbt_rec_host_t;
66
92/* 67/*
93 * Values and macros for delayed-allocation startblock fields. 68 * Values and macros for delayed-allocation startblock fields.
94 */ 69 */
@@ -281,23 +256,17 @@ extern ktrace_t *xfs_bmbt_trace_buf;
281extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int); 256extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
282extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *); 257extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *);
283extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *); 258extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *);
284extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 259extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
285extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur, 260extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur,
286 int, struct xfs_buf **bpp); 261 int, struct xfs_buf **bpp);
287extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r); 262extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r);
288extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r); 263extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r);
289extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r); 264extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r);
290extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r); 265extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r);
291 266
292#ifndef XFS_NATIVE_HOST
293extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 267extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
294extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); 268extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r);
295extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); 269extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
296#else
297#define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s)
298#define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r)
299#define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r)
300#endif /* XFS_NATIVE_HOST */
301 270
302extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *); 271extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *);
303extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *); 272extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *);
@@ -315,22 +284,17 @@ extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t,
315 */ 284 */
316extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat); 285extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat);
317 286
318extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 287extern void xfs_bmbt_set_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
319extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, 288extern void xfs_bmbt_set_allf(xfs_bmbt_rec_host_t *r, xfs_fileoff_t o,
320 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); 289 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
321extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v); 290extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_host_t *r, xfs_filblks_t v);
322extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v); 291extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v);
323extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v); 292extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v);
324extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v); 293extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v);
325 294
326#ifndef XFS_NATIVE_HOST
327extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 295extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
328extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, 296extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
329 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); 297 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
330#else
331#define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s)
332#define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v)
333#endif /* XFS_NATIVE_HOST */
334 298
335extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); 299extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
336extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, 300extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t,
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index b0667cb27d66..c8f2c2886fe4 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -23,6 +23,7 @@
23#include "xfs_inum.h" 23#include "xfs_inum.h"
24#include "xfs_trans.h" 24#include "xfs_trans.h"
25#include "xfs_sb.h" 25#include "xfs_sb.h"
26#include "xfs_ag.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
28#include "xfs_buf_item.h" 29#include "xfs_buf_item.h"
diff --git a/fs/xfs/xfs_clnt.h b/fs/xfs/xfs_clnt.h
index f89196cb08d2..d16c1b971074 100644
--- a/fs/xfs/xfs_clnt.h
+++ b/fs/xfs/xfs_clnt.h
@@ -89,7 +89,6 @@ struct xfs_mount_args {
89#define XFSMNT_IDELETE 0x08000000 /* inode cluster delete */ 89#define XFSMNT_IDELETE 0x08000000 /* inode cluster delete */
90#define XFSMNT_SWALLOC 0x10000000 /* turn on stripe width 90#define XFSMNT_SWALLOC 0x10000000 /* turn on stripe width
91 * allocation */ 91 * allocation */
92#define XFSMNT_IHASHSIZE 0x20000000 /* inode hash table size */
93#define XFSMNT_DIRSYNC 0x40000000 /* sync creat,link,unlink,rename 92#define XFSMNT_DIRSYNC 0x40000000 /* sync creat,link,unlink,rename
94 * symlink,mkdir,rmdir,mknod */ 93 * symlink,mkdir,rmdir,mknod */
95#define XFSMNT_FLAGS2 0x80000000 /* more flags set in flags2 */ 94#define XFSMNT_FLAGS2 0x80000000 /* more flags set in flags2 */
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index de35d18cc002..584f1ae85cd9 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -42,6 +42,7 @@
42#include "xfs_dfrag.h" 42#include "xfs_dfrag.h"
43#include "xfs_error.h" 43#include "xfs_error.h"
44#include "xfs_rw.h" 44#include "xfs_rw.h"
45#include "xfs_vnodeops.h"
45 46
46/* 47/*
47 * Syssgi interface for swapext 48 * Syssgi interface for swapext
@@ -199,7 +200,8 @@ xfs_swap_extents(
199 200
200 if (VN_CACHED(tvp) != 0) { 201 if (VN_CACHED(tvp) != 0) {
201 xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1); 202 xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1);
202 error = bhv_vop_flushinval_pages(tvp, 0, -1, FI_REMAPF_LOCKED); 203 error = xfs_flushinval_pages(tip, 0, -1,
204 FI_REMAPF_LOCKED);
203 if (error) 205 if (error)
204 goto error0; 206 goto error0;
205 } 207 }
@@ -265,7 +267,7 @@ xfs_swap_extents(
265 * fields change. 267 * fields change.
266 */ 268 */
267 269
268 bhv_vop_toss_pages(vp, 0, -1, FI_REMAPF); 270 xfs_tosspages(ip, 0, -1, FI_REMAPF);
269 271
270 tp = xfs_trans_alloc(mp, XFS_TRANS_SWAPEXT); 272 tp = xfs_trans_alloc(mp, XFS_TRANS_SWAPEXT);
271 if ((error = xfs_trans_reserve(tp, 0, 273 if ((error = xfs_trans_reserve(tp, 0,
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index fefd0116bac9..dedd713574e1 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -34,41 +34,41 @@ struct xfs_mount;
34 * because we only need the core part in the in-core inode. 34 * because we only need the core part in the in-core inode.
35 */ 35 */
36typedef struct xfs_timestamp { 36typedef struct xfs_timestamp {
37 __int32_t t_sec; /* timestamp seconds */ 37 __be32 t_sec; /* timestamp seconds */
38 __int32_t t_nsec; /* timestamp nanoseconds */ 38 __be32 t_nsec; /* timestamp nanoseconds */
39} xfs_timestamp_t; 39} xfs_timestamp_t;
40 40
41/* 41/*
42 * Note: Coordinate changes to this structure with the XFS_DI_* #defines 42 * Note: Coordinate changes to this structure with the XFS_DI_* #defines
43 * below and the offsets table in xfs_ialloc_log_di(). 43 * below, the offsets table in xfs_ialloc_log_di() and struct xfs_icdinode
44 * in xfs_inode.h.
44 */ 45 */
45typedef struct xfs_dinode_core 46typedef struct xfs_dinode_core {
46{ 47 __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */
47 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ 48 __be16 di_mode; /* mode and type of file */
48 __uint16_t di_mode; /* mode and type of file */ 49 __u8 di_version; /* inode version */
49 __int8_t di_version; /* inode version */ 50 __u8 di_format; /* format of di_c data */
50 __int8_t di_format; /* format of di_c data */ 51 __be16 di_onlink; /* old number of links to file */
51 __uint16_t di_onlink; /* old number of links to file */ 52 __be32 di_uid; /* owner's user id */
52 __uint32_t di_uid; /* owner's user id */ 53 __be32 di_gid; /* owner's group id */
53 __uint32_t di_gid; /* owner's group id */ 54 __be32 di_nlink; /* number of links to file */
54 __uint32_t di_nlink; /* number of links to file */ 55 __be16 di_projid; /* owner's project id */
55 __uint16_t di_projid; /* owner's project id */ 56 __u8 di_pad[8]; /* unused, zeroed space */
56 __uint8_t di_pad[8]; /* unused, zeroed space */ 57 __be16 di_flushiter; /* incremented on flush */
57 __uint16_t di_flushiter; /* incremented on flush */
58 xfs_timestamp_t di_atime; /* time last accessed */ 58 xfs_timestamp_t di_atime; /* time last accessed */
59 xfs_timestamp_t di_mtime; /* time last modified */ 59 xfs_timestamp_t di_mtime; /* time last modified */
60 xfs_timestamp_t di_ctime; /* time created/inode modified */ 60 xfs_timestamp_t di_ctime; /* time created/inode modified */
61 xfs_fsize_t di_size; /* number of bytes in file */ 61 __be64 di_size; /* number of bytes in file */
62 xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ 62 __be64 di_nblocks; /* # of direct & btree blocks used */
63 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ 63 __be32 di_extsize; /* basic/minimum extent size for file */
64 xfs_extnum_t di_nextents; /* number of extents in data fork */ 64 __be32 di_nextents; /* number of extents in data fork */
65 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ 65 __be16 di_anextents; /* number of extents in attribute fork*/
66 __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ 66 __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
67 __int8_t di_aformat; /* format of attr fork's data */ 67 __s8 di_aformat; /* format of attr fork's data */
68 __uint32_t di_dmevmask; /* DMIG event mask */ 68 __be32 di_dmevmask; /* DMIG event mask */
69 __uint16_t di_dmstate; /* DMIG state info */ 69 __be16 di_dmstate; /* DMIG state info */
70 __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ 70 __be16 di_flags; /* random flags, XFS_DIFLAG_... */
71 __uint32_t di_gen; /* generation number */ 71 __be32 di_gen; /* generation number */
72} xfs_dinode_core_t; 72} xfs_dinode_core_t;
73 73
74#define DI_MAX_FLUSH 0xffff 74#define DI_MAX_FLUSH 0xffff
@@ -81,13 +81,13 @@ typedef struct xfs_dinode
81 * sure to update the macros like XFS_LITINO below and 81 * sure to update the macros like XFS_LITINO below and
82 * XFS_BMAP_RBLOCK_DSIZE in xfs_bmap_btree.h. 82 * XFS_BMAP_RBLOCK_DSIZE in xfs_bmap_btree.h.
83 */ 83 */
84 xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ 84 __be32 di_next_unlinked;/* agi unlinked list ptr */
85 union { 85 union {
86 xfs_bmdr_block_t di_bmbt; /* btree root block */ 86 xfs_bmdr_block_t di_bmbt; /* btree root block */
87 xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */ 87 xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */
88 xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */ 88 xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */
89 char di_c[1]; /* local contents */ 89 char di_c[1]; /* local contents */
90 xfs_dev_t di_dev; /* device for S_IFCHR/S_IFBLK */ 90 __be32 di_dev; /* device for S_IFCHR/S_IFBLK */
91 uuid_t di_muuid; /* mount point value */ 91 uuid_t di_muuid; /* mount point value */
92 char di_symlink[1]; /* local symbolic link */ 92 char di_symlink[1]; /* local symbolic link */
93 } di_u; 93 } di_u;
@@ -175,8 +175,7 @@ typedef enum xfs_dinode_fmt
175#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) 175#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
176 176
177#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) 177#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
178#define XFS_CFORK_BOFF_DISK(dcp) \ 178#define XFS_CFORK_BOFF_DISK(dcp) ((int)((dcp)->di_forkoff << 3))
179 ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
180 179
181#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ 180#define XFS_CFORK_DSIZE_DISK(dcp,mp) \
182 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) 181 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp))
@@ -225,8 +224,8 @@ typedef enum xfs_dinode_fmt
225 224
226#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ 225#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \
227 ((w) == XFS_DATA_FORK ? \ 226 ((w) == XFS_DATA_FORK ? \
228 INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ 227 be32_to_cpu((dcp)->di_nextents) : \
229 INT_GET((dcp)->di_anextents, ARCH_CONVERT)) 228 be16_to_cpu((dcp)->di_anextents))
230#define XFS_CFORK_NEXTENTS(dcp,w) \ 229#define XFS_CFORK_NEXTENTS(dcp,w) \
231 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) 230 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents)
232#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) 231#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w)
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index 29e091914df4..b0f1ee8fcb90 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -43,8 +43,6 @@
43#include "xfs_dir2_trace.h" 43#include "xfs_dir2_trace.h"
44#include "xfs_error.h" 44#include "xfs_error.h"
45 45
46static int xfs_dir2_put_dirent64_direct(xfs_dir2_put_args_t *pa);
47static int xfs_dir2_put_dirent64_uio(xfs_dir2_put_args_t *pa);
48 46
49void 47void
50xfs_dir_mount( 48xfs_dir_mount(
@@ -293,47 +291,33 @@ xfs_dir_removename(
293 * Read a directory. 291 * Read a directory.
294 */ 292 */
295int 293int
296xfs_dir_getdents( 294xfs_readdir(
297 xfs_trans_t *tp,
298 xfs_inode_t *dp, 295 xfs_inode_t *dp,
299 uio_t *uio, /* caller's buffer control */ 296 void *dirent,
300 int *eofp) /* out: eof reached */ 297 size_t bufsize,
298 xfs_off_t *offset,
299 filldir_t filldir)
301{ 300{
302 int alignment; /* alignment required for ABI */
303 xfs_dirent_t *dbp; /* malloc'ed buffer */
304 xfs_dir2_put_t put; /* entry formatting routine */
305 int rval; /* return value */ 301 int rval; /* return value */
306 int v; /* type-checking value */ 302 int v; /* type-checking value */
307 303
304 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
305
306 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
307 return XFS_ERROR(EIO);
308
308 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 309 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
309 XFS_STATS_INC(xs_dir_getdents); 310 XFS_STATS_INC(xs_dir_getdents);
310 /*
311 * If our caller has given us a single contiguous aligned memory buffer,
312 * just work directly within that buffer. If it's in user memory,
313 * lock it down first.
314 */
315 alignment = sizeof(xfs_off_t) - 1;
316 if ((uio->uio_iovcnt == 1) &&
317 (((__psint_t)uio->uio_iov[0].iov_base & alignment) == 0) &&
318 ((uio->uio_iov[0].iov_len & alignment) == 0)) {
319 dbp = NULL;
320 put = xfs_dir2_put_dirent64_direct;
321 } else {
322 dbp = kmem_alloc(sizeof(*dbp) + MAXNAMELEN, KM_SLEEP);
323 put = xfs_dir2_put_dirent64_uio;
324 }
325 311
326 *eofp = 0;
327 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) 312 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
328 rval = xfs_dir2_sf_getdents(dp, uio, eofp, dbp, put); 313 rval = xfs_dir2_sf_getdents(dp, dirent, offset, filldir);
329 else if ((rval = xfs_dir2_isblock(tp, dp, &v))) 314 else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
330 ; 315 ;
331 else if (v) 316 else if (v)
332 rval = xfs_dir2_block_getdents(tp, dp, uio, eofp, dbp, put); 317 rval = xfs_dir2_block_getdents(dp, dirent, offset, filldir);
333 else 318 else
334 rval = xfs_dir2_leaf_getdents(tp, dp, uio, eofp, dbp, put); 319 rval = xfs_dir2_leaf_getdents(dp, dirent, bufsize, offset,
335 if (dbp != NULL) 320 filldir);
336 kmem_free(dbp, sizeof(*dbp) + MAXNAMELEN);
337 return rval; 321 return rval;
338} 322}
339 323
@@ -613,77 +597,6 @@ xfs_dir2_isleaf(
613} 597}
614 598
615/* 599/*
616 * Getdents put routine for 64-bit ABI, direct form.
617 */
618static int
619xfs_dir2_put_dirent64_direct(
620 xfs_dir2_put_args_t *pa)
621{
622 xfs_dirent_t *idbp; /* dirent pointer */
623 iovec_t *iovp; /* io vector */
624 int namelen; /* entry name length */
625 int reclen; /* entry total length */
626 uio_t *uio; /* I/O control */
627
628 namelen = pa->namelen;
629 reclen = DIRENTSIZE(namelen);
630 uio = pa->uio;
631 /*
632 * Won't fit in the remaining space.
633 */
634 if (reclen > uio->uio_resid) {
635 pa->done = 0;
636 return 0;
637 }
638 iovp = uio->uio_iov;
639 idbp = (xfs_dirent_t *)iovp->iov_base;
640 iovp->iov_base = (char *)idbp + reclen;
641 iovp->iov_len -= reclen;
642 uio->uio_resid -= reclen;
643 idbp->d_reclen = reclen;
644 idbp->d_ino = pa->ino;
645 idbp->d_off = pa->cook;
646 idbp->d_name[namelen] = '\0';
647 pa->done = 1;
648 memcpy(idbp->d_name, pa->name, namelen);
649 return 0;
650}
651
652/*
653 * Getdents put routine for 64-bit ABI, uio form.
654 */
655static int
656xfs_dir2_put_dirent64_uio(
657 xfs_dir2_put_args_t *pa)
658{
659 xfs_dirent_t *idbp; /* dirent pointer */
660 int namelen; /* entry name length */
661 int reclen; /* entry total length */
662 int rval; /* return value */
663 uio_t *uio; /* I/O control */
664
665 namelen = pa->namelen;
666 reclen = DIRENTSIZE(namelen);
667 uio = pa->uio;
668 /*
669 * Won't fit in the remaining space.
670 */
671 if (reclen > uio->uio_resid) {
672 pa->done = 0;
673 return 0;
674 }
675 idbp = pa->dbp;
676 idbp->d_reclen = reclen;
677 idbp->d_ino = pa->ino;
678 idbp->d_off = pa->cook;
679 idbp->d_name[namelen] = '\0';
680 memcpy(idbp->d_name, pa->name, namelen);
681 rval = xfs_uio_read((caddr_t)idbp, reclen, uio);
682 pa->done = (rval == 0);
683 return rval;
684}
685
686/*
687 * Remove the given block from the directory. 600 * Remove the given block from the directory.
688 * This routine is used for data and free blocks, leaf/node are done 601 * This routine is used for data and free blocks, leaf/node are done
689 * by xfs_da_shrink_inode. 602 * by xfs_da_shrink_inode.
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
index 86560b6f794c..b265197e74cf 100644
--- a/fs/xfs/xfs_dir2.h
+++ b/fs/xfs/xfs_dir2.h
@@ -60,21 +60,6 @@ typedef __uint32_t xfs_dir2_db_t;
60typedef xfs_off_t xfs_dir2_off_t; 60typedef xfs_off_t xfs_dir2_off_t;
61 61
62/* 62/*
63 * For getdents, argument struct for put routines.
64 */
65typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa);
66typedef struct xfs_dir2_put_args {
67 xfs_off_t cook; /* cookie of (next) entry */
68 xfs_intino_t ino; /* inode number */
69 xfs_dirent_t *dbp; /* buffer pointer */
70 char *name; /* directory entry name */
71 int namelen; /* length of name */
72 int done; /* output: set if value was stored */
73 xfs_dir2_put_t put; /* put function ptr (i/o) */
74 struct uio *uio; /* uio control structure */
75} xfs_dir2_put_args_t;
76
77/*
78 * Generic directory interface routines 63 * Generic directory interface routines
79 */ 64 */
80extern void xfs_dir_startup(void); 65extern void xfs_dir_startup(void);
@@ -92,8 +77,6 @@ extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
92 char *name, int namelen, xfs_ino_t ino, 77 char *name, int namelen, xfs_ino_t ino,
93 xfs_fsblock_t *first, 78 xfs_fsblock_t *first,
94 struct xfs_bmap_free *flist, xfs_extlen_t tot); 79 struct xfs_bmap_free *flist, xfs_extlen_t tot);
95extern int xfs_dir_getdents(struct xfs_trans *tp, struct xfs_inode *dp,
96 uio_t *uio, int *eofp);
97extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, 80extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
98 char *name, int namelen, xfs_ino_t inum, 81 char *name, int namelen, xfs_ino_t inum,
99 xfs_fsblock_t *first, 82 xfs_fsblock_t *first,
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index e4df1aaae2a2..c171767e242a 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dir2.h" 26#include "xfs_dir2.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
@@ -432,12 +433,10 @@ xfs_dir2_block_addname(
432 */ 433 */
433int /* error */ 434int /* error */
434xfs_dir2_block_getdents( 435xfs_dir2_block_getdents(
435 xfs_trans_t *tp, /* transaction (NULL) */
436 xfs_inode_t *dp, /* incore inode */ 436 xfs_inode_t *dp, /* incore inode */
437 uio_t *uio, /* caller's buffer control */ 437 void *dirent,
438 int *eofp, /* eof reached? (out) */ 438 xfs_off_t *offset,
439 xfs_dirent_t *dbp, /* caller's buffer */ 439 filldir_t filldir)
440 xfs_dir2_put_t put) /* abi's formatting function */
441{ 440{
442 xfs_dir2_block_t *block; /* directory block structure */ 441 xfs_dir2_block_t *block; /* directory block structure */
443 xfs_dabuf_t *bp; /* buffer for block */ 442 xfs_dabuf_t *bp; /* buffer for block */
@@ -447,31 +446,32 @@ xfs_dir2_block_getdents(
447 char *endptr; /* end of the data entries */ 446 char *endptr; /* end of the data entries */
448 int error; /* error return value */ 447 int error; /* error return value */
449 xfs_mount_t *mp; /* filesystem mount point */ 448 xfs_mount_t *mp; /* filesystem mount point */
450 xfs_dir2_put_args_t p; /* arg package for put rtn */
451 char *ptr; /* current data entry */ 449 char *ptr; /* current data entry */
452 int wantoff; /* starting block offset */ 450 int wantoff; /* starting block offset */
451 xfs_ino_t ino;
452 xfs_off_t cook;
453 453
454 mp = dp->i_mount; 454 mp = dp->i_mount;
455 /* 455 /*
456 * If the block number in the offset is out of range, we're done. 456 * If the block number in the offset is out of range, we're done.
457 */ 457 */
458 if (xfs_dir2_dataptr_to_db(mp, uio->uio_offset) > mp->m_dirdatablk) { 458 if (xfs_dir2_dataptr_to_db(mp, *offset) > mp->m_dirdatablk) {
459 *eofp = 1;
460 return 0; 459 return 0;
461 } 460 }
462 /* 461 /*
463 * Can't read the block, give up, else get dabuf in bp. 462 * Can't read the block, give up, else get dabuf in bp.
464 */ 463 */
465 if ((error = 464 error = xfs_da_read_buf(NULL, dp, mp->m_dirdatablk, -1,
466 xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK))) { 465 &bp, XFS_DATA_FORK);
466 if (error)
467 return error; 467 return error;
468 } 468
469 ASSERT(bp != NULL); 469 ASSERT(bp != NULL);
470 /* 470 /*
471 * Extract the byte offset we start at from the seek pointer. 471 * Extract the byte offset we start at from the seek pointer.
472 * We'll skip entries before this. 472 * We'll skip entries before this.
473 */ 473 */
474 wantoff = xfs_dir2_dataptr_to_off(mp, uio->uio_offset); 474 wantoff = xfs_dir2_dataptr_to_off(mp, *offset);
475 block = bp->data; 475 block = bp->data;
476 xfs_dir2_data_check(dp, bp); 476 xfs_dir2_data_check(dp, bp);
477 /* 477 /*
@@ -480,9 +480,7 @@ xfs_dir2_block_getdents(
480 btp = xfs_dir2_block_tail_p(mp, block); 480 btp = xfs_dir2_block_tail_p(mp, block);
481 ptr = (char *)block->u; 481 ptr = (char *)block->u;
482 endptr = (char *)xfs_dir2_block_leaf_p(btp); 482 endptr = (char *)xfs_dir2_block_leaf_p(btp);
483 p.dbp = dbp; 483
484 p.put = put;
485 p.uio = uio;
486 /* 484 /*
487 * Loop over the data portion of the block. 485 * Loop over the data portion of the block.
488 * Each object is a real entry (dep) or an unused one (dup). 486 * Each object is a real entry (dep) or an unused one (dup).
@@ -508,33 +506,24 @@ xfs_dir2_block_getdents(
508 */ 506 */
509 if ((char *)dep - (char *)block < wantoff) 507 if ((char *)dep - (char *)block < wantoff)
510 continue; 508 continue;
511 /*
512 * Set up argument structure for put routine.
513 */
514 p.namelen = dep->namelen;
515 509
516 p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 510 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
517 ptr - (char *)block); 511 ptr - (char *)block);
518 p.ino = be64_to_cpu(dep->inumber); 512 ino = be64_to_cpu(dep->inumber);
519#if XFS_BIG_INUMS 513#if XFS_BIG_INUMS
520 p.ino += mp->m_inoadd; 514 ino += mp->m_inoadd;
521#endif 515#endif
522 p.name = (char *)dep->name;
523
524 /*
525 * Put the entry in the caller's buffer.
526 */
527 error = p.put(&p);
528 516
529 /* 517 /*
530 * If it didn't fit, set the final offset to here & return. 518 * If it didn't fit, set the final offset to here & return.
531 */ 519 */
532 if (!p.done) { 520 if (filldir(dirent, dep->name, dep->namelen, cook,
533 uio->uio_offset = 521 ino, DT_UNKNOWN)) {
534 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 522 *offset = xfs_dir2_db_off_to_dataptr(mp,
523 mp->m_dirdatablk,
535 (char *)dep - (char *)block); 524 (char *)dep - (char *)block);
536 xfs_da_brelse(tp, bp); 525 xfs_da_brelse(NULL, bp);
537 return error; 526 return 0;
538 } 527 }
539 } 528 }
540 529
@@ -542,13 +531,8 @@ xfs_dir2_block_getdents(
542 * Reached the end of the block. 531 * Reached the end of the block.
543 * Set the offset to a non-existent block 1 and return. 532 * Set the offset to a non-existent block 1 and return.
544 */ 533 */
545 *eofp = 1; 534 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
546 535 xfs_da_brelse(NULL, bp);
547 uio->uio_offset =
548 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
549
550 xfs_da_brelse(tp, bp);
551
552 return 0; 536 return 0;
553} 537}
554 538
diff --git a/fs/xfs/xfs_dir2_block.h b/fs/xfs/xfs_dir2_block.h
index e7c2606161e9..10e689676382 100644
--- a/fs/xfs/xfs_dir2_block.h
+++ b/fs/xfs/xfs_dir2_block.h
@@ -80,9 +80,8 @@ xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp)
80 * Function declarations. 80 * Function declarations.
81 */ 81 */
82extern int xfs_dir2_block_addname(struct xfs_da_args *args); 82extern int xfs_dir2_block_addname(struct xfs_da_args *args);
83extern int xfs_dir2_block_getdents(struct xfs_trans *tp, struct xfs_inode *dp, 83extern int xfs_dir2_block_getdents(struct xfs_inode *dp, void *dirent,
84 struct uio *uio, int *eofp, 84 xfs_off_t *offset, filldir_t filldir);
85 struct xfs_dirent *dbp, xfs_dir2_put_t put);
86extern int xfs_dir2_block_lookup(struct xfs_da_args *args); 85extern int xfs_dir2_block_lookup(struct xfs_da_args *args);
87extern int xfs_dir2_block_removename(struct xfs_da_args *args); 86extern int xfs_dir2_block_removename(struct xfs_da_args *args);
88extern int xfs_dir2_block_replace(struct xfs_da_args *args); 87extern int xfs_dir2_block_replace(struct xfs_da_args *args);
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index 7ebe295bd6d3..d2452699e9b1 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dir2.h" 26#include "xfs_dir2.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 1b73c9ad646a..e7c12fa1303e 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -749,12 +749,11 @@ xfs_dir2_leaf_compact_x1(
749 */ 749 */
750int /* error */ 750int /* error */
751xfs_dir2_leaf_getdents( 751xfs_dir2_leaf_getdents(
752 xfs_trans_t *tp, /* transaction pointer */
753 xfs_inode_t *dp, /* incore directory inode */ 752 xfs_inode_t *dp, /* incore directory inode */
754 uio_t *uio, /* I/O control & vectors */ 753 void *dirent,
755 int *eofp, /* out: reached end of dir */ 754 size_t bufsize,
756 xfs_dirent_t *dbp, /* caller's buffer */ 755 xfs_off_t *offset,
757 xfs_dir2_put_t put) /* ABI formatting routine */ 756 filldir_t filldir)
758{ 757{
759 xfs_dabuf_t *bp; /* data block buffer */ 758 xfs_dabuf_t *bp; /* data block buffer */
760 int byteoff; /* offset in current block */ 759 int byteoff; /* offset in current block */
@@ -763,7 +762,6 @@ xfs_dir2_leaf_getdents(
763 xfs_dir2_data_t *data; /* data block structure */ 762 xfs_dir2_data_t *data; /* data block structure */
764 xfs_dir2_data_entry_t *dep; /* data entry */ 763 xfs_dir2_data_entry_t *dep; /* data entry */
765 xfs_dir2_data_unused_t *dup; /* unused entry */ 764 xfs_dir2_data_unused_t *dup; /* unused entry */
766 int eof; /* reached end of directory */
767 int error = 0; /* error return value */ 765 int error = 0; /* error return value */
768 int i; /* temporary loop index */ 766 int i; /* temporary loop index */
769 int j; /* temporary loop index */ 767 int j; /* temporary loop index */
@@ -776,46 +774,38 @@ xfs_dir2_leaf_getdents(
776 xfs_mount_t *mp; /* filesystem mount point */ 774 xfs_mount_t *mp; /* filesystem mount point */
777 xfs_dir2_off_t newoff; /* new curoff after new blk */ 775 xfs_dir2_off_t newoff; /* new curoff after new blk */
778 int nmap; /* mappings to ask xfs_bmapi */ 776 int nmap; /* mappings to ask xfs_bmapi */
779 xfs_dir2_put_args_t *p; /* formatting arg bundle */
780 char *ptr = NULL; /* pointer to current data */ 777 char *ptr = NULL; /* pointer to current data */
781 int ra_current; /* number of read-ahead blks */ 778 int ra_current; /* number of read-ahead blks */
782 int ra_index; /* *map index for read-ahead */ 779 int ra_index; /* *map index for read-ahead */
783 int ra_offset; /* map entry offset for ra */ 780 int ra_offset; /* map entry offset for ra */
784 int ra_want; /* readahead count wanted */ 781 int ra_want; /* readahead count wanted */
782 xfs_ino_t ino;
785 783
786 /* 784 /*
787 * If the offset is at or past the largest allowed value, 785 * If the offset is at or past the largest allowed value,
788 * give up right away, return eof. 786 * give up right away.
789 */ 787 */
790 if (uio->uio_offset >= XFS_DIR2_MAX_DATAPTR) { 788 if (*offset >= XFS_DIR2_MAX_DATAPTR)
791 *eofp = 1;
792 return 0; 789 return 0;
793 } 790
794 mp = dp->i_mount; 791 mp = dp->i_mount;
795 /* 792
796 * Setup formatting arguments.
797 */
798 p = kmem_alloc(sizeof(*p), KM_SLEEP);
799 p->dbp = dbp;
800 p->put = put;
801 p->uio = uio;
802 /* 793 /*
803 * Set up to bmap a number of blocks based on the caller's 794 * Set up to bmap a number of blocks based on the caller's
804 * buffer size, the directory block size, and the filesystem 795 * buffer size, the directory block size, and the filesystem
805 * block size. 796 * block size.
806 */ 797 */
807 map_size = 798 map_size = howmany(bufsize + mp->m_dirblksize, mp->m_sb.sb_blocksize);
808 howmany(uio->uio_resid + mp->m_dirblksize,
809 mp->m_sb.sb_blocksize);
810 map = kmem_alloc(map_size * sizeof(*map), KM_SLEEP); 799 map = kmem_alloc(map_size * sizeof(*map), KM_SLEEP);
811 map_valid = ra_index = ra_offset = ra_current = map_blocks = 0; 800 map_valid = ra_index = ra_offset = ra_current = map_blocks = 0;
812 bp = NULL; 801 bp = NULL;
813 eof = 1; 802
814 /* 803 /*
815 * Inside the loop we keep the main offset value as a byte offset 804 * Inside the loop we keep the main offset value as a byte offset
816 * in the directory file. 805 * in the directory file.
817 */ 806 */
818 curoff = xfs_dir2_dataptr_to_byte(mp, uio->uio_offset); 807 curoff = xfs_dir2_dataptr_to_byte(mp, *offset);
808
819 /* 809 /*
820 * Force this conversion through db so we truncate the offset 810 * Force this conversion through db so we truncate the offset
821 * down to get the start of the data block. 811 * down to get the start of the data block.
@@ -836,7 +826,7 @@ xfs_dir2_leaf_getdents(
836 * take it out of the mapping. 826 * take it out of the mapping.
837 */ 827 */
838 if (bp) { 828 if (bp) {
839 xfs_da_brelse(tp, bp); 829 xfs_da_brelse(NULL, bp);
840 bp = NULL; 830 bp = NULL;
841 map_blocks -= mp->m_dirblkfsbs; 831 map_blocks -= mp->m_dirblkfsbs;
842 /* 832 /*
@@ -862,8 +852,9 @@ xfs_dir2_leaf_getdents(
862 /* 852 /*
863 * Recalculate the readahead blocks wanted. 853 * Recalculate the readahead blocks wanted.
864 */ 854 */
865 ra_want = howmany(uio->uio_resid + mp->m_dirblksize, 855 ra_want = howmany(bufsize + mp->m_dirblksize,
866 mp->m_sb.sb_blocksize) - 1; 856 mp->m_sb.sb_blocksize) - 1;
857
867 /* 858 /*
868 * If we don't have as many as we want, and we haven't 859 * If we don't have as many as we want, and we haven't
869 * run out of data blocks, get some more mappings. 860 * run out of data blocks, get some more mappings.
@@ -876,7 +867,7 @@ xfs_dir2_leaf_getdents(
876 * we already have in the table. 867 * we already have in the table.
877 */ 868 */
878 nmap = map_size - map_valid; 869 nmap = map_size - map_valid;
879 error = xfs_bmapi(tp, dp, 870 error = xfs_bmapi(NULL, dp,
880 map_off, 871 map_off,
881 xfs_dir2_byte_to_da(mp, 872 xfs_dir2_byte_to_da(mp,
882 XFS_DIR2_LEAF_OFFSET) - map_off, 873 XFS_DIR2_LEAF_OFFSET) - map_off,
@@ -939,7 +930,7 @@ xfs_dir2_leaf_getdents(
939 * mapping. 930 * mapping.
940 */ 931 */
941 curdb = xfs_dir2_da_to_db(mp, map->br_startoff); 932 curdb = xfs_dir2_da_to_db(mp, map->br_startoff);
942 error = xfs_da_read_buf(tp, dp, map->br_startoff, 933 error = xfs_da_read_buf(NULL, dp, map->br_startoff,
943 map->br_blockcount >= mp->m_dirblkfsbs ? 934 map->br_blockcount >= mp->m_dirblkfsbs ?
944 XFS_FSB_TO_DADDR(mp, map->br_startblock) : 935 XFS_FSB_TO_DADDR(mp, map->br_startblock) :
945 -1, 936 -1,
@@ -982,7 +973,7 @@ xfs_dir2_leaf_getdents(
982 * is a very rare case. 973 * is a very rare case.
983 */ 974 */
984 else if (i > ra_current) { 975 else if (i > ra_current) {
985 (void)xfs_da_reada_buf(tp, dp, 976 (void)xfs_da_reada_buf(NULL, dp,
986 map[ra_index].br_startoff + 977 map[ra_index].br_startoff +
987 ra_offset, XFS_DATA_FORK); 978 ra_offset, XFS_DATA_FORK);
988 ra_current = i; 979 ra_current = i;
@@ -1089,46 +1080,39 @@ xfs_dir2_leaf_getdents(
1089 */ 1080 */
1090 dep = (xfs_dir2_data_entry_t *)ptr; 1081 dep = (xfs_dir2_data_entry_t *)ptr;
1091 1082
1092 p->namelen = dep->namelen; 1083 length = xfs_dir2_data_entsize(dep->namelen);
1093
1094 length = xfs_dir2_data_entsize(p->namelen);
1095
1096 p->cook = xfs_dir2_byte_to_dataptr(mp, curoff + length);
1097 1084
1098 p->ino = be64_to_cpu(dep->inumber); 1085 ino = be64_to_cpu(dep->inumber);
1099#if XFS_BIG_INUMS 1086#if XFS_BIG_INUMS
1100 p->ino += mp->m_inoadd; 1087 ino += mp->m_inoadd;
1101#endif 1088#endif
1102 p->name = (char *)dep->name;
1103
1104 error = p->put(p);
1105 1089
1106 /* 1090 /*
1107 * Won't fit. Return to caller. 1091 * Won't fit. Return to caller.
1108 */ 1092 */
1109 if (!p->done) { 1093 if (filldir(dirent, dep->name, dep->namelen,
1110 eof = 0; 1094 xfs_dir2_byte_to_dataptr(mp, curoff + length),
1095 ino, DT_UNKNOWN))
1111 break; 1096 break;
1112 } 1097
1113 /* 1098 /*
1114 * Advance to next entry in the block. 1099 * Advance to next entry in the block.
1115 */ 1100 */
1116 ptr += length; 1101 ptr += length;
1117 curoff += length; 1102 curoff += length;
1103 bufsize -= length;
1118 } 1104 }
1119 1105
1120 /* 1106 /*
1121 * All done. Set output offset value to current offset. 1107 * All done. Set output offset value to current offset.
1122 */ 1108 */
1123 *eofp = eof;
1124 if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR)) 1109 if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR))
1125 uio->uio_offset = XFS_DIR2_MAX_DATAPTR; 1110 *offset = XFS_DIR2_MAX_DATAPTR;
1126 else 1111 else
1127 uio->uio_offset = xfs_dir2_byte_to_dataptr(mp, curoff); 1112 *offset = xfs_dir2_byte_to_dataptr(mp, curoff);
1128 kmem_free(map, map_size * sizeof(*map)); 1113 kmem_free(map, map_size * sizeof(*map));
1129 kmem_free(p, sizeof(*p));
1130 if (bp) 1114 if (bp)
1131 xfs_da_brelse(tp, bp); 1115 xfs_da_brelse(NULL, bp);
1132 return error; 1116 return error;
1133} 1117}
1134 1118
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h
index 70c97f3f815e..6c9539f06987 100644
--- a/fs/xfs/xfs_dir2_leaf.h
+++ b/fs/xfs/xfs_dir2_leaf.h
@@ -232,9 +232,9 @@ extern void xfs_dir2_leaf_compact(struct xfs_da_args *args,
232extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp, 232extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp,
233 int *lowstalep, int *highstalep, 233 int *lowstalep, int *highstalep,
234 int *lowlogp, int *highlogp); 234 int *lowlogp, int *highlogp);
235extern int xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp, 235extern int xfs_dir2_leaf_getdents(struct xfs_inode *dp, void *dirent,
236 struct uio *uio, int *eofp, 236 size_t bufsize, xfs_off_t *offset,
237 struct xfs_dirent *dbp, xfs_dir2_put_t put); 237 filldir_t filldir);
238extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno, 238extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno,
239 struct xfs_dabuf **bpp, int magic); 239 struct xfs_dabuf **bpp, int magic);
240extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp, 240extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp,
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 91c61d9632c8..eb18e399e836 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dir2.h" 26#include "xfs_dir2.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 38fc4f22b76d..182c70315ad1 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dir2.h" 26#include "xfs_dir2.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
@@ -695,19 +696,18 @@ xfs_dir2_sf_create(
695int /* error */ 696int /* error */
696xfs_dir2_sf_getdents( 697xfs_dir2_sf_getdents(
697 xfs_inode_t *dp, /* incore directory inode */ 698 xfs_inode_t *dp, /* incore directory inode */
698 uio_t *uio, /* caller's buffer control */ 699 void *dirent,
699 int *eofp, /* eof reached? (out) */ 700 xfs_off_t *offset,
700 xfs_dirent_t *dbp, /* caller's buffer */ 701 filldir_t filldir)
701 xfs_dir2_put_t put) /* abi's formatting function */
702{ 702{
703 int error; /* error return value */
704 int i; /* shortform entry number */ 703 int i; /* shortform entry number */
705 xfs_mount_t *mp; /* filesystem mount point */ 704 xfs_mount_t *mp; /* filesystem mount point */
706 xfs_dir2_dataptr_t off; /* current entry's offset */ 705 xfs_dir2_dataptr_t off; /* current entry's offset */
707 xfs_dir2_put_args_t p; /* arg package for put rtn */
708 xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */ 706 xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */
709 xfs_dir2_sf_t *sfp; /* shortform structure */ 707 xfs_dir2_sf_t *sfp; /* shortform structure */
710 xfs_off_t dir_offset; 708 xfs_dir2_dataptr_t dot_offset;
709 xfs_dir2_dataptr_t dotdot_offset;
710 xfs_ino_t ino;
711 711
712 mp = dp->i_mount; 712 mp = dp->i_mount;
713 713
@@ -720,8 +720,6 @@ xfs_dir2_sf_getdents(
720 return XFS_ERROR(EIO); 720 return XFS_ERROR(EIO);
721 } 721 }
722 722
723 dir_offset = uio->uio_offset;
724
725 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); 723 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
726 ASSERT(dp->i_df.if_u1.if_data != NULL); 724 ASSERT(dp->i_df.if_u1.if_data != NULL);
727 725
@@ -732,108 +730,78 @@ xfs_dir2_sf_getdents(
732 /* 730 /*
733 * If the block number in the offset is out of range, we're done. 731 * If the block number in the offset is out of range, we're done.
734 */ 732 */
735 if (xfs_dir2_dataptr_to_db(mp, dir_offset) > mp->m_dirdatablk) { 733 if (xfs_dir2_dataptr_to_db(mp, *offset) > mp->m_dirdatablk)
736 *eofp = 1;
737 return 0; 734 return 0;
738 }
739 735
740 /* 736 /*
741 * Set up putargs structure. 737 * Precalculate offsets for . and .. as we will always need them.
738 *
739 * XXX(hch): the second argument is sometimes 0 and sometimes
740 * mp->m_dirdatablk.
742 */ 741 */
743 p.dbp = dbp; 742 dot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
744 p.put = put; 743 XFS_DIR2_DATA_DOT_OFFSET);
745 p.uio = uio; 744 dotdot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
745 XFS_DIR2_DATA_DOTDOT_OFFSET);
746
746 /* 747 /*
747 * Put . entry unless we're starting past it. 748 * Put . entry unless we're starting past it.
748 */ 749 */
749 if (dir_offset <= 750 if (*offset <= dot_offset) {
750 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 751 ino = dp->i_ino;
751 XFS_DIR2_DATA_DOT_OFFSET)) {
752 p.cook = xfs_dir2_db_off_to_dataptr(mp, 0,
753 XFS_DIR2_DATA_DOTDOT_OFFSET);
754 p.ino = dp->i_ino;
755#if XFS_BIG_INUMS 752#if XFS_BIG_INUMS
756 p.ino += mp->m_inoadd; 753 ino += mp->m_inoadd;
757#endif 754#endif
758 p.name = "."; 755 if (filldir(dirent, ".", 1, dotdot_offset, ino, DT_DIR)) {
759 p.namelen = 1; 756 *offset = dot_offset;
760 757 return 0;
761 error = p.put(&p);
762
763 if (!p.done) {
764 uio->uio_offset =
765 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
766 XFS_DIR2_DATA_DOT_OFFSET);
767 return error;
768 } 758 }
769 } 759 }
770 760
771 /* 761 /*
772 * Put .. entry unless we're starting past it. 762 * Put .. entry unless we're starting past it.
773 */ 763 */
774 if (dir_offset <= 764 if (*offset <= dotdot_offset) {
775 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 765 off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
776 XFS_DIR2_DATA_DOTDOT_OFFSET)) { 766 XFS_DIR2_DATA_FIRST_OFFSET);
777 p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 767 ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
778 XFS_DIR2_DATA_FIRST_OFFSET);
779 p.ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
780#if XFS_BIG_INUMS 768#if XFS_BIG_INUMS
781 p.ino += mp->m_inoadd; 769 ino += mp->m_inoadd;
782#endif 770#endif
783 p.name = ".."; 771 if (filldir(dirent, "..", 2, off, ino, DT_DIR)) {
784 p.namelen = 2; 772 *offset = dotdot_offset;
785 773 return 0;
786 error = p.put(&p);
787
788 if (!p.done) {
789 uio->uio_offset =
790 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
791 XFS_DIR2_DATA_DOTDOT_OFFSET);
792 return error;
793 } 774 }
794 } 775 }
795 776
796 /* 777 /*
797 * Loop while there are more entries and put'ing works. 778 * Loop while there are more entries and put'ing works.
798 */ 779 */
799 for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp); 780 sfep = xfs_dir2_sf_firstentry(sfp);
800 i < sfp->hdr.count; 781 for (i = 0; i < sfp->hdr.count; i++) {
801 i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
802
803 off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 782 off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
804 xfs_dir2_sf_get_offset(sfep)); 783 xfs_dir2_sf_get_offset(sfep));
805 784
806 if (dir_offset > off) 785 if (*offset > off) {
786 sfep = xfs_dir2_sf_nextentry(sfp, sfep);
807 continue; 787 continue;
788 }
808 789
809 p.namelen = sfep->namelen; 790 ino = xfs_dir2_sf_get_inumber(sfp, xfs_dir2_sf_inumberp(sfep));
810
811 p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
812 xfs_dir2_sf_get_offset(sfep) +
813 xfs_dir2_data_entsize(p.namelen));
814
815 p.ino = xfs_dir2_sf_get_inumber(sfp, xfs_dir2_sf_inumberp(sfep));
816#if XFS_BIG_INUMS 791#if XFS_BIG_INUMS
817 p.ino += mp->m_inoadd; 792 ino += mp->m_inoadd;
818#endif 793#endif
819 p.name = (char *)sfep->name;
820
821 error = p.put(&p);
822 794
823 if (!p.done) { 795 if (filldir(dirent, sfep->name, sfep->namelen,
824 uio->uio_offset = off; 796 off + xfs_dir2_data_entsize(sfep->namelen),
825 return error; 797 ino, DT_UNKNOWN)) {
798 *offset = off;
799 return 0;
826 } 800 }
801 sfep = xfs_dir2_sf_nextentry(sfp, sfep);
827 } 802 }
828 803
829 /* 804 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
830 * They all fit.
831 */
832 *eofp = 1;
833
834 uio->uio_offset =
835 xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
836
837 return 0; 805 return 0;
838} 806}
839 807
diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h
index 11e503209afa..005629d702d2 100644
--- a/fs/xfs/xfs_dir2_sf.h
+++ b/fs/xfs/xfs_dir2_sf.h
@@ -169,9 +169,8 @@ extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp,
169 int size, xfs_dir2_sf_hdr_t *sfhp); 169 int size, xfs_dir2_sf_hdr_t *sfhp);
170extern int xfs_dir2_sf_addname(struct xfs_da_args *args); 170extern int xfs_dir2_sf_addname(struct xfs_da_args *args);
171extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino); 171extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
172extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio, 172extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, void *dirent,
173 int *eofp, struct xfs_dirent *dbp, 173 xfs_off_t *offset, filldir_t filldir);
174 xfs_dir2_put_t put);
175extern int xfs_dir2_sf_lookup(struct xfs_da_args *args); 174extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);
176extern int xfs_dir2_sf_removename(struct xfs_da_args *args); 175extern int xfs_dir2_sf_removename(struct xfs_da_args *args);
177extern int xfs_dir2_sf_replace(struct xfs_da_args *args); 176extern int xfs_dir2_sf_replace(struct xfs_da_args *args);
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h
index adc3d251240d..f71784ab6a60 100644
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -67,17 +67,15 @@ typedef enum {
67#define HAVE_DM_RIGHT_T 67#define HAVE_DM_RIGHT_T
68 68
69/* Defines for determining if an event message should be sent. */ 69/* Defines for determining if an event message should be sent. */
70#define DM_EVENT_ENABLED(vfsp, ip, event) ( \ 70#ifdef HAVE_DMAPI
71 unlikely ((vfsp)->vfs_flag & VFS_DMI) && \ 71#define DM_EVENT_ENABLED(ip, event) ( \
72 unlikely ((ip)->i_mount->m_flags & XFS_MOUNT_DMAPI) && \
72 ( ((ip)->i_d.di_dmevmask & (1 << event)) || \ 73 ( ((ip)->i_d.di_dmevmask & (1 << event)) || \
73 ((ip)->i_mount->m_dmevmask & (1 << event)) ) \ 74 ((ip)->i_mount->m_dmevmask & (1 << event)) ) \
74 ) 75 )
75 76#else
76#define DM_EVENT_ENABLED_IO(vfsp, io, event) ( \ 77#define DM_EVENT_ENABLED(ip, event) (0)
77 unlikely ((vfsp)->vfs_flag & VFS_DMI) && \ 78#endif
78 ( ((io)->io_dmevmask & (1 << event)) || \
79 ((io)->io_mount->m_dmevmask & (1 << event)) ) \
80 )
81 79
82#define DM_XFS_VALID_FS_EVENTS ( \ 80#define DM_XFS_VALID_FS_EVENTS ( \
83 (1 << DM_EVENT_PREUNMOUNT) | \ 81 (1 << DM_EVENT_PREUNMOUNT) | \
@@ -170,7 +168,4 @@ typedef enum {
170 DM_FLAGS_NDELAY : 0) 168 DM_FLAGS_NDELAY : 0)
171#define AT_DELAY_FLAG(f) ((f&ATTR_NONBLOCK) ? DM_FLAGS_NDELAY : 0) 169#define AT_DELAY_FLAG(f) ((f&ATTR_NONBLOCK) ? DM_FLAGS_NDELAY : 0)
172 170
173
174extern struct bhv_module_vfsops xfs_dmops;
175
176#endif /* __XFS_DMAPI_H__ */ 171#endif /* __XFS_DMAPI_H__ */
diff --git a/fs/xfs/xfs_dmops.c b/fs/xfs/xfs_dmops.c
index 1e4a35ddf7f9..6cd5704258a2 100644
--- a/fs/xfs/xfs_dmops.c
+++ b/fs/xfs/xfs_dmops.c
@@ -19,18 +19,51 @@
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_types.h" 20#include "xfs_types.h"
21#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
23#include "xfs_trans.h" 22#include "xfs_trans.h"
24#include "xfs_sb.h" 23#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_dir2.h"
27#include "xfs_dmapi.h" 24#include "xfs_dmapi.h"
25#include "xfs_inum.h"
26#include "xfs_ag.h"
28#include "xfs_mount.h" 27#include "xfs_mount.h"
28#include "xfs_clnt.h"
29
29 30
30xfs_dmops_t xfs_dmcore_stub = { 31static struct xfs_dmops xfs_dmcore_stub = {
31 .xfs_send_data = (xfs_send_data_t)fs_nosys, 32 .xfs_send_data = (xfs_send_data_t)fs_nosys,
32 .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr, 33 .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr,
33 .xfs_send_destroy = (xfs_send_destroy_t)fs_nosys, 34 .xfs_send_destroy = (xfs_send_destroy_t)fs_nosys,
34 .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys, 35 .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys,
35 .xfs_send_unmount = (xfs_send_unmount_t)fs_noval, 36 .xfs_send_mount = (xfs_send_mount_t)fs_nosys,
37 .xfs_send_unmount = (xfs_send_unmount_t)fs_noerr,
36}; 38};
39
40int
41xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args)
42{
43 if (args->flags & XFSMNT_DMAPI) {
44 struct xfs_dmops *ops;
45
46 ops = symbol_get(xfs_dmcore_xfs);
47 if (!ops) {
48 request_module("xfs_dmapi");
49 ops = symbol_get(xfs_dmcore_xfs);
50 }
51
52 if (!ops) {
53 cmn_err(CE_WARN, "XFS: no dmapi support available.");
54 return EINVAL;
55 }
56 mp->m_dm_ops = ops;
57 } else {
58 mp->m_dm_ops = &xfs_dmcore_stub;
59 }
60
61 return 0;
62}
63
64void
65xfs_dmops_put(struct xfs_mount *mp)
66{
67 if (mp->m_dm_ops != &xfs_dmcore_stub)
68 symbol_put(xfs_dmcore_xfs);
69}
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 8c4331631337..a4634d94e561 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dir2.h" 26#include "xfs_dir2.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
@@ -132,10 +133,14 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp)
132} 133}
133 134
134int 135int
135xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud) 136xfs_errortag_clearall(xfs_mount_t *mp, int loud)
136{ 137{
137 int i; 138 int64_t fsid;
138 int cleared = 0; 139 int cleared = 0;
140 int i;
141
142 memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
143
139 144
140 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) { 145 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
141 if ((fsid == 0LL || xfs_etest_fsid[i] == fsid) && 146 if ((fsid == 0LL || xfs_etest_fsid[i] == fsid) &&
@@ -154,20 +159,10 @@ xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud)
154 if (loud || cleared) 159 if (loud || cleared)
155 cmn_err(CE_WARN, 160 cmn_err(CE_WARN,
156 "Cleared all XFS error tags for filesystem \"%s\"", 161 "Cleared all XFS error tags for filesystem \"%s\"",
157 fsname); 162 mp->m_fsname);
158 163
159 return 0; 164 return 0;
160} 165}
161
162int
163xfs_errortag_clearall(xfs_mount_t *mp)
164{
165 int64_t fsid;
166
167 memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
168
169 return xfs_errortag_clearall_umount(fsid, mp->m_fsname, 1);
170}
171#endif /* DEBUG || INDUCE_IO_ERROR */ 166#endif /* DEBUG || INDUCE_IO_ERROR */
172 167
173static void 168static void
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 5599ada456a1..10e9d9619ae5 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -144,12 +144,11 @@ extern void xfs_error_test_init(void);
144#endif /* __ANSI_CPP__ */ 144#endif /* __ANSI_CPP__ */
145 145
146extern int xfs_errortag_add(int error_tag, xfs_mount_t *mp); 146extern int xfs_errortag_add(int error_tag, xfs_mount_t *mp);
147extern int xfs_errortag_clearall(xfs_mount_t *mp); 147extern int xfs_errortag_clearall(xfs_mount_t *mp, int loud);
148extern int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud);
149#else 148#else
150#define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) 149#define XFS_TEST_ERROR(expr, mp, tag, rf) (expr)
151#define xfs_errortag_add(tag, mp) (ENOSYS) 150#define xfs_errortag_add(tag, mp) (ENOSYS)
152#define xfs_errortag_clearall(mp) (ENOSYS) 151#define xfs_errortag_clearall(mp, loud) (ENOSYS)
153#endif /* (DEBUG || INDUCE_IO_ERROR) */ 152#endif /* (DEBUG || INDUCE_IO_ERROR) */
154 153
155/* 154/*
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 3b14427ee123..f938a51be81b 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -23,6 +23,7 @@
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_buf_item.h" 24#include "xfs_buf_item.h"
25#include "xfs_sb.h" 25#include "xfs_sb.h"
26#include "xfs_ag.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
28#include "xfs_trans_priv.h" 29#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 432e82347ed6..c92d5b821029 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -136,7 +136,6 @@ xfs_growfs_data_private(
136 xfs_rfsblock_t nfree; 136 xfs_rfsblock_t nfree;
137 xfs_agnumber_t oagcount; 137 xfs_agnumber_t oagcount;
138 int pct; 138 int pct;
139 xfs_sb_t *sbp;
140 xfs_trans_t *tp; 139 xfs_trans_t *tp;
141 140
142 nb = in->newblocks; 141 nb = in->newblocks;
@@ -175,7 +174,7 @@ xfs_growfs_data_private(
175 memset(&mp->m_perag[oagcount], 0, 174 memset(&mp->m_perag[oagcount], 0,
176 (nagcount - oagcount) * sizeof(xfs_perag_t)); 175 (nagcount - oagcount) * sizeof(xfs_perag_t));
177 mp->m_flags |= XFS_MOUNT_32BITINODES; 176 mp->m_flags |= XFS_MOUNT_32BITINODES;
178 nagimax = xfs_initialize_perag(XFS_MTOVFS(mp), mp, nagcount); 177 nagimax = xfs_initialize_perag(mp, nagcount);
179 up_write(&mp->m_peraglock); 178 up_write(&mp->m_peraglock);
180 } 179 }
181 tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); 180 tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
@@ -377,8 +376,7 @@ xfs_growfs_data_private(
377 error, agno); 376 error, agno);
378 break; 377 break;
379 } 378 }
380 sbp = XFS_BUF_TO_SBP(bp); 379 xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, XFS_SB_ALL_BITS);
381 xfs_xlatesb(sbp, &mp->m_sb, -1, XFS_SB_ALL_BITS);
382 /* 380 /*
383 * If we get an error writing out the alternate superblocks, 381 * If we get an error writing out the alternate superblocks,
384 * just issue a warning and continue. The real work is 382 * just issue a warning and continue. The real work is
@@ -435,10 +433,10 @@ xfs_growfs_data(
435 xfs_growfs_data_t *in) 433 xfs_growfs_data_t *in)
436{ 434{
437 int error; 435 int error;
438 if (!cpsema(&mp->m_growlock)) 436 if (!mutex_trylock(&mp->m_growlock))
439 return XFS_ERROR(EWOULDBLOCK); 437 return XFS_ERROR(EWOULDBLOCK);
440 error = xfs_growfs_data_private(mp, in); 438 error = xfs_growfs_data_private(mp, in);
441 vsema(&mp->m_growlock); 439 mutex_unlock(&mp->m_growlock);
442 return error; 440 return error;
443} 441}
444 442
@@ -448,10 +446,10 @@ xfs_growfs_log(
448 xfs_growfs_log_t *in) 446 xfs_growfs_log_t *in)
449{ 447{
450 int error; 448 int error;
451 if (!cpsema(&mp->m_growlock)) 449 if (!mutex_trylock(&mp->m_growlock))
452 return XFS_ERROR(EWOULDBLOCK); 450 return XFS_ERROR(EWOULDBLOCK);
453 error = xfs_growfs_log_private(mp, in); 451 error = xfs_growfs_log_private(mp, in);
454 vsema(&mp->m_growlock); 452 mutex_unlock(&mp->m_growlock);
455 return error; 453 return error;
456} 454}
457 455
@@ -628,8 +626,7 @@ xfs_fs_goingdown(
628{ 626{
629 switch (inflags) { 627 switch (inflags) {
630 case XFS_FSOP_GOING_FLAGS_DEFAULT: { 628 case XFS_FSOP_GOING_FLAGS_DEFAULT: {
631 struct bhv_vfs *vfsp = XFS_MTOVFS(mp); 629 struct super_block *sb = freeze_bdev(mp->m_super->s_bdev);
632 struct super_block *sb = freeze_bdev(vfsp->vfs_super->s_bdev);
633 630
634 if (sb && !IS_ERR(sb)) { 631 if (sb && !IS_ERR(sb)) {
635 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); 632 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index f943368c9b93..1409c2d61c11 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -293,9 +293,9 @@ xfs_ialloc_ag_alloc(
293 xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog); 293 xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog);
294 for (i = 0; i < ninodes; i++) { 294 for (i = 0; i < ninodes; i++) {
295 free = XFS_MAKE_IPTR(args.mp, fbuf, i); 295 free = XFS_MAKE_IPTR(args.mp, fbuf, i);
296 INT_SET(free->di_core.di_magic, ARCH_CONVERT, XFS_DINODE_MAGIC); 296 free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
297 INT_SET(free->di_core.di_version, ARCH_CONVERT, version); 297 free->di_core.di_version = version;
298 INT_SET(free->di_next_unlinked, ARCH_CONVERT, NULLAGINO); 298 free->di_next_unlinked = cpu_to_be32(NULLAGINO);
299 xfs_ialloc_log_di(tp, fbuf, i, 299 xfs_ialloc_log_di(tp, fbuf, i,
300 XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED); 300 XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED);
301 } 301 }
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h
index 97f4040931ca..4e30ec1d13bc 100644
--- a/fs/xfs/xfs_ialloc.h
+++ b/fs/xfs/xfs_ialloc.h
@@ -30,14 +30,9 @@ struct xfs_trans;
30#define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks 30#define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks
31 31
32/* 32/*
33 * For small block file systems, move inodes in clusters of this size. 33 * Move inodes in clusters of this size.
34 * When we don't have a lot of memory, however, we go a bit smaller
35 * to reduce the number of AGI and ialloc btree blocks we need to keep
36 * around for xfs_dilocate(). We choose which one to use in
37 * xfs_mount_int().
38 */ 34 */
39#define XFS_INODE_BIG_CLUSTER_SIZE 8192 35#define XFS_INODE_BIG_CLUSTER_SIZE 8192
40#define XFS_INODE_SMALL_CLUSTER_SIZE 4096
41#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size 36#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size
42 37
43/* 38/*
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 114433a22baa..488836e204a3 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -40,131 +40,13 @@
40#include "xfs_utils.h" 40#include "xfs_utils.h"
41 41
42/* 42/*
43 * Initialize the inode hash table for the newly mounted file system.
44 * Choose an initial table size based on user specified value, else
45 * use a simple algorithm using the maximum number of inodes as an
46 * indicator for table size, and clamp it between one and some large
47 * number of pages.
48 */
49void
50xfs_ihash_init(xfs_mount_t *mp)
51{
52 __uint64_t icount;
53 uint i;
54
55 if (!mp->m_ihsize) {
56 icount = mp->m_maxicount ? mp->m_maxicount :
57 (mp->m_sb.sb_dblocks << mp->m_sb.sb_inopblog);
58 mp->m_ihsize = 1 << max_t(uint, 8,
59 (xfs_highbit64(icount) + 1) / 2);
60 mp->m_ihsize = min_t(uint, mp->m_ihsize,
61 (64 * NBPP) / sizeof(xfs_ihash_t));
62 }
63
64 mp->m_ihash = kmem_zalloc_greedy(&mp->m_ihsize,
65 NBPC * sizeof(xfs_ihash_t),
66 mp->m_ihsize * sizeof(xfs_ihash_t),
67 KM_SLEEP | KM_MAYFAIL | KM_LARGE);
68 mp->m_ihsize /= sizeof(xfs_ihash_t);
69 for (i = 0; i < mp->m_ihsize; i++)
70 rwlock_init(&(mp->m_ihash[i].ih_lock));
71}
72
73/*
74 * Free up structures allocated by xfs_ihash_init, at unmount time.
75 */
76void
77xfs_ihash_free(xfs_mount_t *mp)
78{
79 kmem_free(mp->m_ihash, mp->m_ihsize * sizeof(xfs_ihash_t));
80 mp->m_ihash = NULL;
81}
82
83/*
84 * Initialize the inode cluster hash table for the newly mounted file system.
85 * Its size is derived from the ihash table size.
86 */
87void
88xfs_chash_init(xfs_mount_t *mp)
89{
90 uint i;
91
92 mp->m_chsize = max_t(uint, 1, mp->m_ihsize /
93 (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog));
94 mp->m_chsize = min_t(uint, mp->m_chsize, mp->m_ihsize);
95 mp->m_chash = (xfs_chash_t *)kmem_zalloc(mp->m_chsize
96 * sizeof(xfs_chash_t),
97 KM_SLEEP | KM_LARGE);
98 for (i = 0; i < mp->m_chsize; i++) {
99 spinlock_init(&mp->m_chash[i].ch_lock,"xfshash");
100 }
101}
102
103/*
104 * Free up structures allocated by xfs_chash_init, at unmount time.
105 */
106void
107xfs_chash_free(xfs_mount_t *mp)
108{
109 int i;
110
111 for (i = 0; i < mp->m_chsize; i++) {
112 spinlock_destroy(&mp->m_chash[i].ch_lock);
113 }
114
115 kmem_free(mp->m_chash, mp->m_chsize*sizeof(xfs_chash_t));
116 mp->m_chash = NULL;
117}
118
119/*
120 * Try to move an inode to the front of its hash list if possible
121 * (and if its not there already). Called right after obtaining
122 * the list version number and then dropping the read_lock on the
123 * hash list in question (which is done right after looking up the
124 * inode in question...).
125 */
126STATIC void
127xfs_ihash_promote(
128 xfs_ihash_t *ih,
129 xfs_inode_t *ip,
130 ulong version)
131{
132 xfs_inode_t *iq;
133
134 if ((ip->i_prevp != &ih->ih_next) && write_trylock(&ih->ih_lock)) {
135 if (likely(version == ih->ih_version)) {
136 /* remove from list */
137 if ((iq = ip->i_next)) {
138 iq->i_prevp = ip->i_prevp;
139 }
140 *ip->i_prevp = iq;
141
142 /* insert at list head */
143 iq = ih->ih_next;
144 iq->i_prevp = &ip->i_next;
145 ip->i_next = iq;
146 ip->i_prevp = &ih->ih_next;
147 ih->ih_next = ip;
148 }
149 write_unlock(&ih->ih_lock);
150 }
151}
152
153/*
154 * Look up an inode by number in the given file system. 43 * Look up an inode by number in the given file system.
155 * The inode is looked up in the hash table for the file system 44 * The inode is looked up in the cache held in each AG.
156 * represented by the mount point parameter mp. Each bucket of 45 * If the inode is found in the cache, attach it to the provided
157 * the hash table is guarded by an individual semaphore. 46 * vnode.
158 *
159 * If the inode is found in the hash table, its corresponding vnode
160 * is obtained with a call to vn_get(). This call takes care of
161 * coordination with the reclamation of the inode and vnode. Note
162 * that the vmap structure is filled in while holding the hash lock.
163 * This gives us the state of the inode/vnode when we found it and
164 * is used for coordination in vn_get().
165 * 47 *
166 * If it is not in core, read it in from the file system's device and 48 * If it is not in core, read it in from the file system's device,
167 * add the inode into the hash table. 49 * add it to the cache and attach the provided vnode.
168 * 50 *
169 * The inode is locked according to the value of the lock_flags parameter. 51 * The inode is locked according to the value of the lock_flags parameter.
170 * This flag parameter indicates how and if the inode's IO lock and inode lock 52 * This flag parameter indicates how and if the inode's IO lock and inode lock
@@ -192,274 +74,241 @@ xfs_iget_core(
192 xfs_inode_t **ipp, 74 xfs_inode_t **ipp,
193 xfs_daddr_t bno) 75 xfs_daddr_t bno)
194{ 76{
195 xfs_ihash_t *ih;
196 xfs_inode_t *ip; 77 xfs_inode_t *ip;
197 xfs_inode_t *iq; 78 xfs_inode_t *iq;
198 bhv_vnode_t *inode_vp; 79 bhv_vnode_t *inode_vp;
199 ulong version;
200 int error; 80 int error;
201 /* REFERENCED */ 81 xfs_icluster_t *icl, *new_icl = NULL;
202 xfs_chash_t *ch; 82 unsigned long first_index, mask;
203 xfs_chashlist_t *chl, *chlnew; 83 xfs_perag_t *pag;
204 SPLDECL(s); 84 xfs_agino_t agino;
85
86 /* the radix tree exists only in inode capable AGs */
87 if (XFS_INO_TO_AGNO(mp, ino) >= mp->m_maxagi)
88 return EINVAL;
89
90 /* get the perag structure and ensure that it's inode capable */
91 pag = xfs_get_perag(mp, ino);
92 if (!pag->pagi_inodeok)
93 return EINVAL;
94 ASSERT(pag->pag_ici_init);
95 agino = XFS_INO_TO_AGINO(mp, ino);
205 96
97again:
98 read_lock(&pag->pag_ici_lock);
99 ip = radix_tree_lookup(&pag->pag_ici_root, agino);
206 100
207 ih = XFS_IHASH(mp, ino); 101 if (ip != NULL) {
102 /*
103 * If INEW is set this inode is being set up
104 * we need to pause and try again.
105 */
106 if (xfs_iflags_test(ip, XFS_INEW)) {
107 read_unlock(&pag->pag_ici_lock);
108 delay(1);
109 XFS_STATS_INC(xs_ig_frecycle);
208 110
209again: 111 goto again;
210 read_lock(&ih->ih_lock); 112 }
211 113
212 for (ip = ih->ih_next; ip != NULL; ip = ip->i_next) { 114 inode_vp = XFS_ITOV_NULL(ip);
213 if (ip->i_ino == ino) { 115 if (inode_vp == NULL) {
214 /* 116 /*
215 * If INEW is set this inode is being set up 117 * If IRECLAIM is set this inode is
118 * on its way out of the system,
216 * we need to pause and try again. 119 * we need to pause and try again.
217 */ 120 */
218 if (xfs_iflags_test(ip, XFS_INEW)) { 121 if (xfs_iflags_test(ip, XFS_IRECLAIM)) {
219 read_unlock(&ih->ih_lock); 122 read_unlock(&pag->pag_ici_lock);
220 delay(1); 123 delay(1);
221 XFS_STATS_INC(xs_ig_frecycle); 124 XFS_STATS_INC(xs_ig_frecycle);
222 125
223 goto again; 126 goto again;
224 } 127 }
128 ASSERT(xfs_iflags_test(ip, XFS_IRECLAIMABLE));
225 129
226 inode_vp = XFS_ITOV_NULL(ip); 130 /*
227 if (inode_vp == NULL) { 131 * If lookup is racing with unlink, then we
228 /* 132 * should return an error immediately so we
229 * If IRECLAIM is set this inode is 133 * don't remove it from the reclaim list and
230 * on its way out of the system, 134 * potentially leak the inode.
231 * we need to pause and try again. 135 */
232 */ 136 if ((ip->i_d.di_mode == 0) &&
233 if (xfs_iflags_test(ip, XFS_IRECLAIM)) { 137 !(flags & XFS_IGET_CREATE)) {
234 read_unlock(&ih->ih_lock); 138 read_unlock(&pag->pag_ici_lock);
235 delay(1); 139 xfs_put_perag(mp, pag);
236 XFS_STATS_INC(xs_ig_frecycle); 140 return ENOENT;
237 141 }
238 goto again; 142
239 } 143 /*
240 ASSERT(xfs_iflags_test(ip, XFS_IRECLAIMABLE)); 144 * There may be transactions sitting in the
241 145 * incore log buffers or being flushed to disk
242 /* 146 * at this time. We can't clear the
243 * If lookup is racing with unlink, then we 147 * XFS_IRECLAIMABLE flag until these
244 * should return an error immediately so we 148 * transactions have hit the disk, otherwise we
245 * don't remove it from the reclaim list and 149 * will void the guarantee the flag provides
246 * potentially leak the inode. 150 * xfs_iunpin()
247 */ 151 */
248 if ((ip->i_d.di_mode == 0) && 152 if (xfs_ipincount(ip)) {
249 !(flags & XFS_IGET_CREATE)) { 153 read_unlock(&pag->pag_ici_lock);
250 read_unlock(&ih->ih_lock); 154 xfs_log_force(mp, 0,
251 return ENOENT; 155 XFS_LOG_FORCE|XFS_LOG_SYNC);
252 } 156 XFS_STATS_INC(xs_ig_frecycle);
253 157 goto again;
254 /* 158 }
255 * There may be transactions sitting in the
256 * incore log buffers or being flushed to disk
257 * at this time. We can't clear the
258 * XFS_IRECLAIMABLE flag until these
259 * transactions have hit the disk, otherwise we
260 * will void the guarantee the flag provides
261 * xfs_iunpin()
262 */
263 if (xfs_ipincount(ip)) {
264 read_unlock(&ih->ih_lock);
265 xfs_log_force(mp, 0,
266 XFS_LOG_FORCE|XFS_LOG_SYNC);
267 XFS_STATS_INC(xs_ig_frecycle);
268 goto again;
269 }
270
271 vn_trace_exit(vp, "xfs_iget.alloc",
272 (inst_t *)__return_address);
273 159
274 XFS_STATS_INC(xs_ig_found); 160 vn_trace_exit(ip, "xfs_iget.alloc",
161 (inst_t *)__return_address);
275 162
276 xfs_iflags_clear(ip, XFS_IRECLAIMABLE); 163 XFS_STATS_INC(xs_ig_found);
277 version = ih->ih_version;
278 read_unlock(&ih->ih_lock);
279 xfs_ihash_promote(ih, ip, version);
280 164
281 XFS_MOUNT_ILOCK(mp); 165 xfs_iflags_clear(ip, XFS_IRECLAIMABLE);
282 list_del_init(&ip->i_reclaim); 166 read_unlock(&pag->pag_ici_lock);
283 XFS_MOUNT_IUNLOCK(mp);
284 167
285 goto finish_inode; 168 XFS_MOUNT_ILOCK(mp);
169 list_del_init(&ip->i_reclaim);
170 XFS_MOUNT_IUNLOCK(mp);
286 171
287 } else if (vp != inode_vp) { 172 goto finish_inode;
288 struct inode *inode = vn_to_inode(inode_vp);
289 173
290 /* The inode is being torn down, pause and 174 } else if (vp != inode_vp) {
291 * try again. 175 struct inode *inode = vn_to_inode(inode_vp);
292 */
293 if (inode->i_state & (I_FREEING | I_CLEAR)) {
294 read_unlock(&ih->ih_lock);
295 delay(1);
296 XFS_STATS_INC(xs_ig_frecycle);
297 176
298 goto again; 177 /* The inode is being torn down, pause and
299 } 178 * try again.
300/* Chances are the other vnode (the one in the inode) is being torn 179 */
301 * down right now, and we landed on top of it. Question is, what do 180 if (inode->i_state & (I_FREEING | I_CLEAR)) {
302 * we do? Unhook the old inode and hook up the new one? 181 read_unlock(&pag->pag_ici_lock);
303 */ 182 delay(1);
304 cmn_err(CE_PANIC, 183 XFS_STATS_INC(xs_ig_frecycle);
305 "xfs_iget_core: ambiguous vns: vp/0x%p, invp/0x%p", 184
306 inode_vp, vp); 185 goto again;
307 } 186 }
187/* Chances are the other vnode (the one in the inode) is being torn
188* down right now, and we landed on top of it. Question is, what do
189* we do? Unhook the old inode and hook up the new one?
190*/
191 cmn_err(CE_PANIC,
192 "xfs_iget_core: ambiguous vns: vp/0x%p, invp/0x%p",
193 inode_vp, vp);
194 }
308 195
309 /* 196 /*
310 * Inode cache hit: if ip is not at the front of 197 * Inode cache hit
311 * its hash chain, move it there now. 198 */
312 * Do this with the lock held for update, but 199 read_unlock(&pag->pag_ici_lock);
313 * do statistics after releasing the lock. 200 XFS_STATS_INC(xs_ig_found);
314 */
315 version = ih->ih_version;
316 read_unlock(&ih->ih_lock);
317 xfs_ihash_promote(ih, ip, version);
318 XFS_STATS_INC(xs_ig_found);
319 201
320finish_inode: 202finish_inode:
321 if (ip->i_d.di_mode == 0) { 203 if (ip->i_d.di_mode == 0) {
322 if (!(flags & XFS_IGET_CREATE)) 204 if (!(flags & XFS_IGET_CREATE)) {
323 return ENOENT; 205 xfs_put_perag(mp, pag);
324 xfs_iocore_inode_reinit(ip); 206 return ENOENT;
325 } 207 }
208 xfs_iocore_inode_reinit(ip);
209 }
326 210
327 if (lock_flags != 0) 211 if (lock_flags != 0)
328 xfs_ilock(ip, lock_flags); 212 xfs_ilock(ip, lock_flags);
329 213
330 xfs_iflags_clear(ip, XFS_ISTALE); 214 xfs_iflags_clear(ip, XFS_ISTALE);
331 vn_trace_exit(vp, "xfs_iget.found", 215 vn_trace_exit(ip, "xfs_iget.found",
332 (inst_t *)__return_address); 216 (inst_t *)__return_address);
333 goto return_ip; 217 goto return_ip;
334 }
335 } 218 }
336 219
337 /* 220 /*
338 * Inode cache miss: save the hash chain version stamp and unlock 221 * Inode cache miss
339 * the chain, so we don't deadlock in vn_alloc.
340 */ 222 */
223 read_unlock(&pag->pag_ici_lock);
341 XFS_STATS_INC(xs_ig_missed); 224 XFS_STATS_INC(xs_ig_missed);
342 225
343 version = ih->ih_version;
344
345 read_unlock(&ih->ih_lock);
346
347 /* 226 /*
348 * Read the disk inode attributes into a new inode structure and get 227 * Read the disk inode attributes into a new inode structure and get
349 * a new vnode for it. This should also initialize i_ino and i_mount. 228 * a new vnode for it. This should also initialize i_ino and i_mount.
350 */ 229 */
351 error = xfs_iread(mp, tp, ino, &ip, bno, 230 error = xfs_iread(mp, tp, ino, &ip, bno,
352 (flags & XFS_IGET_BULKSTAT) ? XFS_IMAP_BULKSTAT : 0); 231 (flags & XFS_IGET_BULKSTAT) ? XFS_IMAP_BULKSTAT : 0);
353 if (error) 232 if (error) {
233 xfs_put_perag(mp, pag);
354 return error; 234 return error;
235 }
355 236
356 vn_trace_exit(vp, "xfs_iget.alloc", (inst_t *)__return_address); 237 vn_trace_exit(ip, "xfs_iget.alloc", (inst_t *)__return_address);
357 238
358 xfs_inode_lock_init(ip, vp); 239 xfs_inode_lock_init(ip, vp);
359 xfs_iocore_inode_init(ip); 240 xfs_iocore_inode_init(ip);
360
361 if (lock_flags) 241 if (lock_flags)
362 xfs_ilock(ip, lock_flags); 242 xfs_ilock(ip, lock_flags);
363 243
364 if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) { 244 if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) {
365 xfs_idestroy(ip); 245 xfs_idestroy(ip);
246 xfs_put_perag(mp, pag);
366 return ENOENT; 247 return ENOENT;
367 } 248 }
368 249
369 /* 250 /*
370 * Put ip on its hash chain, unless someone else hashed a duplicate 251 * This is a bit messy - we preallocate everything we _might_
371 * after we released the hash lock. 252 * need before we pick up the ici lock. That way we don't have to
253 * juggle locks and go all the way back to the start.
372 */ 254 */
373 write_lock(&ih->ih_lock); 255 new_icl = kmem_zone_alloc(xfs_icluster_zone, KM_SLEEP);
256 if (radix_tree_preload(GFP_KERNEL)) {
257 delay(1);
258 goto again;
259 }
260 mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1);
261 first_index = agino & mask;
262 write_lock(&pag->pag_ici_lock);
374 263
375 if (ih->ih_version != version) { 264 /*
376 for (iq = ih->ih_next; iq != NULL; iq = iq->i_next) { 265 * Find the cluster if it exists
377 if (iq->i_ino == ino) { 266 */
378 write_unlock(&ih->ih_lock); 267 icl = NULL;
379 xfs_idestroy(ip); 268 if (radix_tree_gang_lookup(&pag->pag_ici_root, (void**)&iq,
269 first_index, 1)) {
270 if ((iq->i_ino & mask) == first_index)
271 icl = iq->i_cluster;
272 }
380 273
381 XFS_STATS_INC(xs_ig_dup); 274 /*
382 goto again; 275 * insert the new inode
383 } 276 */
384 } 277 error = radix_tree_insert(&pag->pag_ici_root, agino, ip);
278 if (unlikely(error)) {
279 BUG_ON(error != -EEXIST);
280 write_unlock(&pag->pag_ici_lock);
281 radix_tree_preload_end();
282 xfs_idestroy(ip);
283 XFS_STATS_INC(xs_ig_dup);
284 goto again;
385 } 285 }
386 286
387 /* 287 /*
388 * These values _must_ be set before releasing ihlock! 288 * These values _must_ be set before releasing ihlock!
389 */ 289 */
390 ip->i_hash = ih;
391 if ((iq = ih->ih_next)) {
392 iq->i_prevp = &ip->i_next;
393 }
394 ip->i_next = iq;
395 ip->i_prevp = &ih->ih_next;
396 ih->ih_next = ip;
397 ip->i_udquot = ip->i_gdquot = NULL; 290 ip->i_udquot = ip->i_gdquot = NULL;
398 ih->ih_version++;
399 xfs_iflags_set(ip, XFS_INEW); 291 xfs_iflags_set(ip, XFS_INEW);
400 write_unlock(&ih->ih_lock);
401 292
402 /* 293 ASSERT(ip->i_cluster == NULL);
403 * put ip on its cluster's hash chain
404 */
405 ASSERT(ip->i_chash == NULL && ip->i_cprev == NULL &&
406 ip->i_cnext == NULL);
407
408 chlnew = NULL;
409 ch = XFS_CHASH(mp, ip->i_blkno);
410 chlredo:
411 s = mutex_spinlock(&ch->ch_lock);
412 for (chl = ch->ch_list; chl != NULL; chl = chl->chl_next) {
413 if (chl->chl_blkno == ip->i_blkno) {
414
415 /* insert this inode into the doubly-linked list
416 * where chl points */
417 if ((iq = chl->chl_ip)) {
418 ip->i_cprev = iq->i_cprev;
419 iq->i_cprev->i_cnext = ip;
420 iq->i_cprev = ip;
421 ip->i_cnext = iq;
422 } else {
423 ip->i_cnext = ip;
424 ip->i_cprev = ip;
425 }
426 chl->chl_ip = ip;
427 ip->i_chash = chl;
428 break;
429 }
430 }
431 294
432 /* no hash list found for this block; add a new hash list */ 295 if (!icl) {
433 if (chl == NULL) { 296 spin_lock_init(&new_icl->icl_lock);
434 if (chlnew == NULL) { 297 INIT_HLIST_HEAD(&new_icl->icl_inodes);
435 mutex_spinunlock(&ch->ch_lock, s); 298 icl = new_icl;
436 ASSERT(xfs_chashlist_zone != NULL); 299 new_icl = NULL;
437 chlnew = (xfs_chashlist_t *)
438 kmem_zone_alloc(xfs_chashlist_zone,
439 KM_SLEEP);
440 ASSERT(chlnew != NULL);
441 goto chlredo;
442 } else {
443 ip->i_cnext = ip;
444 ip->i_cprev = ip;
445 ip->i_chash = chlnew;
446 chlnew->chl_ip = ip;
447 chlnew->chl_blkno = ip->i_blkno;
448 if (ch->ch_list)
449 ch->ch_list->chl_prev = chlnew;
450 chlnew->chl_next = ch->ch_list;
451 chlnew->chl_prev = NULL;
452 ch->ch_list = chlnew;
453 chlnew = NULL;
454 }
455 } else { 300 } else {
456 if (chlnew != NULL) { 301 ASSERT(!hlist_empty(&icl->icl_inodes));
457 kmem_zone_free(xfs_chashlist_zone, chlnew);
458 }
459 } 302 }
303 spin_lock(&icl->icl_lock);
304 hlist_add_head(&ip->i_cnode, &icl->icl_inodes);
305 ip->i_cluster = icl;
306 spin_unlock(&icl->icl_lock);
460 307
461 mutex_spinunlock(&ch->ch_lock, s); 308 write_unlock(&pag->pag_ici_lock);
462 309 radix_tree_preload_end();
310 if (new_icl)
311 kmem_zone_free(xfs_icluster_zone, new_icl);
463 312
464 /* 313 /*
465 * Link ip to its mount and thread it on the mount's inode list. 314 * Link ip to its mount and thread it on the mount's inode list.
@@ -478,6 +327,7 @@ finish_inode:
478 mp->m_inodes = ip; 327 mp->m_inodes = ip;
479 328
480 XFS_MOUNT_IUNLOCK(mp); 329 XFS_MOUNT_IUNLOCK(mp);
330 xfs_put_perag(mp, pag);
481 331
482 return_ip: 332 return_ip:
483 ASSERT(ip->i_df.if_ext_max == 333 ASSERT(ip->i_df.if_ext_max ==
@@ -486,14 +336,14 @@ finish_inode:
486 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) == 336 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
487 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0)); 337 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
488 338
339 xfs_iflags_set(ip, XFS_IMODIFIED);
489 *ipp = ip; 340 *ipp = ip;
490 341
491 /* 342 /*
492 * If we have a real type for an on-disk inode, we can set ops(&unlock) 343 * If we have a real type for an on-disk inode, we can set ops(&unlock)
493 * now. If it's a new inode being created, xfs_ialloc will handle it. 344 * now. If it's a new inode being created, xfs_ialloc will handle it.
494 */ 345 */
495 bhv_vfs_init_vnode(XFS_MTOVFS(mp), vp, XFS_ITOBHV(ip), 1); 346 xfs_initialize_vnode(mp, vp, ip);
496
497 return 0; 347 return 0;
498} 348}
499 349
@@ -519,7 +369,8 @@ xfs_iget(
519 XFS_STATS_INC(xs_ig_attempts); 369 XFS_STATS_INC(xs_ig_attempts);
520 370
521retry: 371retry:
522 if ((inode = iget_locked(XFS_MTOVFS(mp)->vfs_super, ino))) { 372 inode = iget_locked(mp->m_super, ino);
373 if (inode) {
523 xfs_inode_t *ip; 374 xfs_inode_t *ip;
524 375
525 vp = vn_from_inode(inode); 376 vp = vn_from_inode(inode);
@@ -570,8 +421,8 @@ xfs_inode_lock_init(
570 bhv_vnode_t *vp) 421 bhv_vnode_t *vp)
571{ 422{
572 mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, 423 mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER,
573 "xfsino", (long)vp->v_number); 424 "xfsino", ip->i_ino);
574 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", vp->v_number); 425 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
575 init_waitqueue_head(&ip->i_ipin_wait); 426 init_waitqueue_head(&ip->i_ipin_wait);
576 atomic_set(&ip->i_pincount, 0); 427 atomic_set(&ip->i_pincount, 0);
577 initnsema(&ip->i_flock, 1, "xfsfino"); 428 initnsema(&ip->i_flock, 1, "xfsfino");
@@ -587,32 +438,19 @@ xfs_inode_incore(xfs_mount_t *mp,
587 xfs_ino_t ino, 438 xfs_ino_t ino,
588 xfs_trans_t *tp) 439 xfs_trans_t *tp)
589{ 440{
590 xfs_ihash_t *ih;
591 xfs_inode_t *ip; 441 xfs_inode_t *ip;
592 ulong version; 442 xfs_perag_t *pag;
593 443
594 ih = XFS_IHASH(mp, ino); 444 pag = xfs_get_perag(mp, ino);
595 read_lock(&ih->ih_lock); 445 read_lock(&pag->pag_ici_lock);
596 for (ip = ih->ih_next; ip != NULL; ip = ip->i_next) { 446 ip = radix_tree_lookup(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, ino));
597 if (ip->i_ino == ino) { 447 read_unlock(&pag->pag_ici_lock);
598 /* 448 xfs_put_perag(mp, pag);
599 * If we find it and tp matches, return it. 449
600 * Also move it to the front of the hash list 450 /* the returned inode must match the transaction */
601 * if we find it and it is not already there. 451 if (ip && (ip->i_transp != tp))
602 * Otherwise break from the loop and return 452 return NULL;
603 * NULL. 453 return ip;
604 */
605 if (ip->i_transp == tp) {
606 version = ih->ih_version;
607 read_unlock(&ih->ih_lock);
608 xfs_ihash_promote(ih, ip, version);
609 return (ip);
610 }
611 break;
612 }
613 }
614 read_unlock(&ih->ih_lock);
615 return (NULL);
616} 454}
617 455
618/* 456/*
@@ -629,7 +467,7 @@ xfs_iput(xfs_inode_t *ip,
629{ 467{
630 bhv_vnode_t *vp = XFS_ITOV(ip); 468 bhv_vnode_t *vp = XFS_ITOV(ip);
631 469
632 vn_trace_entry(vp, "xfs_iput", (inst_t *)__return_address); 470 vn_trace_entry(ip, "xfs_iput", (inst_t *)__return_address);
633 xfs_iunlock(ip, lock_flags); 471 xfs_iunlock(ip, lock_flags);
634 VN_RELE(vp); 472 VN_RELE(vp);
635} 473}
@@ -644,7 +482,7 @@ xfs_iput_new(xfs_inode_t *ip,
644 bhv_vnode_t *vp = XFS_ITOV(ip); 482 bhv_vnode_t *vp = XFS_ITOV(ip);
645 struct inode *inode = vn_to_inode(vp); 483 struct inode *inode = vn_to_inode(vp);
646 484
647 vn_trace_entry(vp, "xfs_iput_new", (inst_t *)__return_address); 485 vn_trace_entry(ip, "xfs_iput_new", (inst_t *)__return_address);
648 486
649 if ((ip->i_d.di_mode == 0)) { 487 if ((ip->i_d.di_mode == 0)) {
650 ASSERT(!xfs_iflags_test(ip, XFS_IRECLAIMABLE)); 488 ASSERT(!xfs_iflags_test(ip, XFS_IRECLAIMABLE));
@@ -699,7 +537,8 @@ xfs_ireclaim(xfs_inode_t *ip)
699 */ 537 */
700 vp = XFS_ITOV_NULL(ip); 538 vp = XFS_ITOV_NULL(ip);
701 if (vp) { 539 if (vp) {
702 vn_bhv_remove(VN_BHV_HEAD(vp), XFS_ITOBHV(ip)); 540 vn_to_inode(vp)->i_private = NULL;
541 ip->i_vnode = NULL;
703 } 542 }
704 543
705 /* 544 /*
@@ -718,58 +557,26 @@ void
718xfs_iextract( 557xfs_iextract(
719 xfs_inode_t *ip) 558 xfs_inode_t *ip)
720{ 559{
721 xfs_ihash_t *ih; 560 xfs_mount_t *mp = ip->i_mount;
561 xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino);
722 xfs_inode_t *iq; 562 xfs_inode_t *iq;
723 xfs_mount_t *mp; 563
724 xfs_chash_t *ch; 564 write_lock(&pag->pag_ici_lock);
725 xfs_chashlist_t *chl, *chm; 565 radix_tree_delete(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, ip->i_ino));
726 SPLDECL(s); 566 write_unlock(&pag->pag_ici_lock);
727 567 xfs_put_perag(mp, pag);
728 ih = ip->i_hash;
729 write_lock(&ih->ih_lock);
730 if ((iq = ip->i_next)) {
731 iq->i_prevp = ip->i_prevp;
732 }
733 *ip->i_prevp = iq;
734 ih->ih_version++;
735 write_unlock(&ih->ih_lock);
736 568
737 /* 569 /*
738 * Remove from cluster hash list 570 * Remove from cluster list
739 * 1) delete the chashlist if this is the last inode on the chashlist
740 * 2) unchain from list of inodes
741 * 3) point chashlist->chl_ip to 'chl_next' if to this inode.
742 */ 571 */
743 mp = ip->i_mount; 572 mp = ip->i_mount;
744 ch = XFS_CHASH(mp, ip->i_blkno); 573 spin_lock(&ip->i_cluster->icl_lock);
745 s = mutex_spinlock(&ch->ch_lock); 574 hlist_del(&ip->i_cnode);
746 575 spin_unlock(&ip->i_cluster->icl_lock);
747 if (ip->i_cnext == ip) { 576
748 /* Last inode on chashlist */ 577 /* was last inode in cluster? */
749 ASSERT(ip->i_cnext == ip && ip->i_cprev == ip); 578 if (hlist_empty(&ip->i_cluster->icl_inodes))
750 ASSERT(ip->i_chash != NULL); 579 kmem_zone_free(xfs_icluster_zone, ip->i_cluster);
751 chm=NULL;
752 chl = ip->i_chash;
753 if (chl->chl_prev)
754 chl->chl_prev->chl_next = chl->chl_next;
755 else
756 ch->ch_list = chl->chl_next;
757 if (chl->chl_next)
758 chl->chl_next->chl_prev = chl->chl_prev;
759 kmem_zone_free(xfs_chashlist_zone, chl);
760 } else {
761 /* delete one inode from a non-empty list */
762 iq = ip->i_cnext;
763 iq->i_cprev = ip->i_cprev;
764 ip->i_cprev->i_cnext = iq;
765 if (ip->i_chash->chl_ip == ip) {
766 ip->i_chash->chl_ip = iq;
767 }
768 ip->i_chash = __return_address;
769 ip->i_cprev = __return_address;
770 ip->i_cnext = __return_address;
771 }
772 mutex_spinunlock(&ch->ch_lock, s);
773 580
774 /* 581 /*
775 * Remove from mount's inode list. 582 * Remove from mount's inode list.
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index cdc4c28926d0..abf509a88915 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -49,12 +49,11 @@
49#include "xfs_quota.h" 49#include "xfs_quota.h"
50#include "xfs_acl.h" 50#include "xfs_acl.h"
51#include "xfs_filestream.h" 51#include "xfs_filestream.h"
52 52#include "xfs_vnodeops.h"
53#include <linux/log2.h>
54 53
55kmem_zone_t *xfs_ifork_zone; 54kmem_zone_t *xfs_ifork_zone;
56kmem_zone_t *xfs_inode_zone; 55kmem_zone_t *xfs_inode_zone;
57kmem_zone_t *xfs_chashlist_zone; 56kmem_zone_t *xfs_icluster_zone;
58 57
59/* 58/*
60 * Used in xfs_itruncate(). This is the maximum number of extents 59 * Used in xfs_itruncate(). This is the maximum number of extents
@@ -67,7 +66,6 @@ STATIC int xfs_iformat_local(xfs_inode_t *, xfs_dinode_t *, int, int);
67STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int); 66STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int);
68STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int); 67STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int);
69 68
70
71#ifdef DEBUG 69#ifdef DEBUG
72/* 70/*
73 * Make sure that the extents in the given memory buffer 71 * Make sure that the extents in the given memory buffer
@@ -77,28 +75,23 @@ STATIC void
77xfs_validate_extents( 75xfs_validate_extents(
78 xfs_ifork_t *ifp, 76 xfs_ifork_t *ifp,
79 int nrecs, 77 int nrecs,
80 int disk,
81 xfs_exntfmt_t fmt) 78 xfs_exntfmt_t fmt)
82{ 79{
83 xfs_bmbt_rec_t *ep;
84 xfs_bmbt_irec_t irec; 80 xfs_bmbt_irec_t irec;
85 xfs_bmbt_rec_t rec; 81 xfs_bmbt_rec_host_t rec;
86 int i; 82 int i;
87 83
88 for (i = 0; i < nrecs; i++) { 84 for (i = 0; i < nrecs; i++) {
89 ep = xfs_iext_get_ext(ifp, i); 85 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
90 rec.l0 = get_unaligned((__uint64_t*)&ep->l0); 86 rec.l0 = get_unaligned(&ep->l0);
91 rec.l1 = get_unaligned((__uint64_t*)&ep->l1); 87 rec.l1 = get_unaligned(&ep->l1);
92 if (disk) 88 xfs_bmbt_get_all(&rec, &irec);
93 xfs_bmbt_disk_get_all(&rec, &irec);
94 else
95 xfs_bmbt_get_all(&rec, &irec);
96 if (fmt == XFS_EXTFMT_NOSTATE) 89 if (fmt == XFS_EXTFMT_NOSTATE)
97 ASSERT(irec.br_state == XFS_EXT_NORM); 90 ASSERT(irec.br_state == XFS_EXT_NORM);
98 } 91 }
99} 92}
100#else /* DEBUG */ 93#else /* DEBUG */
101#define xfs_validate_extents(ifp, nrecs, disk, fmt) 94#define xfs_validate_extents(ifp, nrecs, fmt)
102#endif /* DEBUG */ 95#endif /* DEBUG */
103 96
104/* 97/*
@@ -201,8 +194,8 @@ xfs_inotobp(
201 } 194 }
202 dip = (xfs_dinode_t *)xfs_buf_offset(bp, 0); 195 dip = (xfs_dinode_t *)xfs_buf_offset(bp, 0);
203 di_ok = 196 di_ok =
204 INT_GET(dip->di_core.di_magic, ARCH_CONVERT) == XFS_DINODE_MAGIC && 197 be16_to_cpu(dip->di_core.di_magic) == XFS_DINODE_MAGIC &&
205 XFS_DINODE_GOOD_VERSION(INT_GET(dip->di_core.di_version, ARCH_CONVERT)); 198 XFS_DINODE_GOOD_VERSION(dip->di_core.di_version);
206 if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP, 199 if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP,
207 XFS_RANDOM_ITOBP_INOTOBP))) { 200 XFS_RANDOM_ITOBP_INOTOBP))) {
208 XFS_CORRUPTION_ERROR("xfs_inotobp", XFS_ERRLEVEL_LOW, mp, dip); 201 XFS_CORRUPTION_ERROR("xfs_inotobp", XFS_ERRLEVEL_LOW, mp, dip);
@@ -346,8 +339,8 @@ xfs_itobp(
346 339
347 dip = (xfs_dinode_t *)xfs_buf_offset(bp, 340 dip = (xfs_dinode_t *)xfs_buf_offset(bp,
348 (i << mp->m_sb.sb_inodelog)); 341 (i << mp->m_sb.sb_inodelog));
349 di_ok = INT_GET(dip->di_core.di_magic, ARCH_CONVERT) == XFS_DINODE_MAGIC && 342 di_ok = be16_to_cpu(dip->di_core.di_magic) == XFS_DINODE_MAGIC &&
350 XFS_DINODE_GOOD_VERSION(INT_GET(dip->di_core.di_version, ARCH_CONVERT)); 343 XFS_DINODE_GOOD_VERSION(dip->di_core.di_version);
351 if (unlikely(XFS_TEST_ERROR(!di_ok, mp, 344 if (unlikely(XFS_TEST_ERROR(!di_ok, mp,
352 XFS_ERRTAG_ITOBP_INOTOBP, 345 XFS_ERRTAG_ITOBP_INOTOBP,
353 XFS_RANDOM_ITOBP_INOTOBP))) { 346 XFS_RANDOM_ITOBP_INOTOBP))) {
@@ -361,7 +354,7 @@ xfs_itobp(
361 "daddr %lld #%d (magic=%x)", 354 "daddr %lld #%d (magic=%x)",
362 XFS_BUFTARG_NAME(mp->m_ddev_targp), 355 XFS_BUFTARG_NAME(mp->m_ddev_targp),
363 (unsigned long long)imap.im_blkno, i, 356 (unsigned long long)imap.im_blkno, i,
364 INT_GET(dip->di_core.di_magic, ARCH_CONVERT)); 357 be16_to_cpu(dip->di_core.di_magic));
365#endif 358#endif
366 XFS_CORRUPTION_ERROR("xfs_itobp", XFS_ERRLEVEL_HIGH, 359 XFS_CORRUPTION_ERROR("xfs_itobp", XFS_ERRLEVEL_HIGH,
367 mp, dip); 360 mp, dip);
@@ -407,27 +400,26 @@ xfs_iformat(
407 XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); 400 XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
408 error = 0; 401 error = 0;
409 402
410 if (unlikely( 403 if (unlikely(be32_to_cpu(dip->di_core.di_nextents) +
411 INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) + 404 be16_to_cpu(dip->di_core.di_anextents) >
412 INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) > 405 be64_to_cpu(dip->di_core.di_nblocks))) {
413 INT_GET(dip->di_core.di_nblocks, ARCH_CONVERT))) {
414 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 406 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
415 "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.", 407 "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",
416 (unsigned long long)ip->i_ino, 408 (unsigned long long)ip->i_ino,
417 (int)(INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) 409 (int)(be32_to_cpu(dip->di_core.di_nextents) +
418 + INT_GET(dip->di_core.di_anextents, ARCH_CONVERT)), 410 be16_to_cpu(dip->di_core.di_anextents)),
419 (unsigned long long) 411 (unsigned long long)
420 INT_GET(dip->di_core.di_nblocks, ARCH_CONVERT)); 412 be64_to_cpu(dip->di_core.di_nblocks));
421 XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW, 413 XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW,
422 ip->i_mount, dip); 414 ip->i_mount, dip);
423 return XFS_ERROR(EFSCORRUPTED); 415 return XFS_ERROR(EFSCORRUPTED);
424 } 416 }
425 417
426 if (unlikely(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT) > ip->i_mount->m_sb.sb_inodesize)) { 418 if (unlikely(dip->di_core.di_forkoff > ip->i_mount->m_sb.sb_inodesize)) {
427 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 419 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
428 "corrupt dinode %Lu, forkoff = 0x%x.", 420 "corrupt dinode %Lu, forkoff = 0x%x.",
429 (unsigned long long)ip->i_ino, 421 (unsigned long long)ip->i_ino,
430 (int)(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT))); 422 dip->di_core.di_forkoff);
431 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, 423 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
432 ip->i_mount, dip); 424 ip->i_mount, dip);
433 return XFS_ERROR(EFSCORRUPTED); 425 return XFS_ERROR(EFSCORRUPTED);
@@ -438,25 +430,25 @@ xfs_iformat(
438 case S_IFCHR: 430 case S_IFCHR:
439 case S_IFBLK: 431 case S_IFBLK:
440 case S_IFSOCK: 432 case S_IFSOCK:
441 if (unlikely(INT_GET(dip->di_core.di_format, ARCH_CONVERT) != XFS_DINODE_FMT_DEV)) { 433 if (unlikely(dip->di_core.di_format != XFS_DINODE_FMT_DEV)) {
442 XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW, 434 XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW,
443 ip->i_mount, dip); 435 ip->i_mount, dip);
444 return XFS_ERROR(EFSCORRUPTED); 436 return XFS_ERROR(EFSCORRUPTED);
445 } 437 }
446 ip->i_d.di_size = 0; 438 ip->i_d.di_size = 0;
447 ip->i_size = 0; 439 ip->i_size = 0;
448 ip->i_df.if_u2.if_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT); 440 ip->i_df.if_u2.if_rdev = be32_to_cpu(dip->di_u.di_dev);
449 break; 441 break;
450 442
451 case S_IFREG: 443 case S_IFREG:
452 case S_IFLNK: 444 case S_IFLNK:
453 case S_IFDIR: 445 case S_IFDIR:
454 switch (INT_GET(dip->di_core.di_format, ARCH_CONVERT)) { 446 switch (dip->di_core.di_format) {
455 case XFS_DINODE_FMT_LOCAL: 447 case XFS_DINODE_FMT_LOCAL:
456 /* 448 /*
457 * no local regular files yet 449 * no local regular files yet
458 */ 450 */
459 if (unlikely((INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFREG)) { 451 if (unlikely((be16_to_cpu(dip->di_core.di_mode) & S_IFMT) == S_IFREG)) {
460 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 452 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
461 "corrupt inode %Lu " 453 "corrupt inode %Lu "
462 "(local format for regular file).", 454 "(local format for regular file).",
@@ -467,7 +459,7 @@ xfs_iformat(
467 return XFS_ERROR(EFSCORRUPTED); 459 return XFS_ERROR(EFSCORRUPTED);
468 } 460 }
469 461
470 di_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT); 462 di_size = be64_to_cpu(dip->di_core.di_size);
471 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { 463 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {
472 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 464 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
473 "corrupt inode %Lu " 465 "corrupt inode %Lu "
@@ -509,7 +501,7 @@ xfs_iformat(
509 ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP); 501 ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP);
510 ip->i_afp->if_ext_max = 502 ip->i_afp->if_ext_max =
511 XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); 503 XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
512 switch (INT_GET(dip->di_core.di_aformat, ARCH_CONVERT)) { 504 switch (dip->di_core.di_aformat) {
513 case XFS_DINODE_FMT_LOCAL: 505 case XFS_DINODE_FMT_LOCAL:
514 atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); 506 atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
515 size = be16_to_cpu(atp->hdr.totsize); 507 size = be16_to_cpu(atp->hdr.totsize);
@@ -602,7 +594,7 @@ xfs_iformat_extents(
602 xfs_dinode_t *dip, 594 xfs_dinode_t *dip,
603 int whichfork) 595 int whichfork)
604{ 596{
605 xfs_bmbt_rec_t *ep, *dp; 597 xfs_bmbt_rec_t *dp;
606 xfs_ifork_t *ifp; 598 xfs_ifork_t *ifp;
607 int nex; 599 int nex;
608 int size; 600 int size;
@@ -637,13 +629,11 @@ xfs_iformat_extents(
637 ifp->if_bytes = size; 629 ifp->if_bytes = size;
638 if (size) { 630 if (size) {
639 dp = (xfs_bmbt_rec_t *) XFS_DFORK_PTR(dip, whichfork); 631 dp = (xfs_bmbt_rec_t *) XFS_DFORK_PTR(dip, whichfork);
640 xfs_validate_extents(ifp, nex, 1, XFS_EXTFMT_INODE(ip)); 632 xfs_validate_extents(ifp, nex, XFS_EXTFMT_INODE(ip));
641 for (i = 0; i < nex; i++, dp++) { 633 for (i = 0; i < nex; i++, dp++) {
642 ep = xfs_iext_get_ext(ifp, i); 634 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
643 ep->l0 = INT_GET(get_unaligned((__uint64_t*)&dp->l0), 635 ep->l0 = be64_to_cpu(get_unaligned(&dp->l0));
644 ARCH_CONVERT); 636 ep->l1 = be64_to_cpu(get_unaligned(&dp->l1));
645 ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1),
646 ARCH_CONVERT);
647 } 637 }
648 XFS_BMAP_TRACE_EXLIST(ip, nex, whichfork); 638 XFS_BMAP_TRACE_EXLIST(ip, nex, whichfork);
649 if (whichfork != XFS_DATA_FORK || 639 if (whichfork != XFS_DATA_FORK ||
@@ -719,70 +709,74 @@ xfs_iformat_btree(
719 return 0; 709 return 0;
720} 710}
721 711
722/*
723 * xfs_xlate_dinode_core - translate an xfs_inode_core_t between ondisk
724 * and native format
725 *
726 * buf = on-disk representation
727 * dip = native representation
728 * dir = direction - +ve -> disk to native
729 * -ve -> native to disk
730 */
731void 712void
732xfs_xlate_dinode_core( 713xfs_dinode_from_disk(
733 xfs_caddr_t buf, 714 xfs_icdinode_t *to,
734 xfs_dinode_core_t *dip, 715 xfs_dinode_core_t *from)
735 int dir)
736{ 716{
737 xfs_dinode_core_t *buf_core = (xfs_dinode_core_t *)buf; 717 to->di_magic = be16_to_cpu(from->di_magic);
738 xfs_dinode_core_t *mem_core = (xfs_dinode_core_t *)dip; 718 to->di_mode = be16_to_cpu(from->di_mode);
739 xfs_arch_t arch = ARCH_CONVERT; 719 to->di_version = from ->di_version;
740 720 to->di_format = from->di_format;
741 ASSERT(dir); 721 to->di_onlink = be16_to_cpu(from->di_onlink);
742 722 to->di_uid = be32_to_cpu(from->di_uid);
743 INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch); 723 to->di_gid = be32_to_cpu(from->di_gid);
744 INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch); 724 to->di_nlink = be32_to_cpu(from->di_nlink);
745 INT_XLATE(buf_core->di_version, mem_core->di_version, dir, arch); 725 to->di_projid = be16_to_cpu(from->di_projid);
746 INT_XLATE(buf_core->di_format, mem_core->di_format, dir, arch); 726 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
747 INT_XLATE(buf_core->di_onlink, mem_core->di_onlink, dir, arch); 727 to->di_flushiter = be16_to_cpu(from->di_flushiter);
748 INT_XLATE(buf_core->di_uid, mem_core->di_uid, dir, arch); 728 to->di_atime.t_sec = be32_to_cpu(from->di_atime.t_sec);
749 INT_XLATE(buf_core->di_gid, mem_core->di_gid, dir, arch); 729 to->di_atime.t_nsec = be32_to_cpu(from->di_atime.t_nsec);
750 INT_XLATE(buf_core->di_nlink, mem_core->di_nlink, dir, arch); 730 to->di_mtime.t_sec = be32_to_cpu(from->di_mtime.t_sec);
751 INT_XLATE(buf_core->di_projid, mem_core->di_projid, dir, arch); 731 to->di_mtime.t_nsec = be32_to_cpu(from->di_mtime.t_nsec);
752 732 to->di_ctime.t_sec = be32_to_cpu(from->di_ctime.t_sec);
753 if (dir > 0) { 733 to->di_ctime.t_nsec = be32_to_cpu(from->di_ctime.t_nsec);
754 memcpy(mem_core->di_pad, buf_core->di_pad, 734 to->di_size = be64_to_cpu(from->di_size);
755 sizeof(buf_core->di_pad)); 735 to->di_nblocks = be64_to_cpu(from->di_nblocks);
756 } else { 736 to->di_extsize = be32_to_cpu(from->di_extsize);
757 memcpy(buf_core->di_pad, mem_core->di_pad, 737 to->di_nextents = be32_to_cpu(from->di_nextents);
758 sizeof(buf_core->di_pad)); 738 to->di_anextents = be16_to_cpu(from->di_anextents);
759 } 739 to->di_forkoff = from->di_forkoff;
760 740 to->di_aformat = from->di_aformat;
761 INT_XLATE(buf_core->di_flushiter, mem_core->di_flushiter, dir, arch); 741 to->di_dmevmask = be32_to_cpu(from->di_dmevmask);
762 742 to->di_dmstate = be16_to_cpu(from->di_dmstate);
763 INT_XLATE(buf_core->di_atime.t_sec, mem_core->di_atime.t_sec, 743 to->di_flags = be16_to_cpu(from->di_flags);
764 dir, arch); 744 to->di_gen = be32_to_cpu(from->di_gen);
765 INT_XLATE(buf_core->di_atime.t_nsec, mem_core->di_atime.t_nsec, 745}
766 dir, arch); 746
767 INT_XLATE(buf_core->di_mtime.t_sec, mem_core->di_mtime.t_sec, 747void
768 dir, arch); 748xfs_dinode_to_disk(
769 INT_XLATE(buf_core->di_mtime.t_nsec, mem_core->di_mtime.t_nsec, 749 xfs_dinode_core_t *to,
770 dir, arch); 750 xfs_icdinode_t *from)
771 INT_XLATE(buf_core->di_ctime.t_sec, mem_core->di_ctime.t_sec, 751{
772 dir, arch); 752 to->di_magic = cpu_to_be16(from->di_magic);
773 INT_XLATE(buf_core->di_ctime.t_nsec, mem_core->di_ctime.t_nsec, 753 to->di_mode = cpu_to_be16(from->di_mode);
774 dir, arch); 754 to->di_version = from ->di_version;
775 INT_XLATE(buf_core->di_size, mem_core->di_size, dir, arch); 755 to->di_format = from->di_format;
776 INT_XLATE(buf_core->di_nblocks, mem_core->di_nblocks, dir, arch); 756 to->di_onlink = cpu_to_be16(from->di_onlink);
777 INT_XLATE(buf_core->di_extsize, mem_core->di_extsize, dir, arch); 757 to->di_uid = cpu_to_be32(from->di_uid);
778 INT_XLATE(buf_core->di_nextents, mem_core->di_nextents, dir, arch); 758 to->di_gid = cpu_to_be32(from->di_gid);
779 INT_XLATE(buf_core->di_anextents, mem_core->di_anextents, dir, arch); 759 to->di_nlink = cpu_to_be32(from->di_nlink);
780 INT_XLATE(buf_core->di_forkoff, mem_core->di_forkoff, dir, arch); 760 to->di_projid = cpu_to_be16(from->di_projid);
781 INT_XLATE(buf_core->di_aformat, mem_core->di_aformat, dir, arch); 761 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
782 INT_XLATE(buf_core->di_dmevmask, mem_core->di_dmevmask, dir, arch); 762 to->di_flushiter = cpu_to_be16(from->di_flushiter);
783 INT_XLATE(buf_core->di_dmstate, mem_core->di_dmstate, dir, arch); 763 to->di_atime.t_sec = cpu_to_be32(from->di_atime.t_sec);
784 INT_XLATE(buf_core->di_flags, mem_core->di_flags, dir, arch); 764 to->di_atime.t_nsec = cpu_to_be32(from->di_atime.t_nsec);
785 INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch); 765 to->di_mtime.t_sec = cpu_to_be32(from->di_mtime.t_sec);
766 to->di_mtime.t_nsec = cpu_to_be32(from->di_mtime.t_nsec);
767 to->di_ctime.t_sec = cpu_to_be32(from->di_ctime.t_sec);
768 to->di_ctime.t_nsec = cpu_to_be32(from->di_ctime.t_nsec);
769 to->di_size = cpu_to_be64(from->di_size);
770 to->di_nblocks = cpu_to_be64(from->di_nblocks);
771 to->di_extsize = cpu_to_be32(from->di_extsize);
772 to->di_nextents = cpu_to_be32(from->di_nextents);
773 to->di_anextents = cpu_to_be16(from->di_anextents);
774 to->di_forkoff = from->di_forkoff;
775 to->di_aformat = from->di_aformat;
776 to->di_dmevmask = cpu_to_be32(from->di_dmevmask);
777 to->di_dmstate = cpu_to_be16(from->di_dmstate);
778 to->di_flags = cpu_to_be16(from->di_flags);
779 to->di_gen = cpu_to_be32(from->di_gen);
786} 780}
787 781
788STATIC uint 782STATIC uint
@@ -829,7 +823,7 @@ uint
829xfs_ip2xflags( 823xfs_ip2xflags(
830 xfs_inode_t *ip) 824 xfs_inode_t *ip)
831{ 825{
832 xfs_dinode_core_t *dic = &ip->i_d; 826 xfs_icdinode_t *dic = &ip->i_d;
833 827
834 return _xfs_dic2xflags(dic->di_flags) | 828 return _xfs_dic2xflags(dic->di_flags) |
835 (XFS_CFORK_Q(dic) ? XFS_XFLAG_HASATTR : 0); 829 (XFS_CFORK_Q(dic) ? XFS_XFLAG_HASATTR : 0);
@@ -839,7 +833,7 @@ uint
839xfs_dic2xflags( 833xfs_dic2xflags(
840 xfs_dinode_core_t *dic) 834 xfs_dinode_core_t *dic)
841{ 835{
842 return _xfs_dic2xflags(INT_GET(dic->di_flags, ARCH_CONVERT)) | 836 return _xfs_dic2xflags(be16_to_cpu(dic->di_flags)) |
843 (XFS_CFORK_Q_DISK(dic) ? XFS_XFLAG_HASATTR : 0); 837 (XFS_CFORK_Q_DISK(dic) ? XFS_XFLAG_HASATTR : 0);
844} 838}
845 839
@@ -870,6 +864,7 @@ xfs_iread(
870 ip = kmem_zone_zalloc(xfs_inode_zone, KM_SLEEP); 864 ip = kmem_zone_zalloc(xfs_inode_zone, KM_SLEEP);
871 ip->i_ino = ino; 865 ip->i_ino = ino;
872 ip->i_mount = mp; 866 ip->i_mount = mp;
867 atomic_set(&ip->i_iocount, 0);
873 spin_lock_init(&ip->i_flags_lock); 868 spin_lock_init(&ip->i_flags_lock);
874 869
875 /* 870 /*
@@ -889,6 +884,9 @@ xfs_iread(
889 * Initialize inode's trace buffers. 884 * Initialize inode's trace buffers.
890 * Do this before xfs_iformat in case it adds entries. 885 * Do this before xfs_iformat in case it adds entries.
891 */ 886 */
887#ifdef XFS_VNODE_TRACE
888 ip->i_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
889#endif
892#ifdef XFS_BMAP_TRACE 890#ifdef XFS_BMAP_TRACE
893 ip->i_xtrace = ktrace_alloc(XFS_BMAP_KTRACE_SIZE, KM_SLEEP); 891 ip->i_xtrace = ktrace_alloc(XFS_BMAP_KTRACE_SIZE, KM_SLEEP);
894#endif 892#endif
@@ -909,14 +907,14 @@ xfs_iread(
909 * If we got something that isn't an inode it means someone 907 * If we got something that isn't an inode it means someone
910 * (nfs or dmi) has a stale handle. 908 * (nfs or dmi) has a stale handle.
911 */ 909 */
912 if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) { 910 if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC) {
913 kmem_zone_free(xfs_inode_zone, ip); 911 kmem_zone_free(xfs_inode_zone, ip);
914 xfs_trans_brelse(tp, bp); 912 xfs_trans_brelse(tp, bp);
915#ifdef DEBUG 913#ifdef DEBUG
916 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " 914 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
917 "dip->di_core.di_magic (0x%x) != " 915 "dip->di_core.di_magic (0x%x) != "
918 "XFS_DINODE_MAGIC (0x%x)", 916 "XFS_DINODE_MAGIC (0x%x)",
919 INT_GET(dip->di_core.di_magic, ARCH_CONVERT), 917 be16_to_cpu(dip->di_core.di_magic),
920 XFS_DINODE_MAGIC); 918 XFS_DINODE_MAGIC);
921#endif /* DEBUG */ 919#endif /* DEBUG */
922 return XFS_ERROR(EINVAL); 920 return XFS_ERROR(EINVAL);
@@ -930,8 +928,7 @@ xfs_iread(
930 * Otherwise, just get the truly permanent information. 928 * Otherwise, just get the truly permanent information.
931 */ 929 */
932 if (dip->di_core.di_mode) { 930 if (dip->di_core.di_mode) {
933 xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, 931 xfs_dinode_from_disk(&ip->i_d, &dip->di_core);
934 &(ip->i_d), 1);
935 error = xfs_iformat(ip, dip); 932 error = xfs_iformat(ip, dip);
936 if (error) { 933 if (error) {
937 kmem_zone_free(xfs_inode_zone, ip); 934 kmem_zone_free(xfs_inode_zone, ip);
@@ -944,10 +941,10 @@ xfs_iread(
944 return error; 941 return error;
945 } 942 }
946 } else { 943 } else {
947 ip->i_d.di_magic = INT_GET(dip->di_core.di_magic, ARCH_CONVERT); 944 ip->i_d.di_magic = be16_to_cpu(dip->di_core.di_magic);
948 ip->i_d.di_version = INT_GET(dip->di_core.di_version, ARCH_CONVERT); 945 ip->i_d.di_version = dip->di_core.di_version;
949 ip->i_d.di_gen = INT_GET(dip->di_core.di_gen, ARCH_CONVERT); 946 ip->i_d.di_gen = be32_to_cpu(dip->di_core.di_gen);
950 ip->i_d.di_flushiter = INT_GET(dip->di_core.di_flushiter, ARCH_CONVERT); 947 ip->i_d.di_flushiter = be16_to_cpu(dip->di_core.di_flushiter);
951 /* 948 /*
952 * Make sure to pull in the mode here as well in 949 * Make sure to pull in the mode here as well in
953 * case the inode is released without being used. 950 * case the inode is released without being used.
@@ -1048,7 +1045,7 @@ xfs_iread_extents(
1048 ifp->if_flags &= ~XFS_IFEXTENTS; 1045 ifp->if_flags &= ~XFS_IFEXTENTS;
1049 return error; 1046 return error;
1050 } 1047 }
1051 xfs_validate_extents(ifp, nextents, 0, XFS_EXTFMT_INODE(ip)); 1048 xfs_validate_extents(ifp, nextents, XFS_EXTFMT_INODE(ip));
1052 return 0; 1049 return 0;
1053} 1050}
1054 1051
@@ -1161,7 +1158,7 @@ xfs_ialloc(
1161 if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1)) 1158 if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1))
1162 xfs_bump_ino_vers2(tp, ip); 1159 xfs_bump_ino_vers2(tp, ip);
1163 1160
1164 if (pip && XFS_INHERIT_GID(pip, vp->v_vfsp)) { 1161 if (pip && XFS_INHERIT_GID(pip)) {
1165 ip->i_d.di_gid = pip->i_d.di_gid; 1162 ip->i_d.di_gid = pip->i_d.di_gid;
1166 if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { 1163 if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) {
1167 ip->i_d.di_mode |= S_ISGID; 1164 ip->i_d.di_mode |= S_ISGID;
@@ -1275,7 +1272,7 @@ xfs_ialloc(
1275 xfs_trans_log_inode(tp, ip, flags); 1272 xfs_trans_log_inode(tp, ip, flags);
1276 1273
1277 /* now that we have an i_mode we can setup inode ops and unlock */ 1274 /* now that we have an i_mode we can setup inode ops and unlock */
1278 bhv_vfs_init_vnode(XFS_MTOVFS(tp->t_mountp), vp, XFS_ITOBHV(ip), 1); 1275 xfs_initialize_vnode(tp->t_mountp, vp, ip);
1279 1276
1280 *ipp = ip; 1277 *ipp = ip;
1281 return 0; 1278 return 0;
@@ -1462,7 +1459,7 @@ xfs_itruncate_start(
1462 mp = ip->i_mount; 1459 mp = ip->i_mount;
1463 vp = XFS_ITOV(ip); 1460 vp = XFS_ITOV(ip);
1464 1461
1465 vn_iowait(vp); /* wait for the completion of any pending DIOs */ 1462 vn_iowait(ip); /* wait for the completion of any pending DIOs */
1466 1463
1467 /* 1464 /*
1468 * Call toss_pages or flushinval_pages to get rid of pages 1465 * Call toss_pages or flushinval_pages to get rid of pages
@@ -1497,9 +1494,11 @@ xfs_itruncate_start(
1497 last_byte); 1494 last_byte);
1498 if (last_byte > toss_start) { 1495 if (last_byte > toss_start) {
1499 if (flags & XFS_ITRUNC_DEFINITE) { 1496 if (flags & XFS_ITRUNC_DEFINITE) {
1500 bhv_vop_toss_pages(vp, toss_start, -1, FI_REMAPF_LOCKED); 1497 xfs_tosspages(ip, toss_start,
1498 -1, FI_REMAPF_LOCKED);
1501 } else { 1499 } else {
1502 error = bhv_vop_flushinval_pages(vp, toss_start, -1, FI_REMAPF_LOCKED); 1500 error = xfs_flushinval_pages(ip, toss_start,
1501 -1, FI_REMAPF_LOCKED);
1503 } 1502 }
1504 } 1503 }
1505 1504
@@ -1932,9 +1931,9 @@ xfs_iunlink(
1932 */ 1931 */
1933 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, agdaddr, 1932 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, agdaddr,
1934 XFS_FSS_TO_BB(mp, 1), 0, &agibp); 1933 XFS_FSS_TO_BB(mp, 1), 0, &agibp);
1935 if (error) { 1934 if (error)
1936 return error; 1935 return error;
1937 } 1936
1938 /* 1937 /*
1939 * Validate the magic number of the agi block. 1938 * Validate the magic number of the agi block.
1940 */ 1939 */
@@ -1958,6 +1957,24 @@ xfs_iunlink(
1958 ASSERT(agi->agi_unlinked[bucket_index]); 1957 ASSERT(agi->agi_unlinked[bucket_index]);
1959 ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); 1958 ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino);
1960 1959
1960 error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0);
1961 if (error)
1962 return error;
1963
1964 /*
1965 * Clear the on-disk di_nlink. This is to prevent xfs_bulkstat
1966 * from picking up this inode when it is reclaimed (its incore state
1967 * initialzed but not flushed to disk yet). The in-core di_nlink is
1968 * already cleared in xfs_droplink() and a corresponding transaction
1969 * logged. The hack here just synchronizes the in-core to on-disk
1970 * di_nlink value in advance before the actual inode sync to disk.
1971 * This is OK because the inode is already unlinked and would never
1972 * change its di_nlink again for this inode generation.
1973 * This is a temporary hack that would require a proper fix
1974 * in the future.
1975 */
1976 dip->di_core.di_nlink = 0;
1977
1961 if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) { 1978 if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) {
1962 /* 1979 /*
1963 * There is already another inode in the bucket we need 1980 * There is already another inode in the bucket we need
@@ -1965,12 +1982,7 @@ xfs_iunlink(
1965 * Here we put the head pointer into our next pointer, 1982 * Here we put the head pointer into our next pointer,
1966 * and then we fall through to point the head at us. 1983 * and then we fall through to point the head at us.
1967 */ 1984 */
1968 error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0); 1985 ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO);
1969 if (error) {
1970 return error;
1971 }
1972 ASSERT(INT_GET(dip->di_next_unlinked, ARCH_CONVERT) == NULLAGINO);
1973 ASSERT(dip->di_next_unlinked);
1974 /* both on-disk, don't endian flip twice */ 1986 /* both on-disk, don't endian flip twice */
1975 dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; 1987 dip->di_next_unlinked = agi->agi_unlinked[bucket_index];
1976 offset = ip->i_boffset + 1988 offset = ip->i_boffset +
@@ -2081,10 +2093,10 @@ xfs_iunlink_remove(
2081 error, mp->m_fsname); 2093 error, mp->m_fsname);
2082 return error; 2094 return error;
2083 } 2095 }
2084 next_agino = INT_GET(dip->di_next_unlinked, ARCH_CONVERT); 2096 next_agino = be32_to_cpu(dip->di_next_unlinked);
2085 ASSERT(next_agino != 0); 2097 ASSERT(next_agino != 0);
2086 if (next_agino != NULLAGINO) { 2098 if (next_agino != NULLAGINO) {
2087 INT_SET(dip->di_next_unlinked, ARCH_CONVERT, NULLAGINO); 2099 dip->di_next_unlinked = cpu_to_be32(NULLAGINO);
2088 offset = ip->i_boffset + 2100 offset = ip->i_boffset +
2089 offsetof(xfs_dinode_t, di_next_unlinked); 2101 offsetof(xfs_dinode_t, di_next_unlinked);
2090 xfs_trans_inode_buf(tp, ibp); 2102 xfs_trans_inode_buf(tp, ibp);
@@ -2128,7 +2140,7 @@ xfs_iunlink_remove(
2128 error, mp->m_fsname); 2140 error, mp->m_fsname);
2129 return error; 2141 return error;
2130 } 2142 }
2131 next_agino = INT_GET(last_dip->di_next_unlinked, ARCH_CONVERT); 2143 next_agino = be32_to_cpu(last_dip->di_next_unlinked);
2132 ASSERT(next_agino != NULLAGINO); 2144 ASSERT(next_agino != NULLAGINO);
2133 ASSERT(next_agino != 0); 2145 ASSERT(next_agino != 0);
2134 } 2146 }
@@ -2143,11 +2155,11 @@ xfs_iunlink_remove(
2143 error, mp->m_fsname); 2155 error, mp->m_fsname);
2144 return error; 2156 return error;
2145 } 2157 }
2146 next_agino = INT_GET(dip->di_next_unlinked, ARCH_CONVERT); 2158 next_agino = be32_to_cpu(dip->di_next_unlinked);
2147 ASSERT(next_agino != 0); 2159 ASSERT(next_agino != 0);
2148 ASSERT(next_agino != agino); 2160 ASSERT(next_agino != agino);
2149 if (next_agino != NULLAGINO) { 2161 if (next_agino != NULLAGINO) {
2150 INT_SET(dip->di_next_unlinked, ARCH_CONVERT, NULLAGINO); 2162 dip->di_next_unlinked = cpu_to_be32(NULLAGINO);
2151 offset = ip->i_boffset + 2163 offset = ip->i_boffset +
2152 offsetof(xfs_dinode_t, di_next_unlinked); 2164 offsetof(xfs_dinode_t, di_next_unlinked);
2153 xfs_trans_inode_buf(tp, ibp); 2165 xfs_trans_inode_buf(tp, ibp);
@@ -2160,7 +2172,7 @@ xfs_iunlink_remove(
2160 /* 2172 /*
2161 * Point the previous inode on the list to the next inode. 2173 * Point the previous inode on the list to the next inode.
2162 */ 2174 */
2163 INT_SET(last_dip->di_next_unlinked, ARCH_CONVERT, next_agino); 2175 last_dip->di_next_unlinked = cpu_to_be32(next_agino);
2164 ASSERT(next_agino != 0); 2176 ASSERT(next_agino != 0);
2165 offset = last_offset + offsetof(xfs_dinode_t, di_next_unlinked); 2177 offset = last_offset + offsetof(xfs_dinode_t, di_next_unlinked);
2166 xfs_trans_inode_buf(tp, last_ibp); 2178 xfs_trans_inode_buf(tp, last_ibp);
@@ -2191,10 +2203,10 @@ xfs_ifree_cluster(
2191 int i, j, found, pre_flushed; 2203 int i, j, found, pre_flushed;
2192 xfs_daddr_t blkno; 2204 xfs_daddr_t blkno;
2193 xfs_buf_t *bp; 2205 xfs_buf_t *bp;
2194 xfs_ihash_t *ih;
2195 xfs_inode_t *ip, **ip_found; 2206 xfs_inode_t *ip, **ip_found;
2196 xfs_inode_log_item_t *iip; 2207 xfs_inode_log_item_t *iip;
2197 xfs_log_item_t *lip; 2208 xfs_log_item_t *lip;
2209 xfs_perag_t *pag = xfs_get_perag(mp, inum);
2198 SPLDECL(s); 2210 SPLDECL(s);
2199 2211
2200 if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) { 2212 if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
@@ -2229,23 +2241,20 @@ xfs_ifree_cluster(
2229 */ 2241 */
2230 found = 0; 2242 found = 0;
2231 for (i = 0; i < ninodes; i++) { 2243 for (i = 0; i < ninodes; i++) {
2232 ih = XFS_IHASH(mp, inum + i); 2244 read_lock(&pag->pag_ici_lock);
2233 read_lock(&ih->ih_lock); 2245 ip = radix_tree_lookup(&pag->pag_ici_root,
2234 for (ip = ih->ih_next; ip != NULL; ip = ip->i_next) { 2246 XFS_INO_TO_AGINO(mp, (inum + i)));
2235 if (ip->i_ino == inum + i)
2236 break;
2237 }
2238 2247
2239 /* Inode not in memory or we found it already, 2248 /* Inode not in memory or we found it already,
2240 * nothing to do 2249 * nothing to do
2241 */ 2250 */
2242 if (!ip || xfs_iflags_test(ip, XFS_ISTALE)) { 2251 if (!ip || xfs_iflags_test(ip, XFS_ISTALE)) {
2243 read_unlock(&ih->ih_lock); 2252 read_unlock(&pag->pag_ici_lock);
2244 continue; 2253 continue;
2245 } 2254 }
2246 2255
2247 if (xfs_inode_clean(ip)) { 2256 if (xfs_inode_clean(ip)) {
2248 read_unlock(&ih->ih_lock); 2257 read_unlock(&pag->pag_ici_lock);
2249 continue; 2258 continue;
2250 } 2259 }
2251 2260
@@ -2268,7 +2277,7 @@ xfs_ifree_cluster(
2268 ip_found[found++] = ip; 2277 ip_found[found++] = ip;
2269 } 2278 }
2270 } 2279 }
2271 read_unlock(&ih->ih_lock); 2280 read_unlock(&pag->pag_ici_lock);
2272 continue; 2281 continue;
2273 } 2282 }
2274 2283
@@ -2286,8 +2295,7 @@ xfs_ifree_cluster(
2286 xfs_iunlock(ip, XFS_ILOCK_EXCL); 2295 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2287 } 2296 }
2288 } 2297 }
2289 2298 read_unlock(&pag->pag_ici_lock);
2290 read_unlock(&ih->ih_lock);
2291 } 2299 }
2292 2300
2293 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno, 2301 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,
@@ -2342,6 +2350,7 @@ xfs_ifree_cluster(
2342 } 2350 }
2343 2351
2344 kmem_free(ip_found, ninodes * sizeof(xfs_inode_t *)); 2352 kmem_free(ip_found, ninodes * sizeof(xfs_inode_t *));
2353 xfs_put_perag(mp, pag);
2345} 2354}
2346 2355
2347/* 2356/*
@@ -2737,6 +2746,10 @@ xfs_idestroy(
2737 mrfree(&ip->i_lock); 2746 mrfree(&ip->i_lock);
2738 mrfree(&ip->i_iolock); 2747 mrfree(&ip->i_iolock);
2739 freesema(&ip->i_flock); 2748 freesema(&ip->i_flock);
2749
2750#ifdef XFS_VNODE_TRACE
2751 ktrace_free(ip->i_trace);
2752#endif
2740#ifdef XFS_BMAP_TRACE 2753#ifdef XFS_BMAP_TRACE
2741 ktrace_free(ip->i_xtrace); 2754 ktrace_free(ip->i_xtrace);
2742#endif 2755#endif
@@ -2887,12 +2900,10 @@ xfs_iunpin_wait(
2887int 2900int
2888xfs_iextents_copy( 2901xfs_iextents_copy(
2889 xfs_inode_t *ip, 2902 xfs_inode_t *ip,
2890 xfs_bmbt_rec_t *buffer, 2903 xfs_bmbt_rec_t *dp,
2891 int whichfork) 2904 int whichfork)
2892{ 2905{
2893 int copied; 2906 int copied;
2894 xfs_bmbt_rec_t *dest_ep;
2895 xfs_bmbt_rec_t *ep;
2896 int i; 2907 int i;
2897 xfs_ifork_t *ifp; 2908 xfs_ifork_t *ifp;
2898 int nrecs; 2909 int nrecs;
@@ -2912,10 +2923,9 @@ xfs_iextents_copy(
2912 * the delayed ones. There must be at least one 2923 * the delayed ones. There must be at least one
2913 * non-delayed extent. 2924 * non-delayed extent.
2914 */ 2925 */
2915 dest_ep = buffer;
2916 copied = 0; 2926 copied = 0;
2917 for (i = 0; i < nrecs; i++) { 2927 for (i = 0; i < nrecs; i++) {
2918 ep = xfs_iext_get_ext(ifp, i); 2928 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
2919 start_block = xfs_bmbt_get_startblock(ep); 2929 start_block = xfs_bmbt_get_startblock(ep);
2920 if (ISNULLSTARTBLOCK(start_block)) { 2930 if (ISNULLSTARTBLOCK(start_block)) {
2921 /* 2931 /*
@@ -2925,15 +2935,13 @@ xfs_iextents_copy(
2925 } 2935 }
2926 2936
2927 /* Translate to on disk format */ 2937 /* Translate to on disk format */
2928 put_unaligned(INT_GET(ep->l0, ARCH_CONVERT), 2938 put_unaligned(cpu_to_be64(ep->l0), &dp->l0);
2929 (__uint64_t*)&dest_ep->l0); 2939 put_unaligned(cpu_to_be64(ep->l1), &dp->l1);
2930 put_unaligned(INT_GET(ep->l1, ARCH_CONVERT), 2940 dp++;
2931 (__uint64_t*)&dest_ep->l1);
2932 dest_ep++;
2933 copied++; 2941 copied++;
2934 } 2942 }
2935 ASSERT(copied != 0); 2943 ASSERT(copied != 0);
2936 xfs_validate_extents(ifp, copied, 1, XFS_EXTFMT_INODE(ip)); 2944 xfs_validate_extents(ifp, copied, XFS_EXTFMT_INODE(ip));
2937 2945
2938 return (copied * (uint)sizeof(xfs_bmbt_rec_t)); 2946 return (copied * (uint)sizeof(xfs_bmbt_rec_t));
2939} 2947}
@@ -3024,7 +3032,7 @@ xfs_iflush_fork(
3024 case XFS_DINODE_FMT_DEV: 3032 case XFS_DINODE_FMT_DEV:
3025 if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) { 3033 if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) {
3026 ASSERT(whichfork == XFS_DATA_FORK); 3034 ASSERT(whichfork == XFS_DATA_FORK);
3027 INT_SET(dip->di_u.di_dev, ARCH_CONVERT, ip->i_df.if_u2.if_rdev); 3035 dip->di_u.di_dev = cpu_to_be32(ip->i_df.if_u2.if_rdev);
3028 } 3036 }
3029 break; 3037 break;
3030 3038
@@ -3064,12 +3072,11 @@ xfs_iflush(
3064 xfs_mount_t *mp; 3072 xfs_mount_t *mp;
3065 int error; 3073 int error;
3066 /* REFERENCED */ 3074 /* REFERENCED */
3067 xfs_chash_t *ch;
3068 xfs_inode_t *iq; 3075 xfs_inode_t *iq;
3069 int clcount; /* count of inodes clustered */ 3076 int clcount; /* count of inodes clustered */
3070 int bufwasdelwri; 3077 int bufwasdelwri;
3078 struct hlist_node *entry;
3071 enum { INT_DELWRI = (1 << 0), INT_ASYNC = (1 << 1) }; 3079 enum { INT_DELWRI = (1 << 0), INT_ASYNC = (1 << 1) };
3072 SPLDECL(s);
3073 3080
3074 XFS_STATS_INC(xs_iflush_count); 3081 XFS_STATS_INC(xs_iflush_count);
3075 3082
@@ -3183,14 +3190,14 @@ xfs_iflush(
3183 * inode clustering: 3190 * inode clustering:
3184 * see if other inodes can be gathered into this write 3191 * see if other inodes can be gathered into this write
3185 */ 3192 */
3186 3193 spin_lock(&ip->i_cluster->icl_lock);
3187 ip->i_chash->chl_buf = bp; 3194 ip->i_cluster->icl_buf = bp;
3188
3189 ch = XFS_CHASH(mp, ip->i_blkno);
3190 s = mutex_spinlock(&ch->ch_lock);
3191 3195
3192 clcount = 0; 3196 clcount = 0;
3193 for (iq = ip->i_cnext; iq != ip; iq = iq->i_cnext) { 3197 hlist_for_each_entry(iq, entry, &ip->i_cluster->icl_inodes, i_cnode) {
3198 if (iq == ip)
3199 continue;
3200
3194 /* 3201 /*
3195 * Do an un-protected check to see if the inode is dirty and 3202 * Do an un-protected check to see if the inode is dirty and
3196 * is a candidate for flushing. These checks will be repeated 3203 * is a candidate for flushing. These checks will be repeated
@@ -3241,7 +3248,7 @@ xfs_iflush(
3241 xfs_iunlock(iq, XFS_ILOCK_SHARED); 3248 xfs_iunlock(iq, XFS_ILOCK_SHARED);
3242 } 3249 }
3243 } 3250 }
3244 mutex_spinunlock(&ch->ch_lock, s); 3251 spin_unlock(&ip->i_cluster->icl_lock);
3245 3252
3246 if (clcount) { 3253 if (clcount) {
3247 XFS_STATS_INC(xs_icluster_flushcnt); 3254 XFS_STATS_INC(xs_icluster_flushcnt);
@@ -3278,7 +3285,7 @@ cluster_corrupt_out:
3278 /* Corruption detected in the clustering loop. Invalidate the 3285 /* Corruption detected in the clustering loop. Invalidate the
3279 * inode buffer and shut down the filesystem. 3286 * inode buffer and shut down the filesystem.
3280 */ 3287 */
3281 mutex_spinunlock(&ch->ch_lock, s); 3288 spin_unlock(&ip->i_cluster->icl_lock);
3282 3289
3283 /* 3290 /*
3284 * Clean up the buffer. If it was B_DELWRI, just release it -- 3291 * Clean up the buffer. If it was B_DELWRI, just release it --
@@ -3373,11 +3380,11 @@ xfs_iflush_int(
3373 */ 3380 */
3374 xfs_synchronize_atime(ip); 3381 xfs_synchronize_atime(ip);
3375 3382
3376 if (XFS_TEST_ERROR(INT_GET(dip->di_core.di_magic,ARCH_CONVERT) != XFS_DINODE_MAGIC, 3383 if (XFS_TEST_ERROR(be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC,
3377 mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) { 3384 mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) {
3378 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 3385 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
3379 "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p", 3386 "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p",
3380 ip->i_ino, (int) INT_GET(dip->di_core.di_magic, ARCH_CONVERT), dip); 3387 ip->i_ino, be16_to_cpu(dip->di_core.di_magic), dip);
3381 goto corrupt_out; 3388 goto corrupt_out;
3382 } 3389 }
3383 if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC, 3390 if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC,
@@ -3440,7 +3447,7 @@ xfs_iflush_int(
3440 * because if the inode is dirty at all the core must 3447 * because if the inode is dirty at all the core must
3441 * be. 3448 * be.
3442 */ 3449 */
3443 xfs_xlate_dinode_core((xfs_caddr_t)&(dip->di_core), &(ip->i_d), -1); 3450 xfs_dinode_to_disk(&dip->di_core, &ip->i_d);
3444 3451
3445 /* Wrap, we never let the log put out DI_MAX_FLUSH */ 3452 /* Wrap, we never let the log put out DI_MAX_FLUSH */
3446 if (ip->i_d.di_flushiter == DI_MAX_FLUSH) 3453 if (ip->i_d.di_flushiter == DI_MAX_FLUSH)
@@ -3460,7 +3467,7 @@ xfs_iflush_int(
3460 * Convert it back. 3467 * Convert it back.
3461 */ 3468 */
3462 ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1); 3469 ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1);
3463 INT_SET(dip->di_core.di_onlink, ARCH_CONVERT, ip->i_d.di_nlink); 3470 dip->di_core.di_onlink = cpu_to_be16(ip->i_d.di_nlink);
3464 } else { 3471 } else {
3465 /* 3472 /*
3466 * The superblock version has already been bumped, 3473 * The superblock version has already been bumped,
@@ -3468,7 +3475,7 @@ xfs_iflush_int(
3468 * format permanent. 3475 * format permanent.
3469 */ 3476 */
3470 ip->i_d.di_version = XFS_DINODE_VERSION_2; 3477 ip->i_d.di_version = XFS_DINODE_VERSION_2;
3471 INT_SET(dip->di_core.di_version, ARCH_CONVERT, XFS_DINODE_VERSION_2); 3478 dip->di_core.di_version = XFS_DINODE_VERSION_2;
3472 ip->i_d.di_onlink = 0; 3479 ip->i_d.di_onlink = 0;
3473 dip->di_core.di_onlink = 0; 3480 dip->di_core.di_onlink = 0;
3474 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); 3481 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
@@ -3711,7 +3718,7 @@ xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra)
3711/* 3718/*
3712 * Return a pointer to the extent record at file index idx. 3719 * Return a pointer to the extent record at file index idx.
3713 */ 3720 */
3714xfs_bmbt_rec_t * 3721xfs_bmbt_rec_host_t *
3715xfs_iext_get_ext( 3722xfs_iext_get_ext(
3716 xfs_ifork_t *ifp, /* inode fork pointer */ 3723 xfs_ifork_t *ifp, /* inode fork pointer */
3717 xfs_extnum_t idx) /* index of target extent */ 3724 xfs_extnum_t idx) /* index of target extent */
@@ -3744,15 +3751,12 @@ xfs_iext_insert(
3744 xfs_extnum_t count, /* number of inserted items */ 3751 xfs_extnum_t count, /* number of inserted items */
3745 xfs_bmbt_irec_t *new) /* items to insert */ 3752 xfs_bmbt_irec_t *new) /* items to insert */
3746{ 3753{
3747 xfs_bmbt_rec_t *ep; /* extent record pointer */
3748 xfs_extnum_t i; /* extent record index */ 3754 xfs_extnum_t i; /* extent record index */
3749 3755
3750 ASSERT(ifp->if_flags & XFS_IFEXTENTS); 3756 ASSERT(ifp->if_flags & XFS_IFEXTENTS);
3751 xfs_iext_add(ifp, idx, count); 3757 xfs_iext_add(ifp, idx, count);
3752 for (i = idx; i < idx + count; i++, new++) { 3758 for (i = idx; i < idx + count; i++, new++)
3753 ep = xfs_iext_get_ext(ifp, i); 3759 xfs_bmbt_set_all(xfs_iext_get_ext(ifp, i), new);
3754 xfs_bmbt_set_all(ep, new);
3755 }
3756} 3760}
3757 3761
3758/* 3762/*
@@ -4203,7 +4207,7 @@ xfs_iext_realloc_direct(
4203 rnew_size = xfs_iroundup(new_size); 4207 rnew_size = xfs_iroundup(new_size);
4204 } 4208 }
4205 if (rnew_size != ifp->if_real_bytes) { 4209 if (rnew_size != ifp->if_real_bytes) {
4206 ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) 4210 ifp->if_u1.if_extents =
4207 kmem_realloc(ifp->if_u1.if_extents, 4211 kmem_realloc(ifp->if_u1.if_extents,
4208 rnew_size, 4212 rnew_size,
4209 ifp->if_real_bytes, 4213 ifp->if_real_bytes,
@@ -4266,8 +4270,7 @@ xfs_iext_inline_to_direct(
4266 xfs_ifork_t *ifp, /* inode fork pointer */ 4270 xfs_ifork_t *ifp, /* inode fork pointer */
4267 int new_size) /* number of extents in file */ 4271 int new_size) /* number of extents in file */
4268{ 4272{
4269 ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) 4273 ifp->if_u1.if_extents = kmem_alloc(new_size, KM_SLEEP);
4270 kmem_alloc(new_size, KM_SLEEP);
4271 memset(ifp->if_u1.if_extents, 0, new_size); 4274 memset(ifp->if_u1.if_extents, 0, new_size);
4272 if (ifp->if_bytes) { 4275 if (ifp->if_bytes) {
4273 memcpy(ifp->if_u1.if_extents, ifp->if_u2.if_inline_ext, 4276 memcpy(ifp->if_u1.if_extents, ifp->if_u2.if_inline_ext,
@@ -4310,7 +4313,7 @@ void
4310xfs_iext_indirect_to_direct( 4313xfs_iext_indirect_to_direct(
4311 xfs_ifork_t *ifp) /* inode fork pointer */ 4314 xfs_ifork_t *ifp) /* inode fork pointer */
4312{ 4315{
4313 xfs_bmbt_rec_t *ep; /* extent record pointer */ 4316 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
4314 xfs_extnum_t nextents; /* number of extents in file */ 4317 xfs_extnum_t nextents; /* number of extents in file */
4315 int size; /* size of file extents */ 4318 int size; /* size of file extents */
4316 4319
@@ -4362,15 +4365,15 @@ xfs_iext_destroy(
4362/* 4365/*
4363 * Return a pointer to the extent record for file system block bno. 4366 * Return a pointer to the extent record for file system block bno.
4364 */ 4367 */
4365xfs_bmbt_rec_t * /* pointer to found extent record */ 4368xfs_bmbt_rec_host_t * /* pointer to found extent record */
4366xfs_iext_bno_to_ext( 4369xfs_iext_bno_to_ext(
4367 xfs_ifork_t *ifp, /* inode fork pointer */ 4370 xfs_ifork_t *ifp, /* inode fork pointer */
4368 xfs_fileoff_t bno, /* block number to search for */ 4371 xfs_fileoff_t bno, /* block number to search for */
4369 xfs_extnum_t *idxp) /* index of target extent */ 4372 xfs_extnum_t *idxp) /* index of target extent */
4370{ 4373{
4371 xfs_bmbt_rec_t *base; /* pointer to first extent */ 4374 xfs_bmbt_rec_host_t *base; /* pointer to first extent */
4372 xfs_filblks_t blockcount = 0; /* number of blocks in extent */ 4375 xfs_filblks_t blockcount = 0; /* number of blocks in extent */
4373 xfs_bmbt_rec_t *ep = NULL; /* pointer to target extent */ 4376 xfs_bmbt_rec_host_t *ep = NULL; /* pointer to target extent */
4374 xfs_ext_irec_t *erp = NULL; /* indirection array pointer */ 4377 xfs_ext_irec_t *erp = NULL; /* indirection array pointer */
4375 int high; /* upper boundary in search */ 4378 int high; /* upper boundary in search */
4376 xfs_extnum_t idx = 0; /* index of target extent */ 4379 xfs_extnum_t idx = 0; /* index of target extent */
@@ -4545,8 +4548,7 @@ xfs_iext_irec_init(
4545 kmem_alloc(sizeof(xfs_ext_irec_t), KM_SLEEP); 4548 kmem_alloc(sizeof(xfs_ext_irec_t), KM_SLEEP);
4546 4549
4547 if (nextents == 0) { 4550 if (nextents == 0) {
4548 ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) 4551 ifp->if_u1.if_extents = kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4549 kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4550 } else if (!ifp->if_real_bytes) { 4552 } else if (!ifp->if_real_bytes) {
4551 xfs_iext_inline_to_direct(ifp, XFS_IEXT_BUFSZ); 4553 xfs_iext_inline_to_direct(ifp, XFS_IEXT_BUFSZ);
4552 } else if (ifp->if_real_bytes < XFS_IEXT_BUFSZ) { 4554 } else if (ifp->if_real_bytes < XFS_IEXT_BUFSZ) {
@@ -4594,8 +4596,7 @@ xfs_iext_irec_new(
4594 4596
4595 /* Initialize new extent record */ 4597 /* Initialize new extent record */
4596 erp = ifp->if_u1.if_ext_irec; 4598 erp = ifp->if_u1.if_ext_irec;
4597 erp[erp_idx].er_extbuf = (xfs_bmbt_rec_t *) 4599 erp[erp_idx].er_extbuf = kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4598 kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4599 ifp->if_real_bytes = nlists * XFS_IEXT_BUFSZ; 4600 ifp->if_real_bytes = nlists * XFS_IEXT_BUFSZ;
4600 memset(erp[erp_idx].er_extbuf, 0, XFS_IEXT_BUFSZ); 4601 memset(erp[erp_idx].er_extbuf, 0, XFS_IEXT_BUFSZ);
4601 erp[erp_idx].er_extcount = 0; 4602 erp[erp_idx].er_extcount = 0;
@@ -4727,7 +4728,7 @@ void
4727xfs_iext_irec_compact_full( 4728xfs_iext_irec_compact_full(
4728 xfs_ifork_t *ifp) /* inode fork pointer */ 4729 xfs_ifork_t *ifp) /* inode fork pointer */
4729{ 4730{
4730 xfs_bmbt_rec_t *ep, *ep_next; /* extent record pointers */ 4731 xfs_bmbt_rec_host_t *ep, *ep_next; /* extent record pointers */
4731 xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */ 4732 xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */
4732 int erp_idx = 0; /* extent irec index */ 4733 int erp_idx = 0; /* extent irec index */
4733 int ext_avail; /* empty entries in ex list */ 4734 int ext_avail; /* empty entries in ex list */
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 012dfd4a958c..e5aff929cc65 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -18,6 +18,10 @@
18#ifndef __XFS_INODE_H__ 18#ifndef __XFS_INODE_H__
19#define __XFS_INODE_H__ 19#define __XFS_INODE_H__
20 20
21struct xfs_dinode;
22struct xfs_dinode_core;
23
24
21/* 25/*
22 * Fork identifiers. 26 * Fork identifiers.
23 */ 27 */
@@ -44,7 +48,7 @@
44 * it is possible that a third level of indirection may be required. 48 * it is possible that a third level of indirection may be required.
45 */ 49 */
46typedef struct xfs_ext_irec { 50typedef struct xfs_ext_irec {
47 xfs_bmbt_rec_t *er_extbuf; /* block of extent records */ 51 xfs_bmbt_rec_host_t *er_extbuf; /* block of extent records */
48 xfs_extnum_t er_extoff; /* extent offset in file */ 52 xfs_extnum_t er_extoff; /* extent offset in file */
49 xfs_extnum_t er_extcount; /* number of extents in page/block */ 53 xfs_extnum_t er_extcount; /* number of extents in page/block */
50} xfs_ext_irec_t; 54} xfs_ext_irec_t;
@@ -65,12 +69,12 @@ typedef struct xfs_ifork {
65 unsigned char if_ext_max; /* max # of extent records */ 69 unsigned char if_ext_max; /* max # of extent records */
66 xfs_extnum_t if_lastex; /* last if_extents used */ 70 xfs_extnum_t if_lastex; /* last if_extents used */
67 union { 71 union {
68 xfs_bmbt_rec_t *if_extents; /* linear map file exts */ 72 xfs_bmbt_rec_host_t *if_extents;/* linear map file exts */
69 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */ 73 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */
70 char *if_data; /* inline file data */ 74 char *if_data; /* inline file data */
71 } if_u1; 75 } if_u1;
72 union { 76 union {
73 xfs_bmbt_rec_t if_inline_ext[XFS_INLINE_EXTS]; 77 xfs_bmbt_rec_host_t if_inline_ext[XFS_INLINE_EXTS];
74 /* very small file extents */ 78 /* very small file extents */
75 char if_inline_data[XFS_INLINE_DATA]; 79 char if_inline_data[XFS_INLINE_DATA];
76 /* very small file data */ 80 /* very small file data */
@@ -102,7 +106,6 @@ typedef struct xfs_ifork {
102 106
103#ifdef __KERNEL__ 107#ifdef __KERNEL__
104struct bhv_desc; 108struct bhv_desc;
105struct bhv_vnode;
106struct cred; 109struct cred;
107struct ktrace; 110struct ktrace;
108struct xfs_buf; 111struct xfs_buf;
@@ -168,41 +171,18 @@ typedef struct xfs_iocore {
168extern void xfs_iocore_inode_init(struct xfs_inode *); 171extern void xfs_iocore_inode_init(struct xfs_inode *);
169extern void xfs_iocore_inode_reinit(struct xfs_inode *); 172extern void xfs_iocore_inode_reinit(struct xfs_inode *);
170 173
171
172/*
173 * This is the type used in the xfs inode hash table.
174 * An array of these is allocated for each mounted
175 * file system to hash the inodes for that file system.
176 */
177typedef struct xfs_ihash {
178 struct xfs_inode *ih_next;
179 rwlock_t ih_lock;
180 uint ih_version;
181} xfs_ihash_t;
182
183#define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)(ino)) % (mp)->m_ihsize))
184
185/* 174/*
186 * This is the xfs inode cluster hash. This hash is used by xfs_iflush to 175 * This is the xfs inode cluster structure. This structure is used by
187 * find inodes that share a cluster and can be flushed to disk at the same 176 * xfs_iflush to find inodes that share a cluster and can be flushed to disk at
188 * time. 177 * the same time.
189 */ 178 */
190typedef struct xfs_chashlist { 179typedef struct xfs_icluster {
191 struct xfs_chashlist *chl_next; 180 struct hlist_head icl_inodes; /* list of inodes on cluster */
192 struct xfs_chashlist *chl_prev; 181 xfs_daddr_t icl_blkno; /* starting block number of
193 struct xfs_inode *chl_ip;
194 xfs_daddr_t chl_blkno; /* starting block number of
195 * the cluster */ 182 * the cluster */
196 struct xfs_buf *chl_buf; /* the inode buffer */ 183 struct xfs_buf *icl_buf; /* the inode buffer */
197} xfs_chashlist_t; 184 lock_t icl_lock; /* inode list lock */
198 185} xfs_icluster_t;
199typedef struct xfs_chash {
200 xfs_chashlist_t *ch_list;
201 lock_t ch_lock;
202} xfs_chash_t;
203
204#define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
205
206 186
207/* 187/*
208 * This is the xfs in-core inode structure. 188 * This is the xfs in-core inode structure.
@@ -227,25 +207,56 @@ typedef struct xfs_chash {
227 * chain off the mount structure by xfs_sync calls. 207 * chain off the mount structure by xfs_sync calls.
228 */ 208 */
229 209
210typedef struct xfs_ictimestamp {
211 __int32_t t_sec; /* timestamp seconds */
212 __int32_t t_nsec; /* timestamp nanoseconds */
213} xfs_ictimestamp_t;
214
215/*
216 * NOTE: This structure must be kept identical to struct xfs_dinode_core
217 * in xfs_dinode.h except for the endianess annotations.
218 */
219typedef struct xfs_icdinode {
220 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
221 __uint16_t di_mode; /* mode and type of file */
222 __int8_t di_version; /* inode version */
223 __int8_t di_format; /* format of di_c data */
224 __uint16_t di_onlink; /* old number of links to file */
225 __uint32_t di_uid; /* owner's user id */
226 __uint32_t di_gid; /* owner's group id */
227 __uint32_t di_nlink; /* number of links to file */
228 __uint16_t di_projid; /* owner's project id */
229 __uint8_t di_pad[8]; /* unused, zeroed space */
230 __uint16_t di_flushiter; /* incremented on flush */
231 xfs_ictimestamp_t di_atime; /* time last accessed */
232 xfs_ictimestamp_t di_mtime; /* time last modified */
233 xfs_ictimestamp_t di_ctime; /* time created/inode modified */
234 xfs_fsize_t di_size; /* number of bytes in file */
235 xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */
236 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
237 xfs_extnum_t di_nextents; /* number of extents in data fork */
238 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
239 __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
240 __int8_t di_aformat; /* format of attr fork's data */
241 __uint32_t di_dmevmask; /* DMIG event mask */
242 __uint16_t di_dmstate; /* DMIG state info */
243 __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
244 __uint32_t di_gen; /* generation number */
245} xfs_icdinode_t;
246
230typedef struct { 247typedef struct {
231 struct xfs_ihash *ip_hash; /* pointer to hash header */
232 struct xfs_inode *ip_next; /* inode hash link forw */
233 struct xfs_inode *ip_mnext; /* next inode in mount list */ 248 struct xfs_inode *ip_mnext; /* next inode in mount list */
234 struct xfs_inode *ip_mprev; /* ptr to prev inode */ 249 struct xfs_inode *ip_mprev; /* ptr to prev inode */
235 struct xfs_inode **ip_prevp; /* ptr to prev i_next */
236 struct xfs_mount *ip_mount; /* fs mount struct ptr */ 250 struct xfs_mount *ip_mount; /* fs mount struct ptr */
237} xfs_iptr_t; 251} xfs_iptr_t;
238 252
239typedef struct xfs_inode { 253typedef struct xfs_inode {
240 /* Inode linking and identification information. */ 254 /* Inode linking and identification information. */
241 struct xfs_ihash *i_hash; /* pointer to hash header */
242 struct xfs_inode *i_next; /* inode hash link forw */
243 struct xfs_inode *i_mnext; /* next inode in mount list */ 255 struct xfs_inode *i_mnext; /* next inode in mount list */
244 struct xfs_inode *i_mprev; /* ptr to prev inode */ 256 struct xfs_inode *i_mprev; /* ptr to prev inode */
245 struct xfs_inode **i_prevp; /* ptr to prev i_next */
246 struct xfs_mount *i_mount; /* fs mount struct ptr */ 257 struct xfs_mount *i_mount; /* fs mount struct ptr */
247 struct list_head i_reclaim; /* reclaim list */ 258 struct list_head i_reclaim; /* reclaim list */
248 struct bhv_desc i_bhv_desc; /* inode behavior descriptor*/ 259 bhv_vnode_t *i_vnode; /* vnode backpointer */
249 struct xfs_dquot *i_udquot; /* user dquot */ 260 struct xfs_dquot *i_udquot; /* user dquot */
250 struct xfs_dquot *i_gdquot; /* group dquot */ 261 struct xfs_dquot *i_gdquot; /* group dquot */
251 262
@@ -282,13 +293,16 @@ typedef struct xfs_inode {
282 unsigned int i_gen; /* generation count */ 293 unsigned int i_gen; /* generation count */
283 unsigned int i_delayed_blks; /* count of delay alloc blks */ 294 unsigned int i_delayed_blks; /* count of delay alloc blks */
284 295
285 xfs_dinode_core_t i_d; /* most of ondisk inode */ 296 xfs_icdinode_t i_d; /* most of ondisk inode */
286 xfs_chashlist_t *i_chash; /* cluster hash list header */ 297 xfs_icluster_t *i_cluster; /* cluster list header */
287 struct xfs_inode *i_cnext; /* cluster hash link forward */ 298 struct hlist_node i_cnode; /* cluster link node */
288 struct xfs_inode *i_cprev; /* cluster hash link backward */
289 299
290 xfs_fsize_t i_size; /* in-memory size */ 300 xfs_fsize_t i_size; /* in-memory size */
301 atomic_t i_iocount; /* outstanding I/O count */
291 /* Trace buffers per inode. */ 302 /* Trace buffers per inode. */
303#ifdef XFS_VNODE_TRACE
304 struct ktrace *i_trace; /* general inode trace */
305#endif
292#ifdef XFS_BMAP_TRACE 306#ifdef XFS_BMAP_TRACE
293 struct ktrace *i_xtrace; /* inode extent list trace */ 307 struct ktrace *i_xtrace; /* inode extent list trace */
294#endif 308#endif
@@ -349,6 +363,19 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
349 spin_unlock(&ip->i_flags_lock); 363 spin_unlock(&ip->i_flags_lock);
350 return ret; 364 return ret;
351} 365}
366
367static inline int
368xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
369{
370 int ret;
371
372 spin_lock(&ip->i_flags_lock);
373 ret = ip->i_flags & flags;
374 if (ret)
375 ip->i_flags &= ~flags;
376 spin_unlock(&ip->i_flags_lock);
377 return ret;
378}
352#endif /* __KERNEL__ */ 379#endif /* __KERNEL__ */
353 380
354 381
@@ -380,6 +407,9 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
380#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */ 407#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */
381#define XFS_INEW 0x0040 408#define XFS_INEW 0x0040
382#define XFS_IFILESTREAM 0x0080 /* inode is in a filestream directory */ 409#define XFS_IFILESTREAM 0x0080 /* inode is in a filestream directory */
410#define XFS_IMODIFIED 0x0100 /* XFS inode state possibly differs */
411 /* to the Linux inode state. */
412#define XFS_ITRUNCATED 0x0200 /* truncated down so flush-on-close */
383 413
384/* 414/*
385 * Flags for inode locking. 415 * Flags for inode locking.
@@ -454,20 +484,17 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
454#define XFS_ITRUNC_DEFINITE 0x1 484#define XFS_ITRUNC_DEFINITE 0x1
455#define XFS_ITRUNC_MAYBE 0x2 485#define XFS_ITRUNC_MAYBE 0x2
456 486
457#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) 487#define XFS_ITOV(ip) ((ip)->i_vnode)
458#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) 488#define XFS_ITOV_NULL(ip) ((ip)->i_vnode)
459#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
460#define XFS_BHVTOI(bhvp) ((xfs_inode_t *)((char *)(bhvp) - \
461 (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
462#define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops)
463 489
464/* 490/*
465 * For multiple groups support: if S_ISGID bit is set in the parent 491 * For multiple groups support: if S_ISGID bit is set in the parent
466 * directory, group of new file is set to that of the parent, and 492 * directory, group of new file is set to that of the parent, and
467 * new subdirectory gets S_ISGID bit from parent. 493 * new subdirectory gets S_ISGID bit from parent.
468 */ 494 */
469#define XFS_INHERIT_GID(pip, vfsp) \ 495#define XFS_INHERIT_GID(pip) \
470 (((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & S_ISGID)) 496 (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \
497 ((pip)->i_d.di_mode & S_ISGID))
471 498
472/* 499/*
473 * Flags for xfs_iget() 500 * Flags for xfs_iget()
@@ -480,11 +507,9 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
480 */ 507 */
481void xfs_ihash_init(struct xfs_mount *); 508void xfs_ihash_init(struct xfs_mount *);
482void xfs_ihash_free(struct xfs_mount *); 509void xfs_ihash_free(struct xfs_mount *);
483void xfs_chash_init(struct xfs_mount *);
484void xfs_chash_free(struct xfs_mount *);
485xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t, 510xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
486 struct xfs_trans *); 511 struct xfs_trans *);
487void xfs_inode_lock_init(xfs_inode_t *, struct bhv_vnode *); 512void xfs_inode_lock_init(xfs_inode_t *, bhv_vnode_t *);
488int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 513int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
489 uint, uint, xfs_inode_t **, xfs_daddr_t); 514 uint, uint, xfs_inode_t **, xfs_daddr_t);
490void xfs_iput(xfs_inode_t *, uint); 515void xfs_iput(xfs_inode_t *, uint);
@@ -506,7 +531,7 @@ int xfs_finish_reclaim_all(struct xfs_mount *, int);
506 * xfs_inode.c prototypes. 531 * xfs_inode.c prototypes.
507 */ 532 */
508int xfs_itobp(struct xfs_mount *, struct xfs_trans *, 533int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
509 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **, 534 xfs_inode_t *, struct xfs_dinode **, struct xfs_buf **,
510 xfs_daddr_t, uint); 535 xfs_daddr_t, uint);
511int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 536int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
512 xfs_inode_t **, xfs_daddr_t, uint); 537 xfs_inode_t **, xfs_daddr_t, uint);
@@ -514,8 +539,11 @@ int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
514int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, 539int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
515 xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t, 540 xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
516 int, struct xfs_buf **, boolean_t *, xfs_inode_t **); 541 int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
517void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, 542void xfs_dinode_from_disk(struct xfs_icdinode *,
518 int); 543 struct xfs_dinode_core *);
544void xfs_dinode_to_disk(struct xfs_dinode_core *,
545 struct xfs_icdinode *);
546
519uint xfs_ip2xflags(struct xfs_inode *); 547uint xfs_ip2xflags(struct xfs_inode *);
520uint xfs_dic2xflags(struct xfs_dinode_core *); 548uint xfs_dic2xflags(struct xfs_dinode_core *);
521int xfs_ifree(struct xfs_trans *, xfs_inode_t *, 549int xfs_ifree(struct xfs_trans *, xfs_inode_t *,
@@ -545,11 +573,9 @@ void xfs_ichgtime(xfs_inode_t *, int);
545xfs_fsize_t xfs_file_last_byte(xfs_inode_t *); 573xfs_fsize_t xfs_file_last_byte(xfs_inode_t *);
546void xfs_lock_inodes(xfs_inode_t **, int, int, uint); 574void xfs_lock_inodes(xfs_inode_t **, int, int, uint);
547 575
548xfs_inode_t *xfs_vtoi(struct bhv_vnode *vp);
549
550void xfs_synchronize_atime(xfs_inode_t *); 576void xfs_synchronize_atime(xfs_inode_t *);
551 577
552xfs_bmbt_rec_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t); 578xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
553void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, 579void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
554 xfs_bmbt_irec_t *); 580 xfs_bmbt_irec_t *);
555void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int); 581void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
@@ -564,7 +590,7 @@ void xfs_iext_indirect_to_direct(xfs_ifork_t *);
564void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t); 590void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
565void xfs_iext_inline_to_direct(xfs_ifork_t *, int); 591void xfs_iext_inline_to_direct(xfs_ifork_t *, int);
566void xfs_iext_destroy(xfs_ifork_t *); 592void xfs_iext_destroy(xfs_ifork_t *);
567xfs_bmbt_rec_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *); 593xfs_bmbt_rec_host_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *);
568xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *); 594xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *);
569xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int); 595xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int);
570void xfs_iext_irec_init(xfs_ifork_t *); 596void xfs_iext_irec_init(xfs_ifork_t *);
@@ -589,7 +615,7 @@ void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
589#define xfs_inobp_check(mp, bp) 615#define xfs_inobp_check(mp, bp)
590#endif /* DEBUG */ 616#endif /* DEBUG */
591 617
592extern struct kmem_zone *xfs_chashlist_zone; 618extern struct kmem_zone *xfs_icluster_zone;
593extern struct kmem_zone *xfs_ifork_zone; 619extern struct kmem_zone *xfs_ifork_zone;
594extern struct kmem_zone *xfs_inode_zone; 620extern struct kmem_zone *xfs_inode_zone;
595extern struct kmem_zone *xfs_ili_zone; 621extern struct kmem_zone *xfs_ili_zone;
diff --git a/fs/xfs/xfs_iocore.c b/fs/xfs/xfs_iocore.c
index 81548ec72ba6..b27b5d5be841 100644
--- a/fs/xfs/xfs_iocore.c
+++ b/fs/xfs/xfs_iocore.c
@@ -57,11 +57,11 @@ xfs_size_fn(
57 57
58STATIC int 58STATIC int
59xfs_ioinit( 59xfs_ioinit(
60 struct bhv_vfs *vfsp, 60 struct xfs_mount *mp,
61 struct xfs_mount_args *mntargs, 61 struct xfs_mount_args *mntargs,
62 int flags) 62 int flags)
63{ 63{
64 return xfs_mountfs(vfsp, XFS_VFSTOM(vfsp), flags); 64 return xfs_mountfs(mp, flags);
65} 65}
66 66
67xfs_ioops_t xfs_iocore_xfs = { 67xfs_ioops_t xfs_iocore_xfs = {
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index bf57b75acb90..72786e356d56 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -135,14 +135,10 @@ xfs_imap_to_bmap(
135 int flags) 135 int flags)
136{ 136{
137 xfs_mount_t *mp; 137 xfs_mount_t *mp;
138 xfs_fsize_t nisize;
139 int pbm; 138 int pbm;
140 xfs_fsblock_t start_block; 139 xfs_fsblock_t start_block;
141 140
142 mp = io->io_mount; 141 mp = io->io_mount;
143 nisize = XFS_SIZE(mp, io);
144 if (io->io_new_size > nisize)
145 nisize = io->io_new_size;
146 142
147 for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) { 143 for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) {
148 iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff); 144 iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
@@ -169,10 +165,6 @@ xfs_imap_to_bmap(
169 iomapp->iomap_flags |= IOMAP_UNWRITTEN; 165 iomapp->iomap_flags |= IOMAP_UNWRITTEN;
170 } 166 }
171 167
172 if ((iomapp->iomap_offset + iomapp->iomap_bsize) >= nisize) {
173 iomapp->iomap_flags |= IOMAP_EOF;
174 }
175
176 offset += iomapp->iomap_bsize - iomapp->iomap_delta; 168 offset += iomapp->iomap_bsize - iomapp->iomap_delta;
177 } 169 }
178 return pbm; /* Return the number filled */ 170 return pbm; /* Return the number filled */
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index df441ee936b2..f5c09887fe93 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -23,7 +23,6 @@
23 23
24typedef enum { /* iomap_flags values */ 24typedef enum { /* iomap_flags values */
25 IOMAP_READ = 0, /* mapping for a read */ 25 IOMAP_READ = 0, /* mapping for a read */
26 IOMAP_EOF = 0x01, /* mapping contains EOF */
27 IOMAP_HOLE = 0x02, /* mapping covers a hole */ 26 IOMAP_HOLE = 0x02, /* mapping covers a hole */
28 IOMAP_DELAY = 0x04, /* mapping covers delalloc region */ 27 IOMAP_DELAY = 0x04, /* mapping covers delalloc region */
29 IOMAP_REALTIME = 0x10, /* mapping on the realtime device */ 28 IOMAP_REALTIME = 0x10, /* mapping on the realtime device */
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 4c2454bcc714..9972992fd3c3 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -57,7 +57,7 @@ xfs_bulkstat_one_iget(
57 xfs_bstat_t *buf, /* return buffer */ 57 xfs_bstat_t *buf, /* return buffer */
58 int *stat) /* BULKSTAT_RV_... */ 58 int *stat) /* BULKSTAT_RV_... */
59{ 59{
60 xfs_dinode_core_t *dic; /* dinode core info pointer */ 60 xfs_icdinode_t *dic; /* dinode core info pointer */
61 xfs_inode_t *ip; /* incore inode pointer */ 61 xfs_inode_t *ip; /* incore inode pointer */
62 bhv_vnode_t *vp; 62 bhv_vnode_t *vp;
63 int error; 63 int error;
@@ -151,37 +151,37 @@ xfs_bulkstat_one_dinode(
151 * the new format. We don't change the version number so that we 151 * the new format. We don't change the version number so that we
152 * can distinguish this from a real new format inode. 152 * can distinguish this from a real new format inode.
153 */ 153 */
154 if (INT_GET(dic->di_version, ARCH_CONVERT) == XFS_DINODE_VERSION_1) { 154 if (dic->di_version == XFS_DINODE_VERSION_1) {
155 buf->bs_nlink = INT_GET(dic->di_onlink, ARCH_CONVERT); 155 buf->bs_nlink = be16_to_cpu(dic->di_onlink);
156 buf->bs_projid = 0; 156 buf->bs_projid = 0;
157 } else { 157 } else {
158 buf->bs_nlink = INT_GET(dic->di_nlink, ARCH_CONVERT); 158 buf->bs_nlink = be32_to_cpu(dic->di_nlink);
159 buf->bs_projid = INT_GET(dic->di_projid, ARCH_CONVERT); 159 buf->bs_projid = be16_to_cpu(dic->di_projid);
160 } 160 }
161 161
162 buf->bs_ino = ino; 162 buf->bs_ino = ino;
163 buf->bs_mode = INT_GET(dic->di_mode, ARCH_CONVERT); 163 buf->bs_mode = be16_to_cpu(dic->di_mode);
164 buf->bs_uid = INT_GET(dic->di_uid, ARCH_CONVERT); 164 buf->bs_uid = be32_to_cpu(dic->di_uid);
165 buf->bs_gid = INT_GET(dic->di_gid, ARCH_CONVERT); 165 buf->bs_gid = be32_to_cpu(dic->di_gid);
166 buf->bs_size = INT_GET(dic->di_size, ARCH_CONVERT); 166 buf->bs_size = be64_to_cpu(dic->di_size);
167 buf->bs_atime.tv_sec = INT_GET(dic->di_atime.t_sec, ARCH_CONVERT); 167 buf->bs_atime.tv_sec = be32_to_cpu(dic->di_atime.t_sec);
168 buf->bs_atime.tv_nsec = INT_GET(dic->di_atime.t_nsec, ARCH_CONVERT); 168 buf->bs_atime.tv_nsec = be32_to_cpu(dic->di_atime.t_nsec);
169 buf->bs_mtime.tv_sec = INT_GET(dic->di_mtime.t_sec, ARCH_CONVERT); 169 buf->bs_mtime.tv_sec = be32_to_cpu(dic->di_mtime.t_sec);
170 buf->bs_mtime.tv_nsec = INT_GET(dic->di_mtime.t_nsec, ARCH_CONVERT); 170 buf->bs_mtime.tv_nsec = be32_to_cpu(dic->di_mtime.t_nsec);
171 buf->bs_ctime.tv_sec = INT_GET(dic->di_ctime.t_sec, ARCH_CONVERT); 171 buf->bs_ctime.tv_sec = be32_to_cpu(dic->di_ctime.t_sec);
172 buf->bs_ctime.tv_nsec = INT_GET(dic->di_ctime.t_nsec, ARCH_CONVERT); 172 buf->bs_ctime.tv_nsec = be32_to_cpu(dic->di_ctime.t_nsec);
173 buf->bs_xflags = xfs_dic2xflags(dic); 173 buf->bs_xflags = xfs_dic2xflags(dic);
174 buf->bs_extsize = INT_GET(dic->di_extsize, ARCH_CONVERT) << mp->m_sb.sb_blocklog; 174 buf->bs_extsize = be32_to_cpu(dic->di_extsize) << mp->m_sb.sb_blocklog;
175 buf->bs_extents = INT_GET(dic->di_nextents, ARCH_CONVERT); 175 buf->bs_extents = be32_to_cpu(dic->di_nextents);
176 buf->bs_gen = INT_GET(dic->di_gen, ARCH_CONVERT); 176 buf->bs_gen = be32_to_cpu(dic->di_gen);
177 memset(buf->bs_pad, 0, sizeof(buf->bs_pad)); 177 memset(buf->bs_pad, 0, sizeof(buf->bs_pad));
178 buf->bs_dmevmask = INT_GET(dic->di_dmevmask, ARCH_CONVERT); 178 buf->bs_dmevmask = be32_to_cpu(dic->di_dmevmask);
179 buf->bs_dmstate = INT_GET(dic->di_dmstate, ARCH_CONVERT); 179 buf->bs_dmstate = be16_to_cpu(dic->di_dmstate);
180 buf->bs_aextents = INT_GET(dic->di_anextents, ARCH_CONVERT); 180 buf->bs_aextents = be16_to_cpu(dic->di_anextents);
181 181
182 switch (INT_GET(dic->di_format, ARCH_CONVERT)) { 182 switch (dic->di_format) {
183 case XFS_DINODE_FMT_DEV: 183 case XFS_DINODE_FMT_DEV:
184 buf->bs_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT); 184 buf->bs_rdev = be32_to_cpu(dip->di_u.di_dev);
185 buf->bs_blksize = BLKDEV_IOSIZE; 185 buf->bs_blksize = BLKDEV_IOSIZE;
186 buf->bs_blocks = 0; 186 buf->bs_blocks = 0;
187 break; 187 break;
@@ -195,7 +195,7 @@ xfs_bulkstat_one_dinode(
195 case XFS_DINODE_FMT_BTREE: 195 case XFS_DINODE_FMT_BTREE:
196 buf->bs_rdev = 0; 196 buf->bs_rdev = 0;
197 buf->bs_blksize = mp->m_sb.sb_blocksize; 197 buf->bs_blksize = mp->m_sb.sb_blocksize;
198 buf->bs_blocks = INT_GET(dic->di_nblocks, ARCH_CONVERT); 198 buf->bs_blocks = be64_to_cpu(dic->di_nblocks);
199 break; 199 break;
200 } 200 }
201 201
@@ -290,16 +290,23 @@ xfs_bulkstat_use_dinode(
290 return 1; 290 return 1;
291 dip = (xfs_dinode_t *) 291 dip = (xfs_dinode_t *)
292 xfs_buf_offset(bp, clustidx << mp->m_sb.sb_inodelog); 292 xfs_buf_offset(bp, clustidx << mp->m_sb.sb_inodelog);
293 if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC || 293 /*
294 !XFS_DINODE_GOOD_VERSION( 294 * Check the buffer containing the on-disk inode for di_nlink == 0.
295 INT_GET(dip->di_core.di_version, ARCH_CONVERT))) 295 * This is to prevent xfs_bulkstat from picking up just reclaimed
296 * inodes that have their in-core state initialized but not flushed
297 * to disk yet. This is a temporary hack that would require a proper
298 * fix in the future.
299 */
300 if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC ||
301 !XFS_DINODE_GOOD_VERSION(dip->di_core.di_version) ||
302 !dip->di_core.di_nlink)
296 return 0; 303 return 0;
297 if (flags & BULKSTAT_FG_QUICK) { 304 if (flags & BULKSTAT_FG_QUICK) {
298 *dipp = dip; 305 *dipp = dip;
299 return 1; 306 return 1;
300 } 307 }
301 /* BULKSTAT_FG_INLINE: if attr fork is local, or not there, use it */ 308 /* BULKSTAT_FG_INLINE: if attr fork is local, or not there, use it */
302 aformat = INT_GET(dip->di_core.di_aformat, ARCH_CONVERT); 309 aformat = dip->di_core.di_aformat;
303 if ((XFS_CFORK_Q(&dip->di_core) == 0) || 310 if ((XFS_CFORK_Q(&dip->di_core) == 0) ||
304 (aformat == XFS_DINODE_FMT_LOCAL) || 311 (aformat == XFS_DINODE_FMT_LOCAL) ||
305 (aformat == XFS_DINODE_FMT_EXTENTS && !dip->di_core.di_anextents)) { 312 (aformat == XFS_DINODE_FMT_EXTENTS && !dip->di_core.di_anextents)) {
@@ -612,21 +619,25 @@ xfs_bulkstat(
612 } 619 }
613 } 620 }
614 } 621 }
622 ino = XFS_AGINO_TO_INO(mp, agno, agino);
623 bno = XFS_AGB_TO_DADDR(mp, agno, agbno);
615 /* 624 /*
616 * Skip if this inode is free. 625 * Skip if this inode is free.
617 */ 626 */
618 if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free) 627 if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free) {
628 lastino = ino;
619 continue; 629 continue;
630 }
620 /* 631 /*
621 * Count used inodes as free so we can tell 632 * Count used inodes as free so we can tell
622 * when the chunk is used up. 633 * when the chunk is used up.
623 */ 634 */
624 irbp->ir_freecount++; 635 irbp->ir_freecount++;
625 ino = XFS_AGINO_TO_INO(mp, agno, agino);
626 bno = XFS_AGB_TO_DADDR(mp, agno, agbno);
627 if (!xfs_bulkstat_use_dinode(mp, flags, bp, 636 if (!xfs_bulkstat_use_dinode(mp, flags, bp,
628 clustidx, &dip)) 637 clustidx, &dip)) {
638 lastino = ino;
629 continue; 639 continue;
640 }
630 /* 641 /*
631 * If we need to do an iget, cannot hold bp. 642 * If we need to do an iget, cannot hold bp.
632 * Drop it, until starting the next cluster. 643 * Drop it, until starting the next cluster.
@@ -687,8 +698,7 @@ xfs_bulkstat(
687 if (end_of_ag) { 698 if (end_of_ag) {
688 agno++; 699 agno++;
689 agino = 0; 700 agino = 0;
690 } else 701 }
691 agino = XFS_INO_TO_AGINO(mp, lastino);
692 } else 702 } else
693 break; 703 break;
694 } 704 }
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 9bfb69e1e885..77c12715a7d0 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -252,6 +252,29 @@ xlog_grant_add_space(struct log *log, int bytes)
252 xlog_grant_add_space_reserve(log, bytes); 252 xlog_grant_add_space_reserve(log, bytes);
253} 253}
254 254
255static void
256xlog_tic_reset_res(xlog_ticket_t *tic)
257{
258 tic->t_res_num = 0;
259 tic->t_res_arr_sum = 0;
260 tic->t_res_num_ophdrs = 0;
261}
262
263static void
264xlog_tic_add_region(xlog_ticket_t *tic, uint len, uint type)
265{
266 if (tic->t_res_num == XLOG_TIC_LEN_MAX) {
267 /* add to overflow and start again */
268 tic->t_res_o_flow += tic->t_res_arr_sum;
269 tic->t_res_num = 0;
270 tic->t_res_arr_sum = 0;
271 }
272
273 tic->t_res_arr[tic->t_res_num].r_len = len;
274 tic->t_res_arr[tic->t_res_num].r_type = type;
275 tic->t_res_arr_sum += len;
276 tic->t_res_num++;
277}
255 278
256/* 279/*
257 * NOTES: 280 * NOTES:
@@ -486,7 +509,7 @@ xfs_log_mount(xfs_mount_t *mp,
486 cmn_err(CE_NOTE, 509 cmn_err(CE_NOTE,
487 "!Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent.", 510 "!Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent.",
488 mp->m_fsname); 511 mp->m_fsname);
489 ASSERT(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY); 512 ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
490 } 513 }
491 514
492 mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks); 515 mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks);
@@ -496,16 +519,15 @@ xfs_log_mount(xfs_mount_t *mp,
496 * just worked. 519 * just worked.
497 */ 520 */
498 if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { 521 if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) {
499 bhv_vfs_t *vfsp = XFS_MTOVFS(mp); 522 int error, readonly = (mp->m_flags & XFS_MOUNT_RDONLY);
500 int error, readonly = (vfsp->vfs_flag & VFS_RDONLY);
501 523
502 if (readonly) 524 if (readonly)
503 vfsp->vfs_flag &= ~VFS_RDONLY; 525 mp->m_flags &= ~XFS_MOUNT_RDONLY;
504 526
505 error = xlog_recover(mp->m_log); 527 error = xlog_recover(mp->m_log);
506 528
507 if (readonly) 529 if (readonly)
508 vfsp->vfs_flag |= VFS_RDONLY; 530 mp->m_flags |= XFS_MOUNT_RDONLY;
509 if (error) { 531 if (error) {
510 cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error); 532 cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
511 xlog_dealloc_log(mp->m_log); 533 xlog_dealloc_log(mp->m_log);
@@ -537,7 +559,7 @@ xfs_log_mount_finish(xfs_mount_t *mp, int mfsi_flags)
537 error = xlog_recover_finish(mp->m_log, mfsi_flags); 559 error = xlog_recover_finish(mp->m_log, mfsi_flags);
538 else { 560 else {
539 error = 0; 561 error = 0;
540 ASSERT(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY); 562 ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
541 } 563 }
542 564
543 return error; 565 return error;
@@ -597,7 +619,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
597 * Don't write out unmount record on read-only mounts. 619 * Don't write out unmount record on read-only mounts.
598 * Or, if we are doing a forced umount (typically because of IO errors). 620 * Or, if we are doing a forced umount (typically because of IO errors).
599 */ 621 */
600 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 622 if (mp->m_flags & XFS_MOUNT_RDONLY)
601 return 0; 623 return 0;
602 624
603 xfs_log_force(mp, 0, XFS_LOG_FORCE|XFS_LOG_SYNC); 625 xfs_log_force(mp, 0, XFS_LOG_FORCE|XFS_LOG_SYNC);
@@ -949,6 +971,19 @@ xlog_iodone(xfs_buf_t *bp)
949 l = iclog->ic_log; 971 l = iclog->ic_log;
950 972
951 /* 973 /*
974 * If the ordered flag has been removed by a lower
975 * layer, it means the underlyin device no longer supports
976 * barrier I/O. Warn loudly and turn off barriers.
977 */
978 if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) {
979 l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
980 xfs_fs_cmn_err(CE_WARN, l->l_mp,
981 "xlog_iodone: Barriers are no longer supported"
982 " by device. Disabling barriers\n");
983 xfs_buftrace("XLOG_IODONE BARRIERS OFF", bp);
984 }
985
986 /*
952 * Race to shutdown the filesystem if we see an error. 987 * Race to shutdown the filesystem if we see an error.
953 */ 988 */
954 if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp, 989 if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp,
@@ -1012,10 +1047,7 @@ xlog_bdstrat_cb(struct xfs_buf *bp)
1012/* 1047/*
1013 * Return size of each in-core log record buffer. 1048 * Return size of each in-core log record buffer.
1014 * 1049 *
1015 * Low memory machines only get 2 16KB buffers. We don't want to waste 1050 * All machines get 8 x 32KB buffers by default, unless tuned otherwise.
1016 * memory here. However, all other machines get at least 2 32KB buffers.
1017 * The number is hard coded because we don't care about the minimum
1018 * memory size, just 32MB systems.
1019 * 1051 *
1020 * If the filesystem blocksize is too large, we may need to choose a 1052 * If the filesystem blocksize is too large, we may need to choose a
1021 * larger size since the directory code currently logs entire blocks. 1053 * larger size since the directory code currently logs entire blocks.
@@ -1028,17 +1060,10 @@ xlog_get_iclog_buffer_size(xfs_mount_t *mp,
1028 int size; 1060 int size;
1029 int xhdrs; 1061 int xhdrs;
1030 1062
1031 if (mp->m_logbufs <= 0) { 1063 if (mp->m_logbufs <= 0)
1032 if (xfs_physmem <= btoc(128*1024*1024)) { 1064 log->l_iclog_bufs = XLOG_MAX_ICLOGS;
1033 log->l_iclog_bufs = XLOG_MIN_ICLOGS; 1065 else
1034 } else if (xfs_physmem <= btoc(400*1024*1024)) {
1035 log->l_iclog_bufs = XLOG_MED_ICLOGS;
1036 } else { /* 256K with 32K bufs */
1037 log->l_iclog_bufs = XLOG_MAX_ICLOGS;
1038 }
1039 } else {
1040 log->l_iclog_bufs = mp->m_logbufs; 1066 log->l_iclog_bufs = mp->m_logbufs;
1041 }
1042 1067
1043 /* 1068 /*
1044 * Buffer size passed in from mount system call. 1069 * Buffer size passed in from mount system call.
@@ -1069,18 +1094,9 @@ xlog_get_iclog_buffer_size(xfs_mount_t *mp,
1069 goto done; 1094 goto done;
1070 } 1095 }
1071 1096
1072 /* 1097 /* All machines use 32KB buffers by default. */
1073 * Special case machines that have less than 32MB of memory. 1098 log->l_iclog_size = XLOG_BIG_RECORD_BSIZE;
1074 * All machines with more memory use 32KB buffers. 1099 log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT;
1075 */
1076 if (xfs_physmem <= btoc(32*1024*1024)) {
1077 /* Don't change; min configuration */
1078 log->l_iclog_size = XLOG_RECORD_BSIZE; /* 16k */
1079 log->l_iclog_size_log = XLOG_RECORD_BSHIFT;
1080 } else {
1081 log->l_iclog_size = XLOG_BIG_RECORD_BSIZE; /* 32k */
1082 log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT;
1083 }
1084 1100
1085 /* the default log size is 16k or 32k which is one header sector */ 1101 /* the default log size is 16k or 32k which is one header sector */
1086 log->l_iclog_hsize = BBSIZE; 1102 log->l_iclog_hsize = BBSIZE;
@@ -1771,14 +1787,14 @@ xlog_write(xfs_mount_t * mp,
1771 len = 0; 1787 len = 0;
1772 if (ticket->t_flags & XLOG_TIC_INITED) { /* acct for start rec of xact */ 1788 if (ticket->t_flags & XLOG_TIC_INITED) { /* acct for start rec of xact */
1773 len += sizeof(xlog_op_header_t); 1789 len += sizeof(xlog_op_header_t);
1774 XLOG_TIC_ADD_OPHDR(ticket); 1790 ticket->t_res_num_ophdrs++;
1775 } 1791 }
1776 1792
1777 for (index = 0; index < nentries; index++) { 1793 for (index = 0; index < nentries; index++) {
1778 len += sizeof(xlog_op_header_t); /* each region gets >= 1 */ 1794 len += sizeof(xlog_op_header_t); /* each region gets >= 1 */
1779 XLOG_TIC_ADD_OPHDR(ticket); 1795 ticket->t_res_num_ophdrs++;
1780 len += reg[index].i_len; 1796 len += reg[index].i_len;
1781 XLOG_TIC_ADD_REGION(ticket, reg[index].i_len, reg[index].i_type); 1797 xlog_tic_add_region(ticket, reg[index].i_len, reg[index].i_type);
1782 } 1798 }
1783 contwr = *start_lsn = 0; 1799 contwr = *start_lsn = 0;
1784 1800
@@ -1887,7 +1903,7 @@ xlog_write(xfs_mount_t * mp,
1887 len += sizeof(xlog_op_header_t); /* from splitting of region */ 1903 len += sizeof(xlog_op_header_t); /* from splitting of region */
1888 /* account for new log op header */ 1904 /* account for new log op header */
1889 ticket->t_curr_res -= sizeof(xlog_op_header_t); 1905 ticket->t_curr_res -= sizeof(xlog_op_header_t);
1890 XLOG_TIC_ADD_OPHDR(ticket); 1906 ticket->t_res_num_ophdrs++;
1891 } 1907 }
1892 xlog_verify_dest_ptr(log, ptr); 1908 xlog_verify_dest_ptr(log, ptr);
1893 1909
@@ -2385,7 +2401,7 @@ restart:
2385 */ 2401 */
2386 if (log_offset == 0) { 2402 if (log_offset == 0) {
2387 ticket->t_curr_res -= log->l_iclog_hsize; 2403 ticket->t_curr_res -= log->l_iclog_hsize;
2388 XLOG_TIC_ADD_REGION(ticket, 2404 xlog_tic_add_region(ticket,
2389 log->l_iclog_hsize, 2405 log->l_iclog_hsize,
2390 XLOG_REG_TYPE_LRHEADER); 2406 XLOG_REG_TYPE_LRHEADER);
2391 INT_SET(head->h_cycle, ARCH_CONVERT, log->l_curr_cycle); 2407 INT_SET(head->h_cycle, ARCH_CONVERT, log->l_curr_cycle);
@@ -2573,7 +2589,7 @@ xlog_regrant_write_log_space(xlog_t *log,
2573#endif 2589#endif
2574 2590
2575 tic->t_curr_res = tic->t_unit_res; 2591 tic->t_curr_res = tic->t_unit_res;
2576 XLOG_TIC_RESET_RES(tic); 2592 xlog_tic_reset_res(tic);
2577 2593
2578 if (tic->t_cnt > 0) 2594 if (tic->t_cnt > 0)
2579 return 0; 2595 return 0;
@@ -2714,7 +2730,7 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2714 s = GRANT_LOCK(log); 2730 s = GRANT_LOCK(log);
2715 xlog_grant_sub_space(log, ticket->t_curr_res); 2731 xlog_grant_sub_space(log, ticket->t_curr_res);
2716 ticket->t_curr_res = ticket->t_unit_res; 2732 ticket->t_curr_res = ticket->t_unit_res;
2717 XLOG_TIC_RESET_RES(ticket); 2733 xlog_tic_reset_res(ticket);
2718 xlog_trace_loggrant(log, ticket, 2734 xlog_trace_loggrant(log, ticket,
2719 "xlog_regrant_reserve_log_space: sub current res"); 2735 "xlog_regrant_reserve_log_space: sub current res");
2720 xlog_verify_grant_head(log, 1); 2736 xlog_verify_grant_head(log, 1);
@@ -2731,7 +2747,7 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2731 xlog_verify_grant_head(log, 0); 2747 xlog_verify_grant_head(log, 0);
2732 GRANT_UNLOCK(log, s); 2748 GRANT_UNLOCK(log, s);
2733 ticket->t_curr_res = ticket->t_unit_res; 2749 ticket->t_curr_res = ticket->t_unit_res;
2734 XLOG_TIC_RESET_RES(ticket); 2750 xlog_tic_reset_res(ticket);
2735} /* xlog_regrant_reserve_log_space */ 2751} /* xlog_regrant_reserve_log_space */
2736 2752
2737 2753
@@ -3354,7 +3370,7 @@ xlog_ticket_get(xlog_t *log,
3354 tic->t_flags |= XLOG_TIC_PERM_RESERV; 3370 tic->t_flags |= XLOG_TIC_PERM_RESERV;
3355 sv_init(&(tic->t_sema), SV_DEFAULT, "logtick"); 3371 sv_init(&(tic->t_sema), SV_DEFAULT, "logtick");
3356 3372
3357 XLOG_TIC_RESET_RES(tic); 3373 xlog_tic_reset_res(tic);
3358 3374
3359 return tic; 3375 return tic;
3360} /* xlog_ticket_get */ 3376} /* xlog_ticket_get */
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 9bd3cdf11a87..752f964b3699 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -30,17 +30,16 @@ struct xfs_mount;
30 */ 30 */
31 31
32#define XLOG_MIN_ICLOGS 2 32#define XLOG_MIN_ICLOGS 2
33#define XLOG_MED_ICLOGS 4
34#define XLOG_MAX_ICLOGS 8 33#define XLOG_MAX_ICLOGS 8
35#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */ 34#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */
36#define XLOG_VERSION_1 1 35#define XLOG_VERSION_1 1
37#define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */ 36#define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */
38#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2) 37#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2)
39#define XLOG_RECORD_BSIZE (16*1024) /* eventually 32k */ 38#define XLOG_MIN_RECORD_BSIZE (16*1024) /* eventually 32k */
40#define XLOG_BIG_RECORD_BSIZE (32*1024) /* 32k buffers */ 39#define XLOG_BIG_RECORD_BSIZE (32*1024) /* 32k buffers */
41#define XLOG_MAX_RECORD_BSIZE (256*1024) 40#define XLOG_MAX_RECORD_BSIZE (256*1024)
42#define XLOG_HEADER_CYCLE_SIZE (32*1024) /* cycle data in header */ 41#define XLOG_HEADER_CYCLE_SIZE (32*1024) /* cycle data in header */
43#define XLOG_RECORD_BSHIFT 14 /* 16384 == 1 << 14 */ 42#define XLOG_MIN_RECORD_BSHIFT 14 /* 16384 == 1 << 14 */
44#define XLOG_BIG_RECORD_BSHIFT 15 /* 32k == 1 << 15 */ 43#define XLOG_BIG_RECORD_BSHIFT 15 /* 32k == 1 << 15 */
45#define XLOG_MAX_RECORD_BSHIFT 18 /* 256k == 1 << 18 */ 44#define XLOG_MAX_RECORD_BSHIFT 18 /* 256k == 1 << 18 */
46#define XLOG_BTOLSUNIT(log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \ 45#define XLOG_BTOLSUNIT(log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \
@@ -250,22 +249,6 @@ typedef __uint32_t xlog_tid_t;
250 249
251/* Ticket reservation region accounting */ 250/* Ticket reservation region accounting */
252#define XLOG_TIC_LEN_MAX 15 251#define XLOG_TIC_LEN_MAX 15
253#define XLOG_TIC_RESET_RES(t) ((t)->t_res_num = \
254 (t)->t_res_arr_sum = (t)->t_res_num_ophdrs = 0)
255#define XLOG_TIC_ADD_OPHDR(t) ((t)->t_res_num_ophdrs++)
256#define XLOG_TIC_ADD_REGION(t, len, type) \
257 do { \
258 if ((t)->t_res_num == XLOG_TIC_LEN_MAX) { \
259 /* add to overflow and start again */ \
260 (t)->t_res_o_flow += (t)->t_res_arr_sum; \
261 (t)->t_res_num = 0; \
262 (t)->t_res_arr_sum = 0; \
263 } \
264 (t)->t_res_arr[(t)->t_res_num].r_len = (len); \
265 (t)->t_res_arr[(t)->t_res_num].r_type = (type); \
266 (t)->t_res_arr_sum += (len); \
267 (t)->t_res_num++; \
268 } while (0)
269 252
270/* 253/*
271 * Reservation region 254 * Reservation region
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 8ae6e8e5f3db..851eca8a7150 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2245,7 +2245,7 @@ xlog_recover_do_inode_trans(
2245 int error; 2245 int error;
2246 int attr_index; 2246 int attr_index;
2247 uint fields; 2247 uint fields;
2248 xfs_dinode_core_t *dicp; 2248 xfs_icdinode_t *dicp;
2249 int need_free = 0; 2249 int need_free = 0;
2250 2250
2251 if (pass == XLOG_RECOVER_PASS1) { 2251 if (pass == XLOG_RECOVER_PASS1) {
@@ -2309,7 +2309,7 @@ xlog_recover_do_inode_trans(
2309 * Make sure the place we're flushing out to really looks 2309 * Make sure the place we're flushing out to really looks
2310 * like an inode! 2310 * like an inode!
2311 */ 2311 */
2312 if (unlikely(INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC)) { 2312 if (unlikely(be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC)) {
2313 xfs_buf_relse(bp); 2313 xfs_buf_relse(bp);
2314 xfs_fs_cmn_err(CE_ALERT, mp, 2314 xfs_fs_cmn_err(CE_ALERT, mp,
2315 "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld", 2315 "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld",
@@ -2319,7 +2319,7 @@ xlog_recover_do_inode_trans(
2319 error = EFSCORRUPTED; 2319 error = EFSCORRUPTED;
2320 goto error; 2320 goto error;
2321 } 2321 }
2322 dicp = (xfs_dinode_core_t*)(item->ri_buf[1].i_addr); 2322 dicp = (xfs_icdinode_t *)(item->ri_buf[1].i_addr);
2323 if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { 2323 if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) {
2324 xfs_buf_relse(bp); 2324 xfs_buf_relse(bp);
2325 xfs_fs_cmn_err(CE_ALERT, mp, 2325 xfs_fs_cmn_err(CE_ALERT, mp,
@@ -2332,15 +2332,13 @@ xlog_recover_do_inode_trans(
2332 } 2332 }
2333 2333
2334 /* Skip replay when the on disk inode is newer than the log one */ 2334 /* Skip replay when the on disk inode is newer than the log one */
2335 if (dicp->di_flushiter < 2335 if (dicp->di_flushiter < be16_to_cpu(dip->di_core.di_flushiter)) {
2336 INT_GET(dip->di_core.di_flushiter, ARCH_CONVERT)) {
2337 /* 2336 /*
2338 * Deal with the wrap case, DI_MAX_FLUSH is less 2337 * Deal with the wrap case, DI_MAX_FLUSH is less
2339 * than smaller numbers 2338 * than smaller numbers
2340 */ 2339 */
2341 if ((INT_GET(dip->di_core.di_flushiter, ARCH_CONVERT) 2340 if (be16_to_cpu(dip->di_core.di_flushiter) == DI_MAX_FLUSH &&
2342 == DI_MAX_FLUSH) && 2341 dicp->di_flushiter < (DI_MAX_FLUSH >> 1)) {
2343 (dicp->di_flushiter < (DI_MAX_FLUSH>>1))) {
2344 /* do nothing */ 2342 /* do nothing */
2345 } else { 2343 } else {
2346 xfs_buf_relse(bp); 2344 xfs_buf_relse(bp);
@@ -2411,8 +2409,8 @@ xlog_recover_do_inode_trans(
2411 } 2409 }
2412 2410
2413 /* The core is in in-core format */ 2411 /* The core is in in-core format */
2414 xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, 2412 xfs_dinode_to_disk(&dip->di_core,
2415 (xfs_dinode_core_t*)item->ri_buf[1].i_addr, -1); 2413 (xfs_icdinode_t *)item->ri_buf[1].i_addr);
2416 2414
2417 /* the rest is in on-disk format */ 2415 /* the rest is in on-disk format */
2418 if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) { 2416 if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) {
@@ -2424,8 +2422,7 @@ xlog_recover_do_inode_trans(
2424 fields = in_f->ilf_fields; 2422 fields = in_f->ilf_fields;
2425 switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) { 2423 switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) {
2426 case XFS_ILOG_DEV: 2424 case XFS_ILOG_DEV:
2427 INT_SET(dip->di_u.di_dev, ARCH_CONVERT, in_f->ilf_u.ilfu_rdev); 2425 dip->di_u.di_dev = cpu_to_be32(in_f->ilf_u.ilfu_rdev);
2428
2429 break; 2426 break;
2430 case XFS_ILOG_UUID: 2427 case XFS_ILOG_UUID:
2431 dip->di_u.di_muuid = in_f->ilf_u.ilfu_uuid; 2428 dip->di_u.di_muuid = in_f->ilf_u.ilfu_uuid;
@@ -3234,8 +3231,8 @@ xlog_recover_process_iunlinks(
3234 ASSERT(ip->i_d.di_nlink == 0); 3231 ASSERT(ip->i_d.di_nlink == 0);
3235 3232
3236 /* setup for the next pass */ 3233 /* setup for the next pass */
3237 agino = INT_GET(dip->di_next_unlinked, 3234 agino = be32_to_cpu(
3238 ARCH_CONVERT); 3235 dip->di_next_unlinked);
3239 xfs_buf_relse(ibp); 3236 xfs_buf_relse(ibp);
3240 /* 3237 /*
3241 * Prevent any DMAPI event from 3238 * Prevent any DMAPI event from
@@ -3837,7 +3834,10 @@ xlog_do_recover(
3837 */ 3834 */
3838 bp = xfs_getsb(log->l_mp, 0); 3835 bp = xfs_getsb(log->l_mp, 0);
3839 XFS_BUF_UNDONE(bp); 3836 XFS_BUF_UNDONE(bp);
3837 ASSERT(!(XFS_BUF_ISWRITE(bp)));
3838 ASSERT(!(XFS_BUF_ISDELAYWRITE(bp)));
3840 XFS_BUF_READ(bp); 3839 XFS_BUF_READ(bp);
3840 XFS_BUF_UNASYNC(bp);
3841 xfsbdstrat(log->l_mp, bp); 3841 xfsbdstrat(log->l_mp, bp);
3842 if ((error = xfs_iowait(bp))) { 3842 if ((error = xfs_iowait(bp))) {
3843 xfs_ioerror_alert("xlog_do_recover", 3843 xfs_ioerror_alert("xlog_do_recover",
@@ -3849,7 +3849,7 @@ xlog_do_recover(
3849 3849
3850 /* Convert superblock from on-disk format */ 3850 /* Convert superblock from on-disk format */
3851 sbp = &log->l_mp->m_sb; 3851 sbp = &log->l_mp->m_sb;
3852 xfs_xlatesb(XFS_BUF_TO_SBP(bp), sbp, 1, XFS_SB_ALL_BITS); 3852 xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(bp));
3853 ASSERT(sbp->sb_magicnum == XFS_SB_MAGIC); 3853 ASSERT(sbp->sb_magicnum == XFS_SB_MAGIC);
3854 ASSERT(XFS_SB_GOOD_VERSION(sbp)); 3854 ASSERT(XFS_SB_GOOD_VERSION(sbp));
3855 xfs_buf_relse(bp); 3855 xfs_buf_relse(bp);
@@ -4027,7 +4027,7 @@ xlog_recover_check_summary(
4027 sbbp = xfs_getsb(mp, 0); 4027 sbbp = xfs_getsb(mp, 0);
4028#ifdef XFS_LOUD_RECOVERY 4028#ifdef XFS_LOUD_RECOVERY
4029 sbp = &mp->m_sb; 4029 sbp = &mp->m_sb;
4030 xfs_xlatesb(XFS_BUF_TO_SBP(sbbp), sbp, 1, XFS_SB_ALL_BITS); 4030 xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(sbbp));
4031 cmn_err(CE_NOTE, 4031 cmn_err(CE_NOTE,
4032 "xlog_recover_check_summary: sb_icount %Lu itotal %Lu", 4032 "xlog_recover_check_summary: sb_icount %Lu itotal %Lu",
4033 sbp->sb_icount, itotal); 4033 sbp->sb_icount, itotal);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index a66b39805176..ebdb76da527c 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -139,7 +139,7 @@ xfs_mount_init(void)
139 AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail"); 139 AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail");
140 spinlock_init(&mp->m_sb_lock, "xfs_sb"); 140 spinlock_init(&mp->m_sb_lock, "xfs_sb");
141 mutex_init(&mp->m_ilock); 141 mutex_init(&mp->m_ilock);
142 initnsema(&mp->m_growlock, 1, "xfs_grow"); 142 mutex_init(&mp->m_growlock);
143 /* 143 /*
144 * Initialize the AIL. 144 * Initialize the AIL.
145 */ 145 */
@@ -157,14 +157,8 @@ xfs_mount_init(void)
157 */ 157 */
158void 158void
159xfs_mount_free( 159xfs_mount_free(
160 xfs_mount_t *mp, 160 xfs_mount_t *mp)
161 int remove_bhv)
162{ 161{
163 if (mp->m_ihash)
164 xfs_ihash_free(mp);
165 if (mp->m_chash)
166 xfs_chash_free(mp);
167
168 if (mp->m_perag) { 162 if (mp->m_perag) {
169 int agno; 163 int agno;
170 164
@@ -180,7 +174,7 @@ xfs_mount_free(
180 AIL_LOCK_DESTROY(&mp->m_ail_lock); 174 AIL_LOCK_DESTROY(&mp->m_ail_lock);
181 spinlock_destroy(&mp->m_sb_lock); 175 spinlock_destroy(&mp->m_sb_lock);
182 mutex_destroy(&mp->m_ilock); 176 mutex_destroy(&mp->m_ilock);
183 freesema(&mp->m_growlock); 177 mutex_destroy(&mp->m_growlock);
184 if (mp->m_quotainfo) 178 if (mp->m_quotainfo)
185 XFS_QM_DONE(mp); 179 XFS_QM_DONE(mp);
186 180
@@ -191,15 +185,7 @@ xfs_mount_free(
191 if (mp->m_logname != NULL) 185 if (mp->m_logname != NULL)
192 kmem_free(mp->m_logname, strlen(mp->m_logname) + 1); 186 kmem_free(mp->m_logname, strlen(mp->m_logname) + 1);
193 187
194 if (remove_bhv) {
195 struct bhv_vfs *vfsp = XFS_MTOVFS(mp);
196
197 bhv_remove_all_vfsops(vfsp, 0);
198 VFS_REMOVEBHV(vfsp, &mp->m_bhv);
199 }
200
201 xfs_icsb_destroy_counters(mp); 188 xfs_icsb_destroy_counters(mp);
202 kmem_free(mp, sizeof(xfs_mount_t));
203} 189}
204 190
205/* 191/*
@@ -342,9 +328,19 @@ xfs_mount_validate_sb(
342 return 0; 328 return 0;
343} 329}
344 330
331STATIC void
332xfs_initialize_perag_icache(
333 xfs_perag_t *pag)
334{
335 if (!pag->pag_ici_init) {
336 rwlock_init(&pag->pag_ici_lock);
337 INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
338 pag->pag_ici_init = 1;
339 }
340}
341
345xfs_agnumber_t 342xfs_agnumber_t
346xfs_initialize_perag( 343xfs_initialize_perag(
347 bhv_vfs_t *vfs,
348 xfs_mount_t *mp, 344 xfs_mount_t *mp,
349 xfs_agnumber_t agcount) 345 xfs_agnumber_t agcount)
350{ 346{
@@ -362,7 +358,7 @@ xfs_initialize_perag(
362 /* Clear the mount flag if no inode can overflow 32 bits 358 /* Clear the mount flag if no inode can overflow 32 bits
363 * on this filesystem, or if specifically requested.. 359 * on this filesystem, or if specifically requested..
364 */ 360 */
365 if ((vfs->vfs_flag & VFS_32BITINODES) && ino > max_inum) { 361 if ((mp->m_flags & XFS_MOUNT_SMALL_INUMS) && ino > max_inum) {
366 mp->m_flags |= XFS_MOUNT_32BITINODES; 362 mp->m_flags |= XFS_MOUNT_32BITINODES;
367 } else { 363 } else {
368 mp->m_flags &= ~XFS_MOUNT_32BITINODES; 364 mp->m_flags &= ~XFS_MOUNT_32BITINODES;
@@ -396,48 +392,92 @@ xfs_initialize_perag(
396 pag->pagi_inodeok = 1; 392 pag->pagi_inodeok = 1;
397 if (index < max_metadata) 393 if (index < max_metadata)
398 pag->pagf_metadata = 1; 394 pag->pagf_metadata = 1;
395 xfs_initialize_perag_icache(pag);
399 } 396 }
400 } else { 397 } else {
401 /* Setup default behavior for smaller filesystems */ 398 /* Setup default behavior for smaller filesystems */
402 for (index = 0; index < agcount; index++) { 399 for (index = 0; index < agcount; index++) {
403 pag = &mp->m_perag[index]; 400 pag = &mp->m_perag[index];
404 pag->pagi_inodeok = 1; 401 pag->pagi_inodeok = 1;
402 xfs_initialize_perag_icache(pag);
405 } 403 }
406 } 404 }
407 return index; 405 return index;
408} 406}
409 407
408void
409xfs_sb_from_disk(
410 xfs_sb_t *to,
411 xfs_dsb_t *from)
412{
413 to->sb_magicnum = be32_to_cpu(from->sb_magicnum);
414 to->sb_blocksize = be32_to_cpu(from->sb_blocksize);
415 to->sb_dblocks = be64_to_cpu(from->sb_dblocks);
416 to->sb_rblocks = be64_to_cpu(from->sb_rblocks);
417 to->sb_rextents = be64_to_cpu(from->sb_rextents);
418 memcpy(&to->sb_uuid, &from->sb_uuid, sizeof(to->sb_uuid));
419 to->sb_logstart = be64_to_cpu(from->sb_logstart);
420 to->sb_rootino = be64_to_cpu(from->sb_rootino);
421 to->sb_rbmino = be64_to_cpu(from->sb_rbmino);
422 to->sb_rsumino = be64_to_cpu(from->sb_rsumino);
423 to->sb_rextsize = be32_to_cpu(from->sb_rextsize);
424 to->sb_agblocks = be32_to_cpu(from->sb_agblocks);
425 to->sb_agcount = be32_to_cpu(from->sb_agcount);
426 to->sb_rbmblocks = be32_to_cpu(from->sb_rbmblocks);
427 to->sb_logblocks = be32_to_cpu(from->sb_logblocks);
428 to->sb_versionnum = be16_to_cpu(from->sb_versionnum);
429 to->sb_sectsize = be16_to_cpu(from->sb_sectsize);
430 to->sb_inodesize = be16_to_cpu(from->sb_inodesize);
431 to->sb_inopblock = be16_to_cpu(from->sb_inopblock);
432 memcpy(&to->sb_fname, &from->sb_fname, sizeof(to->sb_fname));
433 to->sb_blocklog = from->sb_blocklog;
434 to->sb_sectlog = from->sb_sectlog;
435 to->sb_inodelog = from->sb_inodelog;
436 to->sb_inopblog = from->sb_inopblog;
437 to->sb_agblklog = from->sb_agblklog;
438 to->sb_rextslog = from->sb_rextslog;
439 to->sb_inprogress = from->sb_inprogress;
440 to->sb_imax_pct = from->sb_imax_pct;
441 to->sb_icount = be64_to_cpu(from->sb_icount);
442 to->sb_ifree = be64_to_cpu(from->sb_ifree);
443 to->sb_fdblocks = be64_to_cpu(from->sb_fdblocks);
444 to->sb_frextents = be64_to_cpu(from->sb_frextents);
445 to->sb_uquotino = be64_to_cpu(from->sb_uquotino);
446 to->sb_gquotino = be64_to_cpu(from->sb_gquotino);
447 to->sb_qflags = be16_to_cpu(from->sb_qflags);
448 to->sb_flags = from->sb_flags;
449 to->sb_shared_vn = from->sb_shared_vn;
450 to->sb_inoalignmt = be32_to_cpu(from->sb_inoalignmt);
451 to->sb_unit = be32_to_cpu(from->sb_unit);
452 to->sb_width = be32_to_cpu(from->sb_width);
453 to->sb_dirblklog = from->sb_dirblklog;
454 to->sb_logsectlog = from->sb_logsectlog;
455 to->sb_logsectsize = be16_to_cpu(from->sb_logsectsize);
456 to->sb_logsunit = be32_to_cpu(from->sb_logsunit);
457 to->sb_features2 = be32_to_cpu(from->sb_features2);
458}
459
410/* 460/*
411 * xfs_xlatesb 461 * Copy in core superblock to ondisk one.
412 * 462 *
413 * data - on disk version of sb 463 * The fields argument is mask of superblock fields to copy.
414 * sb - a superblock
415 * dir - conversion direction: <0 - convert sb to buf
416 * >0 - convert buf to sb
417 * fields - which fields to copy (bitmask)
418 */ 464 */
419void 465void
420xfs_xlatesb( 466xfs_sb_to_disk(
421 void *data, 467 xfs_dsb_t *to,
422 xfs_sb_t *sb, 468 xfs_sb_t *from,
423 int dir,
424 __int64_t fields) 469 __int64_t fields)
425{ 470{
426 xfs_caddr_t buf_ptr; 471 xfs_caddr_t to_ptr = (xfs_caddr_t)to;
427 xfs_caddr_t mem_ptr; 472 xfs_caddr_t from_ptr = (xfs_caddr_t)from;
428 xfs_sb_field_t f; 473 xfs_sb_field_t f;
429 int first; 474 int first;
430 int size; 475 int size;
431 476
432 ASSERT(dir);
433 ASSERT(fields); 477 ASSERT(fields);
434
435 if (!fields) 478 if (!fields)
436 return; 479 return;
437 480
438 buf_ptr = (xfs_caddr_t)data;
439 mem_ptr = (xfs_caddr_t)sb;
440
441 while (fields) { 481 while (fields) {
442 f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); 482 f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
443 first = xfs_sb_info[f].offset; 483 first = xfs_sb_info[f].offset;
@@ -446,26 +486,20 @@ xfs_xlatesb(
446 ASSERT(xfs_sb_info[f].type == 0 || xfs_sb_info[f].type == 1); 486 ASSERT(xfs_sb_info[f].type == 0 || xfs_sb_info[f].type == 1);
447 487
448 if (size == 1 || xfs_sb_info[f].type == 1) { 488 if (size == 1 || xfs_sb_info[f].type == 1) {
449 if (dir > 0) { 489 memcpy(to_ptr + first, from_ptr + first, size);
450 memcpy(mem_ptr + first, buf_ptr + first, size);
451 } else {
452 memcpy(buf_ptr + first, mem_ptr + first, size);
453 }
454 } else { 490 } else {
455 switch (size) { 491 switch (size) {
456 case 2: 492 case 2:
457 INT_XLATE(*(__uint16_t*)(buf_ptr+first), 493 *(__be16 *)(to_ptr + first) =
458 *(__uint16_t*)(mem_ptr+first), 494 cpu_to_be16(*(__u16 *)(from_ptr + first));
459 dir, ARCH_CONVERT);
460 break; 495 break;
461 case 4: 496 case 4:
462 INT_XLATE(*(__uint32_t*)(buf_ptr+first), 497 *(__be32 *)(to_ptr + first) =
463 *(__uint32_t*)(mem_ptr+first), 498 cpu_to_be32(*(__u32 *)(from_ptr + first));
464 dir, ARCH_CONVERT);
465 break; 499 break;
466 case 8: 500 case 8:
467 INT_XLATE(*(__uint64_t*)(buf_ptr+first), 501 *(__be64 *)(to_ptr + first) =
468 *(__uint64_t*)(mem_ptr+first), dir, ARCH_CONVERT); 502 cpu_to_be64(*(__u64 *)(from_ptr + first));
469 break; 503 break;
470 default: 504 default:
471 ASSERT(0); 505 ASSERT(0);
@@ -487,7 +521,6 @@ xfs_readsb(xfs_mount_t *mp, int flags)
487 unsigned int sector_size; 521 unsigned int sector_size;
488 unsigned int extra_flags; 522 unsigned int extra_flags;
489 xfs_buf_t *bp; 523 xfs_buf_t *bp;
490 xfs_sb_t *sbp;
491 int error; 524 int error;
492 525
493 ASSERT(mp->m_sb_bp == NULL); 526 ASSERT(mp->m_sb_bp == NULL);
@@ -515,8 +548,7 @@ xfs_readsb(xfs_mount_t *mp, int flags)
515 * Initialize the mount structure from the superblock. 548 * Initialize the mount structure from the superblock.
516 * But first do some basic consistency checking. 549 * But first do some basic consistency checking.
517 */ 550 */
518 sbp = XFS_BUF_TO_SBP(bp); 551 xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp));
519 xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1, XFS_SB_ALL_BITS);
520 552
521 error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags); 553 error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags);
522 if (error) { 554 if (error) {
@@ -715,7 +747,6 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount)
715 */ 747 */
716int 748int
717xfs_mountfs( 749xfs_mountfs(
718 bhv_vfs_t *vfsp,
719 xfs_mount_t *mp, 750 xfs_mount_t *mp,
720 int mfsi_flags) 751 int mfsi_flags)
721{ 752{
@@ -842,14 +873,11 @@ xfs_mountfs(
842 */ 873 */
843 if ((mfsi_flags & XFS_MFSI_SECOND) == 0 && 874 if ((mfsi_flags & XFS_MFSI_SECOND) == 0 &&
844 (mp->m_flags & XFS_MOUNT_NOUUID) == 0) { 875 (mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
845 __uint64_t ret64;
846 if (xfs_uuid_mount(mp)) { 876 if (xfs_uuid_mount(mp)) {
847 error = XFS_ERROR(EINVAL); 877 error = XFS_ERROR(EINVAL);
848 goto error1; 878 goto error1;
849 } 879 }
850 uuid_mounted=1; 880 uuid_mounted=1;
851 ret64 = uuid_hash64(&sbp->sb_uuid);
852 memcpy(&vfsp->vfs_fsid, &ret64, sizeof(ret64));
853 } 881 }
854 882
855 /* 883 /*
@@ -871,16 +899,6 @@ xfs_mountfs(
871 writeio_log = mp->m_writeio_log; 899 writeio_log = mp->m_writeio_log;
872 } 900 }
873 901
874 /*
875 * Set the number of readahead buffers to use based on
876 * physical memory size.
877 */
878 if (xfs_physmem <= 4096) /* <= 16MB */
879 mp->m_nreadaheads = XFS_RW_NREADAHEAD_16MB;
880 else if (xfs_physmem <= 8192) /* <= 32MB */
881 mp->m_nreadaheads = XFS_RW_NREADAHEAD_32MB;
882 else
883 mp->m_nreadaheads = XFS_RW_NREADAHEAD_K32;
884 if (sbp->sb_blocklog > readio_log) { 902 if (sbp->sb_blocklog > readio_log) {
885 mp->m_readio_log = sbp->sb_blocklog; 903 mp->m_readio_log = sbp->sb_blocklog;
886 } else { 904 } else {
@@ -895,15 +913,12 @@ xfs_mountfs(
895 mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog); 913 mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
896 914
897 /* 915 /*
898 * Set the inode cluster size based on the physical memory 916 * Set the inode cluster size.
899 * size. This may still be overridden by the file system 917 * This may still be overridden by the file system
900 * block size if it is larger than the chosen cluster size. 918 * block size if it is larger than the chosen cluster size.
901 */ 919 */
902 if (xfs_physmem <= btoc(32 * 1024 * 1024)) { /* <= 32 MB */ 920 mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
903 mp->m_inode_cluster_size = XFS_INODE_SMALL_CLUSTER_SIZE; 921
904 } else {
905 mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
906 }
907 /* 922 /*
908 * Set whether we're using inode alignment. 923 * Set whether we're using inode alignment.
909 */ 924 */
@@ -987,16 +1002,6 @@ xfs_mountfs(
987 */ 1002 */
988 uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid); 1003 uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
989 1004
990 /*
991 * The vfs structure needs to have a file system independent
992 * way of checking for the invariant file system ID. Since it
993 * can't look at mount structures it has a pointer to the data
994 * in the mount structure.
995 *
996 * File systems that don't support user level file handles (i.e.
997 * all of them except for XFS) will leave vfs_altfsid as NULL.
998 */
999 vfsp->vfs_altfsid = (xfs_fsid_t *)mp->m_fixedfsid;
1000 mp->m_dmevmask = 0; /* not persistent; set after each mount */ 1005 mp->m_dmevmask = 0; /* not persistent; set after each mount */
1001 1006
1002 xfs_dir_mount(mp); 1007 xfs_dir_mount(mp);
@@ -1012,20 +1017,13 @@ xfs_mountfs(
1012 xfs_trans_init(mp); 1017 xfs_trans_init(mp);
1013 1018
1014 /* 1019 /*
1015 * Allocate and initialize the inode hash table for this
1016 * file system.
1017 */
1018 xfs_ihash_init(mp);
1019 xfs_chash_init(mp);
1020
1021 /*
1022 * Allocate and initialize the per-ag data. 1020 * Allocate and initialize the per-ag data.
1023 */ 1021 */
1024 init_rwsem(&mp->m_peraglock); 1022 init_rwsem(&mp->m_peraglock);
1025 mp->m_perag = 1023 mp->m_perag =
1026 kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t), KM_SLEEP); 1024 kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t), KM_SLEEP);
1027 1025
1028 mp->m_maxagi = xfs_initialize_perag(vfsp, mp, sbp->sb_agcount); 1026 mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount);
1029 1027
1030 /* 1028 /*
1031 * log's mount-time initialization. Perform 1st part recovery if needed 1029 * log's mount-time initialization. Perform 1st part recovery if needed
@@ -1116,7 +1114,7 @@ xfs_mountfs(
1116 * If fs is not mounted readonly, then update the superblock 1114 * If fs is not mounted readonly, then update the superblock
1117 * unit and width changes. 1115 * unit and width changes.
1118 */ 1116 */
1119 if (update_flags && !(vfsp->vfs_flag & VFS_RDONLY)) 1117 if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY))
1120 xfs_mount_log_sbunit(mp, update_flags); 1118 xfs_mount_log_sbunit(mp, update_flags);
1121 1119
1122 /* 1120 /*
@@ -1169,8 +1167,6 @@ xfs_mountfs(
1169 error3: 1167 error3:
1170 xfs_log_unmount_dealloc(mp); 1168 xfs_log_unmount_dealloc(mp);
1171 error2: 1169 error2:
1172 xfs_ihash_free(mp);
1173 xfs_chash_free(mp);
1174 for (agno = 0; agno < sbp->sb_agcount; agno++) 1170 for (agno = 0; agno < sbp->sb_agcount; agno++)
1175 if (mp->m_perag[agno].pagb_list) 1171 if (mp->m_perag[agno].pagb_list)
1176 kmem_free(mp->m_perag[agno].pagb_list, 1172 kmem_free(mp->m_perag[agno].pagb_list,
@@ -1194,10 +1190,6 @@ xfs_mountfs(
1194int 1190int
1195xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) 1191xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
1196{ 1192{
1197 struct bhv_vfs *vfsp = XFS_MTOVFS(mp);
1198#if defined(DEBUG) || defined(INDUCE_IO_ERROR)
1199 int64_t fsid;
1200#endif
1201 __uint64_t resblks; 1193 __uint64_t resblks;
1202 1194
1203 /* 1195 /*
@@ -1261,21 +1253,17 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
1261 xfs_uuid_unmount(mp); 1253 xfs_uuid_unmount(mp);
1262 1254
1263#if defined(DEBUG) || defined(INDUCE_IO_ERROR) 1255#if defined(DEBUG) || defined(INDUCE_IO_ERROR)
1264 /* 1256 xfs_errortag_clearall(mp, 0);
1265 * clear all error tags on this filesystem
1266 */
1267 memcpy(&fsid, &vfsp->vfs_fsid, sizeof(int64_t));
1268 xfs_errortag_clearall_umount(fsid, mp->m_fsname, 0);
1269#endif 1257#endif
1270 XFS_IODONE(vfsp); 1258 XFS_IODONE(mp);
1271 xfs_mount_free(mp, 1); 1259 xfs_mount_free(mp);
1272 return 0; 1260 return 0;
1273} 1261}
1274 1262
1275void 1263void
1276xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr) 1264xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr)
1277{ 1265{
1278 if (mp->m_logdev_targp != mp->m_ddev_targp) 1266 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp)
1279 xfs_free_buftarg(mp->m_logdev_targp, 1); 1267 xfs_free_buftarg(mp->m_logdev_targp, 1);
1280 if (mp->m_rtdev_targp) 1268 if (mp->m_rtdev_targp)
1281 xfs_free_buftarg(mp->m_rtdev_targp, 1); 1269 xfs_free_buftarg(mp->m_rtdev_targp, 1);
@@ -1295,10 +1283,8 @@ xfs_unmountfs_wait(xfs_mount_t *mp)
1295int 1283int
1296xfs_fs_writable(xfs_mount_t *mp) 1284xfs_fs_writable(xfs_mount_t *mp)
1297{ 1285{
1298 bhv_vfs_t *vfsp = XFS_MTOVFS(mp); 1286 return !(xfs_test_for_freeze(mp) || XFS_FORCED_SHUTDOWN(mp) ||
1299 1287 (mp->m_flags & XFS_MOUNT_RDONLY));
1300 return !(vfs_test_for_freeze(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
1301 (vfsp->vfs_flag & VFS_RDONLY));
1302} 1288}
1303 1289
1304/* 1290/*
@@ -1348,34 +1334,44 @@ xfs_log_sbcount(
1348 return 0; 1334 return 0;
1349} 1335}
1350 1336
1337STATIC void
1338xfs_mark_shared_ro(
1339 xfs_mount_t *mp,
1340 xfs_buf_t *bp)
1341{
1342 xfs_dsb_t *sb = XFS_BUF_TO_SBP(bp);
1343 __uint16_t version;
1344
1345 if (!(sb->sb_flags & XFS_SBF_READONLY))
1346 sb->sb_flags |= XFS_SBF_READONLY;
1347
1348 version = be16_to_cpu(sb->sb_versionnum);
1349 if ((version & XFS_SB_VERSION_NUMBITS) != XFS_SB_VERSION_4 ||
1350 !(version & XFS_SB_VERSION_SHAREDBIT))
1351 version |= XFS_SB_VERSION_SHAREDBIT;
1352 sb->sb_versionnum = cpu_to_be16(version);
1353}
1354
1351int 1355int
1352xfs_unmountfs_writesb(xfs_mount_t *mp) 1356xfs_unmountfs_writesb(xfs_mount_t *mp)
1353{ 1357{
1354 xfs_buf_t *sbp; 1358 xfs_buf_t *sbp;
1355 xfs_sb_t *sb;
1356 int error = 0; 1359 int error = 0;
1357 1360
1358 /* 1361 /*
1359 * skip superblock write if fs is read-only, or 1362 * skip superblock write if fs is read-only, or
1360 * if we are doing a forced umount. 1363 * if we are doing a forced umount.
1361 */ 1364 */
1362 if (!(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY || 1365 if (!((mp->m_flags & XFS_MOUNT_RDONLY) ||
1363 XFS_FORCED_SHUTDOWN(mp))) { 1366 XFS_FORCED_SHUTDOWN(mp))) {
1364 1367
1365 sbp = xfs_getsb(mp, 0); 1368 sbp = xfs_getsb(mp, 0);
1366 sb = XFS_BUF_TO_SBP(sbp);
1367 1369
1368 /* 1370 /*
1369 * mark shared-readonly if desired 1371 * mark shared-readonly if desired
1370 */ 1372 */
1371 if (mp->m_mk_sharedro) { 1373 if (mp->m_mk_sharedro)
1372 if (!(sb->sb_flags & XFS_SBF_READONLY)) 1374 xfs_mark_shared_ro(mp, sbp);
1373 sb->sb_flags |= XFS_SBF_READONLY;
1374 if (!XFS_SB_VERSION_HASSHARED(sb))
1375 XFS_SB_VERSION_ADDSHARED(sb);
1376 xfs_fs_cmn_err(CE_NOTE, mp,
1377 "Unmounting, marking shared read-only");
1378 }
1379 1375
1380 XFS_BUF_UNDONE(sbp); 1376 XFS_BUF_UNDONE(sbp);
1381 XFS_BUF_UNREAD(sbp); 1377 XFS_BUF_UNREAD(sbp);
@@ -1410,7 +1406,6 @@ xfs_mod_sb(xfs_trans_t *tp, __int64_t fields)
1410 int first; 1406 int first;
1411 int last; 1407 int last;
1412 xfs_mount_t *mp; 1408 xfs_mount_t *mp;
1413 xfs_sb_t *sbp;
1414 xfs_sb_field_t f; 1409 xfs_sb_field_t f;
1415 1410
1416 ASSERT(fields); 1411 ASSERT(fields);
@@ -1418,13 +1413,12 @@ xfs_mod_sb(xfs_trans_t *tp, __int64_t fields)
1418 return; 1413 return;
1419 mp = tp->t_mountp; 1414 mp = tp->t_mountp;
1420 bp = xfs_trans_getsb(tp, mp, 0); 1415 bp = xfs_trans_getsb(tp, mp, 0);
1421 sbp = XFS_BUF_TO_SBP(bp);
1422 first = sizeof(xfs_sb_t); 1416 first = sizeof(xfs_sb_t);
1423 last = 0; 1417 last = 0;
1424 1418
1425 /* translate/copy */ 1419 /* translate/copy */
1426 1420
1427 xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), -1, fields); 1421 xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields);
1428 1422
1429 /* find modified range */ 1423 /* find modified range */
1430 1424
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 76ad74758696..c618f7cb5f0e 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -54,13 +54,8 @@ typedef struct xfs_trans_reservations {
54#else 54#else
55struct cred; 55struct cred;
56struct log; 56struct log;
57struct bhv_vfs;
58struct bhv_vnode;
59struct xfs_mount_args; 57struct xfs_mount_args;
60struct xfs_ihash;
61struct xfs_chash;
62struct xfs_inode; 58struct xfs_inode;
63struct xfs_perag;
64struct xfs_iocore; 59struct xfs_iocore;
65struct xfs_bmbt_irec; 60struct xfs_bmbt_irec;
66struct xfs_bmap_free; 61struct xfs_bmap_free;
@@ -68,9 +63,6 @@ struct xfs_extdelta;
68struct xfs_swapext; 63struct xfs_swapext;
69struct xfs_mru_cache; 64struct xfs_mru_cache;
70 65
71extern struct bhv_vfsops xfs_vfsops;
72extern struct bhv_vnodeops xfs_vnodeops;
73
74#define AIL_LOCK_T lock_t 66#define AIL_LOCK_T lock_t
75#define AIL_LOCKINIT(x,y) spinlock_init(x,y) 67#define AIL_LOCKINIT(x,y) spinlock_init(x,y)
76#define AIL_LOCK_DESTROY(x) spinlock_destroy(x) 68#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
@@ -82,15 +74,17 @@ extern struct bhv_vnodeops xfs_vnodeops;
82 * Prototypes and functions for the Data Migration subsystem. 74 * Prototypes and functions for the Data Migration subsystem.
83 */ 75 */
84 76
85typedef int (*xfs_send_data_t)(int, struct bhv_vnode *, 77typedef int (*xfs_send_data_t)(int, bhv_vnode_t *,
86 xfs_off_t, size_t, int, bhv_vrwlock_t *); 78 xfs_off_t, size_t, int, bhv_vrwlock_t *);
87typedef int (*xfs_send_mmap_t)(struct vm_area_struct *, uint); 79typedef int (*xfs_send_mmap_t)(struct vm_area_struct *, uint);
88typedef int (*xfs_send_destroy_t)(struct bhv_vnode *, dm_right_t); 80typedef int (*xfs_send_destroy_t)(bhv_vnode_t *, dm_right_t);
89typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct bhv_vfs *, 81typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *,
90 struct bhv_vnode *, 82 bhv_vnode_t *,
91 dm_right_t, struct bhv_vnode *, dm_right_t, 83 dm_right_t, bhv_vnode_t *, dm_right_t,
92 char *, char *, mode_t, int, int); 84 char *, char *, mode_t, int, int);
93typedef void (*xfs_send_unmount_t)(struct bhv_vfs *, struct bhv_vnode *, 85typedef int (*xfs_send_mount_t)(struct xfs_mount *, dm_right_t,
86 char *, char *);
87typedef void (*xfs_send_unmount_t)(struct xfs_mount *, bhv_vnode_t *,
94 dm_right_t, mode_t, int, int); 88 dm_right_t, mode_t, int, int);
95 89
96typedef struct xfs_dmops { 90typedef struct xfs_dmops {
@@ -98,21 +92,24 @@ typedef struct xfs_dmops {
98 xfs_send_mmap_t xfs_send_mmap; 92 xfs_send_mmap_t xfs_send_mmap;
99 xfs_send_destroy_t xfs_send_destroy; 93 xfs_send_destroy_t xfs_send_destroy;
100 xfs_send_namesp_t xfs_send_namesp; 94 xfs_send_namesp_t xfs_send_namesp;
95 xfs_send_mount_t xfs_send_mount;
101 xfs_send_unmount_t xfs_send_unmount; 96 xfs_send_unmount_t xfs_send_unmount;
102} xfs_dmops_t; 97} xfs_dmops_t;
103 98
104#define XFS_SEND_DATA(mp, ev,vp,off,len,fl,lock) \ 99#define XFS_SEND_DATA(mp, ev,vp,off,len,fl,lock) \
105 (*(mp)->m_dm_ops.xfs_send_data)(ev,vp,off,len,fl,lock) 100 (*(mp)->m_dm_ops->xfs_send_data)(ev,vp,off,len,fl,lock)
106#define XFS_SEND_MMAP(mp, vma,fl) \ 101#define XFS_SEND_MMAP(mp, vma,fl) \
107 (*(mp)->m_dm_ops.xfs_send_mmap)(vma,fl) 102 (*(mp)->m_dm_ops->xfs_send_mmap)(vma,fl)
108#define XFS_SEND_DESTROY(mp, vp,right) \ 103#define XFS_SEND_DESTROY(mp, vp,right) \
109 (*(mp)->m_dm_ops.xfs_send_destroy)(vp,right) 104 (*(mp)->m_dm_ops->xfs_send_destroy)(vp,right)
110#define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \ 105#define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
111 (*(mp)->m_dm_ops.xfs_send_namesp)(ev,NULL,b1,r1,b2,r2,n1,n2,mode,rval,fl) 106 (*(mp)->m_dm_ops->xfs_send_namesp)(ev,NULL,b1,r1,b2,r2,n1,n2,mode,rval,fl)
112#define XFS_SEND_PREUNMOUNT(mp, vfs,b1,r1,b2,r2,n1,n2,mode,rval,fl) \ 107#define XFS_SEND_PREUNMOUNT(mp,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
113 (*(mp)->m_dm_ops.xfs_send_namesp)(DM_EVENT_PREUNMOUNT,vfs,b1,r1,b2,r2,n1,n2,mode,rval,fl) 108 (*(mp)->m_dm_ops->xfs_send_namesp)(DM_EVENT_PREUNMOUNT,mp,b1,r1,b2,r2,n1,n2,mode,rval,fl)
114#define XFS_SEND_UNMOUNT(mp, vfsp,vp,right,mode,rval,fl) \ 109#define XFS_SEND_MOUNT(mp,right,path,name) \
115 (*(mp)->m_dm_ops.xfs_send_unmount)(vfsp,vp,right,mode,rval,fl) 110 (*(mp)->m_dm_ops->xfs_send_mount)(mp,right,path,name)
111#define XFS_SEND_UNMOUNT(mp, vp,right,mode,rval,fl) \
112 (*(mp)->m_dm_ops->xfs_send_unmount)(mp,vp,right,mode,rval,fl)
116 113
117 114
118/* 115/*
@@ -142,6 +139,9 @@ typedef struct xfs_dquot * (*xfs_dqvopchown_t)(
142 struct xfs_dquot **, struct xfs_dquot *); 139 struct xfs_dquot **, struct xfs_dquot *);
143typedef int (*xfs_dqvopchownresv_t)(struct xfs_trans *, struct xfs_inode *, 140typedef int (*xfs_dqvopchownresv_t)(struct xfs_trans *, struct xfs_inode *,
144 struct xfs_dquot *, struct xfs_dquot *, uint); 141 struct xfs_dquot *, struct xfs_dquot *, uint);
142typedef void (*xfs_dqstatvfs_t)(struct xfs_inode *, bhv_statvfs_t *);
143typedef int (*xfs_dqsync_t)(struct xfs_mount *, int flags);
144typedef int (*xfs_quotactl_t)(struct xfs_mount *, int, int, xfs_caddr_t);
145 145
146typedef struct xfs_qmops { 146typedef struct xfs_qmops {
147 xfs_qminit_t xfs_qminit; 147 xfs_qminit_t xfs_qminit;
@@ -157,42 +157,51 @@ typedef struct xfs_qmops {
157 xfs_dqvoprename_t xfs_dqvoprename; 157 xfs_dqvoprename_t xfs_dqvoprename;
158 xfs_dqvopchown_t xfs_dqvopchown; 158 xfs_dqvopchown_t xfs_dqvopchown;
159 xfs_dqvopchownresv_t xfs_dqvopchownresv; 159 xfs_dqvopchownresv_t xfs_dqvopchownresv;
160 xfs_dqstatvfs_t xfs_dqstatvfs;
161 xfs_dqsync_t xfs_dqsync;
162 xfs_quotactl_t xfs_quotactl;
160 struct xfs_dqtrxops *xfs_dqtrxops; 163 struct xfs_dqtrxops *xfs_dqtrxops;
161} xfs_qmops_t; 164} xfs_qmops_t;
162 165
163#define XFS_QM_INIT(mp, mnt, fl) \ 166#define XFS_QM_INIT(mp, mnt, fl) \
164 (*(mp)->m_qm_ops.xfs_qminit)(mp, mnt, fl) 167 (*(mp)->m_qm_ops->xfs_qminit)(mp, mnt, fl)
165#define XFS_QM_MOUNT(mp, mnt, fl, mfsi_flags) \ 168#define XFS_QM_MOUNT(mp, mnt, fl, mfsi_flags) \
166 (*(mp)->m_qm_ops.xfs_qmmount)(mp, mnt, fl, mfsi_flags) 169 (*(mp)->m_qm_ops->xfs_qmmount)(mp, mnt, fl, mfsi_flags)
167#define XFS_QM_UNMOUNT(mp) \ 170#define XFS_QM_UNMOUNT(mp) \
168 (*(mp)->m_qm_ops.xfs_qmunmount)(mp) 171 (*(mp)->m_qm_ops->xfs_qmunmount)(mp)
169#define XFS_QM_DONE(mp) \ 172#define XFS_QM_DONE(mp) \
170 (*(mp)->m_qm_ops.xfs_qmdone)(mp) 173 (*(mp)->m_qm_ops->xfs_qmdone)(mp)
171#define XFS_QM_DQRELE(mp, dq) \ 174#define XFS_QM_DQRELE(mp, dq) \
172 (*(mp)->m_qm_ops.xfs_dqrele)(dq) 175 (*(mp)->m_qm_ops->xfs_dqrele)(dq)
173#define XFS_QM_DQATTACH(mp, ip, fl) \ 176#define XFS_QM_DQATTACH(mp, ip, fl) \
174 (*(mp)->m_qm_ops.xfs_dqattach)(ip, fl) 177 (*(mp)->m_qm_ops->xfs_dqattach)(ip, fl)
175#define XFS_QM_DQDETACH(mp, ip) \ 178#define XFS_QM_DQDETACH(mp, ip) \
176 (*(mp)->m_qm_ops.xfs_dqdetach)(ip) 179 (*(mp)->m_qm_ops->xfs_dqdetach)(ip)
177#define XFS_QM_DQPURGEALL(mp, fl) \ 180#define XFS_QM_DQPURGEALL(mp, fl) \
178 (*(mp)->m_qm_ops.xfs_dqpurgeall)(mp, fl) 181 (*(mp)->m_qm_ops->xfs_dqpurgeall)(mp, fl)
179#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \ 182#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \
180 (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, dq2) 183 (*(mp)->m_qm_ops->xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, dq2)
181#define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \ 184#define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \
182 (*(mp)->m_qm_ops.xfs_dqvopcreate)(tp, ip, dq1, dq2) 185 (*(mp)->m_qm_ops->xfs_dqvopcreate)(tp, ip, dq1, dq2)
183#define XFS_QM_DQVOPRENAME(mp, ip) \ 186#define XFS_QM_DQVOPRENAME(mp, ip) \
184 (*(mp)->m_qm_ops.xfs_dqvoprename)(ip) 187 (*(mp)->m_qm_ops->xfs_dqvoprename)(ip)
185#define XFS_QM_DQVOPCHOWN(mp, tp, ip, dqp, dq) \ 188#define XFS_QM_DQVOPCHOWN(mp, tp, ip, dqp, dq) \
186 (*(mp)->m_qm_ops.xfs_dqvopchown)(tp, ip, dqp, dq) 189 (*(mp)->m_qm_ops->xfs_dqvopchown)(tp, ip, dqp, dq)
187#define XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, dq1, dq2, fl) \ 190#define XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, dq1, dq2, fl) \
188 (*(mp)->m_qm_ops.xfs_dqvopchownresv)(tp, ip, dq1, dq2, fl) 191 (*(mp)->m_qm_ops->xfs_dqvopchownresv)(tp, ip, dq1, dq2, fl)
192#define XFS_QM_DQSTATVFS(ip, statp) \
193 (*(ip)->i_mount->m_qm_ops->xfs_dqstatvfs)(ip, statp)
194#define XFS_QM_DQSYNC(mp, flags) \
195 (*(mp)->m_qm_ops->xfs_dqsync)(mp, flags)
196#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \
197 (*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr)
189 198
190 199
191/* 200/*
192 * Prototypes and functions for I/O core modularization. 201 * Prototypes and functions for I/O core modularization.
193 */ 202 */
194 203
195typedef int (*xfs_ioinit_t)(struct bhv_vfs *, 204typedef int (*xfs_ioinit_t)(struct xfs_mount *,
196 struct xfs_mount_args *, int); 205 struct xfs_mount_args *, int);
197typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *, 206typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *,
198 xfs_fileoff_t, xfs_filblks_t, int, 207 xfs_fileoff_t, xfs_filblks_t, int,
@@ -222,7 +231,7 @@ typedef void (*xfs_lock_demote_t)(void *, uint);
222typedef int (*xfs_lock_nowait_t)(void *, uint); 231typedef int (*xfs_lock_nowait_t)(void *, uint);
223typedef void (*xfs_unlk_t)(void *, unsigned int); 232typedef void (*xfs_unlk_t)(void *, unsigned int);
224typedef xfs_fsize_t (*xfs_size_t)(void *); 233typedef xfs_fsize_t (*xfs_size_t)(void *);
225typedef xfs_fsize_t (*xfs_iodone_t)(struct bhv_vfs *); 234typedef xfs_fsize_t (*xfs_iodone_t)(struct xfs_mount *);
226typedef int (*xfs_swap_extents_t)(void *, void *, 235typedef int (*xfs_swap_extents_t)(void *, void *,
227 struct xfs_swapext*); 236 struct xfs_swapext*);
228 237
@@ -245,8 +254,8 @@ typedef struct xfs_ioops {
245 xfs_swap_extents_t xfs_swap_extents_func; 254 xfs_swap_extents_t xfs_swap_extents_func;
246} xfs_ioops_t; 255} xfs_ioops_t;
247 256
248#define XFS_IOINIT(vfsp, args, flags) \ 257#define XFS_IOINIT(mp, args, flags) \
249 (*(mp)->m_io_ops.xfs_ioinit)(vfsp, args, flags) 258 (*(mp)->m_io_ops.xfs_ioinit)(mp, args, flags)
250#define XFS_BMAPI(mp, trans,io,bno,len,f,first,tot,mval,nmap,flist,delta) \ 259#define XFS_BMAPI(mp, trans,io,bno,len,f,first,tot,mval,nmap,flist,delta) \
251 (*(mp)->m_io_ops.xfs_bmapi_func) \ 260 (*(mp)->m_io_ops.xfs_bmapi_func) \
252 (trans,(io)->io_obj,bno,len,f,first,tot,mval,nmap,flist,delta) 261 (trans,(io)->io_obj,bno,len,f,first,tot,mval,nmap,flist,delta)
@@ -280,8 +289,8 @@ typedef struct xfs_ioops {
280 (*(mp)->m_io_ops.xfs_ilock_demote)((io)->io_obj, mode) 289 (*(mp)->m_io_ops.xfs_ilock_demote)((io)->io_obj, mode)
281#define XFS_SIZE(mp, io) \ 290#define XFS_SIZE(mp, io) \
282 (*(mp)->m_io_ops.xfs_size_func)((io)->io_obj) 291 (*(mp)->m_io_ops.xfs_size_func)((io)->io_obj)
283#define XFS_IODONE(vfsp) \ 292#define XFS_IODONE(mp) \
284 (*(mp)->m_io_ops.xfs_iodone)(vfsp) 293 (*(mp)->m_io_ops.xfs_iodone)(mp)
285#define XFS_SWAP_EXTENTS(mp, io, tio, sxp) \ 294#define XFS_SWAP_EXTENTS(mp, io, tio, sxp) \
286 (*(mp)->m_io_ops.xfs_swap_extents_func) \ 295 (*(mp)->m_io_ops.xfs_swap_extents_func) \
287 ((io)->io_obj, (tio)->io_obj, sxp) 296 ((io)->io_obj, (tio)->io_obj, sxp)
@@ -318,7 +327,7 @@ extern void xfs_icsb_sync_counters_flags(struct xfs_mount *, int);
318#endif 327#endif
319 328
320typedef struct xfs_mount { 329typedef struct xfs_mount {
321 bhv_desc_t m_bhv; /* vfs xfs behavior */ 330 struct super_block *m_super;
322 xfs_tid_t m_tid; /* next unused tid for fs */ 331 xfs_tid_t m_tid; /* next unused tid for fs */
323 AIL_LOCK_T m_ail_lock; /* fs AIL mutex */ 332 AIL_LOCK_T m_ail_lock; /* fs AIL mutex */
324 xfs_ail_entry_t m_ail; /* fs active log item list */ 333 xfs_ail_entry_t m_ail; /* fs active log item list */
@@ -335,8 +344,6 @@ typedef struct xfs_mount {
335 xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ 344 xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */
336 lock_t m_agirotor_lock;/* .. and lock protecting it */ 345 lock_t m_agirotor_lock;/* .. and lock protecting it */
337 xfs_agnumber_t m_maxagi; /* highest inode alloc group */ 346 xfs_agnumber_t m_maxagi; /* highest inode alloc group */
338 size_t m_ihsize; /* size of next field */
339 struct xfs_ihash *m_ihash; /* fs private inode hash table*/
340 struct xfs_inode *m_inodes; /* active inode list */ 347 struct xfs_inode *m_inodes; /* active inode list */
341 struct list_head m_del_inodes; /* inodes to reclaim */ 348 struct list_head m_del_inodes; /* inodes to reclaim */
342 mutex_t m_ilock; /* inode list mutex */ 349 mutex_t m_ilock; /* inode list mutex */
@@ -362,7 +369,6 @@ typedef struct xfs_mount {
362 __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ 369 __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
363 __uint8_t m_agno_log; /* log #ag's */ 370 __uint8_t m_agno_log; /* log #ag's */
364 __uint8_t m_agino_log; /* #bits for agino in inum */ 371 __uint8_t m_agino_log; /* #bits for agino in inum */
365 __uint8_t m_nreadaheads; /* #readahead buffers */
366 __uint16_t m_inode_cluster_size;/* min inode buf size */ 372 __uint16_t m_inode_cluster_size;/* min inode buf size */
367 uint m_blockmask; /* sb_blocksize-1 */ 373 uint m_blockmask; /* sb_blocksize-1 */
368 uint m_blockwsize; /* sb_blocksize in words */ 374 uint m_blockwsize; /* sb_blocksize in words */
@@ -378,7 +384,7 @@ typedef struct xfs_mount {
378 uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ 384 uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
379 struct xfs_perag *m_perag; /* per-ag accounting info */ 385 struct xfs_perag *m_perag; /* per-ag accounting info */
380 struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */ 386 struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
381 sema_t m_growlock; /* growfs mutex */ 387 struct mutex m_growlock; /* growfs mutex */
382 int m_fixedfsid[2]; /* unchanged for life of FS */ 388 int m_fixedfsid[2]; /* unchanged for life of FS */
383 uint m_dmevmask; /* DMI events for this FS */ 389 uint m_dmevmask; /* DMI events for this FS */
384 __uint64_t m_flags; /* global mount flags */ 390 __uint64_t m_flags; /* global mount flags */
@@ -415,8 +421,8 @@ typedef struct xfs_mount {
415 uint m_chsize; /* size of next field */ 421 uint m_chsize; /* size of next field */
416 struct xfs_chash *m_chash; /* fs private inode per-cluster 422 struct xfs_chash *m_chash; /* fs private inode per-cluster
417 * hash table */ 423 * hash table */
418 struct xfs_dmops m_dm_ops; /* vector of DMI ops */ 424 struct xfs_dmops *m_dm_ops; /* vector of DMI ops */
419 struct xfs_qmops m_qm_ops; /* vector of XQM ops */ 425 struct xfs_qmops *m_qm_ops; /* vector of XQM ops */
420 struct xfs_ioops m_io_ops; /* vector of I/O ops */ 426 struct xfs_ioops m_io_ops; /* vector of I/O ops */
421 atomic_t m_active_trans; /* number trans frozen */ 427 atomic_t m_active_trans; /* number trans frozen */
422#ifdef HAVE_PERCPU_SB 428#ifdef HAVE_PERCPU_SB
@@ -426,6 +432,12 @@ typedef struct xfs_mount {
426 struct mutex m_icsb_mutex; /* balancer sync lock */ 432 struct mutex m_icsb_mutex; /* balancer sync lock */
427#endif 433#endif
428 struct xfs_mru_cache *m_filestream; /* per-mount filestream data */ 434 struct xfs_mru_cache *m_filestream; /* per-mount filestream data */
435 struct task_struct *m_sync_task; /* generalised sync thread */
436 bhv_vfs_sync_work_t m_sync_work; /* work item for VFS_SYNC */
437 struct list_head m_sync_list; /* sync thread work item list */
438 spinlock_t m_sync_lock; /* work item list lock */
439 int m_sync_seq; /* sync thread generation no. */
440 wait_queue_head_t m_wait_single_sync_task;
429} xfs_mount_t; 441} xfs_mount_t;
430 442
431/* 443/*
@@ -435,7 +447,7 @@ typedef struct xfs_mount {
435 must be synchronous except 447 must be synchronous except
436 for space allocations */ 448 for space allocations */
437#define XFS_MOUNT_INO64 (1ULL << 1) 449#define XFS_MOUNT_INO64 (1ULL << 1)
438 /* (1ULL << 2) -- currently unused */ 450#define XFS_MOUNT_DMAPI (1ULL << 2) /* dmapi is enabled */
439#define XFS_MOUNT_WAS_CLEAN (1ULL << 3) 451#define XFS_MOUNT_WAS_CLEAN (1ULL << 3)
440#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesystem 452#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesystem
441 operations, typically for 453 operations, typically for
@@ -445,7 +457,7 @@ typedef struct xfs_mount {
445#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment 457#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment
446 allocations */ 458 allocations */
447#define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */ 459#define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */
448 /* (1ULL << 9) -- currently unused */ 460#define XFS_MOUNT_GRPID (1ULL << 9) /* group-ID assigned from directory */
449#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */ 461#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */
450#define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */ 462#define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */
451#define XFS_MOUNT_DFLT_IOSIZE (1ULL << 12) /* set default i/o size */ 463#define XFS_MOUNT_DFLT_IOSIZE (1ULL << 12) /* set default i/o size */
@@ -453,13 +465,13 @@ typedef struct xfs_mount {
453 /* osyncisdsync is now default*/ 465 /* osyncisdsync is now default*/
454#define XFS_MOUNT_32BITINODES (1ULL << 14) /* do not create inodes above 466#define XFS_MOUNT_32BITINODES (1ULL << 14) /* do not create inodes above
455 * 32 bits in size */ 467 * 32 bits in size */
456 /* (1ULL << 15) -- currently unused */ 468#define XFS_MOUNT_SMALL_INUMS (1ULL << 15) /* users wants 32bit inodes */
457#define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */ 469#define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */
458#define XFS_MOUNT_BARRIER (1ULL << 17) 470#define XFS_MOUNT_BARRIER (1ULL << 17)
459#define XFS_MOUNT_IDELETE (1ULL << 18) /* delete empty inode clusters*/ 471#define XFS_MOUNT_IDELETE (1ULL << 18) /* delete empty inode clusters*/
460#define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width 472#define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width
461 * allocation */ 473 * allocation */
462#define XFS_MOUNT_IHASHSIZE (1ULL << 20) /* inode hash table size */ 474#define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */
463#define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */ 475#define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */
464#define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report large preferred 476#define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report large preferred
465 * I/O size in stat() */ 477 * I/O size in stat() */
@@ -518,8 +530,10 @@ xfs_preferred_iosize(xfs_mount_t *mp)
518#define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \ 530#define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \
519 ((mp)->m_flags & XFS_MOUNT_WAS_CLEAN) 531 ((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
520#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) 532#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
533void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
534 int lnnum);
521#define xfs_force_shutdown(m,f) \ 535#define xfs_force_shutdown(m,f) \
522 bhv_vfs_force_shutdown((XFS_MTOVFS(m)), f, __FILE__, __LINE__) 536 xfs_do_force_shutdown(m, f, __FILE__, __LINE__)
523 537
524/* 538/*
525 * Flags for xfs_mountfs 539 * Flags for xfs_mountfs
@@ -533,28 +547,6 @@ xfs_preferred_iosize(xfs_mount_t *mp)
533/* XFS_MFSI_CONVERT_SUNIT */ 547/* XFS_MFSI_CONVERT_SUNIT */
534#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */ 548#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */
535 549
536/*
537 * Macros for getting from mount to vfs and back.
538 */
539#define XFS_MTOVFS(mp) xfs_mtovfs(mp)
540static inline struct bhv_vfs *xfs_mtovfs(xfs_mount_t *mp)
541{
542 return bhvtovfs(&mp->m_bhv);
543}
544
545#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
546static inline xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp)
547{
548 return (xfs_mount_t *)BHV_PDATA(bdp);
549}
550
551#define XFS_VFSTOM(vfs) xfs_vfstom(vfs)
552static inline xfs_mount_t *xfs_vfstom(bhv_vfs_t *vfs)
553{
554 return XFS_BHVTOM(bhv_lookup_range(VFS_BHVHEAD(vfs),
555 VFS_POSITION_XFS, VFS_POSITION_XFS));
556}
557
558#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) 550#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
559static inline xfs_agnumber_t 551static inline xfs_agnumber_t
560xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) 552xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
@@ -573,6 +565,21 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
573} 565}
574 566
575/* 567/*
568 * perag get/put wrappers for eventual ref counting
569 */
570static inline xfs_perag_t *
571xfs_get_perag(struct xfs_mount *mp, xfs_ino_t ino)
572{
573 return &mp->m_perag[XFS_INO_TO_AGNO(mp, ino)];
574}
575
576static inline void
577xfs_put_perag(struct xfs_mount *mp, xfs_perag_t *pag)
578{
579 /* nothing to see here, move along */
580}
581
582/*
576 * Per-cpu superblock locking functions 583 * Per-cpu superblock locking functions
577 */ 584 */
578#ifdef HAVE_PERCPU_SB 585#ifdef HAVE_PERCPU_SB
@@ -609,8 +616,8 @@ typedef struct xfs_mod_sb {
609extern xfs_mount_t *xfs_mount_init(void); 616extern xfs_mount_t *xfs_mount_init(void);
610extern void xfs_mod_sb(xfs_trans_t *, __int64_t); 617extern void xfs_mod_sb(xfs_trans_t *, __int64_t);
611extern int xfs_log_sbcount(xfs_mount_t *, uint); 618extern int xfs_log_sbcount(xfs_mount_t *, uint);
612extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv); 619extern void xfs_mount_free(xfs_mount_t *mp);
613extern int xfs_mountfs(struct bhv_vfs *, xfs_mount_t *mp, int); 620extern int xfs_mountfs(xfs_mount_t *mp, int);
614extern void xfs_mountfs_check_barriers(xfs_mount_t *mp); 621extern void xfs_mountfs_check_barriers(xfs_mount_t *mp);
615 622
616extern int xfs_unmountfs(xfs_mount_t *, struct cred *); 623extern int xfs_unmountfs(xfs_mount_t *, struct cred *);
@@ -626,16 +633,19 @@ extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
626extern int xfs_readsb(xfs_mount_t *, int); 633extern int xfs_readsb(xfs_mount_t *, int);
627extern void xfs_freesb(xfs_mount_t *); 634extern void xfs_freesb(xfs_mount_t *);
628extern int xfs_fs_writable(xfs_mount_t *); 635extern int xfs_fs_writable(xfs_mount_t *);
629extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int);
630extern int xfs_syncsub(xfs_mount_t *, int, int *); 636extern int xfs_syncsub(xfs_mount_t *, int, int *);
631extern int xfs_sync_inodes(xfs_mount_t *, int, int *); 637extern int xfs_sync_inodes(xfs_mount_t *, int, int *);
632extern xfs_agnumber_t xfs_initialize_perag(struct bhv_vfs *, xfs_mount_t *, 638extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t);
633 xfs_agnumber_t); 639extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
634extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t); 640extern void xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
635extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t); 641extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t);
636 642
637extern struct xfs_dmops xfs_dmcore_stub; 643extern int xfs_dmops_get(struct xfs_mount *, struct xfs_mount_args *);
638extern struct xfs_qmops xfs_qmcore_stub; 644extern void xfs_dmops_put(struct xfs_mount *);
645extern int xfs_qmops_get(struct xfs_mount *, struct xfs_mount_args *);
646extern void xfs_qmops_put(struct xfs_mount *);
647
648extern struct xfs_dmops xfs_dmcore_xfs;
639extern struct xfs_ioops xfs_iocore_xfs; 649extern struct xfs_ioops xfs_iocore_xfs;
640 650
641extern int xfs_init(void); 651extern int xfs_init(void);
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c
index 0d594ed7efef..c266a0184b42 100644
--- a/fs/xfs/xfs_qmops.c
+++ b/fs/xfs/xfs_qmops.c
@@ -28,6 +28,8 @@
28#include "xfs_mount.h" 28#include "xfs_mount.h"
29#include "xfs_quota.h" 29#include "xfs_quota.h"
30#include "xfs_error.h" 30#include "xfs_error.h"
31#include "xfs_clnt.h"
32
31 33
32STATIC struct xfs_dquot * 34STATIC struct xfs_dquot *
33xfs_dqvopchown_default( 35xfs_dqvopchown_default(
@@ -64,7 +66,7 @@ xfs_mount_reset_sbqflags(xfs_mount_t *mp)
64 * if the fs is readonly, let the incore superblock run 66 * if the fs is readonly, let the incore superblock run
65 * with quotas off but don't flush the update out to disk 67 * with quotas off but don't flush the update out to disk
66 */ 68 */
67 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 69 if (mp->m_flags & XFS_MOUNT_RDONLY)
68 return 0; 70 return 0;
69#ifdef QUOTADEBUG 71#ifdef QUOTADEBUG
70 xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); 72 xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes");
@@ -110,7 +112,7 @@ xfs_noquota_init(
110 return error; 112 return error;
111} 113}
112 114
113xfs_qmops_t xfs_qmcore_stub = { 115static struct xfs_qmops xfs_qmcore_stub = {
114 .xfs_qminit = (xfs_qminit_t) xfs_noquota_init, 116 .xfs_qminit = (xfs_qminit_t) xfs_noquota_init,
115 .xfs_qmdone = (xfs_qmdone_t) fs_noerr, 117 .xfs_qmdone = (xfs_qmdone_t) fs_noerr,
116 .xfs_qmmount = (xfs_qmmount_t) fs_noerr, 118 .xfs_qmmount = (xfs_qmmount_t) fs_noerr,
@@ -124,4 +126,38 @@ xfs_qmops_t xfs_qmcore_stub = {
124 .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr, 126 .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr,
125 .xfs_dqvopchown = xfs_dqvopchown_default, 127 .xfs_dqvopchown = xfs_dqvopchown_default,
126 .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr, 128 .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr,
129 .xfs_dqstatvfs = (xfs_dqstatvfs_t) fs_noval,
130 .xfs_dqsync = (xfs_dqsync_t) fs_noerr,
131 .xfs_quotactl = (xfs_quotactl_t) fs_nosys,
127}; 132};
133
134int
135xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args)
136{
137 if (args->flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)) {
138 struct xfs_qmops *ops;
139
140 ops = symbol_get(xfs_qmcore_xfs);
141 if (!ops) {
142 request_module("xfs_quota");
143 ops = symbol_get(xfs_qmcore_xfs);
144 }
145
146 if (!ops) {
147 cmn_err(CE_WARN, "XFS: no quota support available.");
148 return EINVAL;
149 }
150 mp->m_qm_ops = ops;
151 } else {
152 mp->m_qm_ops = &xfs_qmcore_stub;
153 }
154
155 return 0;
156}
157
158void
159xfs_qmops_put(struct xfs_mount *mp)
160{
161 if (mp->m_qm_ops != &xfs_qmcore_stub)
162 symbol_put(xfs_qmcore_xfs);
163}
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index 6f14df976f73..12c4ec775af8 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -330,12 +330,12 @@ typedef struct xfs_dqtrxops {
330} xfs_dqtrxops_t; 330} xfs_dqtrxops_t;
331 331
332#define XFS_DQTRXOP(mp, tp, op, args...) \ 332#define XFS_DQTRXOP(mp, tp, op, args...) \
333 ((mp)->m_qm_ops.xfs_dqtrxops ? \ 333 ((mp)->m_qm_ops->xfs_dqtrxops ? \
334 ((mp)->m_qm_ops.xfs_dqtrxops->op)(tp, ## args) : 0) 334 ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : 0)
335 335
336#define XFS_DQTRXOP_VOID(mp, tp, op, args...) \ 336#define XFS_DQTRXOP_VOID(mp, tp, op, args...) \
337 ((mp)->m_qm_ops.xfs_dqtrxops ? \ 337 ((mp)->m_qm_ops->xfs_dqtrxops ? \
338 ((mp)->m_qm_ops.xfs_dqtrxops->op)(tp, ## args) : (void)0) 338 ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : (void)0)
339 339
340#define XFS_TRANS_DUP_DQINFO(mp, otp, ntp) \ 340#define XFS_TRANS_DUP_DQINFO(mp, otp, ntp) \
341 XFS_DQTRXOP_VOID(mp, otp, qo_dup_dqinfo, ntp) 341 XFS_DQTRXOP_VOID(mp, otp, qo_dup_dqinfo, ntp)
@@ -364,7 +364,7 @@ typedef struct xfs_dqtrxops {
364extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); 364extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *);
365extern int xfs_mount_reset_sbqflags(struct xfs_mount *); 365extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
366 366
367extern struct bhv_module_vfsops xfs_qmops; 367extern struct xfs_qmops xfs_qmcore_xfs;
368 368
369#endif /* __KERNEL__ */ 369#endif /* __KERNEL__ */
370 370
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 7679d7a7022d..44ea0ba36476 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dir2.h" 26#include "xfs_dir2.h"
26#include "xfs_dmapi.h" 27#include "xfs_dmapi.h"
27#include "xfs_mount.h" 28#include "xfs_mount.h"
@@ -128,8 +129,7 @@ xfs_lock_for_rename(
128 lock_mode = xfs_ilock_map_shared(dp2); 129 lock_mode = xfs_ilock_map_shared(dp2);
129 } 130 }
130 131
131 error = xfs_dir_lookup_int(XFS_ITOBHV(dp2), lock_mode, 132 error = xfs_dir_lookup_int(dp2, lock_mode, vname2, &inum2, &ip2);
132 vname2, &inum2, &ip2);
133 if (error == ENOENT) { /* target does not need to exist. */ 133 if (error == ENOENT) { /* target does not need to exist. */
134 inum2 = 0; 134 inum2 = 0;
135 } else if (error) { 135 } else if (error) {
@@ -221,15 +221,15 @@ xfs_lock_for_rename(
221 */ 221 */
222int 222int
223xfs_rename( 223xfs_rename(
224 bhv_desc_t *src_dir_bdp, 224 xfs_inode_t *src_dp,
225 bhv_vname_t *src_vname, 225 bhv_vname_t *src_vname,
226 bhv_vnode_t *target_dir_vp, 226 bhv_vnode_t *target_dir_vp,
227 bhv_vname_t *target_vname, 227 bhv_vname_t *target_vname)
228 cred_t *credp)
229{ 228{
229 bhv_vnode_t *src_dir_vp = XFS_ITOV(src_dp);
230 xfs_trans_t *tp; 230 xfs_trans_t *tp;
231 xfs_inode_t *src_dp, *target_dp, *src_ip, *target_ip; 231 xfs_inode_t *target_dp, *src_ip, *target_ip;
232 xfs_mount_t *mp; 232 xfs_mount_t *mp = src_dp->i_mount;
233 int new_parent; /* moving to a new dir */ 233 int new_parent; /* moving to a new dir */
234 int src_is_directory; /* src_name is a directory */ 234 int src_is_directory; /* src_name is a directory */
235 int error; 235 int error;
@@ -239,7 +239,6 @@ xfs_rename(
239 int committed; 239 int committed;
240 xfs_inode_t *inodes[4]; 240 xfs_inode_t *inodes[4];
241 int target_ip_dropped = 0; /* dropped target_ip link? */ 241 int target_ip_dropped = 0; /* dropped target_ip link? */
242 bhv_vnode_t *src_dir_vp;
243 int spaceres; 242 int spaceres;
244 int target_link_zero = 0; 243 int target_link_zero = 0;
245 int num_inodes; 244 int num_inodes;
@@ -248,9 +247,8 @@ xfs_rename(
248 int src_namelen = VNAMELEN(src_vname); 247 int src_namelen = VNAMELEN(src_vname);
249 int target_namelen = VNAMELEN(target_vname); 248 int target_namelen = VNAMELEN(target_vname);
250 249
251 src_dir_vp = BHV_TO_VNODE(src_dir_bdp); 250 vn_trace_entry(src_dp, "xfs_rename", (inst_t *)__return_address);
252 vn_trace_entry(src_dir_vp, "xfs_rename", (inst_t *)__return_address); 251 vn_trace_entry(xfs_vtoi(target_dir_vp), "xfs_rename", (inst_t *)__return_address);
253 vn_trace_entry(target_dir_vp, "xfs_rename", (inst_t *)__return_address);
254 252
255 /* 253 /*
256 * Find the XFS behavior descriptor for the target directory 254 * Find the XFS behavior descriptor for the target directory
@@ -261,12 +259,8 @@ xfs_rename(
261 return XFS_ERROR(EXDEV); 259 return XFS_ERROR(EXDEV);
262 } 260 }
263 261
264 src_dp = XFS_BHVTOI(src_dir_bdp); 262 if (DM_EVENT_ENABLED(src_dp, DM_EVENT_RENAME) ||
265 mp = src_dp->i_mount; 263 DM_EVENT_ENABLED(target_dp, DM_EVENT_RENAME)) {
266
267 if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_RENAME) ||
268 DM_EVENT_ENABLED(target_dir_vp->v_vfsp,
269 target_dp, DM_EVENT_RENAME)) {
270 error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, 264 error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME,
271 src_dir_vp, DM_RIGHT_NULL, 265 src_dir_vp, DM_RIGHT_NULL,
272 target_dir_vp, DM_RIGHT_NULL, 266 target_dir_vp, DM_RIGHT_NULL,
@@ -592,20 +586,16 @@ xfs_rename(
592 /* 586 /*
593 * Let interposed file systems know about removed links. 587 * Let interposed file systems know about removed links.
594 */ 588 */
595 if (target_ip_dropped) { 589 if (target_ip_dropped)
596 bhv_vop_link_removed(XFS_ITOV(target_ip), target_dir_vp,
597 target_link_zero);
598 IRELE(target_ip); 590 IRELE(target_ip);
599 }
600 591
601 IRELE(src_ip); 592 IRELE(src_ip);
602 593
603 /* Fall through to std_return with error = 0 or errno from 594 /* Fall through to std_return with error = 0 or errno from
604 * xfs_trans_commit */ 595 * xfs_trans_commit */
605std_return: 596std_return:
606 if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_POSTRENAME) || 597 if (DM_EVENT_ENABLED(src_dp, DM_EVENT_POSTRENAME) ||
607 DM_EVENT_ENABLED(target_dir_vp->v_vfsp, 598 DM_EVENT_ENABLED(target_dp, DM_EVENT_POSTRENAME)) {
608 target_dp, DM_EVENT_POSTRENAME)) {
609 (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME, 599 (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME,
610 src_dir_vp, DM_RIGHT_NULL, 600 src_dir_vp, DM_RIGHT_NULL,
611 target_dir_vp, DM_RIGHT_NULL, 601 target_dir_vp, DM_RIGHT_NULL,
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
index 905d1c008be7..cd3ece6cc918 100644
--- a/fs/xfs/xfs_rw.c
+++ b/fs/xfs/xfs_rw.c
@@ -178,18 +178,15 @@ xfs_write_sync_logforce(
178 * the shop, make sure that absolutely nothing persistent happens to 178 * the shop, make sure that absolutely nothing persistent happens to
179 * this filesystem after this point. 179 * this filesystem after this point.
180 */ 180 */
181
182void 181void
183xfs_do_force_shutdown( 182xfs_do_force_shutdown(
184 bhv_desc_t *bdp, 183 xfs_mount_t *mp,
185 int flags, 184 int flags,
186 char *fname, 185 char *fname,
187 int lnnum) 186 int lnnum)
188{ 187{
189 int logerror; 188 int logerror;
190 xfs_mount_t *mp;
191 189
192 mp = XFS_BHVTOM(bdp);
193 logerror = flags & SHUTDOWN_LOG_IO_ERROR; 190 logerror = flags & SHUTDOWN_LOG_IO_ERROR;
194 191
195 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { 192 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h
index fcf28dbded7c..49875e1d129f 100644
--- a/fs/xfs/xfs_rw.h
+++ b/fs/xfs/xfs_rw.h
@@ -23,32 +23,6 @@ struct xfs_inode;
23struct xfs_mount; 23struct xfs_mount;
24 24
25/* 25/*
26 * Maximum count of bmaps used by read and write paths.
27 */
28#define XFS_MAX_RW_NBMAPS 4
29
30/*
31 * Counts of readahead buffers to use based on physical memory size.
32 * None of these should be more than XFS_MAX_RW_NBMAPS.
33 */
34#define XFS_RW_NREADAHEAD_16MB 2
35#define XFS_RW_NREADAHEAD_32MB 3
36#define XFS_RW_NREADAHEAD_K32 4
37#define XFS_RW_NREADAHEAD_K64 4
38
39/*
40 * Maximum size of a buffer that we\'ll map. Making this
41 * too big will degrade performance due to the number of
42 * pages which need to be gathered. Making it too small
43 * will prevent us from doing large I/O\'s to hardware that
44 * needs it.
45 *
46 * This is currently set to 512 KB.
47 */
48#define XFS_MAX_BMAP_LEN_BB 1024
49#define XFS_MAX_BMAP_LEN_BYTES 524288
50
51/*
52 * Convert the given file system block to a disk block. 26 * Convert the given file system block to a disk block.
53 * We have to treat it differently based on whether the 27 * We have to treat it differently based on whether the
54 * file is a real time file or not, because the bmap code 28 * file is a real time file or not, because the bmap code
@@ -116,14 +90,6 @@ extern void xfs_ioerror_alert(char *func, struct xfs_mount *mp,
116/* 90/*
117 * Prototypes for functions in xfs_vnodeops.c. 91 * Prototypes for functions in xfs_vnodeops.c.
118 */ 92 */
119extern int xfs_rwlock(bhv_desc_t *bdp, bhv_vrwlock_t write_lock);
120extern void xfs_rwunlock(bhv_desc_t *bdp, bhv_vrwlock_t write_lock);
121extern int xfs_setattr(bhv_desc_t *, bhv_vattr_t *vap, int flags,
122 cred_t *credp);
123extern int xfs_change_file_space(bhv_desc_t *bdp, int cmd, xfs_flock64_t *bf,
124 xfs_off_t offset, cred_t *credp, int flags);
125extern int xfs_set_dmattrs(bhv_desc_t *bdp, u_int evmask, u_int16_t state,
126 cred_t *credp);
127extern int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip, 93extern int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
128 int flags); 94 int flags);
129 95
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index ef42537a607a..94660b1a6ccc 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -87,8 +87,10 @@ struct xfs_mount;
87 (XFS_SB_VERSION2_OKREALFBITS | \ 87 (XFS_SB_VERSION2_OKREALFBITS | \
88 XFS_SB_VERSION2_OKSASHFBITS ) 88 XFS_SB_VERSION2_OKSASHFBITS )
89 89
90typedef struct xfs_sb 90/*
91{ 91 * Superblock - in core version. Must match the ondisk version below.
92 */
93typedef struct xfs_sb {
92 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ 94 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
93 __uint32_t sb_blocksize; /* logical block size, bytes */ 95 __uint32_t sb_blocksize; /* logical block size, bytes */
94 xfs_drfsbno_t sb_dblocks; /* number of data blocks */ 96 xfs_drfsbno_t sb_dblocks; /* number of data blocks */
@@ -146,6 +148,66 @@ typedef struct xfs_sb
146} xfs_sb_t; 148} xfs_sb_t;
147 149
148/* 150/*
151 * Superblock - on disk version. Must match the in core version below.
152 */
153typedef struct xfs_dsb {
154 __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
155 __be32 sb_blocksize; /* logical block size, bytes */
156 __be64 sb_dblocks; /* number of data blocks */
157 __be64 sb_rblocks; /* number of realtime blocks */
158 __be64 sb_rextents; /* number of realtime extents */
159 uuid_t sb_uuid; /* file system unique id */
160 __be64 sb_logstart; /* starting block of log if internal */
161 __be64 sb_rootino; /* root inode number */
162 __be64 sb_rbmino; /* bitmap inode for realtime extents */
163 __be64 sb_rsumino; /* summary inode for rt bitmap */
164 __be32 sb_rextsize; /* realtime extent size, blocks */
165 __be32 sb_agblocks; /* size of an allocation group */
166 __be32 sb_agcount; /* number of allocation groups */
167 __be32 sb_rbmblocks; /* number of rt bitmap blocks */
168 __be32 sb_logblocks; /* number of log blocks */
169 __be16 sb_versionnum; /* header version == XFS_SB_VERSION */
170 __be16 sb_sectsize; /* volume sector size, bytes */
171 __be16 sb_inodesize; /* inode size, bytes */
172 __be16 sb_inopblock; /* inodes per block */
173 char sb_fname[12]; /* file system name */
174 __u8 sb_blocklog; /* log2 of sb_blocksize */
175 __u8 sb_sectlog; /* log2 of sb_sectsize */
176 __u8 sb_inodelog; /* log2 of sb_inodesize */
177 __u8 sb_inopblog; /* log2 of sb_inopblock */
178 __u8 sb_agblklog; /* log2 of sb_agblocks (rounded up) */
179 __u8 sb_rextslog; /* log2 of sb_rextents */
180 __u8 sb_inprogress; /* mkfs is in progress, don't mount */
181 __u8 sb_imax_pct; /* max % of fs for inode space */
182 /* statistics */
183 /*
184 * These fields must remain contiguous. If you really
185 * want to change their layout, make sure you fix the
186 * code in xfs_trans_apply_sb_deltas().
187 */
188 __be64 sb_icount; /* allocated inodes */
189 __be64 sb_ifree; /* free inodes */
190 __be64 sb_fdblocks; /* free data blocks */
191 __be64 sb_frextents; /* free realtime extents */
192 /*
193 * End contiguous fields.
194 */
195 __be64 sb_uquotino; /* user quota inode */
196 __be64 sb_gquotino; /* group quota inode */
197 __be16 sb_qflags; /* quota flags */
198 __u8 sb_flags; /* misc. flags */
199 __u8 sb_shared_vn; /* shared version number */
200 __be32 sb_inoalignmt; /* inode chunk alignment, fsblocks */
201 __be32 sb_unit; /* stripe or raid unit */
202 __be32 sb_width; /* stripe or raid width */
203 __u8 sb_dirblklog; /* log2 of dir block size (fsbs) */
204 __u8 sb_logsectlog; /* log2 of the log sector size */
205 __be16 sb_logsectsize; /* sector size for the log, bytes */
206 __be32 sb_logsunit; /* stripe unit size for the log */
207 __be32 sb_features2; /* additional feature bits */
208} xfs_dsb_t;
209
210/*
149 * Sequence number values for the fields. 211 * Sequence number values for the fields.
150 */ 212 */
151typedef enum { 213typedef enum {
@@ -446,7 +508,7 @@ static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
446 508
447#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ 509#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
448#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) 510#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
449#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp)) 511#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp))
450 512
451#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) 513#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
452#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ 514#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 356d6627f581..8878322ee793 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -234,7 +234,7 @@ xfs_trans_alloc(
234 xfs_mount_t *mp, 234 xfs_mount_t *mp,
235 uint type) 235 uint type)
236{ 236{
237 vfs_wait_for_freeze(XFS_MTOVFS(mp), SB_FREEZE_TRANS); 237 xfs_wait_for_freeze(mp, SB_FREEZE_TRANS);
238 return _xfs_trans_alloc(mp, type); 238 return _xfs_trans_alloc(mp, type);
239} 239}
240 240
@@ -548,7 +548,7 @@ STATIC void
548xfs_trans_apply_sb_deltas( 548xfs_trans_apply_sb_deltas(
549 xfs_trans_t *tp) 549 xfs_trans_t *tp)
550{ 550{
551 xfs_sb_t *sbp; 551 xfs_dsb_t *sbp;
552 xfs_buf_t *bp; 552 xfs_buf_t *bp;
553 int whole = 0; 553 int whole = 0;
554 554
@@ -566,57 +566,51 @@ xfs_trans_apply_sb_deltas(
566 * Only update the superblock counters if we are logging them 566 * Only update the superblock counters if we are logging them
567 */ 567 */
568 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { 568 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) {
569 if (tp->t_icount_delta != 0) { 569 if (tp->t_icount_delta)
570 INT_MOD(sbp->sb_icount, ARCH_CONVERT, tp->t_icount_delta); 570 be64_add(&sbp->sb_icount, tp->t_icount_delta);
571 } 571 if (tp->t_ifree_delta)
572 if (tp->t_ifree_delta != 0) { 572 be64_add(&sbp->sb_ifree, tp->t_ifree_delta);
573 INT_MOD(sbp->sb_ifree, ARCH_CONVERT, tp->t_ifree_delta); 573 if (tp->t_fdblocks_delta)
574 } 574 be64_add(&sbp->sb_fdblocks, tp->t_fdblocks_delta);
575 575 if (tp->t_res_fdblocks_delta)
576 if (tp->t_fdblocks_delta != 0) { 576 be64_add(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta);
577 INT_MOD(sbp->sb_fdblocks, ARCH_CONVERT, tp->t_fdblocks_delta);
578 }
579 if (tp->t_res_fdblocks_delta != 0) {
580 INT_MOD(sbp->sb_fdblocks, ARCH_CONVERT, tp->t_res_fdblocks_delta);
581 }
582 } 577 }
583 578
584 if (tp->t_frextents_delta != 0) { 579 if (tp->t_frextents_delta)
585 INT_MOD(sbp->sb_frextents, ARCH_CONVERT, tp->t_frextents_delta); 580 be64_add(&sbp->sb_frextents, tp->t_frextents_delta);
586 } 581 if (tp->t_res_frextents_delta)
587 if (tp->t_res_frextents_delta != 0) { 582 be64_add(&sbp->sb_frextents, tp->t_res_frextents_delta);
588 INT_MOD(sbp->sb_frextents, ARCH_CONVERT, tp->t_res_frextents_delta); 583
589 } 584 if (tp->t_dblocks_delta) {
590 if (tp->t_dblocks_delta != 0) { 585 be64_add(&sbp->sb_dblocks, tp->t_dblocks_delta);
591 INT_MOD(sbp->sb_dblocks, ARCH_CONVERT, tp->t_dblocks_delta);
592 whole = 1; 586 whole = 1;
593 } 587 }
594 if (tp->t_agcount_delta != 0) { 588 if (tp->t_agcount_delta) {
595 INT_MOD(sbp->sb_agcount, ARCH_CONVERT, tp->t_agcount_delta); 589 be32_add(&sbp->sb_agcount, tp->t_agcount_delta);
596 whole = 1; 590 whole = 1;
597 } 591 }
598 if (tp->t_imaxpct_delta != 0) { 592 if (tp->t_imaxpct_delta) {
599 INT_MOD(sbp->sb_imax_pct, ARCH_CONVERT, tp->t_imaxpct_delta); 593 sbp->sb_imax_pct += tp->t_imaxpct_delta;
600 whole = 1; 594 whole = 1;
601 } 595 }
602 if (tp->t_rextsize_delta != 0) { 596 if (tp->t_rextsize_delta) {
603 INT_MOD(sbp->sb_rextsize, ARCH_CONVERT, tp->t_rextsize_delta); 597 be32_add(&sbp->sb_rextsize, tp->t_rextsize_delta);
604 whole = 1; 598 whole = 1;
605 } 599 }
606 if (tp->t_rbmblocks_delta != 0) { 600 if (tp->t_rbmblocks_delta) {
607 INT_MOD(sbp->sb_rbmblocks, ARCH_CONVERT, tp->t_rbmblocks_delta); 601 be32_add(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta);
608 whole = 1; 602 whole = 1;
609 } 603 }
610 if (tp->t_rblocks_delta != 0) { 604 if (tp->t_rblocks_delta) {
611 INT_MOD(sbp->sb_rblocks, ARCH_CONVERT, tp->t_rblocks_delta); 605 be64_add(&sbp->sb_rblocks, tp->t_rblocks_delta);
612 whole = 1; 606 whole = 1;
613 } 607 }
614 if (tp->t_rextents_delta != 0) { 608 if (tp->t_rextents_delta) {
615 INT_MOD(sbp->sb_rextents, ARCH_CONVERT, tp->t_rextents_delta); 609 be64_add(&sbp->sb_rextents, tp->t_rextents_delta);
616 whole = 1; 610 whole = 1;
617 } 611 }
618 if (tp->t_rextslog_delta != 0) { 612 if (tp->t_rextslog_delta) {
619 INT_MOD(sbp->sb_rextslog, ARCH_CONVERT, tp->t_rextslog_delta); 613 sbp->sb_rextslog += tp->t_rextslog_delta;
620 whole = 1; 614 whole = 1;
621 } 615 }
622 616
@@ -624,17 +618,17 @@ xfs_trans_apply_sb_deltas(
624 /* 618 /*
625 * Log the whole thing, the fields are noncontiguous. 619 * Log the whole thing, the fields are noncontiguous.
626 */ 620 */
627 xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_sb_t) - 1); 621 xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_dsb_t) - 1);
628 else 622 else
629 /* 623 /*
630 * Since all the modifiable fields are contiguous, we 624 * Since all the modifiable fields are contiguous, we
631 * can get away with this. 625 * can get away with this.
632 */ 626 */
633 xfs_trans_log_buf(tp, bp, offsetof(xfs_sb_t, sb_icount), 627 xfs_trans_log_buf(tp, bp, offsetof(xfs_dsb_t, sb_icount),
634 offsetof(xfs_sb_t, sb_frextents) + 628 offsetof(xfs_dsb_t, sb_frextents) +
635 sizeof(sbp->sb_frextents) - 1); 629 sizeof(sbp->sb_frextents) - 1);
636 630
637 XFS_MTOVFS(tp->t_mountp)->vfs_super->s_dirt = 1; 631 tp->t_mountp->m_super->s_dirt = 1;
638} 632}
639 633
640/* 634/*
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index ceb4f6e99960..5b2ff59f19cf 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dmapi.h" 26#include "xfs_dmapi.h"
26#include "xfs_mount.h" 27#include "xfs_mount.h"
27#include "xfs_trans_priv.h" 28#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index b290270dd4a6..27cce2a9c7e9 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -22,6 +22,7 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
25#include "xfs_dmapi.h" 26#include "xfs_dmapi.h"
26#include "xfs_mount.h" 27#include "xfs_mount.h"
27#include "xfs_trans_priv.h" 28#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index 104f64a98790..5c89be475464 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -151,18 +151,6 @@ typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */
151 */ 151 */
152#define MAXNAMELEN 256 152#define MAXNAMELEN 256
153 153
154typedef struct xfs_dirent { /* data from readdir() */
155 xfs_ino_t d_ino; /* inode number of entry */
156 xfs_off_t d_off; /* offset of disk directory entry */
157 unsigned short d_reclen; /* length of this record */
158 char d_name[1]; /* name of file */
159} xfs_dirent_t;
160
161#define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0)
162#define DIRENTSIZE(namelen) \
163 ((DIRENTBASESIZE + (namelen) + \
164 sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1))
165
166typedef enum { 154typedef enum {
167 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi 155 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
168} xfs_lookup_t; 156} xfs_lookup_t;
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 20ffec308e1e..673b405eaa31 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -65,20 +65,15 @@ xfs_get_dir_entry(
65 65
66int 66int
67xfs_dir_lookup_int( 67xfs_dir_lookup_int(
68 bhv_desc_t *dir_bdp, 68 xfs_inode_t *dp,
69 uint lock_mode, 69 uint lock_mode,
70 bhv_vname_t *dentry, 70 bhv_vname_t *dentry,
71 xfs_ino_t *inum, 71 xfs_ino_t *inum,
72 xfs_inode_t **ipp) 72 xfs_inode_t **ipp)
73{ 73{
74 bhv_vnode_t *dir_vp;
75 xfs_inode_t *dp;
76 int error; 74 int error;
77 75
78 dir_vp = BHV_TO_VNODE(dir_bdp); 76 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
79 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
80
81 dp = XFS_BHVTOI(dir_bdp);
82 77
83 error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum); 78 error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum);
84 if (!error) { 79 if (!error) {
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h
index fe953e98afa7..a00b26d8840e 100644
--- a/fs/xfs/xfs_utils.h
+++ b/fs/xfs/xfs_utils.h
@@ -20,13 +20,11 @@
20 20
21#define IRELE(ip) VN_RELE(XFS_ITOV(ip)) 21#define IRELE(ip) VN_RELE(XFS_ITOV(ip))
22#define IHOLD(ip) VN_HOLD(XFS_ITOV(ip)) 22#define IHOLD(ip) VN_HOLD(XFS_ITOV(ip))
23#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \ 23#define ITRACE(ip) vn_trace_ref(ip, __FILE__, __LINE__, \
24 (inst_t *)__return_address) 24 (inst_t *)__return_address)
25 25
26extern int xfs_rename (bhv_desc_t *, bhv_vname_t *, bhv_vnode_t *,
27 bhv_vname_t *, cred_t *);
28extern int xfs_get_dir_entry (bhv_vname_t *, xfs_inode_t **); 26extern int xfs_get_dir_entry (bhv_vname_t *, xfs_inode_t **);
29extern int xfs_dir_lookup_int (bhv_desc_t *, uint, bhv_vname_t *, xfs_ino_t *, 27extern int xfs_dir_lookup_int (xfs_inode_t *, uint, bhv_vname_t *, xfs_ino_t *,
30 xfs_inode_t **); 28 xfs_inode_t **);
31extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *); 29extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *);
32extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, 30extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t,
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 11f5ea29a038..a5a8454f2a63 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -54,8 +54,9 @@
54#include "xfs_mru_cache.h" 54#include "xfs_mru_cache.h"
55#include "xfs_filestream.h" 55#include "xfs_filestream.h"
56#include "xfs_fsops.h" 56#include "xfs_fsops.h"
57#include "xfs_vnodeops.h"
58#include "xfs_vfsops.h"
57 59
58STATIC int xfs_sync(bhv_desc_t *, int, cred_t *);
59 60
60int 61int
61xfs_init(void) 62xfs_init(void)
@@ -117,8 +118,8 @@ xfs_init(void)
117 xfs_ili_zone = 118 xfs_ili_zone =
118 kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili", 119 kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili",
119 KM_ZONE_SPREAD, NULL); 120 KM_ZONE_SPREAD, NULL);
120 xfs_chashlist_zone = 121 xfs_icluster_zone =
121 kmem_zone_init_flags(sizeof(xfs_chashlist_t), "xfs_chashlist", 122 kmem_zone_init_flags(sizeof(xfs_icluster_t), "xfs_icluster",
122 KM_ZONE_SPREAD, NULL); 123 KM_ZONE_SPREAD, NULL);
123 124
124 /* 125 /*
@@ -163,7 +164,7 @@ xfs_cleanup(void)
163 extern kmem_zone_t *xfs_efd_zone; 164 extern kmem_zone_t *xfs_efd_zone;
164 extern kmem_zone_t *xfs_efi_zone; 165 extern kmem_zone_t *xfs_efi_zone;
165 extern kmem_zone_t *xfs_buf_item_zone; 166 extern kmem_zone_t *xfs_buf_item_zone;
166 extern kmem_zone_t *xfs_chashlist_zone; 167 extern kmem_zone_t *xfs_icluster_zone;
167 168
168 xfs_cleanup_procfs(); 169 xfs_cleanup_procfs();
169 xfs_sysctl_unregister(); 170 xfs_sysctl_unregister();
@@ -199,7 +200,7 @@ xfs_cleanup(void)
199 kmem_zone_destroy(xfs_efi_zone); 200 kmem_zone_destroy(xfs_efi_zone);
200 kmem_zone_destroy(xfs_ifork_zone); 201 kmem_zone_destroy(xfs_ifork_zone);
201 kmem_zone_destroy(xfs_ili_zone); 202 kmem_zone_destroy(xfs_ili_zone);
202 kmem_zone_destroy(xfs_chashlist_zone); 203 kmem_zone_destroy(xfs_icluster_zone);
203} 204}
204 205
205/* 206/*
@@ -210,7 +211,6 @@ xfs_cleanup(void)
210 */ 211 */
211STATIC int 212STATIC int
212xfs_start_flags( 213xfs_start_flags(
213 struct bhv_vfs *vfs,
214 struct xfs_mount_args *ap, 214 struct xfs_mount_args *ap,
215 struct xfs_mount *mp) 215 struct xfs_mount *mp)
216{ 216{
@@ -238,17 +238,14 @@ xfs_start_flags(
238 mp->m_logbufs = ap->logbufs; 238 mp->m_logbufs = ap->logbufs;
239 if (ap->logbufsize != -1 && 239 if (ap->logbufsize != -1 &&
240 ap->logbufsize != 0 && 240 ap->logbufsize != 0 &&
241 ap->logbufsize != 16 * 1024 && 241 (ap->logbufsize < XLOG_MIN_RECORD_BSIZE ||
242 ap->logbufsize != 32 * 1024 && 242 ap->logbufsize > XLOG_MAX_RECORD_BSIZE ||
243 ap->logbufsize != 64 * 1024 && 243 !is_power_of_2(ap->logbufsize))) {
244 ap->logbufsize != 128 * 1024 &&
245 ap->logbufsize != 256 * 1024) {
246 cmn_err(CE_WARN, 244 cmn_err(CE_WARN,
247 "XFS: invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]", 245 "XFS: invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
248 ap->logbufsize); 246 ap->logbufsize);
249 return XFS_ERROR(EINVAL); 247 return XFS_ERROR(EINVAL);
250 } 248 }
251 mp->m_ihsize = ap->ihashsize;
252 mp->m_logbsize = ap->logbufsize; 249 mp->m_logbsize = ap->logbufsize;
253 mp->m_fsname_len = strlen(ap->fsname) + 1; 250 mp->m_fsname_len = strlen(ap->fsname) + 1;
254 mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP); 251 mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP);
@@ -295,8 +292,6 @@ xfs_start_flags(
295 mp->m_readio_log = mp->m_writeio_log = ap->iosizelog; 292 mp->m_readio_log = mp->m_writeio_log = ap->iosizelog;
296 } 293 }
297 294
298 if (ap->flags & XFSMNT_IHASHSIZE)
299 mp->m_flags |= XFS_MOUNT_IHASHSIZE;
300 if (ap->flags & XFSMNT_IDELETE) 295 if (ap->flags & XFSMNT_IDELETE)
301 mp->m_flags |= XFS_MOUNT_IDELETE; 296 mp->m_flags |= XFS_MOUNT_IDELETE;
302 if (ap->flags & XFSMNT_DIRSYNC) 297 if (ap->flags & XFSMNT_DIRSYNC)
@@ -311,7 +306,7 @@ xfs_start_flags(
311 * no recovery flag requires a read-only mount 306 * no recovery flag requires a read-only mount
312 */ 307 */
313 if (ap->flags & XFSMNT_NORECOVERY) { 308 if (ap->flags & XFSMNT_NORECOVERY) {
314 if (!(vfs->vfs_flag & VFS_RDONLY)) { 309 if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
315 cmn_err(CE_WARN, 310 cmn_err(CE_WARN,
316 "XFS: tried to mount a FS read-write without recovery!"); 311 "XFS: tried to mount a FS read-write without recovery!");
317 return XFS_ERROR(EINVAL); 312 return XFS_ERROR(EINVAL);
@@ -329,6 +324,8 @@ xfs_start_flags(
329 if (ap->flags2 & XFSMNT2_FILESTREAMS) 324 if (ap->flags2 & XFSMNT2_FILESTREAMS)
330 mp->m_flags |= XFS_MOUNT_FILESTREAMS; 325 mp->m_flags |= XFS_MOUNT_FILESTREAMS;
331 326
327 if (ap->flags & XFSMNT_DMAPI)
328 mp->m_flags |= XFS_MOUNT_DMAPI;
332 return 0; 329 return 0;
333} 330}
334 331
@@ -338,11 +335,10 @@ xfs_start_flags(
338 */ 335 */
339STATIC int 336STATIC int
340xfs_finish_flags( 337xfs_finish_flags(
341 struct bhv_vfs *vfs,
342 struct xfs_mount_args *ap, 338 struct xfs_mount_args *ap,
343 struct xfs_mount *mp) 339 struct xfs_mount *mp)
344{ 340{
345 int ronly = (vfs->vfs_flag & VFS_RDONLY); 341 int ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
346 342
347 /* Fail a mount where the logbuf is smaller then the log stripe */ 343 /* Fail a mount where the logbuf is smaller then the log stripe */
348 if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) { 344 if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) {
@@ -403,6 +399,22 @@ xfs_finish_flags(
403 return XFS_ERROR(EINVAL); 399 return XFS_ERROR(EINVAL);
404 } 400 }
405 401
402 if (ap->flags & XFSMNT_UQUOTA) {
403 mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE);
404 if (ap->flags & XFSMNT_UQUOTAENF)
405 mp->m_qflags |= XFS_UQUOTA_ENFD;
406 }
407
408 if (ap->flags & XFSMNT_GQUOTA) {
409 mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
410 if (ap->flags & XFSMNT_GQUOTAENF)
411 mp->m_qflags |= XFS_OQUOTA_ENFD;
412 } else if (ap->flags & XFSMNT_PQUOTA) {
413 mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
414 if (ap->flags & XFSMNT_PQUOTAENF)
415 mp->m_qflags |= XFS_OQUOTA_ENFD;
416 }
417
406 return 0; 418 return 0;
407} 419}
408 420
@@ -418,30 +430,26 @@ xfs_finish_flags(
418 * they are present. The data subvolume has already been opened by 430 * they are present. The data subvolume has already been opened by
419 * get_sb_bdev() and is stored in vfsp->vfs_super->s_bdev. 431 * get_sb_bdev() and is stored in vfsp->vfs_super->s_bdev.
420 */ 432 */
421STATIC int 433int
422xfs_mount( 434xfs_mount(
423 struct bhv_desc *bhvp, 435 struct xfs_mount *mp,
424 struct xfs_mount_args *args, 436 struct xfs_mount_args *args,
425 cred_t *credp) 437 cred_t *credp)
426{ 438{
427 struct bhv_vfs *vfsp = bhvtovfs(bhvp);
428 struct bhv_desc *p;
429 struct xfs_mount *mp = XFS_BHVTOM(bhvp);
430 struct block_device *ddev, *logdev, *rtdev; 439 struct block_device *ddev, *logdev, *rtdev;
431 int flags = 0, error; 440 int flags = 0, error;
432 441
433 ddev = vfsp->vfs_super->s_bdev; 442 ddev = mp->m_super->s_bdev;
434 logdev = rtdev = NULL; 443 logdev = rtdev = NULL;
435 444
436 /* 445 error = xfs_dmops_get(mp, args);
437 * Setup xfs_mount function vectors from available behaviors 446 if (error)
438 */ 447 return error;
439 p = vfs_bhv_lookup(vfsp, VFS_POSITION_DM); 448 error = xfs_qmops_get(mp, args);
440 mp->m_dm_ops = p ? *(xfs_dmops_t *) vfs_bhv_custom(p) : xfs_dmcore_stub; 449 if (error)
441 p = vfs_bhv_lookup(vfsp, VFS_POSITION_QM); 450 return error;
442 mp->m_qm_ops = p ? *(xfs_qmops_t *) vfs_bhv_custom(p) : xfs_qmcore_stub; 451
443 p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO); 452 mp->m_io_ops = xfs_iocore_xfs;
444 mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs;
445 453
446 if (args->flags & XFSMNT_QUIET) 454 if (args->flags & XFSMNT_QUIET)
447 flags |= XFS_MFSI_QUIET; 455 flags |= XFS_MFSI_QUIET;
@@ -482,24 +490,30 @@ xfs_mount(
482 } 490 }
483 if (rtdev) { 491 if (rtdev) {
484 mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1); 492 mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1);
485 if (!mp->m_rtdev_targp) 493 if (!mp->m_rtdev_targp) {
494 xfs_blkdev_put(logdev);
495 xfs_blkdev_put(rtdev);
486 goto error0; 496 goto error0;
497 }
487 } 498 }
488 mp->m_logdev_targp = (logdev && logdev != ddev) ? 499 mp->m_logdev_targp = (logdev && logdev != ddev) ?
489 xfs_alloc_buftarg(logdev, 1) : mp->m_ddev_targp; 500 xfs_alloc_buftarg(logdev, 1) : mp->m_ddev_targp;
490 if (!mp->m_logdev_targp) 501 if (!mp->m_logdev_targp) {
502 xfs_blkdev_put(logdev);
503 xfs_blkdev_put(rtdev);
491 goto error0; 504 goto error0;
505 }
492 506
493 /* 507 /*
494 * Setup flags based on mount(2) options and then the superblock 508 * Setup flags based on mount(2) options and then the superblock
495 */ 509 */
496 error = xfs_start_flags(vfsp, args, mp); 510 error = xfs_start_flags(args, mp);
497 if (error) 511 if (error)
498 goto error1; 512 goto error1;
499 error = xfs_readsb(mp, flags); 513 error = xfs_readsb(mp, flags);
500 if (error) 514 if (error)
501 goto error1; 515 goto error1;
502 error = xfs_finish_flags(vfsp, args, mp); 516 error = xfs_finish_flags(args, mp);
503 if (error) 517 if (error)
504 goto error2; 518 goto error2;
505 519
@@ -530,10 +544,12 @@ xfs_mount(
530 if ((error = xfs_filestream_mount(mp))) 544 if ((error = xfs_filestream_mount(mp)))
531 goto error2; 545 goto error2;
532 546
533 error = XFS_IOINIT(vfsp, args, flags); 547 error = XFS_IOINIT(mp, args, flags);
534 if (error) 548 if (error)
535 goto error2; 549 goto error2;
536 550
551 XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, args->mtpt, args->fsname);
552
537 return 0; 553 return 0;
538 554
539error2: 555error2:
@@ -547,17 +563,17 @@ error1:
547 xfs_binval(mp->m_rtdev_targp); 563 xfs_binval(mp->m_rtdev_targp);
548error0: 564error0:
549 xfs_unmountfs_close(mp, credp); 565 xfs_unmountfs_close(mp, credp);
566 xfs_qmops_put(mp);
567 xfs_dmops_put(mp);
550 return error; 568 return error;
551} 569}
552 570
553STATIC int 571int
554xfs_unmount( 572xfs_unmount(
555 bhv_desc_t *bdp, 573 xfs_mount_t *mp,
556 int flags, 574 int flags,
557 cred_t *credp) 575 cred_t *credp)
558{ 576{
559 bhv_vfs_t *vfsp = bhvtovfs(bdp);
560 xfs_mount_t *mp = XFS_BHVTOM(bdp);
561 xfs_inode_t *rip; 577 xfs_inode_t *rip;
562 bhv_vnode_t *rvp; 578 bhv_vnode_t *rvp;
563 int unmount_event_wanted = 0; 579 int unmount_event_wanted = 0;
@@ -568,8 +584,9 @@ xfs_unmount(
568 rip = mp->m_rootip; 584 rip = mp->m_rootip;
569 rvp = XFS_ITOV(rip); 585 rvp = XFS_ITOV(rip);
570 586
571 if (vfsp->vfs_flag & VFS_DMI) { 587#ifdef HAVE_DMAPI
572 error = XFS_SEND_PREUNMOUNT(mp, vfsp, 588 if (mp->m_flags & XFS_MOUNT_DMAPI) {
589 error = XFS_SEND_PREUNMOUNT(mp,
573 rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL, 590 rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL,
574 NULL, NULL, 0, 0, 591 NULL, NULL, 0, 0,
575 (mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))? 592 (mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))?
@@ -580,7 +597,7 @@ xfs_unmount(
580 unmount_event_flags = (mp->m_dmevmask & (1<<DM_EVENT_UNMOUNT))? 597 unmount_event_flags = (mp->m_dmevmask & (1<<DM_EVENT_UNMOUNT))?
581 0 : DM_FLAGS_UNWANTED; 598 0 : DM_FLAGS_UNWANTED;
582 } 599 }
583 600#endif
584 /* 601 /*
585 * First blow any referenced inode from this file system 602 * First blow any referenced inode from this file system
586 * out of the reference cache, and delete the timer. 603 * out of the reference cache, and delete the timer.
@@ -612,8 +629,7 @@ xfs_unmount(
612 * referenced vnodes as well. 629 * referenced vnodes as well.
613 */ 630 */
614 if (XFS_FORCED_SHUTDOWN(mp)) { 631 if (XFS_FORCED_SHUTDOWN(mp)) {
615 error = xfs_sync(&mp->m_bhv, 632 error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE);
616 (SYNC_WAIT | SYNC_CLOSE), credp);
617 ASSERT(error != EFSCORRUPTED); 633 ASSERT(error != EFSCORRUPTED);
618 } 634 }
619 xfs_unmountfs_needed = 1; 635 xfs_unmountfs_needed = 1;
@@ -627,7 +643,7 @@ out:
627 /* Note: mp structure must still exist for 643 /* Note: mp structure must still exist for
628 * XFS_SEND_UNMOUNT() call. 644 * XFS_SEND_UNMOUNT() call.
629 */ 645 */
630 XFS_SEND_UNMOUNT(mp, vfsp, error == 0 ? rvp : NULL, 646 XFS_SEND_UNMOUNT(mp, error == 0 ? rvp : NULL,
631 DM_RIGHT_NULL, 0, error, unmount_event_flags); 647 DM_RIGHT_NULL, 0, error, unmount_event_flags);
632 } 648 }
633 if (xfs_unmountfs_needed) { 649 if (xfs_unmountfs_needed) {
@@ -636,6 +652,9 @@ out:
636 * and free the super block buffer & mount structures. 652 * and free the super block buffer & mount structures.
637 */ 653 */
638 xfs_unmountfs(mp, credp); 654 xfs_unmountfs(mp, credp);
655 xfs_qmops_put(mp);
656 xfs_dmops_put(mp);
657 kmem_free(mp, sizeof(xfs_mount_t));
639 } 658 }
640 659
641 return XFS_ERROR(error); 660 return XFS_ERROR(error);
@@ -694,29 +713,26 @@ xfs_attr_quiesce(
694 xfs_unmountfs_writesb(mp); 713 xfs_unmountfs_writesb(mp);
695} 714}
696 715
697STATIC int 716int
698xfs_mntupdate( 717xfs_mntupdate(
699 bhv_desc_t *bdp, 718 struct xfs_mount *mp,
700 int *flags, 719 int *flags,
701 struct xfs_mount_args *args) 720 struct xfs_mount_args *args)
702{ 721{
703 bhv_vfs_t *vfsp = bhvtovfs(bdp);
704 xfs_mount_t *mp = XFS_BHVTOM(bdp);
705
706 if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */ 722 if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */
707 if (vfsp->vfs_flag & VFS_RDONLY) 723 if (mp->m_flags & XFS_MOUNT_RDONLY)
708 vfsp->vfs_flag &= ~VFS_RDONLY; 724 mp->m_flags &= ~XFS_MOUNT_RDONLY;
709 if (args->flags & XFSMNT_BARRIER) { 725 if (args->flags & XFSMNT_BARRIER) {
710 mp->m_flags |= XFS_MOUNT_BARRIER; 726 mp->m_flags |= XFS_MOUNT_BARRIER;
711 xfs_mountfs_check_barriers(mp); 727 xfs_mountfs_check_barriers(mp);
712 } else { 728 } else {
713 mp->m_flags &= ~XFS_MOUNT_BARRIER; 729 mp->m_flags &= ~XFS_MOUNT_BARRIER;
714 } 730 }
715 } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */ 731 } else if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { /* rw -> ro */
716 xfs_filestream_flush(mp); 732 xfs_filestream_flush(mp);
717 bhv_vfs_sync(vfsp, SYNC_DATA_QUIESCE, NULL); 733 xfs_sync(mp, SYNC_DATA_QUIESCE);
718 xfs_attr_quiesce(mp); 734 xfs_attr_quiesce(mp);
719 vfsp->vfs_flag |= VFS_RDONLY; 735 mp->m_flags |= XFS_MOUNT_RDONLY;
720 } 736 }
721 return 0; 737 return 0;
722} 738}
@@ -811,14 +827,14 @@ fscorrupt_out2:
811 * vpp -- address of the caller's vnode pointer which should be 827 * vpp -- address of the caller's vnode pointer which should be
812 * set to the desired fs root vnode 828 * set to the desired fs root vnode
813 */ 829 */
814STATIC int 830int
815xfs_root( 831xfs_root(
816 bhv_desc_t *bdp, 832 xfs_mount_t *mp,
817 bhv_vnode_t **vpp) 833 bhv_vnode_t **vpp)
818{ 834{
819 bhv_vnode_t *vp; 835 bhv_vnode_t *vp;
820 836
821 vp = XFS_ITOV((XFS_BHVTOM(bdp))->m_rootip); 837 vp = XFS_ITOV(mp->m_rootip);
822 VN_HOLD(vp); 838 VN_HOLD(vp);
823 *vpp = vp; 839 *vpp = vp;
824 return 0; 840 return 0;
@@ -831,19 +847,17 @@ xfs_root(
831 * the superblock lock in the mount structure to ensure a consistent 847 * the superblock lock in the mount structure to ensure a consistent
832 * snapshot of the counters returned. 848 * snapshot of the counters returned.
833 */ 849 */
834STATIC int 850int
835xfs_statvfs( 851xfs_statvfs(
836 bhv_desc_t *bdp, 852 xfs_mount_t *mp,
837 bhv_statvfs_t *statp, 853 bhv_statvfs_t *statp,
838 bhv_vnode_t *vp) 854 bhv_vnode_t *vp)
839{ 855{
840 __uint64_t fakeinos; 856 __uint64_t fakeinos;
841 xfs_extlen_t lsize; 857 xfs_extlen_t lsize;
842 xfs_mount_t *mp;
843 xfs_sb_t *sbp; 858 xfs_sb_t *sbp;
844 unsigned long s; 859 unsigned long s;
845 860
846 mp = XFS_BHVTOM(bdp);
847 sbp = &(mp->m_sb); 861 sbp = &(mp->m_sb);
848 862
849 statp->f_type = XFS_SB_MAGIC; 863 statp->f_type = XFS_SB_MAGIC;
@@ -874,6 +888,8 @@ xfs_statvfs(
874 xfs_statvfs_fsid(statp, mp); 888 xfs_statvfs_fsid(statp, mp);
875 statp->f_namelen = MAXNAMELEN - 1; 889 statp->f_namelen = MAXNAMELEN - 1;
876 890
891 if (vp)
892 XFS_QM_DQSTATVFS(xfs_vtoi(vp), statp);
877 return 0; 893 return 0;
878} 894}
879 895
@@ -920,14 +936,30 @@ xfs_statvfs(
920 * filesystem. 936 * filesystem.
921 * 937 *
922 */ 938 */
923/*ARGSUSED*/ 939int
924STATIC int
925xfs_sync( 940xfs_sync(
926 bhv_desc_t *bdp, 941 xfs_mount_t *mp,
927 int flags, 942 int flags)
928 cred_t *credp)
929{ 943{
930 xfs_mount_t *mp = XFS_BHVTOM(bdp); 944 int error;
945
946 /*
947 * Get the Quota Manager to flush the dquots.
948 *
949 * If XFS quota support is not enabled or this filesystem
950 * instance does not use quotas XFS_QM_DQSYNC will always
951 * return zero.
952 */
953 error = XFS_QM_DQSYNC(mp, flags);
954 if (error) {
955 /*
956 * If we got an IO error, we will be shutting down.
957 * So, there's nothing more for us to do here.
958 */
959 ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp));
960 if (XFS_FORCED_SHUTDOWN(mp))
961 return XFS_ERROR(error);
962 }
931 963
932 if (flags & SYNC_IOWAIT) 964 if (flags & SYNC_IOWAIT)
933 xfs_filestream_flush(mp); 965 xfs_filestream_flush(mp);
@@ -1015,7 +1047,7 @@ xfs_sync_inodes(
1015 1047
1016 if (bypassed) 1048 if (bypassed)
1017 *bypassed = 0; 1049 *bypassed = 0;
1018 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 1050 if (mp->m_flags & XFS_MOUNT_RDONLY)
1019 return 0; 1051 return 0;
1020 error = 0; 1052 error = 0;
1021 last_error = 0; 1053 last_error = 0;
@@ -1189,12 +1221,13 @@ xfs_sync_inodes(
1189 if (flags & SYNC_CLOSE) { 1221 if (flags & SYNC_CLOSE) {
1190 /* Shutdown case. Flush and invalidate. */ 1222 /* Shutdown case. Flush and invalidate. */
1191 if (XFS_FORCED_SHUTDOWN(mp)) 1223 if (XFS_FORCED_SHUTDOWN(mp))
1192 bhv_vop_toss_pages(vp, 0, -1, FI_REMAPF); 1224 xfs_tosspages(ip, 0, -1,
1225 FI_REMAPF);
1193 else 1226 else
1194 error = bhv_vop_flushinval_pages(vp, 0, 1227 error = xfs_flushinval_pages(ip,
1195 -1, FI_REMAPF); 1228 0, -1, FI_REMAPF);
1196 } else if ((flags & SYNC_DELWRI) && VN_DIRTY(vp)) { 1229 } else if ((flags & SYNC_DELWRI) && VN_DIRTY(vp)) {
1197 error = bhv_vop_flush_pages(vp, (xfs_off_t)0, 1230 error = xfs_flush_pages(ip, 0,
1198 -1, fflag, FI_NONE); 1231 -1, fflag, FI_NONE);
1199 } 1232 }
1200 1233
@@ -1204,7 +1237,7 @@ xfs_sync_inodes(
1204 * place after this point 1237 * place after this point
1205 */ 1238 */
1206 if (flags & SYNC_IOWAIT) 1239 if (flags & SYNC_IOWAIT)
1207 vn_iowait(vp); 1240 vn_iowait(ip);
1208 1241
1209 xfs_ilock(ip, XFS_ILOCK_SHARED); 1242 xfs_ilock(ip, XFS_ILOCK_SHARED);
1210 } 1243 }
@@ -1598,13 +1631,12 @@ xfs_syncsub(
1598/* 1631/*
1599 * xfs_vget - called by DMAPI and NFSD to get vnode from file handle 1632 * xfs_vget - called by DMAPI and NFSD to get vnode from file handle
1600 */ 1633 */
1601STATIC int 1634int
1602xfs_vget( 1635xfs_vget(
1603 bhv_desc_t *bdp, 1636 xfs_mount_t *mp,
1604 bhv_vnode_t **vpp, 1637 bhv_vnode_t **vpp,
1605 fid_t *fidp) 1638 fid_t *fidp)
1606{ 1639{
1607 xfs_mount_t *mp = XFS_BHVTOM(bdp);
1608 xfs_fid_t *xfid = (struct xfs_fid *)fidp; 1640 xfs_fid_t *xfid = (struct xfs_fid *)fidp;
1609 xfs_inode_t *ip; 1641 xfs_inode_t *ip;
1610 int error; 1642 int error;
@@ -1668,7 +1700,6 @@ xfs_vget(
1668#define MNTOPT_BSDGROUPS "bsdgroups" /* group-ID from parent directory */ 1700#define MNTOPT_BSDGROUPS "bsdgroups" /* group-ID from parent directory */
1669#define MNTOPT_SYSVGROUPS "sysvgroups" /* group-ID from current process */ 1701#define MNTOPT_SYSVGROUPS "sysvgroups" /* group-ID from current process */
1670#define MNTOPT_ALLOCSIZE "allocsize" /* preferred allocation size */ 1702#define MNTOPT_ALLOCSIZE "allocsize" /* preferred allocation size */
1671#define MNTOPT_IHASHSIZE "ihashsize" /* size of inode hash table */
1672#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */ 1703#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */
1673#define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and 1704#define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and
1674 * unwritten extent conversion */ 1705 * unwritten extent conversion */
@@ -1683,6 +1714,21 @@ xfs_vget(
1683#define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */ 1714#define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */
1684#define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */ 1715#define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */
1685#define MNTOPT_FILESTREAM "filestreams" /* use filestreams allocator */ 1716#define MNTOPT_FILESTREAM "filestreams" /* use filestreams allocator */
1717#define MNTOPT_QUOTA "quota" /* disk quotas (user) */
1718#define MNTOPT_NOQUOTA "noquota" /* no quotas */
1719#define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */
1720#define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */
1721#define MNTOPT_PRJQUOTA "prjquota" /* project quota enabled */
1722#define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */
1723#define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */
1724#define MNTOPT_PQUOTA "pquota" /* project quota (IRIX variant) */
1725#define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */
1726#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */
1727#define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */
1728#define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */
1729#define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */
1730#define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */
1731#define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */
1686 1732
1687STATIC unsigned long 1733STATIC unsigned long
1688suffix_strtoul(char *s, char **endp, unsigned int base) 1734suffix_strtoul(char *s, char **endp, unsigned int base)
@@ -1707,19 +1753,18 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
1707 return simple_strtoul((const char *)s, endp, base) << shift_left_factor; 1753 return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
1708} 1754}
1709 1755
1710STATIC int 1756int
1711xfs_parseargs( 1757xfs_parseargs(
1712 struct bhv_desc *bhv, 1758 struct xfs_mount *mp,
1713 char *options, 1759 char *options,
1714 struct xfs_mount_args *args, 1760 struct xfs_mount_args *args,
1715 int update) 1761 int update)
1716{ 1762{
1717 bhv_vfs_t *vfsp = bhvtovfs(bhv);
1718 char *this_char, *value, *eov; 1763 char *this_char, *value, *eov;
1719 int dsunit, dswidth, vol_dsunit, vol_dswidth; 1764 int dsunit, dswidth, vol_dsunit, vol_dswidth;
1720 int iosize; 1765 int iosize;
1766 int ikeep = 0;
1721 1767
1722 args->flags |= XFSMNT_IDELETE;
1723 args->flags |= XFSMNT_BARRIER; 1768 args->flags |= XFSMNT_BARRIER;
1724 args->flags2 |= XFSMNT2_COMPAT_IOSIZE; 1769 args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
1725 1770
@@ -1794,21 +1839,12 @@ xfs_parseargs(
1794 iosize = suffix_strtoul(value, &eov, 10); 1839 iosize = suffix_strtoul(value, &eov, 10);
1795 args->flags |= XFSMNT_IOSIZE; 1840 args->flags |= XFSMNT_IOSIZE;
1796 args->iosizelog = ffs(iosize) - 1; 1841 args->iosizelog = ffs(iosize) - 1;
1797 } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) {
1798 if (!value || !*value) {
1799 cmn_err(CE_WARN,
1800 "XFS: %s option requires an argument",
1801 this_char);
1802 return EINVAL;
1803 }
1804 args->flags |= XFSMNT_IHASHSIZE;
1805 args->ihashsize = simple_strtoul(value, &eov, 10);
1806 } else if (!strcmp(this_char, MNTOPT_GRPID) || 1842 } else if (!strcmp(this_char, MNTOPT_GRPID) ||
1807 !strcmp(this_char, MNTOPT_BSDGROUPS)) { 1843 !strcmp(this_char, MNTOPT_BSDGROUPS)) {
1808 vfsp->vfs_flag |= VFS_GRPID; 1844 mp->m_flags |= XFS_MOUNT_GRPID;
1809 } else if (!strcmp(this_char, MNTOPT_NOGRPID) || 1845 } else if (!strcmp(this_char, MNTOPT_NOGRPID) ||
1810 !strcmp(this_char, MNTOPT_SYSVGROUPS)) { 1846 !strcmp(this_char, MNTOPT_SYSVGROUPS)) {
1811 vfsp->vfs_flag &= ~VFS_GRPID; 1847 mp->m_flags &= ~XFS_MOUNT_GRPID;
1812 } else if (!strcmp(this_char, MNTOPT_WSYNC)) { 1848 } else if (!strcmp(this_char, MNTOPT_WSYNC)) {
1813 args->flags |= XFSMNT_WSYNC; 1849 args->flags |= XFSMNT_WSYNC;
1814 } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) { 1850 } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) {
@@ -1858,6 +1894,7 @@ xfs_parseargs(
1858 } else if (!strcmp(this_char, MNTOPT_NOBARRIER)) { 1894 } else if (!strcmp(this_char, MNTOPT_NOBARRIER)) {
1859 args->flags &= ~XFSMNT_BARRIER; 1895 args->flags &= ~XFSMNT_BARRIER;
1860 } else if (!strcmp(this_char, MNTOPT_IKEEP)) { 1896 } else if (!strcmp(this_char, MNTOPT_IKEEP)) {
1897 ikeep = 1;
1861 args->flags &= ~XFSMNT_IDELETE; 1898 args->flags &= ~XFSMNT_IDELETE;
1862 } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) { 1899 } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) {
1863 args->flags |= XFSMNT_IDELETE; 1900 args->flags |= XFSMNT_IDELETE;
@@ -1871,6 +1908,38 @@ xfs_parseargs(
1871 args->flags &= ~XFSMNT_ATTR2; 1908 args->flags &= ~XFSMNT_ATTR2;
1872 } else if (!strcmp(this_char, MNTOPT_FILESTREAM)) { 1909 } else if (!strcmp(this_char, MNTOPT_FILESTREAM)) {
1873 args->flags2 |= XFSMNT2_FILESTREAMS; 1910 args->flags2 |= XFSMNT2_FILESTREAMS;
1911 } else if (!strcmp(this_char, MNTOPT_NOQUOTA)) {
1912 args->flags &= ~(XFSMNT_UQUOTAENF|XFSMNT_UQUOTA);
1913 args->flags &= ~(XFSMNT_GQUOTAENF|XFSMNT_GQUOTA);
1914 } else if (!strcmp(this_char, MNTOPT_QUOTA) ||
1915 !strcmp(this_char, MNTOPT_UQUOTA) ||
1916 !strcmp(this_char, MNTOPT_USRQUOTA)) {
1917 args->flags |= XFSMNT_UQUOTA | XFSMNT_UQUOTAENF;
1918 } else if (!strcmp(this_char, MNTOPT_QUOTANOENF) ||
1919 !strcmp(this_char, MNTOPT_UQUOTANOENF)) {
1920 args->flags |= XFSMNT_UQUOTA;
1921 args->flags &= ~XFSMNT_UQUOTAENF;
1922 } else if (!strcmp(this_char, MNTOPT_PQUOTA) ||
1923 !strcmp(this_char, MNTOPT_PRJQUOTA)) {
1924 args->flags |= XFSMNT_PQUOTA | XFSMNT_PQUOTAENF;
1925 } else if (!strcmp(this_char, MNTOPT_PQUOTANOENF)) {
1926 args->flags |= XFSMNT_PQUOTA;
1927 args->flags &= ~XFSMNT_PQUOTAENF;
1928 } else if (!strcmp(this_char, MNTOPT_GQUOTA) ||
1929 !strcmp(this_char, MNTOPT_GRPQUOTA)) {
1930 args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF;
1931 } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) {
1932 args->flags |= XFSMNT_GQUOTA;
1933 args->flags &= ~XFSMNT_GQUOTAENF;
1934 } else if (!strcmp(this_char, MNTOPT_DMAPI)) {
1935 args->flags |= XFSMNT_DMAPI;
1936 } else if (!strcmp(this_char, MNTOPT_XDSM)) {
1937 args->flags |= XFSMNT_DMAPI;
1938 } else if (!strcmp(this_char, MNTOPT_DMI)) {
1939 args->flags |= XFSMNT_DMAPI;
1940 } else if (!strcmp(this_char, "ihashsize")) {
1941 cmn_err(CE_WARN,
1942 "XFS: ihashsize no longer used, option is deprecated.");
1874 } else if (!strcmp(this_char, "osyncisdsync")) { 1943 } else if (!strcmp(this_char, "osyncisdsync")) {
1875 /* no-op, this is now the default */ 1944 /* no-op, this is now the default */
1876 cmn_err(CE_WARN, 1945 cmn_err(CE_WARN,
@@ -1886,7 +1955,7 @@ xfs_parseargs(
1886 } 1955 }
1887 1956
1888 if (args->flags & XFSMNT_NORECOVERY) { 1957 if (args->flags & XFSMNT_NORECOVERY) {
1889 if ((vfsp->vfs_flag & VFS_RDONLY) == 0) { 1958 if ((mp->m_flags & XFS_MOUNT_RDONLY) == 0) {
1890 cmn_err(CE_WARN, 1959 cmn_err(CE_WARN,
1891 "XFS: no-recovery mounts must be read-only."); 1960 "XFS: no-recovery mounts must be read-only.");
1892 return EINVAL; 1961 return EINVAL;
@@ -1899,6 +1968,18 @@ xfs_parseargs(
1899 return EINVAL; 1968 return EINVAL;
1900 } 1969 }
1901 1970
1971 if ((args->flags & XFSMNT_GQUOTA) && (args->flags & XFSMNT_PQUOTA)) {
1972 cmn_err(CE_WARN,
1973 "XFS: cannot mount with both project and group quota");
1974 return EINVAL;
1975 }
1976
1977 if ((args->flags & XFSMNT_DMAPI) && *args->mtpt == '\0') {
1978 printk("XFS: %s option needs the mount point option as well\n",
1979 MNTOPT_DMAPI);
1980 return EINVAL;
1981 }
1982
1902 if ((dsunit && !dswidth) || (!dsunit && dswidth)) { 1983 if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
1903 cmn_err(CE_WARN, 1984 cmn_err(CE_WARN,
1904 "XFS: sunit and swidth must be specified together"); 1985 "XFS: sunit and swidth must be specified together");
@@ -1912,6 +1993,18 @@ xfs_parseargs(
1912 return EINVAL; 1993 return EINVAL;
1913 } 1994 }
1914 1995
1996 /*
1997 * Applications using DMI filesystems often expect the
1998 * inode generation number to be monotonically increasing.
1999 * If we delete inode chunks we break this assumption, so
2000 * keep unused inode chunks on disk for DMI filesystems
2001 * until we come up with a better solution.
2002 * Note that if "ikeep" or "noikeep" mount options are
2003 * supplied, then they are honored.
2004 */
2005 if (!(args->flags & XFSMNT_DMAPI) && !ikeep)
2006 args->flags |= XFSMNT_IDELETE;
2007
1915 if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { 2008 if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) {
1916 if (dsunit) { 2009 if (dsunit) {
1917 args->sunit = dsunit; 2010 args->sunit = dsunit;
@@ -1927,15 +2020,15 @@ xfs_parseargs(
1927 2020
1928done: 2021done:
1929 if (args->flags & XFSMNT_32BITINODES) 2022 if (args->flags & XFSMNT_32BITINODES)
1930 vfsp->vfs_flag |= VFS_32BITINODES; 2023 mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
1931 if (args->flags2) 2024 if (args->flags2)
1932 args->flags |= XFSMNT_FLAGS2; 2025 args->flags |= XFSMNT_FLAGS2;
1933 return 0; 2026 return 0;
1934} 2027}
1935 2028
1936STATIC int 2029int
1937xfs_showargs( 2030xfs_showargs(
1938 struct bhv_desc *bhv, 2031 struct xfs_mount *mp,
1939 struct seq_file *m) 2032 struct seq_file *m)
1940{ 2033{
1941 static struct proc_xfs_info { 2034 static struct proc_xfs_info {
@@ -1953,17 +2046,12 @@ xfs_showargs(
1953 { 0, NULL } 2046 { 0, NULL }
1954 }; 2047 };
1955 struct proc_xfs_info *xfs_infop; 2048 struct proc_xfs_info *xfs_infop;
1956 struct xfs_mount *mp = XFS_BHVTOM(bhv);
1957 struct bhv_vfs *vfsp = XFS_MTOVFS(mp);
1958 2049
1959 for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { 2050 for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) {
1960 if (mp->m_flags & xfs_infop->flag) 2051 if (mp->m_flags & xfs_infop->flag)
1961 seq_puts(m, xfs_infop->str); 2052 seq_puts(m, xfs_infop->str);
1962 } 2053 }
1963 2054
1964 if (mp->m_flags & XFS_MOUNT_IHASHSIZE)
1965 seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", (int)mp->m_ihsize);
1966
1967 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) 2055 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
1968 seq_printf(m, "," MNTOPT_ALLOCSIZE "=%dk", 2056 seq_printf(m, "," MNTOPT_ALLOCSIZE "=%dk",
1969 (int)(1 << mp->m_writeio_log) >> 10); 2057 (int)(1 << mp->m_writeio_log) >> 10);
@@ -1990,11 +2078,37 @@ xfs_showargs(
1990 if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) 2078 if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE))
1991 seq_printf(m, "," MNTOPT_LARGEIO); 2079 seq_printf(m, "," MNTOPT_LARGEIO);
1992 2080
1993 if (!(vfsp->vfs_flag & VFS_32BITINODES)) 2081 if (!(mp->m_flags & XFS_MOUNT_SMALL_INUMS))
1994 seq_printf(m, "," MNTOPT_64BITINODE); 2082 seq_printf(m, "," MNTOPT_64BITINODE);
1995 if (vfsp->vfs_flag & VFS_GRPID) 2083 if (mp->m_flags & XFS_MOUNT_GRPID)
1996 seq_printf(m, "," MNTOPT_GRPID); 2084 seq_printf(m, "," MNTOPT_GRPID);
1997 2085
2086 if (mp->m_qflags & XFS_UQUOTA_ACCT) {
2087 if (mp->m_qflags & XFS_UQUOTA_ENFD)
2088 seq_puts(m, "," MNTOPT_USRQUOTA);
2089 else
2090 seq_puts(m, "," MNTOPT_UQUOTANOENF);
2091 }
2092
2093 if (mp->m_qflags & XFS_PQUOTA_ACCT) {
2094 if (mp->m_qflags & XFS_OQUOTA_ENFD)
2095 seq_puts(m, "," MNTOPT_PRJQUOTA);
2096 else
2097 seq_puts(m, "," MNTOPT_PQUOTANOENF);
2098 }
2099
2100 if (mp->m_qflags & XFS_GQUOTA_ACCT) {
2101 if (mp->m_qflags & XFS_OQUOTA_ENFD)
2102 seq_puts(m, "," MNTOPT_GRPQUOTA);
2103 else
2104 seq_puts(m, "," MNTOPT_GQUOTANOENF);
2105 }
2106
2107 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
2108 seq_puts(m, "," MNTOPT_NOQUOTA);
2109
2110 if (mp->m_flags & XFS_MOUNT_DMAPI)
2111 seq_puts(m, "," MNTOPT_DMAPI);
1998 return 0; 2112 return 0;
1999} 2113}
2000 2114
@@ -2003,31 +2117,10 @@ xfs_showargs(
2003 * need to take care of themetadata. Once that's done write a dummy 2117 * need to take care of themetadata. Once that's done write a dummy
2004 * record to dirty the log in case of a crash while frozen. 2118 * record to dirty the log in case of a crash while frozen.
2005 */ 2119 */
2006STATIC void 2120void
2007xfs_freeze( 2121xfs_freeze(
2008 bhv_desc_t *bdp) 2122 xfs_mount_t *mp)
2009{ 2123{
2010 xfs_mount_t *mp = XFS_BHVTOM(bdp);
2011
2012 xfs_attr_quiesce(mp); 2124 xfs_attr_quiesce(mp);
2013 xfs_fs_log_dummy(mp); 2125 xfs_fs_log_dummy(mp);
2014} 2126}
2015
2016
2017bhv_vfsops_t xfs_vfsops = {
2018 BHV_IDENTITY_INIT(VFS_BHV_XFS,VFS_POSITION_XFS),
2019 .vfs_parseargs = xfs_parseargs,
2020 .vfs_showargs = xfs_showargs,
2021 .vfs_mount = xfs_mount,
2022 .vfs_unmount = xfs_unmount,
2023 .vfs_mntupdate = xfs_mntupdate,
2024 .vfs_root = xfs_root,
2025 .vfs_statvfs = xfs_statvfs,
2026 .vfs_sync = xfs_sync,
2027 .vfs_vget = xfs_vget,
2028 .vfs_dmapiops = (vfs_dmapiops_t)fs_nosys,
2029 .vfs_quotactl = (vfs_quotactl_t)fs_nosys,
2030 .vfs_init_vnode = xfs_initialize_vnode,
2031 .vfs_force_shutdown = xfs_do_force_shutdown,
2032 .vfs_freeze = xfs_freeze,
2033};
diff --git a/fs/xfs/xfs_vfsops.h b/fs/xfs/xfs_vfsops.h
new file mode 100644
index 000000000000..bc99e3eb7dbb
--- /dev/null
+++ b/fs/xfs/xfs_vfsops.h
@@ -0,0 +1,28 @@
1#ifndef _XFS_VFSOPS_H
2#define _XFS_VFSOPS_H 1
3
4struct cred;
5struct fid;
6struct inode;
7struct kstatfs;
8struct xfs_mount;
9struct xfs_mount_args;
10
11int xfs_mount(struct xfs_mount *mp, struct xfs_mount_args *args,
12 struct cred *credp);
13int xfs_unmount(struct xfs_mount *mp, int flags, struct cred *credp);
14int xfs_mntupdate(struct xfs_mount *mp, int *flags,
15 struct xfs_mount_args *args);
16int xfs_root(struct xfs_mount *mp, bhv_vnode_t **vpp);
17int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp,
18 bhv_vnode_t *vp);
19int xfs_sync(struct xfs_mount *mp, int flags);
20int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct fid *fidp);
21int xfs_parseargs(struct xfs_mount *mp, char *options,
22 struct xfs_mount_args *args, int update);
23int xfs_showargs(struct xfs_mount *mp, struct seq_file *m);
24void xfs_freeze(struct xfs_mount *mp);
25void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
26 int lnnum);
27
28#endif /* _XFS_VFSOPS_H */
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 603459229904..5e3c57ca9981 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -52,15 +52,13 @@
52#include "xfs_trans_space.h" 52#include "xfs_trans_space.h"
53#include "xfs_log_priv.h" 53#include "xfs_log_priv.h"
54#include "xfs_filestream.h" 54#include "xfs_filestream.h"
55#include "xfs_vnodeops.h"
55 56
56STATIC int 57int
57xfs_open( 58xfs_open(
58 bhv_desc_t *bdp, 59 xfs_inode_t *ip)
59 cred_t *credp)
60{ 60{
61 int mode; 61 int mode;
62 bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
63 xfs_inode_t *ip = XFS_BHVTOI(bdp);
64 62
65 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) 63 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
66 return XFS_ERROR(EIO); 64 return XFS_ERROR(EIO);
@@ -69,7 +67,7 @@ xfs_open(
69 * If it's a directory with any blocks, read-ahead block 0 67 * If it's a directory with any blocks, read-ahead block 0
70 * as we're almost certain to have the next operation be a read there. 68 * as we're almost certain to have the next operation be a read there.
71 */ 69 */
72 if (VN_ISDIR(vp) && ip->i_d.di_nextents > 0) { 70 if (S_ISDIR(ip->i_d.di_mode) && ip->i_d.di_nextents > 0) {
73 mode = xfs_ilock_map_shared(ip); 71 mode = xfs_ilock_map_shared(ip);
74 if (ip->i_d.di_nextents > 0) 72 if (ip->i_d.di_nextents > 0)
75 (void)xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK); 73 (void)xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK);
@@ -81,22 +79,16 @@ xfs_open(
81/* 79/*
82 * xfs_getattr 80 * xfs_getattr
83 */ 81 */
84STATIC int 82int
85xfs_getattr( 83xfs_getattr(
86 bhv_desc_t *bdp, 84 xfs_inode_t *ip,
87 bhv_vattr_t *vap, 85 bhv_vattr_t *vap,
88 int flags, 86 int flags)
89 cred_t *credp)
90{ 87{
91 xfs_inode_t *ip; 88 bhv_vnode_t *vp = XFS_ITOV(ip);
92 xfs_mount_t *mp; 89 xfs_mount_t *mp = ip->i_mount;
93 bhv_vnode_t *vp;
94
95 vp = BHV_TO_VNODE(bdp);
96 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
97 90
98 ip = XFS_BHVTOI(bdp); 91 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
99 mp = ip->i_mount;
100 92
101 if (XFS_FORCED_SHUTDOWN(mp)) 93 if (XFS_FORCED_SHUTDOWN(mp))
102 return XFS_ERROR(EIO); 94 return XFS_ERROR(EIO);
@@ -215,14 +207,14 @@ xfs_getattr(
215 */ 207 */
216int 208int
217xfs_setattr( 209xfs_setattr(
218 bhv_desc_t *bdp, 210 xfs_inode_t *ip,
219 bhv_vattr_t *vap, 211 bhv_vattr_t *vap,
220 int flags, 212 int flags,
221 cred_t *credp) 213 cred_t *credp)
222{ 214{
223 xfs_inode_t *ip; 215 bhv_vnode_t *vp = XFS_ITOV(ip);
216 xfs_mount_t *mp = ip->i_mount;
224 xfs_trans_t *tp; 217 xfs_trans_t *tp;
225 xfs_mount_t *mp;
226 int mask; 218 int mask;
227 int code; 219 int code;
228 uint lock_flags; 220 uint lock_flags;
@@ -230,17 +222,15 @@ xfs_setattr(
230 uid_t uid=0, iuid=0; 222 uid_t uid=0, iuid=0;
231 gid_t gid=0, igid=0; 223 gid_t gid=0, igid=0;
232 int timeflags = 0; 224 int timeflags = 0;
233 bhv_vnode_t *vp;
234 xfs_prid_t projid=0, iprojid=0; 225 xfs_prid_t projid=0, iprojid=0;
235 int mandlock_before, mandlock_after; 226 int mandlock_before, mandlock_after;
236 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; 227 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
237 int file_owner; 228 int file_owner;
238 int need_iolock = 1; 229 int need_iolock = 1;
239 230
240 vp = BHV_TO_VNODE(bdp); 231 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
241 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
242 232
243 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 233 if (mp->m_flags & XFS_MOUNT_RDONLY)
244 return XFS_ERROR(EROFS); 234 return XFS_ERROR(EROFS);
245 235
246 /* 236 /*
@@ -251,9 +241,6 @@ xfs_setattr(
251 return XFS_ERROR(EINVAL); 241 return XFS_ERROR(EINVAL);
252 } 242 }
253 243
254 ip = XFS_BHVTOI(bdp);
255 mp = ip->i_mount;
256
257 if (XFS_FORCED_SHUTDOWN(mp)) 244 if (XFS_FORCED_SHUTDOWN(mp))
258 return XFS_ERROR(EIO); 245 return XFS_ERROR(EIO);
259 246
@@ -337,7 +324,7 @@ xfs_setattr(
337 } 324 }
338 } 325 }
339 } else { 326 } else {
340 if (DM_EVENT_ENABLED (vp->v_vfsp, ip, DM_EVENT_TRUNCATE) && 327 if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) &&
341 !(flags & ATTR_DMI)) { 328 !(flags & ATTR_DMI)) {
342 int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR; 329 int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR;
343 code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, vp, 330 code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, vp,
@@ -605,13 +592,13 @@ xfs_setattr(
605 if (!code && 592 if (!code &&
606 (ip->i_size != ip->i_d.di_size) && 593 (ip->i_size != ip->i_d.di_size) &&
607 (vap->va_size > ip->i_d.di_size)) { 594 (vap->va_size > ip->i_d.di_size)) {
608 code = bhv_vop_flush_pages(XFS_ITOV(ip), 595 code = xfs_flush_pages(ip,
609 ip->i_d.di_size, vap->va_size, 596 ip->i_d.di_size, vap->va_size,
610 XFS_B_ASYNC, FI_NONE); 597 XFS_B_ASYNC, FI_NONE);
611 } 598 }
612 599
613 /* wait for all I/O to complete */ 600 /* wait for all I/O to complete */
614 vn_iowait(vp); 601 vn_iowait(ip);
615 602
616 if (!code) 603 if (!code)
617 code = xfs_itruncate_data(ip, vap->va_size); 604 code = xfs_itruncate_data(ip, vap->va_size);
@@ -673,7 +660,7 @@ xfs_setattr(
673 * vnode and flush it when the file is closed, and 660 * vnode and flush it when the file is closed, and
674 * do not wait the usual (long) time for writeout. 661 * do not wait the usual (long) time for writeout.
675 */ 662 */
676 VTRUNCATE(vp); 663 xfs_iflags_set(ip, XFS_ITRUNCATED);
677 } 664 }
678 /* 665 /*
679 * Have to do this even if the file's size doesn't change. 666 * Have to do this even if the file's size doesn't change.
@@ -877,10 +864,6 @@ xfs_setattr(
877 * racing calls to vop_vnode_change. 864 * racing calls to vop_vnode_change.
878 */ 865 */
879 mandlock_after = MANDLOCK(vp, ip->i_d.di_mode); 866 mandlock_after = MANDLOCK(vp, ip->i_d.di_mode);
880 if (mandlock_before != mandlock_after) {
881 bhv_vop_vnode_change(vp, VCHANGE_FLAGS_ENF_LOCKING,
882 mandlock_after);
883 }
884 867
885 xfs_iunlock(ip, lock_flags); 868 xfs_iunlock(ip, lock_flags);
886 869
@@ -896,7 +879,7 @@ xfs_setattr(
896 return code; 879 return code;
897 } 880 }
898 881
899 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_ATTRIBUTE) && 882 if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) &&
900 !(flags & ATTR_DMI)) { 883 !(flags & ATTR_DMI)) {
901 (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, vp, DM_RIGHT_NULL, 884 (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, vp, DM_RIGHT_NULL,
902 NULL, DM_RIGHT_NULL, NULL, NULL, 885 NULL, DM_RIGHT_NULL, NULL, NULL,
@@ -924,19 +907,16 @@ xfs_setattr(
924 * xfs_access 907 * xfs_access
925 * Null conversion from vnode mode bits to inode mode bits, as in efs. 908 * Null conversion from vnode mode bits to inode mode bits, as in efs.
926 */ 909 */
927STATIC int 910int
928xfs_access( 911xfs_access(
929 bhv_desc_t *bdp, 912 xfs_inode_t *ip,
930 int mode, 913 int mode,
931 cred_t *credp) 914 cred_t *credp)
932{ 915{
933 xfs_inode_t *ip;
934 int error; 916 int error;
935 917
936 vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__, 918 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
937 (inst_t *)__return_address);
938 919
939 ip = XFS_BHVTOI(bdp);
940 xfs_ilock(ip, XFS_ILOCK_SHARED); 920 xfs_ilock(ip, XFS_ILOCK_SHARED);
941 error = xfs_iaccess(ip, mode, credp); 921 error = xfs_iaccess(ip, mode, credp);
942 xfs_iunlock(ip, XFS_ILOCK_SHARED); 922 xfs_iunlock(ip, XFS_ILOCK_SHARED);
@@ -951,105 +931,88 @@ xfs_access(
951 */ 931 */
952#define SYMLINK_MAPS 2 932#define SYMLINK_MAPS 2
953 933
954/*
955 * xfs_readlink
956 *
957 */
958STATIC int 934STATIC int
959xfs_readlink( 935xfs_readlink_bmap(
960 bhv_desc_t *bdp, 936 xfs_inode_t *ip,
961 uio_t *uiop, 937 char *link)
962 int ioflags,
963 cred_t *credp)
964{ 938{
965 xfs_inode_t *ip; 939 xfs_mount_t *mp = ip->i_mount;
966 int count; 940 int pathlen = ip->i_d.di_size;
967 xfs_off_t offset; 941 int nmaps = SYMLINK_MAPS;
968 int pathlen;
969 bhv_vnode_t *vp;
970 int error = 0;
971 xfs_mount_t *mp;
972 int nmaps;
973 xfs_bmbt_irec_t mval[SYMLINK_MAPS]; 942 xfs_bmbt_irec_t mval[SYMLINK_MAPS];
974 xfs_daddr_t d; 943 xfs_daddr_t d;
975 int byte_cnt; 944 int byte_cnt;
976 int n; 945 int n;
977 xfs_buf_t *bp; 946 xfs_buf_t *bp;
947 int error = 0;
978 948
979 vp = BHV_TO_VNODE(bdp); 949 error = xfs_bmapi(NULL, ip, 0, XFS_B_TO_FSB(mp, pathlen), 0, NULL, 0,
980 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 950 mval, &nmaps, NULL, NULL);
981 951 if (error)
982 ip = XFS_BHVTOI(bdp); 952 goto out;
983 mp = ip->i_mount;
984 953
985 if (XFS_FORCED_SHUTDOWN(mp)) 954 for (n = 0; n < nmaps; n++) {
986 return XFS_ERROR(EIO); 955 d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
956 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
987 957
988 xfs_ilock(ip, XFS_ILOCK_SHARED); 958 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0);
959 error = XFS_BUF_GETERROR(bp);
960 if (error) {
961 xfs_ioerror_alert("xfs_readlink",
962 ip->i_mount, bp, XFS_BUF_ADDR(bp));
963 xfs_buf_relse(bp);
964 goto out;
965 }
966 if (pathlen < byte_cnt)
967 byte_cnt = pathlen;
968 pathlen -= byte_cnt;
989 969
990 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFLNK); 970 memcpy(link, XFS_BUF_PTR(bp), byte_cnt);
971 xfs_buf_relse(bp);
972 }
991 973
992 offset = uiop->uio_offset; 974 link[ip->i_d.di_size] = '\0';
993 count = uiop->uio_resid; 975 error = 0;
994 976
995 if (offset < 0) { 977 out:
996 error = XFS_ERROR(EINVAL); 978 return error;
997 goto error_return; 979}
998 }
999 if (count <= 0) {
1000 error = 0;
1001 goto error_return;
1002 }
1003 980
1004 /* 981int
1005 * See if the symlink is stored inline. 982xfs_readlink(
1006 */ 983 xfs_inode_t *ip,
1007 pathlen = (int)ip->i_d.di_size; 984 char *link)
985{
986 xfs_mount_t *mp = ip->i_mount;
987 int pathlen;
988 int error = 0;
1008 989
1009 if (ip->i_df.if_flags & XFS_IFINLINE) { 990 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
1010 error = xfs_uio_read(ip->i_df.if_u1.if_data, pathlen, uiop);
1011 }
1012 else {
1013 /*
1014 * Symlink not inline. Call bmap to get it in.
1015 */
1016 nmaps = SYMLINK_MAPS;
1017 991
1018 error = xfs_bmapi(NULL, ip, 0, XFS_B_TO_FSB(mp, pathlen), 992 if (XFS_FORCED_SHUTDOWN(mp))
1019 0, NULL, 0, mval, &nmaps, NULL, NULL); 993 return XFS_ERROR(EIO);
1020 994
1021 if (error) { 995 xfs_ilock(ip, XFS_ILOCK_SHARED);
1022 goto error_return;
1023 }
1024 996
1025 for (n = 0; n < nmaps; n++) { 997 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFLNK);
1026 d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); 998 ASSERT(ip->i_d.di_size <= MAXPATHLEN);
1027 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
1028 bp = xfs_buf_read(mp->m_ddev_targp, d,
1029 BTOBB(byte_cnt), 0);
1030 error = XFS_BUF_GETERROR(bp);
1031 if (error) {
1032 xfs_ioerror_alert("xfs_readlink",
1033 ip->i_mount, bp, XFS_BUF_ADDR(bp));
1034 xfs_buf_relse(bp);
1035 goto error_return;
1036 }
1037 if (pathlen < byte_cnt)
1038 byte_cnt = pathlen;
1039 pathlen -= byte_cnt;
1040 999
1041 error = xfs_uio_read(XFS_BUF_PTR(bp), byte_cnt, uiop); 1000 pathlen = ip->i_d.di_size;
1042 xfs_buf_relse (bp); 1001 if (!pathlen)
1043 } 1002 goto out;
1044 1003
1004 if (ip->i_df.if_flags & XFS_IFINLINE) {
1005 memcpy(link, ip->i_df.if_u1.if_data, pathlen);
1006 link[pathlen] = '\0';
1007 } else {
1008 error = xfs_readlink_bmap(ip, link);
1045 } 1009 }
1046 1010
1047error_return: 1011 out:
1048 xfs_iunlock(ip, XFS_ILOCK_SHARED); 1012 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1049 return error; 1013 return error;
1050} 1014}
1051 1015
1052
1053/* 1016/*
1054 * xfs_fsync 1017 * xfs_fsync
1055 * 1018 *
@@ -1059,23 +1022,18 @@ error_return:
1059 * be held while flushing the data, so acquire after we're done 1022 * be held while flushing the data, so acquire after we're done
1060 * with that. 1023 * with that.
1061 */ 1024 */
1062STATIC int 1025int
1063xfs_fsync( 1026xfs_fsync(
1064 bhv_desc_t *bdp, 1027 xfs_inode_t *ip,
1065 int flag, 1028 int flag,
1066 cred_t *credp,
1067 xfs_off_t start, 1029 xfs_off_t start,
1068 xfs_off_t stop) 1030 xfs_off_t stop)
1069{ 1031{
1070 xfs_inode_t *ip;
1071 xfs_trans_t *tp; 1032 xfs_trans_t *tp;
1072 int error; 1033 int error;
1073 int log_flushed = 0, changed = 1; 1034 int log_flushed = 0, changed = 1;
1074 1035
1075 vn_trace_entry(BHV_TO_VNODE(bdp), 1036 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
1076 __FUNCTION__, (inst_t *)__return_address);
1077
1078 ip = XFS_BHVTOI(bdp);
1079 1037
1080 ASSERT(start >= 0 && stop >= -1); 1038 ASSERT(start >= 0 && stop >= -1);
1081 1039
@@ -1545,27 +1503,24 @@ xfs_inactive_attrs(
1545 return 0; 1503 return 0;
1546} 1504}
1547 1505
1548STATIC int 1506int
1549xfs_release( 1507xfs_release(
1550 bhv_desc_t *bdp) 1508 xfs_inode_t *ip)
1551{ 1509{
1552 xfs_inode_t *ip; 1510 bhv_vnode_t *vp = XFS_ITOV(ip);
1553 bhv_vnode_t *vp; 1511 xfs_mount_t *mp = ip->i_mount;
1554 xfs_mount_t *mp;
1555 int error; 1512 int error;
1556 1513
1557 vp = BHV_TO_VNODE(bdp);
1558 ip = XFS_BHVTOI(bdp);
1559 mp = ip->i_mount;
1560
1561 if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0)) 1514 if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0))
1562 return 0; 1515 return 0;
1563 1516
1564 /* If this is a read-only mount, don't do this (would generate I/O) */ 1517 /* If this is a read-only mount, don't do this (would generate I/O) */
1565 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 1518 if (mp->m_flags & XFS_MOUNT_RDONLY)
1566 return 0; 1519 return 0;
1567 1520
1568 if (!XFS_FORCED_SHUTDOWN(mp)) { 1521 if (!XFS_FORCED_SHUTDOWN(mp)) {
1522 int truncated;
1523
1569 /* 1524 /*
1570 * If we are using filestreams, and we have an unlinked 1525 * If we are using filestreams, and we have an unlinked
1571 * file that we are processing the last close on, then nothing 1526 * file that we are processing the last close on, then nothing
@@ -1586,8 +1541,9 @@ xfs_release(
1586 * significantly reducing the time window where we'd otherwise 1541 * significantly reducing the time window where we'd otherwise
1587 * be exposed to that problem. 1542 * be exposed to that problem.
1588 */ 1543 */
1589 if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0) 1544 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
1590 bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE); 1545 if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
1546 xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
1591 } 1547 }
1592 1548
1593#ifdef HAVE_REFCACHE 1549#ifdef HAVE_REFCACHE
@@ -1623,13 +1579,11 @@ xfs_release(
1623 * now be truncated. Also, we clear all of the read-ahead state 1579 * now be truncated. Also, we clear all of the read-ahead state
1624 * kept for the inode here since the file is now closed. 1580 * kept for the inode here since the file is now closed.
1625 */ 1581 */
1626STATIC int 1582int
1627xfs_inactive( 1583xfs_inactive(
1628 bhv_desc_t *bdp, 1584 xfs_inode_t *ip)
1629 cred_t *credp)
1630{ 1585{
1631 xfs_inode_t *ip; 1586 bhv_vnode_t *vp = XFS_ITOV(ip);
1632 bhv_vnode_t *vp;
1633 xfs_bmap_free_t free_list; 1587 xfs_bmap_free_t free_list;
1634 xfs_fsblock_t first_block; 1588 xfs_fsblock_t first_block;
1635 int committed; 1589 int committed;
@@ -1638,10 +1592,7 @@ xfs_inactive(
1638 int error; 1592 int error;
1639 int truncate; 1593 int truncate;
1640 1594
1641 vp = BHV_TO_VNODE(bdp); 1595 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
1642 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
1643
1644 ip = XFS_BHVTOI(bdp);
1645 1596
1646 /* 1597 /*
1647 * If the inode is already free, then there can be nothing 1598 * If the inode is already free, then there can be nothing
@@ -1666,15 +1617,14 @@ xfs_inactive(
1666 1617
1667 mp = ip->i_mount; 1618 mp = ip->i_mount;
1668 1619
1669 if (ip->i_d.di_nlink == 0 && 1620 if (ip->i_d.di_nlink == 0 && DM_EVENT_ENABLED(ip, DM_EVENT_DESTROY)) {
1670 DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_DESTROY)) {
1671 (void) XFS_SEND_DESTROY(mp, vp, DM_RIGHT_NULL); 1621 (void) XFS_SEND_DESTROY(mp, vp, DM_RIGHT_NULL);
1672 } 1622 }
1673 1623
1674 error = 0; 1624 error = 0;
1675 1625
1676 /* If this is a read-only mount, don't do this (would generate I/O) */ 1626 /* If this is a read-only mount, don't do this (would generate I/O) */
1677 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 1627 if (mp->m_flags & XFS_MOUNT_RDONLY)
1678 goto out; 1628 goto out;
1679 1629
1680 if (ip->i_d.di_nlink != 0) { 1630 if (ip->i_d.di_nlink != 0) {
@@ -1844,34 +1794,24 @@ xfs_inactive(
1844} 1794}
1845 1795
1846 1796
1847/* 1797int
1848 * xfs_lookup
1849 */
1850STATIC int
1851xfs_lookup( 1798xfs_lookup(
1852 bhv_desc_t *dir_bdp, 1799 xfs_inode_t *dp,
1853 bhv_vname_t *dentry, 1800 bhv_vname_t *dentry,
1854 bhv_vnode_t **vpp, 1801 bhv_vnode_t **vpp)
1855 int flags,
1856 bhv_vnode_t *rdir,
1857 cred_t *credp)
1858{ 1802{
1859 xfs_inode_t *dp, *ip; 1803 xfs_inode_t *ip;
1860 xfs_ino_t e_inum; 1804 xfs_ino_t e_inum;
1861 int error; 1805 int error;
1862 uint lock_mode; 1806 uint lock_mode;
1863 bhv_vnode_t *dir_vp;
1864
1865 dir_vp = BHV_TO_VNODE(dir_bdp);
1866 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
1867 1807
1868 dp = XFS_BHVTOI(dir_bdp); 1808 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
1869 1809
1870 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 1810 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
1871 return XFS_ERROR(EIO); 1811 return XFS_ERROR(EIO);
1872 1812
1873 lock_mode = xfs_ilock_map_shared(dp); 1813 lock_mode = xfs_ilock_map_shared(dp);
1874 error = xfs_dir_lookup_int(dir_bdp, lock_mode, dentry, &e_inum, &ip); 1814 error = xfs_dir_lookup_int(dp, lock_mode, dentry, &e_inum, &ip);
1875 if (!error) { 1815 if (!error) {
1876 *vpp = XFS_ITOV(ip); 1816 *vpp = XFS_ITOV(ip);
1877 ITRACE(ip); 1817 ITRACE(ip);
@@ -1880,53 +1820,43 @@ xfs_lookup(
1880 return error; 1820 return error;
1881} 1821}
1882 1822
1883 1823int
1884/*
1885 * xfs_create (create a new file).
1886 */
1887STATIC int
1888xfs_create( 1824xfs_create(
1889 bhv_desc_t *dir_bdp, 1825 xfs_inode_t *dp,
1890 bhv_vname_t *dentry, 1826 bhv_vname_t *dentry,
1891 bhv_vattr_t *vap, 1827 mode_t mode,
1828 xfs_dev_t rdev,
1892 bhv_vnode_t **vpp, 1829 bhv_vnode_t **vpp,
1893 cred_t *credp) 1830 cred_t *credp)
1894{ 1831{
1895 char *name = VNAME(dentry); 1832 char *name = VNAME(dentry);
1896 bhv_vnode_t *dir_vp; 1833 xfs_mount_t *mp = dp->i_mount;
1897 xfs_inode_t *dp, *ip; 1834 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
1835 xfs_inode_t *ip;
1898 bhv_vnode_t *vp = NULL; 1836 bhv_vnode_t *vp = NULL;
1899 xfs_trans_t *tp; 1837 xfs_trans_t *tp;
1900 xfs_mount_t *mp;
1901 xfs_dev_t rdev;
1902 int error; 1838 int error;
1903 xfs_bmap_free_t free_list; 1839 xfs_bmap_free_t free_list;
1904 xfs_fsblock_t first_block; 1840 xfs_fsblock_t first_block;
1905 boolean_t dp_joined_to_trans; 1841 boolean_t unlock_dp_on_error = B_FALSE;
1906 int dm_event_sent = 0; 1842 int dm_event_sent = 0;
1907 uint cancel_flags; 1843 uint cancel_flags;
1908 int committed; 1844 int committed;
1909 xfs_prid_t prid; 1845 xfs_prid_t prid;
1910 struct xfs_dquot *udqp, *gdqp; 1846 struct xfs_dquot *udqp, *gdqp;
1911 uint resblks; 1847 uint resblks;
1912 int dm_di_mode;
1913 int namelen; 1848 int namelen;
1914 1849
1915 ASSERT(!*vpp); 1850 ASSERT(!*vpp);
1916 dir_vp = BHV_TO_VNODE(dir_bdp); 1851 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
1917 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
1918 1852
1919 dp = XFS_BHVTOI(dir_bdp);
1920 mp = dp->i_mount;
1921
1922 dm_di_mode = vap->va_mode;
1923 namelen = VNAMELEN(dentry); 1853 namelen = VNAMELEN(dentry);
1924 1854
1925 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) { 1855 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
1926 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, 1856 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
1927 dir_vp, DM_RIGHT_NULL, NULL, 1857 dir_vp, DM_RIGHT_NULL, NULL,
1928 DM_RIGHT_NULL, name, NULL, 1858 DM_RIGHT_NULL, name, NULL,
1929 dm_di_mode, 0, 0); 1859 mode, 0, 0);
1930 1860
1931 if (error) 1861 if (error)
1932 return error; 1862 return error;
@@ -1941,8 +1871,6 @@ xfs_create(
1941 udqp = gdqp = NULL; 1871 udqp = gdqp = NULL;
1942 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 1872 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
1943 prid = dp->i_d.di_projid; 1873 prid = dp->i_d.di_projid;
1944 else if (vap->va_mask & XFS_AT_PROJID)
1945 prid = (xfs_prid_t)vap->va_projid;
1946 else 1874 else
1947 prid = (xfs_prid_t)dfltprid; 1875 prid = (xfs_prid_t)dfltprid;
1948 1876
@@ -1956,7 +1884,6 @@ xfs_create(
1956 goto std_return; 1884 goto std_return;
1957 1885
1958 ip = NULL; 1886 ip = NULL;
1959 dp_joined_to_trans = B_FALSE;
1960 1887
1961 tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); 1888 tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
1962 cancel_flags = XFS_TRANS_RELEASE_LOG_RES; 1889 cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
@@ -1976,11 +1903,11 @@ xfs_create(
1976 } 1903 }
1977 if (error) { 1904 if (error) {
1978 cancel_flags = 0; 1905 cancel_flags = 0;
1979 dp = NULL;
1980 goto error_return; 1906 goto error_return;
1981 } 1907 }
1982 1908
1983 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 1909 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
1910 unlock_dp_on_error = B_TRUE;
1984 1911
1985 XFS_BMAP_INIT(&free_list, &first_block); 1912 XFS_BMAP_INIT(&free_list, &first_block);
1986 1913
@@ -1995,8 +1922,7 @@ xfs_create(
1995 1922
1996 if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen))) 1923 if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen)))
1997 goto error_return; 1924 goto error_return;
1998 rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; 1925 error = xfs_dir_ialloc(&tp, dp, mode, 1,
1999 error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1,
2000 rdev, credp, prid, resblks > 0, 1926 rdev, credp, prid, resblks > 0,
2001 &ip, &committed); 1927 &ip, &committed);
2002 if (error) { 1928 if (error) {
@@ -2014,15 +1940,15 @@ xfs_create(
2014 ASSERT(ismrlocked (&ip->i_lock, MR_UPDATE)); 1940 ASSERT(ismrlocked (&ip->i_lock, MR_UPDATE));
2015 1941
2016 /* 1942 /*
2017 * Now we join the directory inode to the transaction. 1943 * Now we join the directory inode to the transaction. We do not do it
2018 * We do not do it earlier because xfs_dir_ialloc 1944 * earlier because xfs_dir_ialloc might commit the previous transaction
2019 * might commit the previous transaction (and release 1945 * (and release all the locks). An error from here on will result in
2020 * all the locks). 1946 * the transaction cancel unlocking dp so don't do it explicitly in the
1947 * error path.
2021 */ 1948 */
2022
2023 VN_HOLD(dir_vp); 1949 VN_HOLD(dir_vp);
2024 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 1950 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2025 dp_joined_to_trans = B_TRUE; 1951 unlock_dp_on_error = B_FALSE;
2026 1952
2027 error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino, 1953 error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino,
2028 &first_block, &free_list, resblks ? 1954 &first_block, &free_list, resblks ?
@@ -2076,25 +2002,18 @@ xfs_create(
2076 XFS_QM_DQRELE(mp, udqp); 2002 XFS_QM_DQRELE(mp, udqp);
2077 XFS_QM_DQRELE(mp, gdqp); 2003 XFS_QM_DQRELE(mp, gdqp);
2078 2004
2079 /*
2080 * Propagate the fact that the vnode changed after the
2081 * xfs_inode locks have been released.
2082 */
2083 bhv_vop_vnode_change(vp, VCHANGE_FLAGS_TRUNCATED, 3);
2084
2085 *vpp = vp; 2005 *vpp = vp;
2086 2006
2087 /* Fallthrough to std_return with error = 0 */ 2007 /* Fallthrough to std_return with error = 0 */
2088 2008
2089std_return: 2009std_return:
2090 if ( (*vpp || (error != 0 && dm_event_sent != 0)) && 2010 if ((*vpp || (error != 0 && dm_event_sent != 0)) &&
2091 DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), 2011 DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
2092 DM_EVENT_POSTCREATE)) {
2093 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, 2012 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
2094 dir_vp, DM_RIGHT_NULL, 2013 dir_vp, DM_RIGHT_NULL,
2095 *vpp ? vp:NULL, 2014 *vpp ? vp:NULL,
2096 DM_RIGHT_NULL, name, NULL, 2015 DM_RIGHT_NULL, name, NULL,
2097 dm_di_mode, error, 0); 2016 mode, error, 0);
2098 } 2017 }
2099 return error; 2018 return error;
2100 2019
@@ -2106,11 +2025,12 @@ std_return:
2106 if (tp != NULL) 2025 if (tp != NULL)
2107 xfs_trans_cancel(tp, cancel_flags); 2026 xfs_trans_cancel(tp, cancel_flags);
2108 2027
2109 if (!dp_joined_to_trans && (dp != NULL))
2110 xfs_iunlock(dp, XFS_ILOCK_EXCL);
2111 XFS_QM_DQRELE(mp, udqp); 2028 XFS_QM_DQRELE(mp, udqp);
2112 XFS_QM_DQRELE(mp, gdqp); 2029 XFS_QM_DQRELE(mp, gdqp);
2113 2030
2031 if (unlock_dp_on_error)
2032 xfs_iunlock(dp, XFS_ILOCK_EXCL);
2033
2114 goto std_return; 2034 goto std_return;
2115 2035
2116 abort_rele: 2036 abort_rele:
@@ -2381,22 +2301,16 @@ int remove_which_error_return = 0;
2381#define REMOVE_DEBUG_TRACE(x) 2301#define REMOVE_DEBUG_TRACE(x)
2382#endif /* ! DEBUG */ 2302#endif /* ! DEBUG */
2383 2303
2384 2304int
2385/*
2386 * xfs_remove
2387 *
2388 */
2389STATIC int
2390xfs_remove( 2305xfs_remove(
2391 bhv_desc_t *dir_bdp, 2306 xfs_inode_t *dp,
2392 bhv_vname_t *dentry, 2307 bhv_vname_t *dentry)
2393 cred_t *credp)
2394{ 2308{
2395 bhv_vnode_t *dir_vp; 2309 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
2396 char *name = VNAME(dentry); 2310 char *name = VNAME(dentry);
2397 xfs_inode_t *dp, *ip; 2311 xfs_mount_t *mp = dp->i_mount;
2312 xfs_inode_t *ip;
2398 xfs_trans_t *tp = NULL; 2313 xfs_trans_t *tp = NULL;
2399 xfs_mount_t *mp;
2400 int error = 0; 2314 int error = 0;
2401 xfs_bmap_free_t free_list; 2315 xfs_bmap_free_t free_list;
2402 xfs_fsblock_t first_block; 2316 xfs_fsblock_t first_block;
@@ -2407,11 +2321,7 @@ xfs_remove(
2407 uint resblks; 2321 uint resblks;
2408 int namelen; 2322 int namelen;
2409 2323
2410 dir_vp = BHV_TO_VNODE(dir_bdp); 2324 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
2411 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
2412
2413 dp = XFS_BHVTOI(dir_bdp);
2414 mp = dp->i_mount;
2415 2325
2416 if (XFS_FORCED_SHUTDOWN(mp)) 2326 if (XFS_FORCED_SHUTDOWN(mp))
2417 return XFS_ERROR(EIO); 2327 return XFS_ERROR(EIO);
@@ -2423,7 +2333,7 @@ xfs_remove(
2423 IRELE(ip); 2333 IRELE(ip);
2424 } 2334 }
2425 2335
2426 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { 2336 if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
2427 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp, 2337 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp,
2428 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, 2338 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
2429 name, NULL, dm_di_mode, 0, 0); 2339 name, NULL, dm_di_mode, 0, 0);
@@ -2454,7 +2364,7 @@ xfs_remove(
2454 2364
2455 dm_di_mode = ip->i_d.di_mode; 2365 dm_di_mode = ip->i_d.di_mode;
2456 2366
2457 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 2367 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
2458 2368
2459 ITRACE(ip); 2369 ITRACE(ip);
2460 2370
@@ -2588,19 +2498,13 @@ xfs_remove(
2588 if (link_zero && xfs_inode_is_filestream(ip)) 2498 if (link_zero && xfs_inode_is_filestream(ip))
2589 xfs_filestream_deassociate(ip); 2499 xfs_filestream_deassociate(ip);
2590 2500
2591 vn_trace_exit(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 2501 vn_trace_exit(ip, __FUNCTION__, (inst_t *)__return_address);
2592
2593 /*
2594 * Let interposed file systems know about removed links.
2595 */
2596 bhv_vop_link_removed(XFS_ITOV(ip), dir_vp, link_zero);
2597 2502
2598 IRELE(ip); 2503 IRELE(ip);
2599 2504
2600/* Fall through to std_return with error = 0 */ 2505/* Fall through to std_return with error = 0 */
2601 std_return: 2506 std_return:
2602 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, 2507 if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
2603 DM_EVENT_POSTREMOVE)) {
2604 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, 2508 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
2605 dir_vp, DM_RIGHT_NULL, 2509 dir_vp, DM_RIGHT_NULL,
2606 NULL, DM_RIGHT_NULL, 2510 NULL, DM_RIGHT_NULL,
@@ -2638,46 +2542,36 @@ xfs_remove(
2638 goto std_return; 2542 goto std_return;
2639} 2543}
2640 2544
2641 2545int
2642/*
2643 * xfs_link
2644 *
2645 */
2646STATIC int
2647xfs_link( 2546xfs_link(
2648 bhv_desc_t *target_dir_bdp, 2547 xfs_inode_t *tdp,
2649 bhv_vnode_t *src_vp, 2548 bhv_vnode_t *src_vp,
2650 bhv_vname_t *dentry, 2549 bhv_vname_t *dentry)
2651 cred_t *credp)
2652{ 2550{
2653 xfs_inode_t *tdp, *sip; 2551 bhv_vnode_t *target_dir_vp = XFS_ITOV(tdp);
2552 xfs_mount_t *mp = tdp->i_mount;
2553 xfs_inode_t *sip = xfs_vtoi(src_vp);
2654 xfs_trans_t *tp; 2554 xfs_trans_t *tp;
2655 xfs_mount_t *mp;
2656 xfs_inode_t *ips[2]; 2555 xfs_inode_t *ips[2];
2657 int error; 2556 int error;
2658 xfs_bmap_free_t free_list; 2557 xfs_bmap_free_t free_list;
2659 xfs_fsblock_t first_block; 2558 xfs_fsblock_t first_block;
2660 int cancel_flags; 2559 int cancel_flags;
2661 int committed; 2560 int committed;
2662 bhv_vnode_t *target_dir_vp;
2663 int resblks; 2561 int resblks;
2664 char *target_name = VNAME(dentry); 2562 char *target_name = VNAME(dentry);
2665 int target_namelen; 2563 int target_namelen;
2666 2564
2667 target_dir_vp = BHV_TO_VNODE(target_dir_bdp); 2565 vn_trace_entry(tdp, __FUNCTION__, (inst_t *)__return_address);
2668 vn_trace_entry(target_dir_vp, __FUNCTION__, (inst_t *)__return_address); 2566 vn_trace_entry(xfs_vtoi(src_vp), __FUNCTION__, (inst_t *)__return_address);
2669 vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address);
2670 2567
2671 target_namelen = VNAMELEN(dentry); 2568 target_namelen = VNAMELEN(dentry);
2672 ASSERT(!VN_ISDIR(src_vp)); 2569 ASSERT(!VN_ISDIR(src_vp));
2673 2570
2674 sip = xfs_vtoi(src_vp);
2675 tdp = XFS_BHVTOI(target_dir_bdp);
2676 mp = tdp->i_mount;
2677 if (XFS_FORCED_SHUTDOWN(mp)) 2571 if (XFS_FORCED_SHUTDOWN(mp))
2678 return XFS_ERROR(EIO); 2572 return XFS_ERROR(EIO);
2679 2573
2680 if (DM_EVENT_ENABLED(src_vp->v_vfsp, tdp, DM_EVENT_LINK)) { 2574 if (DM_EVENT_ENABLED(tdp, DM_EVENT_LINK)) {
2681 error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, 2575 error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK,
2682 target_dir_vp, DM_RIGHT_NULL, 2576 target_dir_vp, DM_RIGHT_NULL,
2683 src_vp, DM_RIGHT_NULL, 2577 src_vp, DM_RIGHT_NULL,
@@ -2788,8 +2682,7 @@ xfs_link(
2788 2682
2789 /* Fall through to std_return with error = 0. */ 2683 /* Fall through to std_return with error = 0. */
2790std_return: 2684std_return:
2791 if (DM_EVENT_ENABLED(src_vp->v_vfsp, sip, 2685 if (DM_EVENT_ENABLED(sip, DM_EVENT_POSTLINK)) {
2792 DM_EVENT_POSTLINK)) {
2793 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, 2686 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK,
2794 target_dir_vp, DM_RIGHT_NULL, 2687 target_dir_vp, DM_RIGHT_NULL,
2795 src_vp, DM_RIGHT_NULL, 2688 src_vp, DM_RIGHT_NULL,
@@ -2807,57 +2700,43 @@ std_return:
2807} 2700}
2808 2701
2809 2702
2810/* 2703int
2811 * xfs_mkdir
2812 *
2813 */
2814STATIC int
2815xfs_mkdir( 2704xfs_mkdir(
2816 bhv_desc_t *dir_bdp, 2705 xfs_inode_t *dp,
2817 bhv_vname_t *dentry, 2706 bhv_vname_t *dentry,
2818 bhv_vattr_t *vap, 2707 mode_t mode,
2819 bhv_vnode_t **vpp, 2708 bhv_vnode_t **vpp,
2820 cred_t *credp) 2709 cred_t *credp)
2821{ 2710{
2711 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
2822 char *dir_name = VNAME(dentry); 2712 char *dir_name = VNAME(dentry);
2823 xfs_inode_t *dp; 2713 int dir_namelen = VNAMELEN(dentry);
2714 xfs_mount_t *mp = dp->i_mount;
2824 xfs_inode_t *cdp; /* inode of created dir */ 2715 xfs_inode_t *cdp; /* inode of created dir */
2825 bhv_vnode_t *cvp; /* vnode of created dir */ 2716 bhv_vnode_t *cvp; /* vnode of created dir */
2826 xfs_trans_t *tp; 2717 xfs_trans_t *tp;
2827 xfs_mount_t *mp;
2828 int cancel_flags; 2718 int cancel_flags;
2829 int error; 2719 int error;
2830 int committed; 2720 int committed;
2831 xfs_bmap_free_t free_list; 2721 xfs_bmap_free_t free_list;
2832 xfs_fsblock_t first_block; 2722 xfs_fsblock_t first_block;
2833 bhv_vnode_t *dir_vp; 2723 boolean_t unlock_dp_on_error = B_FALSE;
2834 boolean_t dp_joined_to_trans;
2835 boolean_t created = B_FALSE; 2724 boolean_t created = B_FALSE;
2836 int dm_event_sent = 0; 2725 int dm_event_sent = 0;
2837 xfs_prid_t prid; 2726 xfs_prid_t prid;
2838 struct xfs_dquot *udqp, *gdqp; 2727 struct xfs_dquot *udqp, *gdqp;
2839 uint resblks; 2728 uint resblks;
2840 int dm_di_mode;
2841 int dir_namelen;
2842
2843 dir_vp = BHV_TO_VNODE(dir_bdp);
2844 dp = XFS_BHVTOI(dir_bdp);
2845 mp = dp->i_mount;
2846 2729
2847 if (XFS_FORCED_SHUTDOWN(mp)) 2730 if (XFS_FORCED_SHUTDOWN(mp))
2848 return XFS_ERROR(EIO); 2731 return XFS_ERROR(EIO);
2849 2732
2850 dir_namelen = VNAMELEN(dentry);
2851
2852 tp = NULL; 2733 tp = NULL;
2853 dp_joined_to_trans = B_FALSE;
2854 dm_di_mode = vap->va_mode;
2855 2734
2856 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) { 2735 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
2857 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, 2736 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
2858 dir_vp, DM_RIGHT_NULL, NULL, 2737 dir_vp, DM_RIGHT_NULL, NULL,
2859 DM_RIGHT_NULL, dir_name, NULL, 2738 DM_RIGHT_NULL, dir_name, NULL,
2860 dm_di_mode, 0, 0); 2739 mode, 0, 0);
2861 if (error) 2740 if (error)
2862 return error; 2741 return error;
2863 dm_event_sent = 1; 2742 dm_event_sent = 1;
@@ -2865,14 +2744,12 @@ xfs_mkdir(
2865 2744
2866 /* Return through std_return after this point. */ 2745 /* Return through std_return after this point. */
2867 2746
2868 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); 2747 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
2869 2748
2870 mp = dp->i_mount; 2749 mp = dp->i_mount;
2871 udqp = gdqp = NULL; 2750 udqp = gdqp = NULL;
2872 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 2751 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
2873 prid = dp->i_d.di_projid; 2752 prid = dp->i_d.di_projid;
2874 else if (vap->va_mask & XFS_AT_PROJID)
2875 prid = (xfs_prid_t)vap->va_projid;
2876 else 2753 else
2877 prid = (xfs_prid_t)dfltprid; 2754 prid = (xfs_prid_t)dfltprid;
2878 2755
@@ -2898,11 +2775,11 @@ xfs_mkdir(
2898 } 2775 }
2899 if (error) { 2776 if (error) {
2900 cancel_flags = 0; 2777 cancel_flags = 0;
2901 dp = NULL;
2902 goto error_return; 2778 goto error_return;
2903 } 2779 }
2904 2780
2905 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 2781 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
2782 unlock_dp_on_error = B_TRUE;
2906 2783
2907 /* 2784 /*
2908 * Check for directory link count overflow. 2785 * Check for directory link count overflow.
@@ -2925,7 +2802,7 @@ xfs_mkdir(
2925 /* 2802 /*
2926 * create the directory inode. 2803 * create the directory inode.
2927 */ 2804 */
2928 error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 2, 2805 error = xfs_dir_ialloc(&tp, dp, mode, 2,
2929 0, credp, prid, resblks > 0, 2806 0, credp, prid, resblks > 0,
2930 &cdp, NULL); 2807 &cdp, NULL);
2931 if (error) { 2808 if (error) {
@@ -2939,11 +2816,13 @@ xfs_mkdir(
2939 * Now we add the directory inode to the transaction. 2816 * Now we add the directory inode to the transaction.
2940 * We waited until now since xfs_dir_ialloc might start 2817 * We waited until now since xfs_dir_ialloc might start
2941 * a new transaction. Had we joined the transaction 2818 * a new transaction. Had we joined the transaction
2942 * earlier, the locks might have gotten released. 2819 * earlier, the locks might have gotten released. An error
2820 * from here on will result in the transaction cancel
2821 * unlocking dp so don't do it explicitly in the error path.
2943 */ 2822 */
2944 VN_HOLD(dir_vp); 2823 VN_HOLD(dir_vp);
2945 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 2824 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2946 dp_joined_to_trans = B_TRUE; 2825 unlock_dp_on_error = B_FALSE;
2947 2826
2948 XFS_BMAP_INIT(&free_list, &first_block); 2827 XFS_BMAP_INIT(&free_list, &first_block);
2949 2828
@@ -3010,15 +2889,14 @@ xfs_mkdir(
3010 * xfs_trans_commit. */ 2889 * xfs_trans_commit. */
3011 2890
3012std_return: 2891std_return:
3013 if ( (created || (error != 0 && dm_event_sent != 0)) && 2892 if ((created || (error != 0 && dm_event_sent != 0)) &&
3014 DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), 2893 DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
3015 DM_EVENT_POSTCREATE)) {
3016 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, 2894 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
3017 dir_vp, DM_RIGHT_NULL, 2895 dir_vp, DM_RIGHT_NULL,
3018 created ? XFS_ITOV(cdp):NULL, 2896 created ? XFS_ITOV(cdp):NULL,
3019 DM_RIGHT_NULL, 2897 DM_RIGHT_NULL,
3020 dir_name, NULL, 2898 dir_name, NULL,
3021 dm_di_mode, error, 0); 2899 mode, error, 0);
3022 } 2900 }
3023 return error; 2901 return error;
3024 2902
@@ -3032,56 +2910,43 @@ std_return:
3032 XFS_QM_DQRELE(mp, udqp); 2910 XFS_QM_DQRELE(mp, udqp);
3033 XFS_QM_DQRELE(mp, gdqp); 2911 XFS_QM_DQRELE(mp, gdqp);
3034 2912
3035 if (!dp_joined_to_trans && (dp != NULL)) { 2913 if (unlock_dp_on_error)
3036 xfs_iunlock(dp, XFS_ILOCK_EXCL); 2914 xfs_iunlock(dp, XFS_ILOCK_EXCL);
3037 }
3038 2915
3039 goto std_return; 2916 goto std_return;
3040} 2917}
3041 2918
3042 2919int
3043/*
3044 * xfs_rmdir
3045 *
3046 */
3047STATIC int
3048xfs_rmdir( 2920xfs_rmdir(
3049 bhv_desc_t *dir_bdp, 2921 xfs_inode_t *dp,
3050 bhv_vname_t *dentry, 2922 bhv_vname_t *dentry)
3051 cred_t *credp)
3052{ 2923{
2924 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
3053 char *name = VNAME(dentry); 2925 char *name = VNAME(dentry);
3054 xfs_inode_t *dp; 2926 int namelen = VNAMELEN(dentry);
3055 xfs_inode_t *cdp; /* child directory */ 2927 xfs_mount_t *mp = dp->i_mount;
2928 xfs_inode_t *cdp; /* child directory */
3056 xfs_trans_t *tp; 2929 xfs_trans_t *tp;
3057 xfs_mount_t *mp;
3058 int error; 2930 int error;
3059 xfs_bmap_free_t free_list; 2931 xfs_bmap_free_t free_list;
3060 xfs_fsblock_t first_block; 2932 xfs_fsblock_t first_block;
3061 int cancel_flags; 2933 int cancel_flags;
3062 int committed; 2934 int committed;
3063 bhv_vnode_t *dir_vp;
3064 int dm_di_mode = S_IFDIR; 2935 int dm_di_mode = S_IFDIR;
3065 int last_cdp_link; 2936 int last_cdp_link;
3066 int namelen;
3067 uint resblks; 2937 uint resblks;
3068 2938
3069 dir_vp = BHV_TO_VNODE(dir_bdp); 2939 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
3070 dp = XFS_BHVTOI(dir_bdp);
3071 mp = dp->i_mount;
3072
3073 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
3074 2940
3075 if (XFS_FORCED_SHUTDOWN(XFS_BHVTOI(dir_bdp)->i_mount)) 2941 if (XFS_FORCED_SHUTDOWN(mp))
3076 return XFS_ERROR(EIO); 2942 return XFS_ERROR(EIO);
3077 namelen = VNAMELEN(dentry);
3078 2943
3079 if (!xfs_get_dir_entry(dentry, &cdp)) { 2944 if (!xfs_get_dir_entry(dentry, &cdp)) {
3080 dm_di_mode = cdp->i_d.di_mode; 2945 dm_di_mode = cdp->i_d.di_mode;
3081 IRELE(cdp); 2946 IRELE(cdp);
3082 } 2947 }
3083 2948
3084 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { 2949 if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
3085 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, 2950 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE,
3086 dir_vp, DM_RIGHT_NULL, 2951 dir_vp, DM_RIGHT_NULL,
3087 NULL, DM_RIGHT_NULL, 2952 NULL, DM_RIGHT_NULL,
@@ -3260,17 +3125,12 @@ xfs_rmdir(
3260 } 3125 }
3261 3126
3262 3127
3263 /*
3264 * Let interposed file systems know about removed links.
3265 */
3266 bhv_vop_link_removed(XFS_ITOV(cdp), dir_vp, last_cdp_link);
3267
3268 IRELE(cdp); 3128 IRELE(cdp);
3269 3129
3270 /* Fall through to std_return with error = 0 or the errno 3130 /* Fall through to std_return with error = 0 or the errno
3271 * from xfs_trans_commit. */ 3131 * from xfs_trans_commit. */
3272 std_return: 3132 std_return:
3273 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_POSTREMOVE)) { 3133 if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
3274 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, 3134 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
3275 dir_vp, DM_RIGHT_NULL, 3135 dir_vp, DM_RIGHT_NULL,
3276 NULL, DM_RIGHT_NULL, 3136 NULL, DM_RIGHT_NULL,
@@ -3289,56 +3149,24 @@ xfs_rmdir(
3289 goto std_return; 3149 goto std_return;
3290} 3150}
3291 3151
3292 3152int
3293/*
3294 * Read dp's entries starting at uiop->uio_offset and translate them into
3295 * bufsize bytes worth of struct dirents starting at bufbase.
3296 */
3297STATIC int
3298xfs_readdir(
3299 bhv_desc_t *dir_bdp,
3300 uio_t *uiop,
3301 cred_t *credp,
3302 int *eofp)
3303{
3304 xfs_inode_t *dp;
3305 xfs_trans_t *tp = NULL;
3306 int error = 0;
3307 uint lock_mode;
3308
3309 vn_trace_entry(BHV_TO_VNODE(dir_bdp), __FUNCTION__,
3310 (inst_t *)__return_address);
3311 dp = XFS_BHVTOI(dir_bdp);
3312
3313 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
3314 return XFS_ERROR(EIO);
3315
3316 lock_mode = xfs_ilock_map_shared(dp);
3317 error = xfs_dir_getdents(tp, dp, uiop, eofp);
3318 xfs_iunlock_map_shared(dp, lock_mode);
3319 return error;
3320}
3321
3322
3323STATIC int
3324xfs_symlink( 3153xfs_symlink(
3325 bhv_desc_t *dir_bdp, 3154 xfs_inode_t *dp,
3326 bhv_vname_t *dentry, 3155 bhv_vname_t *dentry,
3327 bhv_vattr_t *vap,
3328 char *target_path, 3156 char *target_path,
3157 mode_t mode,
3329 bhv_vnode_t **vpp, 3158 bhv_vnode_t **vpp,
3330 cred_t *credp) 3159 cred_t *credp)
3331{ 3160{
3161 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
3162 xfs_mount_t *mp = dp->i_mount;
3332 xfs_trans_t *tp; 3163 xfs_trans_t *tp;
3333 xfs_mount_t *mp;
3334 xfs_inode_t *dp;
3335 xfs_inode_t *ip; 3164 xfs_inode_t *ip;
3336 int error; 3165 int error;
3337 int pathlen; 3166 int pathlen;
3338 xfs_bmap_free_t free_list; 3167 xfs_bmap_free_t free_list;
3339 xfs_fsblock_t first_block; 3168 xfs_fsblock_t first_block;
3340 boolean_t dp_joined_to_trans; 3169 boolean_t unlock_dp_on_error = B_FALSE;
3341 bhv_vnode_t *dir_vp;
3342 uint cancel_flags; 3170 uint cancel_flags;
3343 int committed; 3171 int committed;
3344 xfs_fileoff_t first_fsb; 3172 xfs_fileoff_t first_fsb;
@@ -3357,16 +3185,12 @@ xfs_symlink(
3357 int link_namelen; 3185 int link_namelen;
3358 3186
3359 *vpp = NULL; 3187 *vpp = NULL;
3360 dir_vp = BHV_TO_VNODE(dir_bdp);
3361 dp = XFS_BHVTOI(dir_bdp);
3362 dp_joined_to_trans = B_FALSE;
3363 error = 0; 3188 error = 0;
3364 ip = NULL; 3189 ip = NULL;
3365 tp = NULL; 3190 tp = NULL;
3366 3191
3367 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); 3192 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
3368 3193
3369 mp = dp->i_mount;
3370 3194
3371 if (XFS_FORCED_SHUTDOWN(mp)) 3195 if (XFS_FORCED_SHUTDOWN(mp))
3372 return XFS_ERROR(EIO); 3196 return XFS_ERROR(EIO);
@@ -3405,7 +3229,7 @@ xfs_symlink(
3405 } 3229 }
3406 } 3230 }
3407 3231
3408 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_SYMLINK)) { 3232 if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) {
3409 error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dir_vp, 3233 error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dir_vp,
3410 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, 3234 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
3411 link_name, target_path, 0, 0, 0); 3235 link_name, target_path, 0, 0, 0);
@@ -3418,8 +3242,6 @@ xfs_symlink(
3418 udqp = gdqp = NULL; 3242 udqp = gdqp = NULL;
3419 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 3243 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
3420 prid = dp->i_d.di_projid; 3244 prid = dp->i_d.di_projid;
3421 else if (vap->va_mask & XFS_AT_PROJID)
3422 prid = (xfs_prid_t)vap->va_projid;
3423 else 3245 else
3424 prid = (xfs_prid_t)dfltprid; 3246 prid = (xfs_prid_t)dfltprid;
3425 3247
@@ -3452,11 +3274,11 @@ xfs_symlink(
3452 } 3274 }
3453 if (error) { 3275 if (error) {
3454 cancel_flags = 0; 3276 cancel_flags = 0;
3455 dp = NULL;
3456 goto error_return; 3277 goto error_return;
3457 } 3278 }
3458 3279
3459 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 3280 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
3281 unlock_dp_on_error = B_TRUE;
3460 3282
3461 /* 3283 /*
3462 * Check whether the directory allows new symlinks or not. 3284 * Check whether the directory allows new symlinks or not.
@@ -3488,7 +3310,7 @@ xfs_symlink(
3488 /* 3310 /*
3489 * Allocate an inode for the symlink. 3311 * Allocate an inode for the symlink.
3490 */ 3312 */
3491 error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (vap->va_mode&~S_IFMT), 3313 error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT),
3492 1, 0, credp, prid, resblks > 0, &ip, NULL); 3314 1, 0, credp, prid, resblks > 0, &ip, NULL);
3493 if (error) { 3315 if (error) {
3494 if (error == ENOSPC) 3316 if (error == ENOSPC)
@@ -3497,9 +3319,14 @@ xfs_symlink(
3497 } 3319 }
3498 ITRACE(ip); 3320 ITRACE(ip);
3499 3321
3322 /*
3323 * An error after we've joined dp to the transaction will result in the
3324 * transaction cancel unlocking dp so don't do it explicitly in the
3325 * error path.
3326 */
3500 VN_HOLD(dir_vp); 3327 VN_HOLD(dir_vp);
3501 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 3328 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
3502 dp_joined_to_trans = B_TRUE; 3329 unlock_dp_on_error = B_FALSE;
3503 3330
3504 /* 3331 /*
3505 * Also attach the dquot(s) to it, if applicable. 3332 * Also attach the dquot(s) to it, if applicable.
@@ -3605,8 +3432,7 @@ xfs_symlink(
3605 /* Fall through to std_return with error = 0 or errno from 3432 /* Fall through to std_return with error = 0 or errno from
3606 * xfs_trans_commit */ 3433 * xfs_trans_commit */
3607std_return: 3434std_return:
3608 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), 3435 if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTSYMLINK)) {
3609 DM_EVENT_POSTSYMLINK)) {
3610 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, 3436 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK,
3611 dir_vp, DM_RIGHT_NULL, 3437 dir_vp, DM_RIGHT_NULL,
3612 error ? NULL : XFS_ITOV(ip), 3438 error ? NULL : XFS_ITOV(ip),
@@ -3633,9 +3459,8 @@ std_return:
3633 XFS_QM_DQRELE(mp, udqp); 3459 XFS_QM_DQRELE(mp, udqp);
3634 XFS_QM_DQRELE(mp, gdqp); 3460 XFS_QM_DQRELE(mp, gdqp);
3635 3461
3636 if (!dp_joined_to_trans && (dp != NULL)) { 3462 if (unlock_dp_on_error)
3637 xfs_iunlock(dp, XFS_ILOCK_EXCL); 3463 xfs_iunlock(dp, XFS_ILOCK_EXCL);
3638 }
3639 3464
3640 goto std_return; 3465 goto std_return;
3641} 3466}
@@ -3647,20 +3472,16 @@ std_return:
3647 * A fid routine that takes a pointer to a previously allocated 3472 * A fid routine that takes a pointer to a previously allocated
3648 * fid structure (like xfs_fast_fid) but uses a 64 bit inode number. 3473 * fid structure (like xfs_fast_fid) but uses a 64 bit inode number.
3649 */ 3474 */
3650STATIC int 3475int
3651xfs_fid2( 3476xfs_fid2(
3652 bhv_desc_t *bdp, 3477 xfs_inode_t *ip,
3653 fid_t *fidp) 3478 fid_t *fidp)
3654{ 3479{
3655 xfs_inode_t *ip; 3480 xfs_fid2_t *xfid = (xfs_fid2_t *)fidp;
3656 xfs_fid2_t *xfid;
3657 3481
3658 vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__, 3482 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
3659 (inst_t *)__return_address);
3660 ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t)); 3483 ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
3661 3484
3662 xfid = (xfs_fid2_t *)fidp;
3663 ip = XFS_BHVTOI(bdp);
3664 xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len); 3485 xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len);
3665 xfid->fid_pad = 0; 3486 xfid->fid_pad = 0;
3666 /* 3487 /*
@@ -3674,21 +3495,13 @@ xfs_fid2(
3674} 3495}
3675 3496
3676 3497
3677/*
3678 * xfs_rwlock
3679 */
3680int 3498int
3681xfs_rwlock( 3499xfs_rwlock(
3682 bhv_desc_t *bdp, 3500 xfs_inode_t *ip,
3683 bhv_vrwlock_t locktype) 3501 bhv_vrwlock_t locktype)
3684{ 3502{
3685 xfs_inode_t *ip; 3503 if (S_ISDIR(ip->i_d.di_mode))
3686 bhv_vnode_t *vp;
3687
3688 vp = BHV_TO_VNODE(bdp);
3689 if (VN_ISDIR(vp))
3690 return 1; 3504 return 1;
3691 ip = XFS_BHVTOI(bdp);
3692 if (locktype == VRWLOCK_WRITE) { 3505 if (locktype == VRWLOCK_WRITE) {
3693 xfs_ilock(ip, XFS_IOLOCK_EXCL); 3506 xfs_ilock(ip, XFS_IOLOCK_EXCL);
3694 } else if (locktype == VRWLOCK_TRY_READ) { 3507 } else if (locktype == VRWLOCK_TRY_READ) {
@@ -3705,21 +3518,13 @@ xfs_rwlock(
3705} 3518}
3706 3519
3707 3520
3708/*
3709 * xfs_rwunlock
3710 */
3711void 3521void
3712xfs_rwunlock( 3522xfs_rwunlock(
3713 bhv_desc_t *bdp, 3523 xfs_inode_t *ip,
3714 bhv_vrwlock_t locktype) 3524 bhv_vrwlock_t locktype)
3715{ 3525{
3716 xfs_inode_t *ip; 3526 if (S_ISDIR(ip->i_d.di_mode))
3717 bhv_vnode_t *vp; 3527 return;
3718
3719 vp = BHV_TO_VNODE(bdp);
3720 if (VN_ISDIR(vp))
3721 return;
3722 ip = XFS_BHVTOI(bdp);
3723 if (locktype == VRWLOCK_WRITE) { 3528 if (locktype == VRWLOCK_WRITE) {
3724 /* 3529 /*
3725 * In the write case, we may have added a new entry to 3530 * In the write case, we may have added a new entry to
@@ -3737,20 +3542,16 @@ xfs_rwunlock(
3737 return; 3542 return;
3738} 3543}
3739 3544
3740STATIC int 3545
3546int
3741xfs_inode_flush( 3547xfs_inode_flush(
3742 bhv_desc_t *bdp, 3548 xfs_inode_t *ip,
3743 int flags) 3549 int flags)
3744{ 3550{
3745 xfs_inode_t *ip; 3551 xfs_mount_t *mp = ip->i_mount;
3746 xfs_mount_t *mp; 3552 xfs_inode_log_item_t *iip = ip->i_itemp;
3747 xfs_inode_log_item_t *iip;
3748 int error = 0; 3553 int error = 0;
3749 3554
3750 ip = XFS_BHVTOI(bdp);
3751 mp = ip->i_mount;
3752 iip = ip->i_itemp;
3753
3754 if (XFS_FORCED_SHUTDOWN(mp)) 3555 if (XFS_FORCED_SHUTDOWN(mp))
3755 return XFS_ERROR(EIO); 3556 return XFS_ERROR(EIO);
3756 3557
@@ -3819,24 +3620,20 @@ xfs_inode_flush(
3819 return error; 3620 return error;
3820} 3621}
3821 3622
3623
3822int 3624int
3823xfs_set_dmattrs ( 3625xfs_set_dmattrs(
3824 bhv_desc_t *bdp, 3626 xfs_inode_t *ip,
3825 u_int evmask, 3627 u_int evmask,
3826 u_int16_t state, 3628 u_int16_t state)
3827 cred_t *credp)
3828{ 3629{
3829 xfs_inode_t *ip; 3630 xfs_mount_t *mp = ip->i_mount;
3830 xfs_trans_t *tp; 3631 xfs_trans_t *tp;
3831 xfs_mount_t *mp;
3832 int error; 3632 int error;
3833 3633
3834 if (!capable(CAP_SYS_ADMIN)) 3634 if (!capable(CAP_SYS_ADMIN))
3835 return XFS_ERROR(EPERM); 3635 return XFS_ERROR(EPERM);
3836 3636
3837 ip = XFS_BHVTOI(bdp);
3838 mp = ip->i_mount;
3839
3840 if (XFS_FORCED_SHUTDOWN(mp)) 3637 if (XFS_FORCED_SHUTDOWN(mp))
3841 return XFS_ERROR(EIO); 3638 return XFS_ERROR(EIO);
3842 3639
@@ -3859,17 +3656,13 @@ xfs_set_dmattrs (
3859 return error; 3656 return error;
3860} 3657}
3861 3658
3862STATIC int 3659int
3863xfs_reclaim( 3660xfs_reclaim(
3864 bhv_desc_t *bdp) 3661 xfs_inode_t *ip)
3865{ 3662{
3866 xfs_inode_t *ip; 3663 bhv_vnode_t *vp = XFS_ITOV(ip);
3867 bhv_vnode_t *vp;
3868
3869 vp = BHV_TO_VNODE(bdp);
3870 ip = XFS_BHVTOI(bdp);
3871 3664
3872 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 3665 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
3873 3666
3874 ASSERT(!VN_MAPPED(vp)); 3667 ASSERT(!VN_MAPPED(vp));
3875 3668
@@ -3879,7 +3672,7 @@ xfs_reclaim(
3879 return 0; 3672 return 0;
3880 } 3673 }
3881 3674
3882 vn_iowait(vp); 3675 vn_iowait(ip);
3883 3676
3884 ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); 3677 ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0);
3885 3678
@@ -3911,7 +3704,8 @@ xfs_reclaim(
3911 XFS_MOUNT_ILOCK(mp); 3704 XFS_MOUNT_ILOCK(mp);
3912 spin_lock(&ip->i_flags_lock); 3705 spin_lock(&ip->i_flags_lock);
3913 __xfs_iflags_set(ip, XFS_IRECLAIMABLE); 3706 __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
3914 vn_bhv_remove(VN_BHV_HEAD(vp), XFS_ITOBHV(ip)); 3707 vn_to_inode(vp)->i_private = NULL;
3708 ip->i_vnode = NULL;
3915 spin_unlock(&ip->i_flags_lock); 3709 spin_unlock(&ip->i_flags_lock);
3916 list_add_tail(&ip->i_reclaim, &mp->m_del_inodes); 3710 list_add_tail(&ip->i_reclaim, &mp->m_del_inodes);
3917 XFS_MOUNT_IUNLOCK(mp); 3711 XFS_MOUNT_IUNLOCK(mp);
@@ -3925,7 +3719,7 @@ xfs_finish_reclaim(
3925 int locked, 3719 int locked,
3926 int sync_mode) 3720 int sync_mode)
3927{ 3721{
3928 xfs_ihash_t *ih = ip->i_hash; 3722 xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino);
3929 bhv_vnode_t *vp = XFS_ITOV_NULL(ip); 3723 bhv_vnode_t *vp = XFS_ITOV_NULL(ip);
3930 int error; 3724 int error;
3931 3725
@@ -3937,12 +3731,12 @@ xfs_finish_reclaim(
3937 * Once we have the XFS_IRECLAIM flag set it will not touch 3731 * Once we have the XFS_IRECLAIM flag set it will not touch
3938 * us. 3732 * us.
3939 */ 3733 */
3940 write_lock(&ih->ih_lock); 3734 write_lock(&pag->pag_ici_lock);
3941 spin_lock(&ip->i_flags_lock); 3735 spin_lock(&ip->i_flags_lock);
3942 if (__xfs_iflags_test(ip, XFS_IRECLAIM) || 3736 if (__xfs_iflags_test(ip, XFS_IRECLAIM) ||
3943 (!__xfs_iflags_test(ip, XFS_IRECLAIMABLE) && vp == NULL)) { 3737 (!__xfs_iflags_test(ip, XFS_IRECLAIMABLE) && vp == NULL)) {
3944 spin_unlock(&ip->i_flags_lock); 3738 spin_unlock(&ip->i_flags_lock);
3945 write_unlock(&ih->ih_lock); 3739 write_unlock(&pag->pag_ici_lock);
3946 if (locked) { 3740 if (locked) {
3947 xfs_ifunlock(ip); 3741 xfs_ifunlock(ip);
3948 xfs_iunlock(ip, XFS_ILOCK_EXCL); 3742 xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -3951,7 +3745,8 @@ xfs_finish_reclaim(
3951 } 3745 }
3952 __xfs_iflags_set(ip, XFS_IRECLAIM); 3746 __xfs_iflags_set(ip, XFS_IRECLAIM);
3953 spin_unlock(&ip->i_flags_lock); 3747 spin_unlock(&ip->i_flags_lock);
3954 write_unlock(&ih->ih_lock); 3748 write_unlock(&pag->pag_ici_lock);
3749 xfs_put_perag(ip->i_mount, pag);
3955 3750
3956 /* 3751 /*
3957 * If the inode is still dirty, then flush it out. If the inode 3752 * If the inode is still dirty, then flush it out. If the inode
@@ -4085,7 +3880,7 @@ xfs_alloc_file_space(
4085 int committed; 3880 int committed;
4086 int error; 3881 int error;
4087 3882
4088 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 3883 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
4089 3884
4090 if (XFS_FORCED_SHUTDOWN(mp)) 3885 if (XFS_FORCED_SHUTDOWN(mp))
4091 return XFS_ERROR(EIO); 3886 return XFS_ERROR(EIO);
@@ -4109,7 +3904,7 @@ xfs_alloc_file_space(
4109 /* Generate a DMAPI event if needed. */ 3904 /* Generate a DMAPI event if needed. */
4110 if (alloc_type != 0 && offset < ip->i_size && 3905 if (alloc_type != 0 && offset < ip->i_size &&
4111 (attr_flags&ATTR_DMI) == 0 && 3906 (attr_flags&ATTR_DMI) == 0 &&
4112 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { 3907 DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
4113 xfs_off_t end_dmi_offset; 3908 xfs_off_t end_dmi_offset;
4114 3909
4115 end_dmi_offset = offset+len; 3910 end_dmi_offset = offset+len;
@@ -4223,9 +4018,8 @@ retry:
4223 allocatesize_fsb -= allocated_fsb; 4018 allocatesize_fsb -= allocated_fsb;
4224 } 4019 }
4225dmapi_enospc_check: 4020dmapi_enospc_check:
4226 if (error == ENOSPC && (attr_flags&ATTR_DMI) == 0 && 4021 if (error == ENOSPC && (attr_flags & ATTR_DMI) == 0 &&
4227 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_NOSPACE)) { 4022 DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) {
4228
4229 error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE, 4023 error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE,
4230 XFS_ITOV(ip), DM_RIGHT_NULL, 4024 XFS_ITOV(ip), DM_RIGHT_NULL,
4231 XFS_ITOV(ip), DM_RIGHT_NULL, 4025 XFS_ITOV(ip), DM_RIGHT_NULL,
@@ -4356,7 +4150,7 @@ xfs_free_file_space(
4356 vp = XFS_ITOV(ip); 4150 vp = XFS_ITOV(ip);
4357 mp = ip->i_mount; 4151 mp = ip->i_mount;
4358 4152
4359 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 4153 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
4360 4154
4361 if ((error = XFS_QM_DQATTACH(mp, ip, 0))) 4155 if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
4362 return error; 4156 return error;
@@ -4369,9 +4163,8 @@ xfs_free_file_space(
4369 end_dmi_offset = offset + len; 4163 end_dmi_offset = offset + len;
4370 endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); 4164 endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
4371 4165
4372 if (offset < ip->i_size && 4166 if (offset < ip->i_size && (attr_flags & ATTR_DMI) == 0 &&
4373 (attr_flags & ATTR_DMI) == 0 && 4167 DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
4374 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {
4375 if (end_dmi_offset > ip->i_size) 4168 if (end_dmi_offset > ip->i_size)
4376 end_dmi_offset = ip->i_size; 4169 end_dmi_offset = ip->i_size;
4377 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, 4170 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp,
@@ -4385,7 +4178,7 @@ xfs_free_file_space(
4385 need_iolock = 0; 4178 need_iolock = 0;
4386 if (need_iolock) { 4179 if (need_iolock) {
4387 xfs_ilock(ip, XFS_IOLOCK_EXCL); 4180 xfs_ilock(ip, XFS_IOLOCK_EXCL);
4388 vn_iowait(vp); /* wait for the completion of any pending DIOs */ 4181 vn_iowait(ip); /* wait for the completion of any pending DIOs */
4389 } 4182 }
4390 4183
4391 rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); 4184 rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP);
@@ -4394,7 +4187,8 @@ xfs_free_file_space(
4394 if (VN_CACHED(vp) != 0) { 4187 if (VN_CACHED(vp) != 0) {
4395 xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, 4188 xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1,
4396 ctooff(offtoct(ioffset)), -1); 4189 ctooff(offtoct(ioffset)), -1);
4397 error = bhv_vop_flushinval_pages(vp, ctooff(offtoct(ioffset)), 4190 error = xfs_flushinval_pages(ip,
4191 ctooff(offtoct(ioffset)),
4398 -1, FI_REMAPF_LOCKED); 4192 -1, FI_REMAPF_LOCKED);
4399 if (error) 4193 if (error)
4400 goto out_unlock_iolock; 4194 goto out_unlock_iolock;
@@ -4545,35 +4339,29 @@ xfs_free_file_space(
4545 */ 4339 */
4546int 4340int
4547xfs_change_file_space( 4341xfs_change_file_space(
4548 bhv_desc_t *bdp, 4342 xfs_inode_t *ip,
4549 int cmd, 4343 int cmd,
4550 xfs_flock64_t *bf, 4344 xfs_flock64_t *bf,
4551 xfs_off_t offset, 4345 xfs_off_t offset,
4552 cred_t *credp, 4346 cred_t *credp,
4553 int attr_flags) 4347 int attr_flags)
4554{ 4348{
4349 xfs_mount_t *mp = ip->i_mount;
4555 int clrprealloc; 4350 int clrprealloc;
4556 int error; 4351 int error;
4557 xfs_fsize_t fsize; 4352 xfs_fsize_t fsize;
4558 xfs_inode_t *ip;
4559 xfs_mount_t *mp;
4560 int setprealloc; 4353 int setprealloc;
4561 xfs_off_t startoffset; 4354 xfs_off_t startoffset;
4562 xfs_off_t llen; 4355 xfs_off_t llen;
4563 xfs_trans_t *tp; 4356 xfs_trans_t *tp;
4564 bhv_vattr_t va; 4357 bhv_vattr_t va;
4565 bhv_vnode_t *vp;
4566 4358
4567 vp = BHV_TO_VNODE(bdp); 4359 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
4568 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
4569
4570 ip = XFS_BHVTOI(bdp);
4571 mp = ip->i_mount;
4572 4360
4573 /* 4361 /*
4574 * must be a regular file and have write permission 4362 * must be a regular file and have write permission
4575 */ 4363 */
4576 if (!VN_ISREG(vp)) 4364 if (!S_ISREG(ip->i_d.di_mode))
4577 return XFS_ERROR(EINVAL); 4365 return XFS_ERROR(EINVAL);
4578 4366
4579 xfs_ilock(ip, XFS_ILOCK_SHARED); 4367 xfs_ilock(ip, XFS_ILOCK_SHARED);
@@ -4655,7 +4443,7 @@ xfs_change_file_space(
4655 va.va_mask = XFS_AT_SIZE; 4443 va.va_mask = XFS_AT_SIZE;
4656 va.va_size = startoffset; 4444 va.va_size = startoffset;
4657 4445
4658 error = xfs_setattr(bdp, &va, attr_flags, credp); 4446 error = xfs_setattr(ip, &va, attr_flags, credp);
4659 4447
4660 if (error) 4448 if (error)
4661 return error; 4449 return error;
@@ -4714,46 +4502,3 @@ xfs_change_file_space(
4714 4502
4715 return error; 4503 return error;
4716} 4504}
4717
4718bhv_vnodeops_t xfs_vnodeops = {
4719 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
4720 .vop_open = xfs_open,
4721 .vop_read = xfs_read,
4722#ifdef HAVE_SPLICE
4723 .vop_splice_read = xfs_splice_read,
4724 .vop_splice_write = xfs_splice_write,
4725#endif
4726 .vop_write = xfs_write,
4727 .vop_ioctl = xfs_ioctl,
4728 .vop_getattr = xfs_getattr,
4729 .vop_setattr = xfs_setattr,
4730 .vop_access = xfs_access,
4731 .vop_lookup = xfs_lookup,
4732 .vop_create = xfs_create,
4733 .vop_remove = xfs_remove,
4734 .vop_link = xfs_link,
4735 .vop_rename = xfs_rename,
4736 .vop_mkdir = xfs_mkdir,
4737 .vop_rmdir = xfs_rmdir,
4738 .vop_readdir = xfs_readdir,
4739 .vop_symlink = xfs_symlink,
4740 .vop_readlink = xfs_readlink,
4741 .vop_fsync = xfs_fsync,
4742 .vop_inactive = xfs_inactive,
4743 .vop_fid2 = xfs_fid2,
4744 .vop_rwlock = xfs_rwlock,
4745 .vop_rwunlock = xfs_rwunlock,
4746 .vop_bmap = xfs_bmap,
4747 .vop_reclaim = xfs_reclaim,
4748 .vop_attr_get = xfs_attr_get,
4749 .vop_attr_set = xfs_attr_set,
4750 .vop_attr_remove = xfs_attr_remove,
4751 .vop_attr_list = xfs_attr_list,
4752 .vop_link_removed = (vop_link_removed_t)fs_noval,
4753 .vop_vnode_change = (vop_vnode_change_t)fs_noval,
4754 .vop_tosspages = fs_tosspages,
4755 .vop_flushinval_pages = fs_flushinval_pages,
4756 .vop_flush_pages = fs_flush_pages,
4757 .vop_release = xfs_release,
4758 .vop_iflush = xfs_inode_flush,
4759};
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
new file mode 100644
index 000000000000..f36e74f2f0c2
--- /dev/null
+++ b/fs/xfs/xfs_vnodeops.h
@@ -0,0 +1,86 @@
1#ifndef _XFS_VNODEOPS_H
2#define _XFS_VNODEOPS_H 1
3
4struct attrlist_cursor_kern;
5struct bhv_vattr;
6struct cred;
7struct file;
8struct inode;
9struct iovec;
10struct kiocb;
11struct pipe_inode_info;
12struct uio;
13struct xfs_inode;
14struct xfs_iomap;
15
16
17int xfs_open(struct xfs_inode *ip);
18int xfs_getattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags);
19int xfs_setattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags,
20 struct cred *credp);
21int xfs_access(struct xfs_inode *ip, int mode, struct cred *credp);
22int xfs_readlink(struct xfs_inode *ip, char *link);
23int xfs_fsync(struct xfs_inode *ip, int flag, xfs_off_t start,
24 xfs_off_t stop);
25int xfs_release(struct xfs_inode *ip);
26int xfs_inactive(struct xfs_inode *ip);
27int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry,
28 bhv_vnode_t **vpp);
29int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, mode_t mode,
30 xfs_dev_t rdev, bhv_vnode_t **vpp, struct cred *credp);
31int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry);
32int xfs_link(struct xfs_inode *tdp, bhv_vnode_t *src_vp,
33 bhv_vname_t *dentry);
34int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry,
35 mode_t mode, bhv_vnode_t **vpp, struct cred *credp);
36int xfs_rmdir(struct xfs_inode *dp, bhv_vname_t *dentry);
37int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
38 xfs_off_t *offset, filldir_t filldir);
39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry,
40 char *target_path, mode_t mode, bhv_vnode_t **vpp,
41 struct cred *credp);
42int xfs_fid2(struct xfs_inode *ip, fid_t *fidp);
43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
45int xfs_inode_flush(struct xfs_inode *ip, int flags);
46int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state);
47int xfs_reclaim(struct xfs_inode *ip);
48int xfs_change_file_space(struct xfs_inode *ip, int cmd,
49 xfs_flock64_t *bf, xfs_off_t offset,
50 struct cred *credp, int attr_flags);
51int xfs_rename(struct xfs_inode *src_dp, bhv_vname_t *src_vname,
52 bhv_vnode_t *target_dir_vp, bhv_vname_t *target_vname);
53int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value,
54 int *valuelenp, int flags, cred_t *cred);
55int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value,
56 int valuelen, int flags);
57int xfs_attr_remove(struct xfs_inode *dp, const char *name, int flags);
58int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
59 int flags, struct attrlist_cursor_kern *cursor);
60int xfs_ioctl(struct xfs_inode *ip, struct file *filp,
61 int ioflags, unsigned int cmd, void __user *arg);
62ssize_t xfs_read(struct xfs_inode *ip, struct kiocb *iocb,
63 const struct iovec *iovp, unsigned int segs,
64 loff_t *offset, int ioflags);
65ssize_t xfs_sendfile(struct xfs_inode *ip, struct file *filp,
66 loff_t *offset, int ioflags, size_t count,
67 read_actor_t actor, void *target);
68ssize_t xfs_splice_read(struct xfs_inode *ip, struct file *infilp,
69 loff_t *ppos, struct pipe_inode_info *pipe, size_t count,
70 int flags, int ioflags);
71ssize_t xfs_splice_write(struct xfs_inode *ip,
72 struct pipe_inode_info *pipe, struct file *outfilp,
73 loff_t *ppos, size_t count, int flags, int ioflags);
74ssize_t xfs_write(struct xfs_inode *xip, struct kiocb *iocb,
75 const struct iovec *iovp, unsigned int nsegs,
76 loff_t *offset, int ioflags);
77int xfs_bmap(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
78 int flags, struct xfs_iomap *iomapp, int *niomaps);
79void xfs_tosspages(struct xfs_inode *inode, xfs_off_t first,
80 xfs_off_t last, int fiopt);
81int xfs_flushinval_pages(struct xfs_inode *ip, xfs_off_t first,
82 xfs_off_t last, int fiopt);
83int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
84 xfs_off_t last, uint64_t flags, int fiopt);
85
86#endif /* _XFS_VNODEOPS_H */
diff --git a/include/Kbuild b/include/Kbuild
index 2d03f995865f..b52288774345 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,6 +1,5 @@
1header-y += asm-generic/ 1header-y += asm-generic/
2header-y += linux/ 2header-y += linux/
3header-y += scsi/
4header-y += sound/ 3header-y += sound/
5header-y += mtd/ 4header-y += mtd/
6header-y += rdma/ 5header-y += rdma/
diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h
index 6c2d78fba264..4b518e3b952c 100644
--- a/include/asm-alpha/elf.h
+++ b/include/asm-alpha/elf.h
@@ -155,6 +155,7 @@ extern int alpha_l1d_cacheshape;
155extern int alpha_l2_cacheshape; 155extern int alpha_l2_cacheshape;
156extern int alpha_l3_cacheshape; 156extern int alpha_l3_cacheshape;
157 157
158/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
158#define ARCH_DLINFO \ 159#define ARCH_DLINFO \
159 do { \ 160 do { \
160 NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape); \ 161 NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape); \
diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h
index 6a9f02af9529..0be50413b2b5 100644
--- a/include/asm-alpha/floppy.h
+++ b/include/asm-alpha/floppy.h
@@ -91,8 +91,6 @@ static int FDC2 = -1;
91#define N_FDC 2 91#define N_FDC 2
92#define N_DRIVE 8 92#define N_DRIVE 8
93 93
94#define FLOPPY_MOTOR_MASK 0xf0
95
96/* 94/*
97 * Most Alphas have no problems with floppy DMA crossing 64k borders, 95 * Most Alphas have no problems with floppy DMA crossing 64k borders,
98 * except for certain ones, like XL and RUFFIAN. 96 * except for certain ones, like XL and RUFFIAN.
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index ab5b60dcef19..38f18cf18c9d 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -551,12 +551,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
551#endif 551#endif
552#define RTC_ALWAYS_BCD 0 552#define RTC_ALWAYS_BCD 0
553 553
554/* Nothing to do */
555
556#define dma_cache_inv(_start,_size) do { } while (0)
557#define dma_cache_wback(_start,_size) do { } while (0)
558#define dma_cache_wback_inv(_start,_size) do { } while (0)
559
560/* 554/*
561 * Some mucking forons use if[n]def writeq to check if platform has it. 555 * Some mucking forons use if[n]def writeq to check if platform has it.
562 * It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them 556 * It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
diff --git a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h
index 1a6295f2c2d4..f1e9278a9fe2 100644
--- a/include/asm-alpha/semaphore.h
+++ b/include/asm-alpha/semaphore.h
@@ -30,7 +30,6 @@ struct semaphore {
30 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 30 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
31 31
32#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 32#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
33#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
34 33
35static inline void sema_init(struct semaphore *sem, int val) 34static inline void sema_init(struct semaphore *sem, int val)
36{ 35{
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index 620c4d86cbf4..fd9dc889f36c 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -48,6 +48,7 @@
48 48
49#ifndef __ASSEMBLY__ 49#ifndef __ASSEMBLY__
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#define AT_VECTOR_SIZE_ARCH 4 /* entries in ARCH_DLINFO */
51 52
52/* 53/*
53 * This is the logout header that should be common to all platforms 54 * This is the logout header that should be common to all platforms
diff --git a/include/asm-arm/floppy.h b/include/asm-arm/floppy.h
index d595c15166a4..41a5e9d6bb69 100644
--- a/include/asm-arm/floppy.h
+++ b/include/asm-arm/floppy.h
@@ -128,8 +128,6 @@ static inline void fd_scandrives (void)
128#define N_FDC 1 128#define N_FDC 1
129#define N_DRIVE 4 129#define N_DRIVE 4
130 130
131#define FLOPPY_MOTOR_MASK 0xf0
132
133#define CROSS_64KB(a,s) (0) 131#define CROSS_64KB(a,s) (0)
134 132
135/* 133/*
diff --git a/include/asm-arm/ipc.h b/include/asm-arm/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-arm/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h
index d5dc624f452a..1c8b441f89e3 100644
--- a/include/asm-arm/semaphore.h
+++ b/include/asm-arm/semaphore.h
@@ -28,7 +28,6 @@ struct semaphore {
28 struct semaphore name = __SEMAPHORE_INIT(name,count) 28 struct semaphore name = __SEMAPHORE_INIT(name,count)
29 29
30#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 30#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
31#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
32 31
33static inline void sema_init(struct semaphore *sem, int val) 32static inline void sema_init(struct semaphore *sem, int val)
34{ 33{
diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h
index 22992ee0627a..3141451a9bd6 100644
--- a/include/asm-arm/types.h
+++ b/include/asm-arm/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
19typedef __signed__ int __s32; 19typedef __signed__ int __s32;
20typedef unsigned int __u32; 20typedef unsigned int __u32;
21 21
22#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 22#if defined(__GNUC__)
23typedef __signed__ long long __s64; 23__extension__ typedef __signed__ long long __s64;
24typedef unsigned long long __u64; 24__extension__ typedef unsigned long long __u64;
25#endif 25#endif
26 26
27#endif /* __ASSEMBLY__ */ 27#endif /* __ASSEMBLY__ */
diff --git a/include/asm-arm26/irq_regs.h b/include/asm-arm26/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-arm26/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 64bb92bb6773..8be7ea9c9047 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -298,13 +298,6 @@ extern void __iounmap(void __iomem *addr);
298#define ioport_map(port, nr) ioremap(port, nr) 298#define ioport_map(port, nr) ioremap(port, nr)
299#define ioport_unmap(port) iounmap(port) 299#define ioport_unmap(port) iounmap(port)
300 300
301#define dma_cache_wback_inv(_start, _size) \
302 flush_dcache_region(_start, _size)
303#define dma_cache_inv(_start, _size) \
304 invalidate_dcache_region(_start, _size)
305#define dma_cache_wback(_start, _size) \
306 clean_dcache_region(_start, _size)
307
308/* 301/*
309 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 302 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
310 * access 303 * access
diff --git a/include/asm-avr32/semaphore.h b/include/asm-avr32/semaphore.h
index ef99ddccc10c..feaf1d453386 100644
--- a/include/asm-avr32/semaphore.h
+++ b/include/asm-avr32/semaphore.h
@@ -36,7 +36,6 @@ struct semaphore {
36 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 36 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
37 37
38#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 38#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
39#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
40 39
41static inline void sema_init (struct semaphore *sem, int val) 40static inline void sema_init (struct semaphore *sem, int val)
42{ 41{
diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h
index 2bff153a32ed..8999a3819403 100644
--- a/include/asm-avr32/types.h
+++ b/include/asm-avr32/types.h
@@ -25,9 +25,9 @@ typedef unsigned short __u16;
25typedef __signed__ int __s32; 25typedef __signed__ int __s32;
26typedef unsigned int __u32; 26typedef unsigned int __u32;
27 27
28#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 28#if defined(__GNUC__)
29typedef __signed__ long long __s64; 29__extension__ typedef __signed__ long long __s64;
30typedef unsigned long long __u64; 30__extension__ typedef unsigned long long __u64;
31#endif 31#endif
32 32
33#endif /* __ASSEMBLY__ */ 33#endif /* __ASSEMBLY__ */
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index 525179bf43d7..d1d2e6be3b59 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -183,10 +183,6 @@ extern void blkfin_inv_cache_all(void);
183#define ioport_map(port, nr) ((void __iomem*)(port)) 183#define ioport_map(port, nr) ((void __iomem*)(port))
184#define ioport_unmap(addr) 184#define ioport_unmap(addr)
185 185
186#define dma_cache_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
187#define dma_cache_wback(_start,_size) do { } while (0)
188#define dma_cache_wback_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
189
190/* Pages to physical address... */ 186/* Pages to physical address... */
191#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) 187#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
192#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT) 188#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
index a46e3d9c2a3f..000000000000
--- a/include/asm-blackfin/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-blackfin/semaphore.h b/include/asm-blackfin/semaphore.h
index 94c04d7ab23e..533f90fb2e4e 100644
--- a/include/asm-blackfin/semaphore.h
+++ b/include/asm-blackfin/semaphore.h
@@ -35,7 +35,6 @@ struct semaphore {
35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
36 36
37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
38#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
39 38
40static inline void sema_init(struct semaphore *sem, int val) 39static inline void sema_init(struct semaphore *sem, int val)
41{ 40{
diff --git a/include/asm-blackfin/types.h b/include/asm-blackfin/types.h
index 36f8dc8c52ba..9785a6d531c6 100644
--- a/include/asm-blackfin/types.h
+++ b/include/asm-blackfin/types.h
@@ -27,9 +27,9 @@ typedef __signed__ int __s32;
27typedef unsigned int __u32; 27typedef unsigned int __u32;
28 28
29/* HK0617 -- Changes to unsigned long temporarily */ 29/* HK0617 -- Changes to unsigned long temporarily */
30#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 30#if defined(__GNUC__)
31typedef __signed__ long long __s64; 31__extension__ typedef __signed__ long long __s64;
32typedef unsigned long long __u64; 32__extension__ typedef unsigned long long __u64;
33#endif 33#endif
34 34
35#endif /* __ASSEMBLY__ */ 35#endif /* __ASSEMBLY__ */
diff --git a/include/asm-cris/ipc.h b/include/asm-cris/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-cris/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#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
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-cris/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h
index 53f548b791c1..31a4ac448195 100644
--- a/include/asm-cris/semaphore.h
+++ b/include/asm-cris/semaphore.h
@@ -35,7 +35,6 @@ struct semaphore {
35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
36 36
37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
38#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
39 38
40static inline void sema_init(struct semaphore *sem, int val) 39static inline void sema_init(struct semaphore *sem, int val)
41{ 40{
diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h
index 84557c9bac93..5a21c42bc6c5 100644
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
19typedef __signed__ int __s32; 19typedef __signed__ int __s32;
20typedef unsigned int __u32; 20typedef unsigned int __u32;
21 21
22#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 22#if defined(__GNUC__)
23typedef __signed__ long long __s64; 23__extension__ typedef __signed__ long long __s64;
24typedef unsigned long long __u64; 24__extension__ typedef unsigned long long __u64;
25#endif 25#endif
26 26
27#endif /* __ASSEMBLY__ */ 27#endif /* __ASSEMBLY__ */
diff --git a/include/asm-frv/ipc.h b/include/asm-frv/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-frv/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-frv/semaphore.h b/include/asm-frv/semaphore.h
index 09586528e007..d7aaa1911a1a 100644
--- a/include/asm-frv/semaphore.h
+++ b/include/asm-frv/semaphore.h
@@ -49,7 +49,6 @@ struct semaphore {
49 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 49 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
50 50
51#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 51#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
52#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
53 52
54static inline void sema_init (struct semaphore *sem, int val) 53static inline void sema_init (struct semaphore *sem, int val)
55{ 54{
diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h
index 1b6d1923b25b..767e5ed71c4b 100644
--- a/include/asm-frv/types.h
+++ b/include/asm-frv/types.h
@@ -30,9 +30,9 @@ typedef unsigned short __u16;
30typedef __signed__ int __s32; 30typedef __signed__ int __s32;
31typedef unsigned int __u32; 31typedef unsigned int __u32;
32 32
33#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 33#if defined(__GNUC__)
34typedef __signed__ long long __s64; 34__extension__ typedef __signed__ long long __s64;
35typedef unsigned long long __u64; 35__extension__ typedef unsigned long long __u64;
36#endif 36#endif
37 37
38#endif /* __ASSEMBLY__ */ 38#endif /* __ASSEMBLY__ */
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 5bfeef761649..c18110ee30f1 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -2,7 +2,6 @@ header-y += errno-base.h
2header-y += errno.h 2header-y += errno.h
3header-y += fcntl.h 3header-y += fcntl.h
4header-y += ioctl.h 4header-y += ioctl.h
5header-y += ipc.h
6header-y += mman.h 5header-y += mman.h
7header-y += poll.h 6header-y += poll.h
8header-y += signal.h 7header-y += signal.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index a37e95fe58d6..8fd81713cfc0 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -30,6 +30,5 @@ unifdef-y += unistd.h
30unifdef-y += user.h 30unifdef-y += user.h
31 31
32# These probably shouldn't be exported 32# These probably shouldn't be exported
33unifdef-y += shmparam.h
34unifdef-y += elf.h 33unifdef-y += elf.h
35unifdef-y += page.h 34unifdef-y += page.h
diff --git a/include/asm-generic/ipc.h b/include/asm-generic/ipc.h
deleted file mode 100644
index a40407a165ce..000000000000
--- a/include/asm-generic/ipc.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_GENERIC_IPC_H
2#define _ASM_GENERIC_IPC_H
3/*
4 * These are used to wrap system calls.
5 *
6 * See architecture code for ugly details..
7 */
8struct ipc_kludge {
9 struct msgbuf __user *msgp;
10 long msgtyp;
11};
12
13#define SEMOP 1
14#define SEMGET 2
15#define SEMCTL 3
16#define SEMTIMEDOP 4
17#define MSGSND 11
18#define MSGRCV 12
19#define MSGGET 13
20#define MSGCTL 14
21#define SHMAT 21
22#define SHMDT 22
23#define SHMGET 23
24#define SHMCTL 24
25
26/* Used by the DIPC package, try and avoid reusing it */
27#define DIPC 25
28
29#define IPCCALL(version,op) ((version)<<16 | (op))
30
31#endif /* _ASM_GENERIC_IPC_H */
diff --git a/include/asm-h8300/io.h b/include/asm-h8300/io.h
index 91b7487cb7ae..7543a57b4ea1 100644
--- a/include/asm-h8300/io.h
+++ b/include/asm-h8300/io.h
@@ -264,12 +264,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
264 264
265extern void iounmap(void *addr); 265extern void iounmap(void *addr);
266 266
267/* Nothing to do */
268
269#define dma_cache_inv(_start,_size) do { } while (0)
270#define dma_cache_wback(_start,_size) do { } while (0)
271#define dma_cache_wback_inv(_start,_size) do { } while (0)
272
273/* H8/300 internal I/O functions */ 267/* H8/300 internal I/O functions */
274static __inline__ unsigned char ctrl_inb(unsigned long addr) 268static __inline__ unsigned char ctrl_inb(unsigned long addr)
275{ 269{
diff --git a/include/asm-h8300/ipc.h b/include/asm-h8300/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-h8300/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-h8300/semaphore.h b/include/asm-h8300/semaphore.h
index 81bae2a99192..f3ffff83ff09 100644
--- a/include/asm-h8300/semaphore.h
+++ b/include/asm-h8300/semaphore.h
@@ -39,7 +39,6 @@ struct semaphore {
39 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 39 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
40 40
41#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 41#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
42#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
43 42
44static inline void sema_init (struct semaphore *sem, int val) 43static inline void sema_init (struct semaphore *sem, int val)
45{ 44{
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
index 2a8b1b2be782..56566e2a09fd 100644
--- a/include/asm-h8300/types.h
+++ b/include/asm-h8300/types.h
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
27typedef __signed__ int __s32; 27typedef __signed__ int __s32;
28typedef unsigned int __u32; 28typedef unsigned int __u32;
29 29
30#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 30#if defined(__GNUC__)
31typedef __signed__ long long __s64; 31__extension__ typedef __signed__ long long __s64;
32typedef unsigned long long __u64; 32__extension__ typedef unsigned long long __u64;
33#endif 33#endif
34 34
35/* 35/*
diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h
index 25f9835d5459..f10e29b60b00 100644
--- a/include/asm-ia64/elf.h
+++ b/include/asm-ia64/elf.h
@@ -192,6 +192,7 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
192 192
193#define GATE_EHDR ((const struct elfhdr *) GATE_ADDR) 193#define GATE_EHDR ((const struct elfhdr *) GATE_ADDR)
194 194
195/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
195#define ARCH_DLINFO \ 196#define ARCH_DLINFO \
196do { \ 197do { \
197 extern char __kernel_syscall_via_epc[]; \ 198 extern char __kernel_syscall_via_epc[]; \
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index eb17a8692967..4ebed77aa472 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -435,10 +435,6 @@ extern void memcpy_fromio(void *dst, const volatile void __iomem *src, long n);
435extern void memcpy_toio(volatile void __iomem *dst, const void *src, long n); 435extern void memcpy_toio(volatile void __iomem *dst, const void *src, long n);
436extern void memset_io(volatile void __iomem *s, int c, long n); 436extern void memset_io(volatile void __iomem *s, int c, long n);
437 437
438#define dma_cache_inv(_start,_size) do { } while (0)
439#define dma_cache_wback(_start,_size) do { } while (0)
440#define dma_cache_wback_inv(_start,_size) do { } while (0)
441
442# endif /* __KERNEL__ */ 438# endif /* __KERNEL__ */
443 439
444/* 440/*
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
index 7d5e2ccc37a0..6a8a27cfae3e 100644
--- a/include/asm-ia64/numa.h
+++ b/include/asm-ia64/numa.h
@@ -24,6 +24,7 @@
24 24
25extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned; 25extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
26extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; 26extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
27extern pg_data_t *pgdat_list[MAX_NUMNODES];
27 28
28/* Stuff below this line could be architecture independent */ 29/* Stuff below this line could be architecture independent */
29 30
diff --git a/include/asm-ia64/semaphore.h b/include/asm-ia64/semaphore.h
index f483eeb95dd1..d8393d11288d 100644
--- a/include/asm-ia64/semaphore.h
+++ b/include/asm-ia64/semaphore.h
@@ -28,7 +28,6 @@ struct semaphore {
28 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count) 28 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
29 29
30#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) 30#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
31#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0)
32 31
33static inline void 32static inline void
34sema_init (struct semaphore *sem, int val) 33sema_init (struct semaphore *sem, int val)
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 91bb8e00066c..595112bca3cc 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -32,6 +32,8 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/types.h> 33#include <linux/types.h>
34 34
35#define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
36
35struct pci_vector_struct { 37struct pci_vector_struct {
36 __u16 segment; /* PCI Segment number */ 38 __u16 segment; /* PCI Segment number */
37 __u16 bus; /* PCI Bus number */ 39 __u16 bus; /* PCI Bus number */
diff --git a/include/asm-m32r/ipc.h b/include/asm-m32r/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-m32r/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-m32r/semaphore.h b/include/asm-m32r/semaphore.h
index 41e45d7b87ef..b5bf95a6f2b4 100644
--- a/include/asm-m32r/semaphore.h
+++ b/include/asm-m32r/semaphore.h
@@ -35,7 +35,6 @@ struct semaphore {
35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
36 36
37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
38#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
39 38
40static inline void sema_init (struct semaphore *sem, int val) 39static inline void sema_init (struct semaphore *sem, int val)
41{ 40{
diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h
index 27d3eb539c50..b64c16639a7b 100644
--- a/include/asm-m32r/types.h
+++ b/include/asm-m32r/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
19typedef __signed__ int __s32; 19typedef __signed__ int __s32;
20typedef unsigned int __u32; 20typedef unsigned int __u32;
21 21
22#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 22#if defined(__GNUC__)
23typedef __signed__ long long __s64; 23__extension__ typedef __signed__ long long __s64;
24typedef unsigned long long __u64; 24__extension__ typedef unsigned long long __u64;
25#endif 25#endif
26#endif /* __ASSEMBLY__ */ 26#endif /* __ASSEMBLY__ */
27 27
diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h
index 45dc908932a3..697d50393dd0 100644
--- a/include/asm-m68k/floppy.h
+++ b/include/asm-m68k/floppy.h
@@ -31,9 +31,6 @@ asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id);
31#define FLOPPY0_TYPE (MACH_IS_Q40 ? 6 : 4) 31#define FLOPPY0_TYPE (MACH_IS_Q40 ? 6 : 4)
32#define FLOPPY1_TYPE 0 32#define FLOPPY1_TYPE 0
33 33
34#define FLOPPY_MOTOR_MASK 0xf0
35
36
37/* basically PC init + set use_virtual_dma */ 34/* basically PC init + set use_virtual_dma */
38#define FDC1 m68k_floppy_init() 35#define FDC1 m68k_floppy_init()
39 36
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 47bb9cf107b7..baf4f9b8acfc 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -384,12 +384,6 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
384 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 384 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
385} 385}
386 386
387
388/* m68k caches aren't DMA coherent */
389extern void dma_cache_wback_inv(unsigned long start, unsigned long size);
390extern void dma_cache_wback(unsigned long start, unsigned long size);
391extern void dma_cache_inv(unsigned long start, unsigned long size);
392
393static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) 387static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
394{ 388{
395 __builtin_memset((void __force *) addr, val, count); 389 __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
index a46e3d9c2a3f..000000000000
--- a/include/asm-m68k/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h
index fd4c7cc3d3be..64d6b119bb0a 100644
--- a/include/asm-m68k/semaphore.h
+++ b/include/asm-m68k/semaphore.h
@@ -40,7 +40,6 @@ struct semaphore {
40 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 40 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
41 41
42#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 42#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
43#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
44 43
45static inline void sema_init(struct semaphore *sem, int val) 44static inline void sema_init(struct semaphore *sem, int val)
46{ 45{
diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h
index b5a1febc97d4..c35c09d93b66 100644
--- a/include/asm-m68k/types.h
+++ b/include/asm-m68k/types.h
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
27typedef __signed__ int __s32; 27typedef __signed__ int __s32;
28typedef unsigned int __u32; 28typedef unsigned int __u32;
29 29
30#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 30#if defined(__GNUC__)
31typedef __signed__ long long __s64; 31__extension__ typedef __signed__ long long __s64;
32typedef unsigned long long __u64; 32__extension__ typedef unsigned long long __u64;
33#endif 33#endif
34 34
35#endif /* __ASSEMBLY__ */ 35#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m68knommu/io.h b/include/asm-m68knommu/io.h
index 8df4cee2a0cd..653d9b2d7ddf 100644
--- a/include/asm-m68knommu/io.h
+++ b/include/asm-m68knommu/io.h
@@ -165,12 +165,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
165 165
166extern void iounmap(void *addr); 166extern void iounmap(void *addr);
167 167
168/* Nothing to do */
169
170#define dma_cache_inv(_start,_size) do { } while (0)
171#define dma_cache_wback(_start,_size) do { } while (0)
172#define dma_cache_wback_inv(_start,_size) do { } while (0)
173
174/* Pages to physical address... */ 168/* Pages to physical address... */
175#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) 169#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
176#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT) 170#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
index a46e3d9c2a3f..000000000000
--- a/include/asm-m68knommu/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-m68knommu/semaphore.h b/include/asm-m68knommu/semaphore.h
index 5cc1fdd86f50..5779eb6c0689 100644
--- a/include/asm-m68knommu/semaphore.h
+++ b/include/asm-m68knommu/semaphore.h
@@ -39,7 +39,6 @@ struct semaphore {
39 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 39 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
40 40
41#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 41#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
42#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
43 42
44static inline void sema_init (struct semaphore *sem, int val) 43static inline void sema_init (struct semaphore *sem, int val)
45{ 44{
diff --git a/include/asm-mips/floppy.h b/include/asm-mips/floppy.h
index a62d0990c8ae..992d232adc83 100644
--- a/include/asm-mips/floppy.h
+++ b/include/asm-mips/floppy.h
@@ -34,8 +34,6 @@ static inline void fd_cacheflush(char * addr, long size)
34#define N_FDC 1 /* do you *really* want a second controller? */ 34#define N_FDC 1 /* do you *really* want a second controller? */
35#define N_DRIVE 8 35#define N_DRIVE 8
36 36
37#define FLOPPY_MOTOR_MASK 0xf0
38
39/* 37/*
40 * The DMA channel used by the floppy controller cannot access data at 38 * The DMA channel used by the floppy controller cannot access data at
41 * addresses >= 16MB 39 * addresses >= 16MB
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 2cd8323c8586..e62058b0d28c 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -554,6 +554,8 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
554 * caches. Dirty lines of the caches may be written back or simply 554 * caches. Dirty lines of the caches may be written back or simply
555 * be discarded. This operation is necessary before dma operations 555 * be discarded. This operation is necessary before dma operations
556 * to the memory. 556 * to the memory.
557 *
558 * This API used to be exported; it now is for arch code internal use only.
557 */ 559 */
558#ifdef CONFIG_DMA_NONCOHERENT 560#ifdef CONFIG_DMA_NONCOHERENT
559 561
diff --git a/include/asm-mips/ipc.h b/include/asm-mips/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-mips/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h
index 080daa77f867..fdf8042b784b 100644
--- a/include/asm-mips/semaphore.h
+++ b/include/asm-mips/semaphore.h
@@ -49,7 +49,6 @@ struct semaphore {
49 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count) 49 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
50 50
51#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) 51#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
52#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0)
53 52
54static inline void sema_init(struct semaphore *sem, int val) 53static inline void sema_init(struct semaphore *sem, int val)
55{ 54{
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index 63a13c5bd832..2dd147f519d1 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -34,9 +34,9 @@ typedef unsigned long __u64;
34 34
35#else 35#else
36 36
37#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 37#if defined(__GNUC__)
38typedef __signed__ long long __s64; 38__extension__ typedef __signed__ long long __s64;
39typedef unsigned long long __u64; 39__extension__ typedef unsigned long long __u64;
40#endif 40#endif
41 41
42#endif 42#endif
diff --git a/include/asm-parisc/floppy.h b/include/asm-parisc/floppy.h
index da2f9c157143..4ca69f558fae 100644
--- a/include/asm-parisc/floppy.h
+++ b/include/asm-parisc/floppy.h
@@ -266,10 +266,6 @@ static int FDC2 = -1;
266#define N_FDC 1 266#define N_FDC 1
267#define N_DRIVE 8 267#define N_DRIVE 8
268 268
269#define FLOPPY_MOTOR_MASK 0xf0
270
271#define AUTO_DMA
272
273#define EXTRA_FLOPPY_PARAMS 269#define EXTRA_FLOPPY_PARAMS
274 270
275#endif /* __ASM_PARISC_FLOPPY_H */ 271#endif /* __ASM_PARISC_FLOPPY_H */
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index 4cc9bcec0564..95f00e11c7b4 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -270,11 +270,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
270/* IO Port space is : BBiiii where BB is HBA number. */ 270/* IO Port space is : BBiiii where BB is HBA number. */
271#define IO_SPACE_LIMIT 0x00ffffff 271#define IO_SPACE_LIMIT 0x00ffffff
272 272
273
274#define dma_cache_inv(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0)
275#define dma_cache_wback(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0)
276#define dma_cache_wback_inv(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0)
277
278/* PA machines have an MM I/O space from 0xf0000000-0xffffffff in 32 273/* PA machines have an MM I/O space from 0xf0000000-0xffffffff in 32
279 * bit mode and from 0xfffffffff0000000-0xfffffffffffffff in 64 bit 274 * bit mode and from 0xfffffffff0000000-0xfffffffffffffff in 64 bit
280 * mode (essentially just sign extending. This macro takes in a 32 275 * mode (essentially just sign extending. This macro takes in a 32
diff --git a/include/asm-parisc/semaphore.h b/include/asm-parisc/semaphore.h
index d45827a21f94..b771dcfcfdd1 100644
--- a/include/asm-parisc/semaphore.h
+++ b/include/asm-parisc/semaphore.h
@@ -53,7 +53,6 @@ struct semaphore {
53 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 53 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
54 54
55#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 55#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
56#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
57 56
58extern inline void sema_init (struct semaphore *sem, int val) 57extern inline void sema_init (struct semaphore *sem, int val)
59{ 58{
diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h
index d4aa33033d98..56c84802da59 100644
--- a/include/asm-parisc/types.h
+++ b/include/asm-parisc/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
19typedef __signed__ int __s32; 19typedef __signed__ int __s32;
20typedef unsigned int __u32; 20typedef unsigned int __u32;
21 21
22#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 22#if defined(__GNUC__)
23typedef __signed__ long long __s64; 23__extension__ typedef __signed__ long long __s64;
24typedef unsigned long long __u64; 24__extension__ typedef unsigned long long __u64;
25#endif 25#endif
26 26
27#endif /* __ASSEMBLY__ */ 27#endif /* __ASSEMBLY__ */
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild
index 4869513b872f..5f640e542475 100644
--- a/include/asm-powerpc/Kbuild
+++ b/include/asm-powerpc/Kbuild
@@ -13,9 +13,7 @@ header-y += shmbuf.h
13header-y += socket.h 13header-y += socket.h
14header-y += termbits.h 14header-y += termbits.h
15header-y += fcntl.h 15header-y += fcntl.h
16header-y += ipc.h
17header-y += poll.h 16header-y += poll.h
18header-y += shmparam.h
19header-y += sockios.h 17header-y += sockios.h
20header-y += ucontext.h 18header-y += ucontext.h
21header-y += ioctl.h 19header-y += ioctl.h
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index e42820d6d25b..6bd07ef78ac4 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -101,6 +101,7 @@ typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG];
101 101
102typedef unsigned int elf_greg_t32; 102typedef unsigned int elf_greg_t32;
103typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; 103typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG];
104typedef elf_gregset_t32 compat_elf_gregset_t;
104 105
105/* 106/*
106 * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps. 107 * 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];
175 176
176#define ELF_ET_DYN_BASE (0x20000000) 177#define ELF_ET_DYN_BASE (0x20000000)
177 178
178/* Common routine for both 32-bit and 64-bit processes */ 179/*
180 * Our registers are always unsigned longs, whether we're a 32 bit
181 * process or 64 bit, on either a 64 bit or 32 bit kernel.
182 *
183 * This macro relies on elf_regs[i] having the right type to truncate to,
184 * either u32 or u64. It defines the body of the elf_core_copy_regs
185 * function, either the native one with elf_gregset_t elf_regs or
186 * the 32-bit one with elf_gregset_t32 elf_regs.
187 */
188#define PPC_ELF_CORE_COPY_REGS(elf_regs, regs) \
189 int i, nregs = min(sizeof(*regs) / sizeof(unsigned long), \
190 (size_t)ELF_NGREG); \
191 for (i = 0; i < nregs; i++) \
192 elf_regs[i] = ((unsigned long *) regs)[i]; \
193 memset(&elf_regs[i], 0, (ELF_NGREG - i) * sizeof(elf_regs[0]))
194
195/* Common routine for both 32-bit and 64-bit native processes */
179static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs, 196static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs,
180 struct pt_regs *regs) 197 struct pt_regs *regs)
181{ 198{
182 int i, nregs; 199 PPC_ELF_CORE_COPY_REGS(elf_regs, regs);
183
184 memset((void *)elf_regs, 0, sizeof(elf_gregset_t));
185
186 /* Our registers are always unsigned longs, whether we're a 32 bit
187 * process or 64 bit, on either a 64 bit or 32 bit kernel.
188 * Don't use ELF_GREG_TYPE here. */
189 nregs = sizeof(struct pt_regs) / sizeof(unsigned long);
190 if (nregs > ELF_NGREG)
191 nregs = ELF_NGREG;
192
193 for (i = 0; i < nregs; i++) {
194 /* This will correctly truncate 64 bit registers to 32 bits
195 * for a 32 bit process on a 64 bit kernel. */
196 elf_regs[i] = (elf_greg_t)((ELF_GREG_TYPE *)regs)[i];
197 }
198} 200}
199#define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs); 201#define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs);
200 202
@@ -212,6 +214,14 @@ static inline int dump_task_regs(struct task_struct *tsk,
212extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 214extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
213#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 215#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
214 216
217typedef elf_vrregset_t elf_fpxregset_t;
218
219#ifdef CONFIG_ALTIVEC
220extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
221#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
222#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
223#endif
224
215#endif /* __KERNEL__ */ 225#endif /* __KERNEL__ */
216 226
217/* ELF_HWCAP yields a mask that user programs can use to figure out what 227/* 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,
281 * AT_IGNOREPPC is used for that. 291 * AT_IGNOREPPC is used for that.
282 * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC, 292 * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
283 * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. 293 * even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
294 * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes
284 */ 295 */
285#define ARCH_DLINFO \ 296#define ARCH_DLINFO \
286do { \ 297do { \
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index 34146f0eea63..24bd34c57e9d 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -202,8 +202,6 @@ static int FDC2 = -1;
202#define N_FDC 2 /* Don't change this! */ 202#define N_FDC 2 /* Don't change this! */
203#define N_DRIVE 8 203#define N_DRIVE 8
204 204
205#define FLOPPY_MOTOR_MASK 0xf0
206
207/* 205/*
208 * The PowerPC has no problems with floppy DMA crossing 64k borders. 206 * The PowerPC has no problems with floppy DMA crossing 64k borders.
209 */ 207 */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 0d0589ef8ea6..bf14ab4ef4c9 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -498,23 +498,6 @@ static inline void name at \
498#define writeq writeq 498#define writeq writeq
499#endif 499#endif
500 500
501#ifdef CONFIG_NOT_COHERENT_CACHE
502
503#define dma_cache_inv(_start,_size) \
504 invalidate_dcache_range(_start, (_start + _size))
505#define dma_cache_wback(_start,_size) \
506 clean_dcache_range(_start, (_start + _size))
507#define dma_cache_wback_inv(_start,_size) \
508 flush_dcache_range(_start, (_start + _size))
509
510#else /* CONFIG_NOT_COHERENT_CACHE */
511
512#define dma_cache_inv(_start,_size) do { } while (0)
513#define dma_cache_wback(_start,_size) do { } while (0)
514#define dma_cache_wback_inv(_start,_size) do { } while (0)
515
516#endif /* !CONFIG_NOT_COHERENT_CACHE */
517
518/* 501/*
519 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 502 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
520 * access 503 * access
diff --git a/include/asm-powerpc/ipc.h b/include/asm-powerpc/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-powerpc/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-powerpc/semaphore.h b/include/asm-powerpc/semaphore.h
index 57369d2cadef..48dd32e07749 100644
--- a/include/asm-powerpc/semaphore.h
+++ b/include/asm-powerpc/semaphore.h
@@ -35,7 +35,6 @@ struct semaphore {
35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 35 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
36 36
37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) 37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
38#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0)
39 38
40static inline void sema_init (struct semaphore *sem, int val) 39static inline void sema_init (struct semaphore *sem, int val)
41{ 40{
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index d10e99bf5001..87be8c3bc9cb 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -40,6 +40,7 @@
40#define set_mb(var, value) do { var = value; mb(); } while (0) 40#define set_mb(var, value) do { var = value; mb(); } while (0)
41 41
42#ifdef __KERNEL__ 42#ifdef __KERNEL__
43#define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */
43#ifdef CONFIG_SMP 44#ifdef CONFIG_SMP
44#define smp_mb() mb() 45#define smp_mb() mb()
45#define smp_rmb() rmb() 46#define smp_rmb() rmb()
diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h
index a584341c87e3..903fd1932436 100644
--- a/include/asm-powerpc/types.h
+++ b/include/asm-powerpc/types.h
@@ -40,9 +40,9 @@ typedef unsigned int __u32;
40typedef __signed__ long __s64; 40typedef __signed__ long __s64;
41typedef unsigned long __u64; 41typedef unsigned long __u64;
42#else 42#else
43#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 43#if defined(__GNUC__)
44typedef __signed__ long long __s64; 44__extension__ typedef __signed__ long long __s64;
45typedef unsigned long long __u64; 45__extension__ typedef unsigned long long __u64;
46#endif 46#endif
47#endif /* __powerpc64__ */ 47#endif /* __powerpc64__ */
48 48
diff --git a/include/asm-ppc/floppy.h b/include/asm-ppc/floppy.h
index ae316e6d2ca9..7d9b3f430d92 100644
--- a/include/asm-ppc/floppy.h
+++ b/include/asm-ppc/floppy.h
@@ -166,8 +166,6 @@ static int FDC2 = -1;
166#define N_FDC 2 /* Don't change this! */ 166#define N_FDC 2 /* Don't change this! */
167#define N_DRIVE 8 167#define N_DRIVE 8
168 168
169#define FLOPPY_MOTOR_MASK 0xf0
170
171/* 169/*
172 * The PowerPC has no problems with floppy DMA crossing 64k borders. 170 * The PowerPC has no problems with floppy DMA crossing 64k borders.
173 */ 171 */
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 8f58231a8bc6..a0d409a5d80f 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -478,23 +478,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
478#include <asm/mpc8260_pci9.h> 478#include <asm/mpc8260_pci9.h>
479#endif 479#endif
480 480
481#ifdef CONFIG_NOT_COHERENT_CACHE
482
483#define dma_cache_inv(_start,_size) \
484 invalidate_dcache_range(_start, (_start + _size))
485#define dma_cache_wback(_start,_size) \
486 clean_dcache_range(_start, (_start + _size))
487#define dma_cache_wback_inv(_start,_size) \
488 flush_dcache_range(_start, (_start + _size))
489
490#else
491
492#define dma_cache_inv(_start,_size) do { } while (0)
493#define dma_cache_wback(_start,_size) do { } while (0)
494#define dma_cache_wback_inv(_start,_size) do { } while (0)
495
496#endif
497
498/* 481/*
499 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 482 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
500 * access 483 * access
diff --git a/include/asm-ppc/irq_regs.h b/include/asm-ppc/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-ppc/irq_regs.h
@@ -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
index a46e3d9c2a3f..000000000000
--- a/include/asm-s390/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h
index dbce058aefa9..0e7001ad8392 100644
--- a/include/asm-s390/semaphore.h
+++ b/include/asm-s390/semaphore.h
@@ -33,7 +33,6 @@ struct semaphore {
33 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 33 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
34 34
35#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 35#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
36#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
37 36
38static inline void sema_init (struct semaphore *sem, int val) 37static inline void sema_init (struct semaphore *sem, int val)
39{ 38{
diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h
index fc5d7cf19324..2c5879ae90ca 100644
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -28,9 +28,9 @@ typedef __signed__ int __s32;
28typedef unsigned int __u32; 28typedef unsigned int __u32;
29 29
30#ifndef __s390x__ 30#ifndef __s390x__
31#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 31#if defined(__GNUC__)
32typedef __signed__ long long __s64; 32__extension__ typedef __signed__ long long __s64;
33typedef unsigned long long __u64; 33__extension__ typedef unsigned long long __u64;
34#endif 34#endif
35#else /* __s390x__ */ 35#else /* __s390x__ */
36typedef __signed__ long __s64; 36typedef __signed__ long __s64;
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
index 43ca244564b1..12cc4b392bf0 100644
--- a/include/asm-sh/elf.h
+++ b/include/asm-sh/elf.h
@@ -133,6 +133,7 @@ extern void __kernel_vsyscall;
133#define VDSO_BASE ((unsigned long)current->mm->context.vdso) 133#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
134#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x)) 134#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
135 135
136/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
136#define ARCH_DLINFO \ 137#define ARCH_DLINFO \
137do { \ 138do { \
138 if (vdso_enabled) \ 139 if (vdso_enabled) \
diff --git a/include/asm-sh/floppy.h b/include/asm-sh/floppy.h
index 3b59b3af777b..59fbfdc90dfb 100644
--- a/include/asm-sh/floppy.h
+++ b/include/asm-sh/floppy.h
@@ -213,7 +213,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
213 } 213 }
214#endif 214#endif
215 215
216 dma_cache_wback_inv(addr, size); 216 __flush_purge_region(addr, size);
217 217
218 /* actual, physical DMA */ 218 /* actual, physical DMA */
219 doing_pdma = 0; 219 doing_pdma = 0;
@@ -263,10 +263,6 @@ static int FDC2 = -1;
263#define N_FDC 2 263#define N_FDC 2
264#define N_DRIVE 8 264#define N_DRIVE 8
265 265
266#define FLOPPY_MOTOR_MASK 0xf0
267
268#define AUTO_DMA
269
270#define EXTRA_FLOPPY_PARAMS 266#define EXTRA_FLOPPY_PARAMS
271 267
272#endif /* __ASM_SH_FLOPPY_H */ 268#endif /* __ASM_SH_FLOPPY_H */
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index 1a336cdc75fe..6ed34d8eac5f 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -327,31 +327,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
327 __iounmap((addr)) 327 __iounmap((addr))
328 328
329/* 329/*
330 * The caches on some architectures aren't dma-coherent and have need to
331 * handle this in software. There are three types of operations that
332 * can be applied to dma buffers.
333 *
334 * - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
335 * writing the content of the caches back to memory, if necessary.
336 * The function also invalidates the affected part of the caches as
337 * necessary before DMA transfers from outside to memory.
338 * - dma_cache_inv(start, size) invalidates the affected parts of the
339 * caches. Dirty lines of the caches may be written back or simply
340 * be discarded. This operation is necessary before dma operations
341 * to the memory.
342 * - dma_cache_wback(start, size) writes back any dirty lines but does
343 * not invalidate the cache. This can be used before DMA reads from
344 * memory,
345 */
346
347#define dma_cache_wback_inv(_start,_size) \
348 __flush_purge_region(_start,_size)
349#define dma_cache_inv(_start,_size) \
350 __flush_invalidate_region(_start,_size)
351#define dma_cache_wback(_start,_size) \
352 __flush_wback_region(_start,_size)
353
354/*
355 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 330 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
356 * access 331 * access
357 */ 332 */
diff --git a/include/asm-sh/ipc.h b/include/asm-sh/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-sh/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-sh/semaphore.h b/include/asm-sh/semaphore.h
index 489f7847c5d9..9e5a37c4dce2 100644
--- a/include/asm-sh/semaphore.h
+++ b/include/asm-sh/semaphore.h
@@ -37,7 +37,6 @@ struct semaphore {
37 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 37 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
38 38
39#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 39#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
40#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
41 40
42static inline void sema_init (struct semaphore *sem, int val) 41static inline void sema_init (struct semaphore *sem, int val)
43{ 42{
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 9d849e6df268..4faa2fb88616 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -15,6 +15,7 @@
15struct task_struct *__switch_to(struct task_struct *prev, 15struct task_struct *__switch_to(struct task_struct *prev,
16 struct task_struct *next); 16 struct task_struct *next);
17 17
18#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
18/* 19/*
19 * switch_to() should switch tasks to task nr n, first 20 * switch_to() should switch tasks to task nr n, first
20 */ 21 */
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
index fd00dbb82f84..7ba69d9707ef 100644
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
19typedef __signed__ int __s32; 19typedef __signed__ int __s32;
20typedef unsigned int __u32; 20typedef unsigned int __u32;
21 21
22#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 22#if defined(__GNUC__)
23typedef __signed__ long long __s64; 23__extension__ typedef __signed__ long long __s64;
24typedef unsigned long long __u64; 24__extension__ typedef unsigned long long __u64;
25#endif 25#endif
26 26
27#endif /* __ASSEMBLY__ */ 27#endif /* __ASSEMBLY__ */
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index de4309960207..e661857f98dc 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -42,7 +42,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
42static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 42static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
43 enum dma_data_direction dir) 43 enum dma_data_direction dir)
44{ 44{
45 dma_cache_wback_inv((unsigned long)vaddr, size); 45 unsigned long s = (unsigned long) vaddr & L1_CACHE_ALIGN_MASK;
46 unsigned long e = (vaddr + size) & L1_CACHE_ALIGN_MASK;
47
48 for (; s <= e; s += L1_CACHE_BYTES)
49 asm volatile ("ocbp %0, 0" : : "r" (s));
46} 50}
47 51
48static inline dma_addr_t dma_map_single(struct device *dev, 52static inline dma_addr_t dma_map_single(struct device *dev,
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index 3de3ad99f457..7bd7314d38c2 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -182,54 +182,6 @@ unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* n
182extern void onchip_unmap(unsigned long vaddr); 182extern void onchip_unmap(unsigned long vaddr);
183 183
184/* 184/*
185 * The caches on some architectures aren't dma-coherent and have need to
186 * handle this in software. There are three types of operations that
187 * can be applied to dma buffers.
188 *
189 * - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
190 * writing the content of the caches back to memory, if necessary.
191 * The function also invalidates the affected part of the caches as
192 * necessary before DMA transfers from outside to memory.
193 * - dma_cache_inv(start, size) invalidates the affected parts of the
194 * caches. Dirty lines of the caches may be written back or simply
195 * be discarded. This operation is necessary before dma operations
196 * to the memory.
197 * - dma_cache_wback(start, size) writes back any dirty lines but does
198 * not invalidate the cache. This can be used before DMA reads from
199 * memory,
200 */
201
202static __inline__ void dma_cache_wback_inv (unsigned long start, unsigned long size)
203{
204 unsigned long s = start & L1_CACHE_ALIGN_MASK;
205 unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
206
207 for (; s <= e; s += L1_CACHE_BYTES)
208 asm volatile ("ocbp %0, 0" : : "r" (s));
209}
210
211static __inline__ void dma_cache_inv (unsigned long start, unsigned long size)
212{
213 // Note that caller has to be careful with overzealous
214 // invalidation should there be partial cache lines at the extremities
215 // of the specified range
216 unsigned long s = start & L1_CACHE_ALIGN_MASK;
217 unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
218
219 for (; s <= e; s += L1_CACHE_BYTES)
220 asm volatile ("ocbi %0, 0" : : "r" (s));
221}
222
223static __inline__ void dma_cache_wback (unsigned long start, unsigned long size)
224{
225 unsigned long s = start & L1_CACHE_ALIGN_MASK;
226 unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
227
228 for (; s <= e; s += L1_CACHE_BYTES)
229 asm volatile ("ocbwb %0, 0" : : "r" (s));
230}
231
232/*
233 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 185 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
234 * access 186 * access
235 */ 187 */
diff --git a/include/asm-sh64/ipc.h b/include/asm-sh64/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-sh64/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-sh64/semaphore.h b/include/asm-sh64/semaphore.h
index 469526459149..f027cc14b55b 100644
--- a/include/asm-sh64/semaphore.h
+++ b/include/asm-sh64/semaphore.h
@@ -44,7 +44,6 @@ struct semaphore {
44 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 44 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
45 45
46#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 46#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
47#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
48 47
49static inline void sema_init (struct semaphore *sem, int val) 48static inline void sema_init (struct semaphore *sem, int val)
50{ 49{
diff --git a/include/asm-sh64/types.h b/include/asm-sh64/types.h
index 8d41db2153b5..2c7ad73b3883 100644
--- a/include/asm-sh64/types.h
+++ b/include/asm-sh64/types.h
@@ -30,9 +30,9 @@ typedef unsigned short __u16;
30typedef __signed__ int __s32; 30typedef __signed__ int __s32;
31typedef unsigned int __u32; 31typedef unsigned int __u32;
32 32
33#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 33#if defined(__GNUC__)
34typedef __signed__ long long __s64; 34__extension__ typedef __signed__ long long __s64;
35typedef unsigned long long __u64; 35__extension__ typedef unsigned long long __u64;
36#endif 36#endif
37 37
38#endif /* __ASSEMBLY__ */ 38#endif /* __ASSEMBLY__ */
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
index acd06d8ff70a..5da1eef0f706 100644
--- a/include/asm-sparc/floppy.h
+++ b/include/asm-sparc/floppy.h
@@ -77,8 +77,6 @@ static struct sun_floppy_ops sun_fdops;
77#define fd_dma_mem_free(addr,size) (vfree((void *)(addr))) 77#define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
78#endif 78#endif
79 79
80#define FLOPPY_MOTOR_MASK 0x10
81
82/* XXX This isn't really correct. XXX */ 80/* XXX This isn't really correct. XXX */
83#define get_dma_residue(x) (0) 81#define get_dma_residue(x) (0)
84 82
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index c23e74a0eaa8..243bf8e9a058 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -310,13 +310,6 @@ extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size);
310#define RTC_PORT(x) (rtc_port + (x)) 310#define RTC_PORT(x) (rtc_port + (x))
311#define RTC_ALWAYS_BCD 0 311#define RTC_ALWAYS_BCD 0
312 312
313/* Nothing to do */
314/* P3: Only IDE DMA may need these. XXX Verify that it still does... */
315
316#define dma_cache_inv(_start,_size) do { } while (0)
317#define dma_cache_wback(_start,_size) do { } while (0)
318#define dma_cache_wback_inv(_start,_size) do { } while (0)
319
320#endif 313#endif
321 314
322#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 315#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
index a46e3d9c2a3f..000000000000
--- a/include/asm-sparc/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h
index f74ba31e265b..8018f9f4d497 100644
--- a/include/asm-sparc/semaphore.h
+++ b/include/asm-sparc/semaphore.h
@@ -26,7 +26,6 @@ struct semaphore {
26 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 26 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
27 27
28#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 28#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
29#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
30 29
31static inline void sema_init (struct semaphore *sem, int val) 30static inline void sema_init (struct semaphore *sem, int val)
32{ 31{
diff --git a/include/asm-sparc64/Kbuild b/include/asm-sparc64/Kbuild
index 854fd3a65acf..a90dc82129d1 100644
--- a/include/asm-sparc64/Kbuild
+++ b/include/asm-sparc64/Kbuild
@@ -10,7 +10,6 @@ header-y += bbc.h
10header-y += bpp.h 10header-y += bpp.h
11header-y += display7seg.h 11header-y += display7seg.h
12header-y += envctrl.h 12header-y += envctrl.h
13header-y += ipc.h
14header-y += openprom.h 13header-y += openprom.h
15header-y += openpromio.h 14header-y += openpromio.h
16header-y += pconf.h 15header-y += pconf.h
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 1783239c7b40..c47f58d6c15c 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -84,8 +84,6 @@ static struct sun_floppy_ops sun_fdops;
84#define fd_free_irq() sun_fdops.fd_free_irq() 84#define fd_free_irq() sun_fdops.fd_free_irq()
85#define fd_eject(drive) sun_fdops.fd_eject(drive) 85#define fd_eject(drive) sun_fdops.fd_eject(drive)
86 86
87static int FLOPPY_MOTOR_MASK = 0x10;
88
89/* Super paranoid... */ 87/* Super paranoid... */
90#undef HAVE_DISABLE_HLT 88#undef HAVE_DISABLE_HLT
91 89
@@ -622,7 +620,6 @@ isa_done:
622 sun_fdops.fd_eject = sun_pci_fd_eject; 620 sun_fdops.fd_eject = sun_pci_fd_eject;
623 621
624 fdc_status = (unsigned long) &sun_fdc->status_82077; 622 fdc_status = (unsigned long) &sun_fdc->status_82077;
625 FLOPPY_MOTOR_MASK = 0xf0;
626 623
627 allowed_drive_mask = 0; 624 allowed_drive_mask = 0;
628 sun_floppy_types[0] = 0; 625 sun_floppy_types[0] = 0;
@@ -729,7 +726,6 @@ static unsigned long __init sun_floppy_init(void)
729 sun_fdops.fd_eject = sun_pci_fd_eject; 726 sun_fdops.fd_eject = sun_pci_fd_eject;
730 727
731 fdc_status = (unsigned long) &sun_fdc->status_82077; 728 fdc_status = (unsigned long) &sun_fdc->status_82077;
732 FLOPPY_MOTOR_MASK = 0xf0;
733 729
734 /* 730 /*
735 * XXX: Find out on which machines this is really needed. 731 * XXX: Find out on which machines this is really needed.
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 9565a892801e..cd7ef3097ac2 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -474,12 +474,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
474#define sbus_iounmap(__addr, __size) \ 474#define sbus_iounmap(__addr, __size) \
475 release_region((unsigned long)(__addr), (__size)) 475 release_region((unsigned long)(__addr), (__size))
476 476
477/* Nothing to do */
478
479#define dma_cache_inv(_start,_size) do { } while (0)
480#define dma_cache_wback(_start,_size) do { } while (0)
481#define dma_cache_wback_inv(_start,_size) do { } while (0)
482
483/* 477/*
484 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 478 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
485 * access 479 * access
diff --git a/include/asm-sparc64/ipc.h b/include/asm-sparc64/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-sparc64/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h
index 093dcc6788db..7f7c0c4e024f 100644
--- a/include/asm-sparc64/semaphore.h
+++ b/include/asm-sparc64/semaphore.h
@@ -26,7 +26,6 @@ struct semaphore {
26 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 26 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
27 27
28#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) 28#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
29#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0)
30 29
31static inline void sema_init (struct semaphore *sem, int val) 30static inline void sema_init (struct semaphore *sem, int val)
32{ 31{
diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h
index 911d0427de6d..8c66fded8a32 100644
--- a/include/asm-sparc64/shmparam.h
+++ b/include/asm-sparc64/shmparam.h
@@ -1,7 +1,6 @@
1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */ 1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */
2#ifndef _ASMSPARC64_SHMPARAM_H 2#ifndef _ASMSPARC64_SHMPARAM_H
3#define _ASMSPARC64_SHMPARAM_H 3#define _ASMSPARC64_SHMPARAM_H
4#ifdef __KERNEL__
5 4
6#include <asm/spitfire.h> 5#include <asm/spitfire.h>
7 6
@@ -9,5 +8,4 @@
9/* attach addr a multiple of this */ 8/* attach addr a multiple of this */
10#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE) 9#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE)
11 10
12#endif /* __KERNEL__ */
13#endif /* _ASMSPARC64_SHMPARAM_H */ 11#endif /* _ASMSPARC64_SHMPARAM_H */
diff --git a/include/asm-um/ipc.h b/include/asm-um/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-um/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-v850/ipc.h b/include/asm-v850/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-v850/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#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
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-v850/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-v850/semaphore.h b/include/asm-v850/semaphore.h
index 735baaf3a16e..10ed0ccf37df 100644
--- a/include/asm-v850/semaphore.h
+++ b/include/asm-v850/semaphore.h
@@ -22,7 +22,6 @@ struct semaphore {
22 struct semaphore name = __SEMAPHORE_INITIALIZER (name,count) 22 struct semaphore name = __SEMAPHORE_INITIALIZER (name,count)
23 23
24#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC (name,1) 24#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC (name,1)
25#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC (name,0)
26 25
27static inline void sema_init (struct semaphore *sem, int val) 26static inline void sema_init (struct semaphore *sem, int val)
28{ 27{
diff --git a/include/asm-v850/types.h b/include/asm-v850/types.h
index dcef57196875..284bda882112 100644
--- a/include/asm-v850/types.h
+++ b/include/asm-v850/types.h
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
27typedef __signed__ int __s32; 27typedef __signed__ int __s32;
28typedef unsigned int __u32; 28typedef unsigned int __u32;
29 29
30#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 30#if defined(__GNUC__)
31typedef __signed__ long long __s64; 31__extension__ typedef __signed__ long long __s64;
32typedef unsigned long long __u64; 32__extension__ typedef unsigned long long __u64;
33#endif 33#endif
34 34
35#endif /* !__ASSEMBLY__ */ 35#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index c5e43cb39874..80744dbcfafd 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -1,7 +1,6 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += boot.h 3header-y += boot.h
4header-y += bootsetup.h
5header-y += debugreg_32.h 4header-y += debugreg_32.h
6header-y += debugreg_64.h 5header-y += debugreg_64.h
7header-y += debugreg.h 6header-y += debugreg.h
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h
index b91b01783e4b..ef67b59dbdb9 100644
--- a/include/asm-x86/bootparam.h
+++ b/include/asm-x86/bootparam.h
@@ -14,6 +14,9 @@ struct setup_header {
14 u16 root_flags; 14 u16 root_flags;
15 u32 syssize; 15 u32 syssize;
16 u16 ram_size; 16 u16 ram_size;
17#define RAMDISK_IMAGE_START_MASK 0x07FF
18#define RAMDISK_PROMPT_FLAG 0x8000
19#define RAMDISK_LOAD_FLAG 0x4000
17 u16 vid_mode; 20 u16 vid_mode;
18 u16 root_dev; 21 u16 root_dev;
19 u16 boot_flag; 22 u16 boot_flag;
diff --git a/include/asm-x86/bootsetup.h b/include/asm-x86/bootsetup.h
deleted file mode 100644
index 7b1c3ad155fd..000000000000
--- a/include/asm-x86/bootsetup.h
+++ /dev/null
@@ -1,40 +0,0 @@
1
2#ifndef _X86_64_BOOTSETUP_H
3#define _X86_64_BOOTSETUP_H 1
4
5#define BOOT_PARAM_SIZE 4096
6extern char x86_boot_params[BOOT_PARAM_SIZE];
7
8/*
9 * This is set up by the setup-routine at boot-time
10 */
11#define PARAM ((unsigned char *)x86_boot_params)
12#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
13#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
14#define ALT_MEM_K (*(unsigned int *) (PARAM+0x1e0))
15#define E820_MAP_NR (*(char*) (PARAM+E820NR))
16#define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
17#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
18#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
19#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
20#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
21#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8))
22#define SAVED_VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA))
23#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
24#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
25#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
26#define KERNEL_START (*(unsigned int *) (PARAM+0x214))
27#define INITRD_START (*(unsigned int *) (PARAM+0x218))
28#define INITRD_SIZE (*(unsigned int *) (PARAM+0x21c))
29#define EDID_INFO (*(struct edid_info *) (PARAM+0x140))
30#define EDD_NR (*(unsigned char *) (PARAM+EDDNR))
31#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
32#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
33#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
34#define COMMAND_LINE boot_command_line
35
36#define RAMDISK_IMAGE_START_MASK 0x07FF
37#define RAMDISK_PROMPT_FLAG 0x8000
38#define RAMDISK_LOAD_FLAG 0x4000
39
40#endif
diff --git a/include/asm-x86/elf_32.h b/include/asm-x86/elf_32.h
index b32df3a332da..b3f694eaaf37 100644
--- a/include/asm-x86/elf_32.h
+++ b/include/asm-x86/elf_32.h
@@ -129,6 +129,7 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct
129#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) 129#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
130#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 130#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
131#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs) 131#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
132#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
132 133
133#define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO)) 134#define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO))
134#define VDSO_CURRENT_BASE ((unsigned long)current->mm->context.vdso) 135#define VDSO_CURRENT_BASE ((unsigned long)current->mm->context.vdso)
@@ -152,6 +153,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
152 153
153extern unsigned int vdso_enabled; 154extern unsigned int vdso_enabled;
154 155
156/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
155#define ARCH_DLINFO \ 157#define ARCH_DLINFO \
156do if (vdso_enabled) { \ 158do if (vdso_enabled) { \
157 NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \ 159 NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \
diff --git a/include/asm-x86/floppy_32.h b/include/asm-x86/floppy_32.h
index 44ef2f55a8e9..99583b39d216 100644
--- a/include/asm-x86/floppy_32.h
+++ b/include/asm-x86/floppy_32.h
@@ -275,10 +275,6 @@ static int FDC2 = -1;
275#define N_FDC 2 275#define N_FDC 2
276#define N_DRIVE 8 276#define N_DRIVE 8
277 277
278#define FLOPPY_MOTOR_MASK 0xf0
279
280#define AUTO_DMA
281
282#define EXTRA_FLOPPY_PARAMS 278#define EXTRA_FLOPPY_PARAMS
283 279
284#endif /* __ASM_I386_FLOPPY_H */ 280#endif /* __ASM_I386_FLOPPY_H */
diff --git a/include/asm-x86/floppy_64.h b/include/asm-x86/floppy_64.h
index 6ea13c3806f3..d993380dcb47 100644
--- a/include/asm-x86/floppy_64.h
+++ b/include/asm-x86/floppy_64.h
@@ -274,10 +274,6 @@ static int FDC2 = -1;
274#define N_FDC 2 274#define N_FDC 2
275#define N_DRIVE 8 275#define N_DRIVE 8
276 276
277#define FLOPPY_MOTOR_MASK 0xf0
278
279#define AUTO_DMA
280
281#define EXTRA_FLOPPY_PARAMS 277#define EXTRA_FLOPPY_PARAMS
282 278
283#endif /* __ASM_X86_64_FLOPPY_H */ 279#endif /* __ASM_X86_64_FLOPPY_H */
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
index e8e0bd641120..4ea7b1ad3c1d 100644
--- a/include/asm-x86/io_32.h
+++ b/include/asm-x86/io_32.h
@@ -237,18 +237,9 @@ static inline void flush_write_buffers(void)
237 __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory"); 237 __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory");
238} 238}
239 239
240#define dma_cache_inv(_start,_size) flush_write_buffers()
241#define dma_cache_wback(_start,_size) flush_write_buffers()
242#define dma_cache_wback_inv(_start,_size) flush_write_buffers()
243
244#else 240#else
245 241
246/* Nothing to do */ 242#define flush_write_buffers() do { } while (0)
247
248#define dma_cache_inv(_start,_size) do { } while (0)
249#define dma_cache_wback(_start,_size) do { } while (0)
250#define dma_cache_wback_inv(_start,_size) do { } while (0)
251#define flush_write_buffers()
252 243
253#endif 244#endif
254 245
diff --git a/include/asm-x86/io_64.h b/include/asm-x86/io_64.h
index 7475095c5061..a037b0794332 100644
--- a/include/asm-x86/io_64.h
+++ b/include/asm-x86/io_64.h
@@ -249,12 +249,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
249 */ 249 */
250#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 250#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
251 251
252/* Nothing to do */
253
254#define dma_cache_inv(_start,_size) do { } while (0)
255#define dma_cache_wback(_start,_size) do { } while (0)
256#define dma_cache_wback_inv(_start,_size) do { } while (0)
257
258#define flush_write_buffers() 252#define flush_write_buffers()
259 253
260extern int iommu_bio_merge; 254extern int iommu_bio_merge;
diff --git a/include/asm-x86/ipc.h b/include/asm-x86/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-x86/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index c7fefa6b12fd..acd4b339c49b 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -40,7 +40,7 @@ extern spinlock_t pgd_lock;
40extern struct page *pgd_list; 40extern struct page *pgd_list;
41void check_pgt_cache(void); 41void check_pgt_cache(void);
42 42
43void pmd_ctor(void *, struct kmem_cache *, unsigned long); 43void pmd_ctor(struct kmem_cache *, void *);
44void pgtable_cache_init(void); 44void pgtable_cache_init(void);
45void paging_init(void); 45void paging_init(void);
46 46
diff --git a/include/asm-x86/semaphore_32.h b/include/asm-x86/semaphore_32.h
index 4e34a468c383..835c1d751a9f 100644
--- a/include/asm-x86/semaphore_32.h
+++ b/include/asm-x86/semaphore_32.h
@@ -59,7 +59,6 @@ struct semaphore {
59 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 59 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
60 60
61#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 61#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
62#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
63 62
64static inline void sema_init (struct semaphore *sem, int val) 63static inline void sema_init (struct semaphore *sem, int val)
65{ 64{
diff --git a/include/asm-x86/semaphore_64.h b/include/asm-x86/semaphore_64.h
index 1194888536b9..79694306bf7d 100644
--- a/include/asm-x86/semaphore_64.h
+++ b/include/asm-x86/semaphore_64.h
@@ -60,7 +60,6 @@ struct semaphore {
60 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 60 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
61 61
62#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 62#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
63#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
64 63
65static inline void sema_init (struct semaphore *sem, int val) 64static inline void sema_init (struct semaphore *sem, int val)
66{ 65{
diff --git a/include/asm-x86/setup_32.h b/include/asm-x86/setup_32.h
index 7862fe858a9e..7a57ca8a1793 100644
--- a/include/asm-x86/setup_32.h
+++ b/include/asm-x86/setup_32.h
@@ -34,35 +34,6 @@
34 */ 34 */
35extern struct boot_params boot_params; 35extern struct boot_params boot_params;
36 36
37#define PARAM ((char *)&boot_params)
38#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
39#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
40#define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0))
41#define E820_MAP_NR (*(char*) (PARAM+E820NR))
42#define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
43#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
44#define IST_INFO (*(struct ist_info *) (PARAM+0x60))
45#define SYS_DESC_TABLE (*(struct sys_desc_table *)(PARAM+0xa0))
46#define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4)))
47#define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8)))
48#define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc)))
49#define EFI_MEMMAP ((void *) *((unsigned long *)(PARAM+0x1d0)))
50#define EFI_MEMMAP_SIZE (*((unsigned long *) (PARAM+0x1d4)))
51#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
52#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8))
53#define VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA))
54#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
55#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
56#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
57#define KERNEL_START (*(unsigned long *) (PARAM+0x214))
58#define INITRD_START (*(unsigned long *) (PARAM+0x218))
59#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
60#define EDID_INFO (*(struct edid_info *) (PARAM+0x140))
61#define EDD_NR (*(unsigned char *) (PARAM+EDDNR))
62#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
63#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
64#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
65
66/* 37/*
67 * Do NOT EVER look at the BIOS memory size location. 38 * Do NOT EVER look at the BIOS memory size location.
68 * It does not work on many machines. 39 * It does not work on many machines.
diff --git a/include/asm-x86/setup_64.h b/include/asm-x86/setup_64.h
index eaeff73d6c10..a04aadcccf67 100644
--- a/include/asm-x86/setup_64.h
+++ b/include/asm-x86/setup_64.h
@@ -3,4 +3,17 @@
3 3
4#define COMMAND_LINE_SIZE 2048 4#define COMMAND_LINE_SIZE 2048
5 5
6#ifdef __KERNEL__
7
8#ifndef __ASSEMBLY__
9#include <asm/bootparam.h>
10
11/*
12 * This is set up by the setup-routine at boot-time
13 */
14extern struct boot_params boot_params;
15
16#endif /* not __ASSEMBLY__ */
17#endif /* __KERNEL__ */
18
6#endif 19#endif
diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h
index e7e5d426fef5..d84e593b7dfc 100644
--- a/include/asm-x86/system_32.h
+++ b/include/asm-x86/system_32.h
@@ -7,6 +7,7 @@
7#include <asm/cmpxchg.h> 7#include <asm/cmpxchg.h>
8 8
9#ifdef __KERNEL__ 9#ifdef __KERNEL__
10#define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
10 11
11struct task_struct; /* one of the stranger aspects of C forward declarations.. */ 12struct task_struct; /* one of the stranger aspects of C forward declarations.. */
12extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); 13extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
diff --git a/include/asm-x86/types_32.h b/include/asm-x86/types_32.h
index ad0a55bd782f..faca1922c4c3 100644
--- a/include/asm-x86/types_32.h
+++ b/include/asm-x86/types_32.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
19typedef __signed__ int __s32; 19typedef __signed__ int __s32;
20typedef unsigned int __u32; 20typedef unsigned int __u32;
21 21
22#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 22#if defined(__GNUC__)
23typedef __signed__ long long __s64; 23__extension__ typedef __signed__ long long __s64;
24typedef unsigned long long __u64; 24__extension__ typedef unsigned long long __u64;
25#endif 25#endif
26 26
27#endif /* __ASSEMBLY__ */ 27#endif /* __ASSEMBLY__ */
diff --git a/include/asm-xtensa/semaphore.h b/include/asm-xtensa/semaphore.h
index f10c3487cd4c..3e04167cd9dc 100644
--- a/include/asm-xtensa/semaphore.h
+++ b/include/asm-xtensa/semaphore.h
@@ -33,7 +33,6 @@ struct semaphore {
33 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 33 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
34 34
35#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 35#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
36#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
37 36
38static inline void sema_init (struct semaphore *sem, int val) 37static inline void sema_init (struct semaphore *sem, int val)
39{ 38{
diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h
index f1e84526f999..b27d841a8eb7 100644
--- a/include/asm-xtensa/types.h
+++ b/include/asm-xtensa/types.h
@@ -38,9 +38,9 @@ typedef unsigned short __u16;
38typedef __signed__ int __s32; 38typedef __signed__ int __s32;
39typedef unsigned int __u32; 39typedef unsigned int __u32;
40 40
41#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 41#if defined(__GNUC__)
42typedef __signed__ long long __s64; 42__extension__ typedef __signed__ long long __s64;
43typedef unsigned long long __u64; 43__extension__ typedef unsigned long long __u64;
44#endif 44#endif
45 45
46/* 46/*
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
index e2ee73aef0ee..4ea429b18750 100644
--- a/include/keys/rxrpc-type.h
+++ b/include/keys/rxrpc-type.h
@@ -19,4 +19,6 @@
19 */ 19 */
20extern struct key_type key_type_rxrpc; 20extern struct key_type key_type_rxrpc;
21 21
22extern struct key *rxrpc_get_null_key(const char *);
23
22#endif /* _KEYS_USER_TYPE_H */ 24#endif /* _KEYS_USER_TYPE_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 025af706d114..7ac8303c8471 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -46,7 +46,6 @@ header-y += chio.h
46header-y += coda_psdev.h 46header-y += coda_psdev.h
47header-y += coff.h 47header-y += coff.h
48header-y += comstats.h 48header-y += comstats.h
49header-y += consolemap.h
50header-y += const.h 49header-y += const.h
51header-y += cycx_cfm.h 50header-y += cycx_cfm.h
52header-y += dlm_device.h 51header-y += dlm_device.h
@@ -283,6 +282,7 @@ unifdef-y += nfs_idmap.h
283unifdef-y += n_r3964.h 282unifdef-y += n_r3964.h
284unifdef-y += nubus.h 283unifdef-y += nubus.h
285unifdef-y += nvram.h 284unifdef-y += nvram.h
285unifdef-y += oom.h
286unifdef-y += parport.h 286unifdef-y += parport.h
287unifdef-y += patchkey.h 287unifdef-y += patchkey.h
288unifdef-y += pci.h 288unifdef-y += pci.h
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
new file mode 100644
index 000000000000..06023393fba9
--- /dev/null
+++ b/include/linux/atmel-ssc.h
@@ -0,0 +1,312 @@
1#ifndef __INCLUDE_ATMEL_SSC_H
2#define __INCLUDE_ATMEL_SSC_H
3
4#include <linux/platform_device.h>
5#include <linux/list.h>
6
7struct ssc_device {
8 struct list_head list;
9 void __iomem *regs;
10 struct platform_device *pdev;
11 struct clk *clk;
12 int user;
13 int irq;
14};
15
16struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
17void ssc_free(struct ssc_device *ssc);
18
19/* SSC register offsets */
20
21/* SSC Control Register */
22#define SSC_CR 0x00000000
23#define SSC_CR_RXDIS_SIZE 1
24#define SSC_CR_RXDIS_OFFSET 1
25#define SSC_CR_RXEN_SIZE 1
26#define SSC_CR_RXEN_OFFSET 0
27#define SSC_CR_SWRST_SIZE 1
28#define SSC_CR_SWRST_OFFSET 15
29#define SSC_CR_TXDIS_SIZE 1
30#define SSC_CR_TXDIS_OFFSET 9
31#define SSC_CR_TXEN_SIZE 1
32#define SSC_CR_TXEN_OFFSET 8
33
34/* SSC Clock Mode Register */
35#define SSC_CMR 0x00000004
36#define SSC_CMR_DIV_SIZE 12
37#define SSC_CMR_DIV_OFFSET 0
38
39/* SSC Receive Clock Mode Register */
40#define SSC_RCMR 0x00000010
41#define SSC_RCMR_CKG_SIZE 2
42#define SSC_RCMR_CKG_OFFSET 6
43#define SSC_RCMR_CKI_SIZE 1
44#define SSC_RCMR_CKI_OFFSET 5
45#define SSC_RCMR_CKO_SIZE 3
46#define SSC_RCMR_CKO_OFFSET 2
47#define SSC_RCMR_CKS_SIZE 2
48#define SSC_RCMR_CKS_OFFSET 0
49#define SSC_RCMR_PERIOD_SIZE 8
50#define SSC_RCMR_PERIOD_OFFSET 24
51#define SSC_RCMR_START_SIZE 4
52#define SSC_RCMR_START_OFFSET 8
53#define SSC_RCMR_STOP_SIZE 1
54#define SSC_RCMR_STOP_OFFSET 12
55#define SSC_RCMR_STTDLY_SIZE 8
56#define SSC_RCMR_STTDLY_OFFSET 16
57
58/* SSC Receive Frame Mode Register */
59#define SSC_RFMR 0x00000014
60#define SSC_RFMR_DATLEN_SIZE 5
61#define SSC_RFMR_DATLEN_OFFSET 0
62#define SSC_RFMR_DATNB_SIZE 4
63#define SSC_RFMR_DATNB_OFFSET 8
64#define SSC_RFMR_FSEDGE_SIZE 1
65#define SSC_RFMR_FSEDGE_OFFSET 24
66#define SSC_RFMR_FSLEN_SIZE 4
67#define SSC_RFMR_FSLEN_OFFSET 16
68#define SSC_RFMR_FSOS_SIZE 4
69#define SSC_RFMR_FSOS_OFFSET 20
70#define SSC_RFMR_LOOP_SIZE 1
71#define SSC_RFMR_LOOP_OFFSET 5
72#define SSC_RFMR_MSBF_SIZE 1
73#define SSC_RFMR_MSBF_OFFSET 7
74
75/* SSC Transmit Clock Mode Register */
76#define SSC_TCMR 0x00000018
77#define SSC_TCMR_CKG_SIZE 2
78#define SSC_TCMR_CKG_OFFSET 6
79#define SSC_TCMR_CKI_SIZE 1
80#define SSC_TCMR_CKI_OFFSET 5
81#define SSC_TCMR_CKO_SIZE 3
82#define SSC_TCMR_CKO_OFFSET 2
83#define SSC_TCMR_CKS_SIZE 2
84#define SSC_TCMR_CKS_OFFSET 0
85#define SSC_TCMR_PERIOD_SIZE 8
86#define SSC_TCMR_PERIOD_OFFSET 24
87#define SSC_TCMR_START_SIZE 4
88#define SSC_TCMR_START_OFFSET 8
89#define SSC_TCMR_STTDLY_SIZE 8
90#define SSC_TCMR_STTDLY_OFFSET 16
91
92/* SSC Transmit Frame Mode Register */
93#define SSC_TFMR 0x0000001c
94#define SSC_TFMR_DATDEF_SIZE 1
95#define SSC_TFMR_DATDEF_OFFSET 5
96#define SSC_TFMR_DATLEN_SIZE 5
97#define SSC_TFMR_DATLEN_OFFSET 0
98#define SSC_TFMR_DATNB_SIZE 4
99#define SSC_TFMR_DATNB_OFFSET 8
100#define SSC_TFMR_FSDEN_SIZE 1
101#define SSC_TFMR_FSDEN_OFFSET 23
102#define SSC_TFMR_FSEDGE_SIZE 1
103#define SSC_TFMR_FSEDGE_OFFSET 24
104#define SSC_TFMR_FSLEN_SIZE 4
105#define SSC_TFMR_FSLEN_OFFSET 16
106#define SSC_TFMR_FSOS_SIZE 3
107#define SSC_TFMR_FSOS_OFFSET 20
108#define SSC_TFMR_MSBF_SIZE 1
109#define SSC_TFMR_MSBF_OFFSET 7
110
111/* SSC Receive Hold Register */
112#define SSC_RHR 0x00000020
113#define SSC_RHR_RDAT_SIZE 32
114#define SSC_RHR_RDAT_OFFSET 0
115
116/* SSC Transmit Hold Register */
117#define SSC_THR 0x00000024
118#define SSC_THR_TDAT_SIZE 32
119#define SSC_THR_TDAT_OFFSET 0
120
121/* SSC Receive Sync. Holding Register */
122#define SSC_RSHR 0x00000030
123#define SSC_RSHR_RSDAT_SIZE 16
124#define SSC_RSHR_RSDAT_OFFSET 0
125
126/* SSC Transmit Sync. Holding Register */
127#define SSC_TSHR 0x00000034
128#define SSC_TSHR_TSDAT_SIZE 16
129#define SSC_TSHR_RSDAT_OFFSET 0
130
131/* SSC Receive Compare 0 Register */
132#define SSC_RC0R 0x00000038
133#define SSC_RC0R_CP0_SIZE 16
134#define SSC_RC0R_CP0_OFFSET 0
135
136/* SSC Receive Compare 1 Register */
137#define SSC_RC1R 0x0000003c
138#define SSC_RC1R_CP1_SIZE 16
139#define SSC_RC1R_CP1_OFFSET 0
140
141/* SSC Status Register */
142#define SSC_SR 0x00000040
143#define SSC_SR_CP0_SIZE 1
144#define SSC_SR_CP0_OFFSET 8
145#define SSC_SR_CP1_SIZE 1
146#define SSC_SR_CP1_OFFSET 9
147#define SSC_SR_ENDRX_SIZE 1
148#define SSC_SR_ENDRX_OFFSET 6
149#define SSC_SR_ENDTX_SIZE 1
150#define SSC_SR_ENDTX_OFFSET 2
151#define SSC_SR_OVRUN_SIZE 1
152#define SSC_SR_OVRUN_OFFSET 5
153#define SSC_SR_RXBUFF_SIZE 1
154#define SSC_SR_RXBUFF_OFFSET 7
155#define SSC_SR_RXEN_SIZE 1
156#define SSC_SR_RXEN_OFFSET 17
157#define SSC_SR_RXRDY_SIZE 1
158#define SSC_SR_RXRDY_OFFSET 4
159#define SSC_SR_RXSYN_SIZE 1
160#define SSC_SR_RXSYN_OFFSET 11
161#define SSC_SR_TXBUFE_SIZE 1
162#define SSC_SR_TXBUFE_OFFSET 3
163#define SSC_SR_TXEMPTY_SIZE 1
164#define SSC_SR_TXEMPTY_OFFSET 1
165#define SSC_SR_TXEN_SIZE 1
166#define SSC_SR_TXEN_OFFSET 16
167#define SSC_SR_TXRDY_SIZE 1
168#define SSC_SR_TXRDY_OFFSET 0
169#define SSC_SR_TXSYN_SIZE 1
170#define SSC_SR_TXSYN_OFFSET 10
171
172/* SSC Interrupt Enable Register */
173#define SSC_IER 0x00000044
174#define SSC_IER_CP0_SIZE 1
175#define SSC_IER_CP0_OFFSET 8
176#define SSC_IER_CP1_SIZE 1
177#define SSC_IER_CP1_OFFSET 9
178#define SSC_IER_ENDRX_SIZE 1
179#define SSC_IER_ENDRX_OFFSET 6
180#define SSC_IER_ENDTX_SIZE 1
181#define SSC_IER_ENDTX_OFFSET 2
182#define SSC_IER_OVRUN_SIZE 1
183#define SSC_IER_OVRUN_OFFSET 5
184#define SSC_IER_RXBUFF_SIZE 1
185#define SSC_IER_RXBUFF_OFFSET 7
186#define SSC_IER_RXRDY_SIZE 1
187#define SSC_IER_RXRDY_OFFSET 4
188#define SSC_IER_RXSYN_SIZE 1
189#define SSC_IER_RXSYN_OFFSET 11
190#define SSC_IER_TXBUFE_SIZE 1
191#define SSC_IER_TXBUFE_OFFSET 3
192#define SSC_IER_TXEMPTY_SIZE 1
193#define SSC_IER_TXEMPTY_OFFSET 1
194#define SSC_IER_TXRDY_SIZE 1
195#define SSC_IER_TXRDY_OFFSET 0
196#define SSC_IER_TXSYN_SIZE 1
197#define SSC_IER_TXSYN_OFFSET 10
198
199/* SSC Interrupt Disable Register */
200#define SSC_IDR 0x00000048
201#define SSC_IDR_CP0_SIZE 1
202#define SSC_IDR_CP0_OFFSET 8
203#define SSC_IDR_CP1_SIZE 1
204#define SSC_IDR_CP1_OFFSET 9
205#define SSC_IDR_ENDRX_SIZE 1
206#define SSC_IDR_ENDRX_OFFSET 6
207#define SSC_IDR_ENDTX_SIZE 1
208#define SSC_IDR_ENDTX_OFFSET 2
209#define SSC_IDR_OVRUN_SIZE 1
210#define SSC_IDR_OVRUN_OFFSET 5
211#define SSC_IDR_RXBUFF_SIZE 1
212#define SSC_IDR_RXBUFF_OFFSET 7
213#define SSC_IDR_RXRDY_SIZE 1
214#define SSC_IDR_RXRDY_OFFSET 4
215#define SSC_IDR_RXSYN_SIZE 1
216#define SSC_IDR_RXSYN_OFFSET 11
217#define SSC_IDR_TXBUFE_SIZE 1
218#define SSC_IDR_TXBUFE_OFFSET 3
219#define SSC_IDR_TXEMPTY_SIZE 1
220#define SSC_IDR_TXEMPTY_OFFSET 1
221#define SSC_IDR_TXRDY_SIZE 1
222#define SSC_IDR_TXRDY_OFFSET 0
223#define SSC_IDR_TXSYN_SIZE 1
224#define SSC_IDR_TXSYN_OFFSET 10
225
226/* SSC Interrupt Mask Register */
227#define SSC_IMR 0x0000004c
228#define SSC_IMR_CP0_SIZE 1
229#define SSC_IMR_CP0_OFFSET 8
230#define SSC_IMR_CP1_SIZE 1
231#define SSC_IMR_CP1_OFFSET 9
232#define SSC_IMR_ENDRX_SIZE 1
233#define SSC_IMR_ENDRX_OFFSET 6
234#define SSC_IMR_ENDTX_SIZE 1
235#define SSC_IMR_ENDTX_OFFSET 2
236#define SSC_IMR_OVRUN_SIZE 1
237#define SSC_IMR_OVRUN_OFFSET 5
238#define SSC_IMR_RXBUFF_SIZE 1
239#define SSC_IMR_RXBUFF_OFFSET 7
240#define SSC_IMR_RXRDY_SIZE 1
241#define SSC_IMR_RXRDY_OFFSET 4
242#define SSC_IMR_RXSYN_SIZE 1
243#define SSC_IMR_RXSYN_OFFSET 11
244#define SSC_IMR_TXBUFE_SIZE 1
245#define SSC_IMR_TXBUFE_OFFSET 3
246#define SSC_IMR_TXEMPTY_SIZE 1
247#define SSC_IMR_TXEMPTY_OFFSET 1
248#define SSC_IMR_TXRDY_SIZE 1
249#define SSC_IMR_TXRDY_OFFSET 0
250#define SSC_IMR_TXSYN_SIZE 1
251#define SSC_IMR_TXSYN_OFFSET 10
252
253/* SSC PDC Receive Pointer Register */
254#define SSC_PDC_RPR 0x00000100
255
256/* SSC PDC Receive Counter Register */
257#define SSC_PDC_RCR 0x00000104
258
259/* SSC PDC Transmit Pointer Register */
260#define SSC_PDC_TPR 0x00000108
261
262/* SSC PDC Receive Next Pointer Register */
263#define SSC_PDC_RNPR 0x00000110
264
265/* SSC PDC Receive Next Counter Register */
266#define SSC_PDC_RNCR 0x00000114
267
268/* SSC PDC Transmit Counter Register */
269#define SSC_PDC_TCR 0x0000010c
270
271/* SSC PDC Transmit Next Pointer Register */
272#define SSC_PDC_TNPR 0x00000118
273
274/* SSC PDC Transmit Next Counter Register */
275#define SSC_PDC_TNCR 0x0000011c
276
277/* SSC PDC Transfer Control Register */
278#define SSC_PDC_PTCR 0x00000120
279#define SSC_PDC_PTCR_RXTDIS_SIZE 1
280#define SSC_PDC_PTCR_RXTDIS_OFFSET 1
281#define SSC_PDC_PTCR_RXTEN_SIZE 1
282#define SSC_PDC_PTCR_RXTEN_OFFSET 0
283#define SSC_PDC_PTCR_TXTDIS_SIZE 1
284#define SSC_PDC_PTCR_TXTDIS_OFFSET 9
285#define SSC_PDC_PTCR_TXTEN_SIZE 1
286#define SSC_PDC_PTCR_TXTEN_OFFSET 8
287
288/* SSC PDC Transfer Status Register */
289#define SSC_PDC_PTSR 0x00000124
290#define SSC_PDC_PTSR_RXTEN_SIZE 1
291#define SSC_PDC_PTSR_RXTEN_OFFSET 0
292#define SSC_PDC_PTSR_TXTEN_SIZE 1
293#define SSC_PDC_PTSR_TXTEN_OFFSET 8
294
295/* Bit manipulation macros */
296#define SSC_BIT(name) \
297 (1 << SSC_##name##_OFFSET)
298#define SSC_BF(name, value) \
299 (((value) & ((1 << SSC_##name##_SIZE) - 1)) \
300 << SSC_##name##_OFFSET)
301#define SSC_BFEXT(name, value) \
302 (((value) >> SSC_##name##_OFFSET) \
303 & ((1 << SSC_##name##_SIZE) - 1))
304#define SSC_BFINS(name, value, old) \
305 (((old) & ~(((1 << SSC_##name##_SIZE) - 1) \
306 << SSC_##name##_OFFSET)) | SSC_BF(name, value))
307
308/* Register access macros */
309#define ssc_readl(base, reg) __raw_readl(base + SSC_##reg)
310#define ssc_writel(base, reg, value) __raw_writel((value), base + SSC_##reg)
311
312#endif /* __INCLUDE_ATMEL_SSC_H */
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index d2bc0d66e65d..ad895455ab72 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -26,6 +26,8 @@
26 26
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28 28
29#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */ 29#ifdef __KERNEL__
30#define AT_VECTOR_SIZE_BASE (14 + 2) /* NEW_AUX_ENT entries in auxiliary table */
31#endif
30 32
31#endif /* _LINUX_AUXVEC_H */ 33#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 7011d6255593..48a62baace58 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -8,6 +8,9 @@
8#ifndef _LINUX_BACKING_DEV_H 8#ifndef _LINUX_BACKING_DEV_H
9#define _LINUX_BACKING_DEV_H 9#define _LINUX_BACKING_DEV_H
10 10
11#include <linux/percpu_counter.h>
12#include <linux/log2.h>
13#include <linux/proportions.h>
11#include <asm/atomic.h> 14#include <asm/atomic.h>
12 15
13struct page; 16struct page;
@@ -24,6 +27,14 @@ enum bdi_state {
24 27
25typedef int (congested_fn)(void *, int); 28typedef int (congested_fn)(void *, int);
26 29
30enum bdi_stat_item {
31 BDI_RECLAIMABLE,
32 BDI_WRITEBACK,
33 NR_BDI_STAT_ITEMS
34};
35
36#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
37
27struct backing_dev_info { 38struct backing_dev_info {
28 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 39 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
29 unsigned long state; /* Always use atomic bitops on this */ 40 unsigned long state; /* Always use atomic bitops on this */
@@ -32,8 +43,90 @@ struct backing_dev_info {
32 void *congested_data; /* Pointer to aux data for congested func */ 43 void *congested_data; /* Pointer to aux data for congested func */
33 void (*unplug_io_fn)(struct backing_dev_info *, struct page *); 44 void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
34 void *unplug_io_data; 45 void *unplug_io_data;
46
47 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
48
49 struct prop_local_percpu completions;
50 int dirty_exceeded;
35}; 51};
36 52
53int bdi_init(struct backing_dev_info *bdi);
54void bdi_destroy(struct backing_dev_info *bdi);
55
56static inline void __add_bdi_stat(struct backing_dev_info *bdi,
57 enum bdi_stat_item item, s64 amount)
58{
59 __percpu_counter_add(&bdi->bdi_stat[item], amount, BDI_STAT_BATCH);
60}
61
62static inline void __inc_bdi_stat(struct backing_dev_info *bdi,
63 enum bdi_stat_item item)
64{
65 __add_bdi_stat(bdi, item, 1);
66}
67
68static inline void inc_bdi_stat(struct backing_dev_info *bdi,
69 enum bdi_stat_item item)
70{
71 unsigned long flags;
72
73 local_irq_save(flags);
74 __inc_bdi_stat(bdi, item);
75 local_irq_restore(flags);
76}
77
78static inline void __dec_bdi_stat(struct backing_dev_info *bdi,
79 enum bdi_stat_item item)
80{
81 __add_bdi_stat(bdi, item, -1);
82}
83
84static inline void dec_bdi_stat(struct backing_dev_info *bdi,
85 enum bdi_stat_item item)
86{
87 unsigned long flags;
88
89 local_irq_save(flags);
90 __dec_bdi_stat(bdi, item);
91 local_irq_restore(flags);
92}
93
94static inline s64 bdi_stat(struct backing_dev_info *bdi,
95 enum bdi_stat_item item)
96{
97 return percpu_counter_read_positive(&bdi->bdi_stat[item]);
98}
99
100static inline s64 __bdi_stat_sum(struct backing_dev_info *bdi,
101 enum bdi_stat_item item)
102{
103 return percpu_counter_sum_positive(&bdi->bdi_stat[item]);
104}
105
106static inline s64 bdi_stat_sum(struct backing_dev_info *bdi,
107 enum bdi_stat_item item)
108{
109 s64 sum;
110 unsigned long flags;
111
112 local_irq_save(flags);
113 sum = __bdi_stat_sum(bdi, item);
114 local_irq_restore(flags);
115
116 return sum;
117}
118
119/*
120 * maximal error of a stat counter.
121 */
122static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi)
123{
124#ifdef CONFIG_SMP
125 return nr_cpu_ids * BDI_STAT_BATCH;
126#else
127 return 1;
128#endif
129}
37 130
38/* 131/*
39 * Flags in backing_dev_info::capability 132 * Flags in backing_dev_info::capability
@@ -93,7 +186,6 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw); 186void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw); 187void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout); 188long congestion_wait(int rw, long timeout);
96void congestion_end(int rw);
97 189
98#define bdi_cap_writeback_dirty(bdi) \ 190#define bdi_cap_writeback_dirty(bdi) \
99 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) 191 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 91c8c07fe8b7..b7fc55ec8d48 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -37,7 +37,8 @@ struct linux_binprm{
37 int sh_bang; 37 int sh_bang;
38 struct file * file; 38 struct file * file;
39 int e_uid, e_gid; 39 int e_uid, e_gid;
40 kernel_cap_t cap_inheritable, cap_permitted, cap_effective; 40 kernel_cap_t cap_inheritable, cap_permitted;
41 bool cap_effective;
41 void *security; 42 void *security;
42 int argc, envc; 43 int argc, envc;
43 char * filename; /* Name of binary as seen by procps */ 44 char * filename; /* Name of binary as seen by procps */
@@ -63,17 +64,17 @@ struct linux_binprm{
63 * linux accepts. 64 * linux accepts.
64 */ 65 */
65struct linux_binfmt { 66struct linux_binfmt {
66 struct linux_binfmt * next; 67 struct list_head lh;
67 struct module *module; 68 struct module *module;
68 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); 69 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
69 int (*load_shlib)(struct file *); 70 int (*load_shlib)(struct file *);
70 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); 71 int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
71 unsigned long min_coredump; /* minimal dump size */ 72 unsigned long min_coredump; /* minimal dump size */
72 int hasvdso; 73 int hasvdso;
73}; 74};
74 75
75extern int register_binfmt(struct linux_binfmt *); 76extern int register_binfmt(struct linux_binfmt *);
76extern int unregister_binfmt(struct linux_binfmt *); 77extern void unregister_binfmt(struct linux_binfmt *);
77 78
78extern int prepare_binprm(struct linux_binprm *); 79extern int prepare_binprm(struct linux_binprm *);
79extern int __must_check remove_arg_zero(struct linux_binprm *); 80extern int __must_check remove_arg_zero(struct linux_binprm *);
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 2dfa58555934..8961e7fb755c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -1,14 +1,14 @@
1/* 1/*
2 * This is <linux/capability.h> 2 * This is <linux/capability.h>
3 * 3 *
4 * Andrew G. Morgan <morgan@transmeta.com> 4 * Andrew G. Morgan <morgan@kernel.org>
5 * Alexander Kjeldaas <astor@guardian.no> 5 * Alexander Kjeldaas <astor@guardian.no>
6 * with help from Aleph1, Roland Buresund and Andrew Main. 6 * with help from Aleph1, Roland Buresund and Andrew Main.
7 * 7 *
8 * See here for the libcap library ("POSIX draft" compliance): 8 * See here for the libcap library ("POSIX draft" compliance):
9 * 9 *
10 * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.2/ 10 * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */ 11 */
12 12
13#ifndef _LINUX_CAPABILITY_H 13#ifndef _LINUX_CAPABILITY_H
14#define _LINUX_CAPABILITY_H 14#define _LINUX_CAPABILITY_H
@@ -28,23 +28,41 @@ struct task_struct;
28 following structure to such a composite is better handled in a user 28 following structure to such a composite is better handled in a user
29 library since the draft standard requires the use of malloc/free 29 library since the draft standard requires the use of malloc/free
30 etc.. */ 30 etc.. */
31 31
32#define _LINUX_CAPABILITY_VERSION 0x19980330 32#define _LINUX_CAPABILITY_VERSION 0x19980330
33 33
34typedef struct __user_cap_header_struct { 34typedef struct __user_cap_header_struct {
35 __u32 version; 35 __u32 version;
36 int pid; 36 int pid;
37} __user *cap_user_header_t; 37} __user *cap_user_header_t;
38 38
39typedef struct __user_cap_data_struct { 39typedef struct __user_cap_data_struct {
40 __u32 effective; 40 __u32 effective;
41 __u32 permitted; 41 __u32 permitted;
42 __u32 inheritable; 42 __u32 inheritable;
43} __user *cap_user_data_t; 43} __user *cap_user_data_t;
44
45#ifdef __KERNEL__
46 44
47#include <asm/current.h> 45#define XATTR_CAPS_SUFFIX "capability"
46#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
47
48#define XATTR_CAPS_SZ (3*sizeof(__le32))
49#define VFS_CAP_REVISION_MASK 0xFF000000
50#define VFS_CAP_REVISION_1 0x01000000
51
52#define VFS_CAP_REVISION VFS_CAP_REVISION_1
53
54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
55#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
56
57struct vfs_cap_data {
58 __u32 magic_etc; /* Little endian */
59 struct {
60 __u32 permitted; /* Little endian */
61 __u32 inheritable; /* Little endian */
62 } data[1];
63};
64
65#ifdef __KERNEL__
48 66
49/* #define STRICT_CAP_T_TYPECHECKS */ 67/* #define STRICT_CAP_T_TYPECHECKS */
50 68
@@ -59,7 +77,7 @@ typedef struct kernel_cap_struct {
59typedef __u32 kernel_cap_t; 77typedef __u32 kernel_cap_t;
60 78
61#endif 79#endif
62 80
63#define _USER_CAP_HEADER_SIZE (2*sizeof(__u32)) 81#define _USER_CAP_HEADER_SIZE (2*sizeof(__u32))
64#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) 82#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
65 83
@@ -67,7 +85,7 @@ typedef __u32 kernel_cap_t;
67 85
68 86
69/** 87/**
70 ** POSIX-draft defined capabilities. 88 ** POSIX-draft defined capabilities.
71 **/ 89 **/
72 90
73/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this 91/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
@@ -87,7 +105,7 @@ typedef __u32 kernel_cap_t;
87 defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ 105 defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
88 106
89#define CAP_DAC_READ_SEARCH 2 107#define CAP_DAC_READ_SEARCH 2
90 108
91/* Overrides all restrictions about allowed operations on files, where 109/* Overrides all restrictions about allowed operations on files, where
92 file owner ID must be equal to the user ID, except where CAP_FSETID 110 file owner ID must be equal to the user ID, except where CAP_FSETID
93 is applicable. It doesn't override MAC and DAC restrictions. */ 111 is applicable. It doesn't override MAC and DAC restrictions. */
@@ -257,7 +275,7 @@ typedef __u32 kernel_cap_t;
257/* Override reserved space on ext2 filesystem */ 275/* Override reserved space on ext2 filesystem */
258/* Modify data journaling mode on ext3 filesystem (uses journaling 276/* Modify data journaling mode on ext3 filesystem (uses journaling
259 resources) */ 277 resources) */
260/* NOTE: ext2 honors fsuid when checking for resource overrides, so 278/* NOTE: ext2 honors fsuid when checking for resource overrides, so
261 you can override using fsuid too */ 279 you can override using fsuid too */
262/* Override size restrictions on IPC message queues */ 280/* Override size restrictions on IPC message queues */
263/* Allow more than 64hz interrupts from the real-time clock */ 281/* Allow more than 64hz interrupts from the real-time clock */
@@ -289,8 +307,10 @@ typedef __u32 kernel_cap_t;
289 307
290#define CAP_AUDIT_CONTROL 30 308#define CAP_AUDIT_CONTROL 30
291 309
310#define CAP_SETFCAP 31
311
292#ifdef __KERNEL__ 312#ifdef __KERNEL__
293/* 313/*
294 * Bounding set 314 * Bounding set
295 */ 315 */
296extern kernel_cap_t cap_bset; 316extern kernel_cap_t cap_bset;
@@ -298,7 +318,7 @@ extern kernel_cap_t cap_bset;
298/* 318/*
299 * Internal kernel functions only 319 * Internal kernel functions only
300 */ 320 */
301 321
302#ifdef STRICT_CAP_T_TYPECHECKS 322#ifdef STRICT_CAP_T_TYPECHECKS
303 323
304#define to_cap_t(x) { x } 324#define to_cap_t(x) { x }
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 03ec2311fb29..acd583384bd9 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -1,4 +1,6 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */ 1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
3#endif
2 4
3/* 5/*
4 * Common definitions for all gcc versions go here. 6 * Common definitions for all gcc versions go here.
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index a9e2863c2dbf..2d8c0f48f55e 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -1,4 +1,6 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */ 1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
3#endif
2 4
3/* These definitions are for GCC v3.x. */ 5/* These definitions are for GCC v3.x. */
4#include <linux/compiler-gcc.h> 6#include <linux/compiler-gcc.h>
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 14f7494280f0..ee7ca5de970c 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -1,4 +1,6 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */ 1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
3#endif
2 4
3/* These definitions are for GCC v4.x. */ 5/* These definitions are for GCC v4.x. */
4#include <linux/compiler-gcc.h> 6#include <linux/compiler-gcc.h>
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index b769961e6f23..d8e636e5607d 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -1,4 +1,6 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */ 1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead."
3#endif
2 4
3#ifdef __ECC 5#ifdef __ECC
4 6
diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h
index 06b2768c603f..e2bf7e5db39a 100644
--- a/include/linux/consolemap.h
+++ b/include/linux/consolemap.h
@@ -16,4 +16,5 @@ extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode);
16extern unsigned short *set_translate(int m, struct vc_data *vc); 16extern unsigned short *set_translate(int m, struct vc_data *vc);
17extern int conv_uni_to_pc(struct vc_data *conp, long ucs); 17extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
18extern u32 conv_8bit_to_uni(unsigned char c); 18extern u32 conv_8bit_to_uni(unsigned char c);
19extern int conv_uni_to_8bit(u32 uni);
19void console_map_init(void); 20void console_map_init(void);
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 9e633ea103ce..ea44d2e768a0 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -45,7 +45,8 @@ static int inline cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
45 __cpuset_zone_allowed_hardwall(z, gfp_mask); 45 __cpuset_zone_allowed_hardwall(z, gfp_mask);
46} 46}
47 47
48extern int cpuset_excl_nodes_overlap(const struct task_struct *p); 48extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
49 const struct task_struct *tsk2);
49 50
50#define cpuset_memory_pressure_bump() \ 51#define cpuset_memory_pressure_bump() \
51 do { \ 52 do { \
@@ -113,7 +114,8 @@ static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
113 return 1; 114 return 1;
114} 115}
115 116
116static inline int cpuset_excl_nodes_overlap(const struct task_struct *p) 117static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
118 const struct task_struct *tsk2)
117{ 119{
118 return 1; 120 return 1;
119} 121}
diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index 1dba681e428d..3be4e5a27d82 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ 6#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
7#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */
7#define CRAMFS_SIGNATURE "Compressed ROMFS" 8#define CRAMFS_SIGNATURE "Compressed ROMFS"
8 9
9/* 10/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index d2da84acf45d..576e83bd6d88 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -2,7 +2,6 @@
2#define _LINUX_ELF_H 2#define _LINUX_ELF_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/auxvec.h>
6#include <linux/elf-em.h> 5#include <linux/elf-em.h>
7#include <asm/elf.h> 6#include <asm/elf.h>
8 7
@@ -355,6 +354,7 @@ typedef struct elf64_shdr {
355#define NT_TASKSTRUCT 4 354#define NT_TASKSTRUCT 4
356#define NT_AUXV 6 355#define NT_AUXV 6
357#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 356#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
357#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
358 358
359 359
360/* Note header in a PT_NOTE section */ 360/* 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
index 000000000000..532d13adabc4
--- /dev/null
+++ b/include/linux/elfcore-compat.h
@@ -0,0 +1,55 @@
1#ifndef _LINUX_ELFCORE_COMPAT_H
2#define _LINUX_ELFCORE_COMPAT_H
3
4#include <linux/elf.h>
5#include <linux/elfcore.h>
6#include <linux/compat.h>
7
8/*
9 * Make sure these layouts match the linux/elfcore.h native definitions.
10 */
11
12struct compat_elf_siginfo
13{
14 compat_int_t si_signo;
15 compat_int_t si_code;
16 compat_int_t si_errno;
17};
18
19struct compat_elf_prstatus
20{
21 struct compat_elf_siginfo pr_info;
22 short pr_cursig;
23 compat_ulong_t pr_sigpend;
24 compat_ulong_t pr_sighold;
25 compat_pid_t pr_pid;
26 compat_pid_t pr_ppid;
27 compat_pid_t pr_pgrp;
28 compat_pid_t pr_sid;
29 struct compat_timeval pr_utime;
30 struct compat_timeval pr_stime;
31 struct compat_timeval pr_cutime;
32 struct compat_timeval pr_cstime;
33 compat_elf_gregset_t pr_reg;
34#ifdef CONFIG_BINFMT_ELF_FDPIC
35 compat_ulong_t pr_exec_fdpic_loadmap;
36 compat_ulong_t pr_interp_fdpic_loadmap;
37#endif
38 compat_int_t pr_fpvalid;
39};
40
41struct compat_elf_prpsinfo
42{
43 char pr_state;
44 char pr_sname;
45 char pr_zomb;
46 char pr_nice;
47 compat_ulong_t pr_flag;
48 compat_uid_t pr_uid;
49 compat_gid_t pr_gid;
50 compat_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
51 char pr_fname[16];
52 char pr_psargs[ELF_PRARGSZ];
53};
54
55#endif /* _LINUX_ELFCORE_COMPAT_H */
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 153d755376a4..c77c3bbfe4bb 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -29,11 +29,12 @@
29#undef EXT2FS_DEBUG 29#undef EXT2FS_DEBUG
30 30
31/* 31/*
32 * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files 32 * Define EXT2_RESERVATION to reserve data blocks for expanding files
33 */ 33 */
34#define EXT2_PREALLOCATE 34#define EXT2_DEFAULT_RESERVE_BLOCKS 8
35#define EXT2_DEFAULT_PREALLOC_BLOCKS 8 35/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
36 36#define EXT2_MAX_RESERVE_BLOCKS 1027
37#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0
37/* 38/*
38 * The second extended file system version 39 * The second extended file system version
39 */ 40 */
@@ -200,6 +201,8 @@ struct ext2_group_desc
200#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS 201#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS
201#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION 202#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION
202#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION 203#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION
204#define EXT2_IOC_GETRSVSZ _IOR('f', 5, long)
205#define EXT2_IOC_SETRSVSZ _IOW('f', 6, long)
203 206
204/* 207/*
205 * ioctl commands in 32 bit emulation 208 * ioctl commands in 32 bit emulation
@@ -317,8 +320,9 @@ struct ext2_inode {
317#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ 320#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
318#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ 321#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
319#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ 322#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
320#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */ 323#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
321#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */ 324#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
325#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
322 326
323 327
324#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt 328#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
@@ -558,4 +562,11 @@ enum {
558#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ 562#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
559 ~EXT2_DIR_ROUND) 563 ~EXT2_DIR_ROUND)
560 564
565static inline ext2_fsblk_t
566ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
567{
568 return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
569 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
570}
571
561#endif /* _LINUX_EXT2_FS_H */ 572#endif /* _LINUX_EXT2_FS_H */
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index d149f2959e67..f273415ab6f1 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -18,6 +18,52 @@
18 18
19#include <linux/blockgroup_lock.h> 19#include <linux/blockgroup_lock.h>
20#include <linux/percpu_counter.h> 20#include <linux/percpu_counter.h>
21#include <linux/rbtree.h>
22
23/* XXX Here for now... not interested in restructing headers JUST now */
24
25/* data type for block offset of block group */
26typedef int ext2_grpblk_t;
27
28/* data type for filesystem-wide blocks number */
29typedef unsigned long ext2_fsblk_t;
30
31#define E2FSBLK "%lu"
32
33struct ext2_reserve_window {
34 ext2_fsblk_t _rsv_start; /* First byte reserved */
35 ext2_fsblk_t _rsv_end; /* Last byte reserved or 0 */
36};
37
38struct ext2_reserve_window_node {
39 struct rb_node rsv_node;
40 __u32 rsv_goal_size;
41 __u32 rsv_alloc_hit;
42 struct ext2_reserve_window rsv_window;
43};
44
45struct ext2_block_alloc_info {
46 /* information about reservation window */
47 struct ext2_reserve_window_node rsv_window_node;
48 /*
49 * was i_next_alloc_block in ext2_inode_info
50 * is the logical (file-relative) number of the
51 * most-recently-allocated block in this file.
52 * We use this for detecting linearly ascending allocation requests.
53 */
54 __u32 last_alloc_logical_block;
55 /*
56 * Was i_next_alloc_goal in ext2_inode_info
57 * is the *physical* companion to i_next_alloc_block.
58 * it the the physical block number of the block which was most-recentl
59 * allocated to this file. This give us the goal (target) for the next
60 * allocation when we detect linearly ascending requests.
61 */
62 ext2_fsblk_t last_alloc_physical_block;
63};
64
65#define rsv_start rsv_window._rsv_start
66#define rsv_end rsv_window._rsv_end
21 67
22/* 68/*
23 * second extended-fs super-block data in memory 69 * second extended-fs super-block data in memory
@@ -39,6 +85,7 @@ struct ext2_sb_info {
39 struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */ 85 struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
40 struct buffer_head ** s_group_desc; 86 struct buffer_head ** s_group_desc;
41 unsigned long s_mount_opt; 87 unsigned long s_mount_opt;
88 unsigned long s_sb_block;
42 uid_t s_resuid; 89 uid_t s_resuid;
43 gid_t s_resgid; 90 gid_t s_resgid;
44 unsigned short s_mount_state; 91 unsigned short s_mount_state;
@@ -55,6 +102,10 @@ struct ext2_sb_info {
55 struct percpu_counter s_freeinodes_counter; 102 struct percpu_counter s_freeinodes_counter;
56 struct percpu_counter s_dirs_counter; 103 struct percpu_counter s_dirs_counter;
57 struct blockgroup_lock s_blockgroup_lock; 104 struct blockgroup_lock s_blockgroup_lock;
105 /* root of the per fs reservation window tree */
106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head;
58}; 109};
59 110
60#endif /* _LINUX_EXT2_FS_SB */ 111#endif /* _LINUX_EXT2_FS_SB */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index ece49a804fe1..589b0b355d84 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -35,10 +35,6 @@
35/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ 35/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
36#define EXT3_MAX_RESERVE_BLOCKS 1027 36#define EXT3_MAX_RESERVE_BLOCKS 1027
37#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 37#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
38/*
39 * Always enable hashed directories
40 */
41#define CONFIG_EXT3_INDEX
42 38
43/* 39/*
44 * Debug code 40 * Debug code
@@ -665,17 +661,11 @@ struct ext3_dir_entry_2 {
665 * (c) Daniel Phillips, 2001 661 * (c) Daniel Phillips, 2001
666 */ 662 */
667 663
668#ifdef CONFIG_EXT3_INDEX 664#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
669 #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \ 665 EXT3_FEATURE_COMPAT_DIR_INDEX) && \
670 EXT3_FEATURE_COMPAT_DIR_INDEX) && \
671 (EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) 666 (EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
672#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX) 667#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
673#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) 668#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
674#else
675 #define is_dx(dir) 0
676#define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX)
677#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
678#endif
679 669
680/* Legal values for the dx_root hash_version field: */ 670/* Legal values for the dx_root hash_version field: */
681 671
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index d3c08353edf6..b65f0288b842 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -44,6 +44,7 @@ struct ext3_sb_info {
44 struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */ 44 struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */
45 struct buffer_head ** s_group_desc; 45 struct buffer_head ** s_group_desc;
46 unsigned long s_mount_opt; 46 unsigned long s_mount_opt;
47 ext3_fsblk_t s_sb_block;
47 uid_t s_resuid; 48 uid_t s_resuid;
48 gid_t s_resgid; 49 gid_t s_resgid;
49 unsigned short s_mount_state; 50 unsigned short s_mount_state;
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index 1b2ffee12be9..0a8e47d47c91 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -45,6 +45,7 @@ struct ext4_sb_info {
45 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 45 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
46 struct buffer_head ** s_group_desc; 46 struct buffer_head ** s_group_desc;
47 unsigned long s_mount_opt; 47 unsigned long s_mount_opt;
48 ext4_fsblk_t s_sb_block;
48 uid_t s_resuid; 49 uid_t s_resuid;
49 gid_t s_resgid; 50 gid_t s_resgid;
50 unsigned short s_mount_state; 51 unsigned short s_mount_state;
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 40b93265d4ba..86037400a6e3 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -3,12 +3,17 @@
3 3
4#include <asm/fcntl.h> 4#include <asm/fcntl.h>
5 5
6/* Cancel a blocking posix lock; internal use only until we expose an 6#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
7 * asynchronous lock api to userspace: */ 7#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
8#define F_CANCELLK (F_LINUX_SPECIFIC_BASE+5)
9 8
10#define F_SETLEASE (F_LINUX_SPECIFIC_BASE+0) 9/*
11#define F_GETLEASE (F_LINUX_SPECIFIC_BASE+1) 10 * Cancel a blocking posix lock; internal use only until we expose an
11 * asynchronous lock api to userspace:
12 */
13#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
14
15/* Create a file descriptor with FD_CLOEXEC set. */
16#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
12 17
13/* 18/*
14 * Request nofications on a directory. 19 * Request nofications on a directory.
diff --git a/include/linux/file.h b/include/linux/file.h
index 0114fbc78061..56023c74e9fd 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -62,6 +62,15 @@ extern struct kmem_cache *filp_cachep;
62extern void FASTCALL(__fput(struct file *)); 62extern void FASTCALL(__fput(struct file *));
63extern void FASTCALL(fput(struct file *)); 63extern void FASTCALL(fput(struct file *));
64 64
65struct file_operations;
66struct vfsmount;
67struct dentry;
68extern int init_file(struct file *, struct vfsmount *mnt,
69 struct dentry *dentry, mode_t mode,
70 const struct file_operations *fop);
71extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
72 mode_t mode, const struct file_operations *fop);
73
65static inline void fput_light(struct file *file, int fput_needed) 74static inline void fput_light(struct file *file, int fput_needed)
66{ 75{
67 if (unlikely(fput_needed)) 76 if (unlikely(fput_needed))
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f70d52c46617..e3fc5dbb2246 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -283,7 +283,6 @@ extern int dir_notify_enable;
283#include <linux/init.h> 283#include <linux/init.h>
284#include <linux/pid.h> 284#include <linux/pid.h>
285#include <linux/mutex.h> 285#include <linux/mutex.h>
286#include <linux/sysctl.h>
287#include <linux/capability.h> 286#include <linux/capability.h>
288 287
289#include <asm/atomic.h> 288#include <asm/atomic.h>
@@ -301,9 +300,9 @@ struct kstatfs;
301struct vm_area_struct; 300struct vm_area_struct;
302struct vfsmount; 301struct vfsmount;
303 302
304extern void __init inode_init(unsigned long); 303extern void __init inode_init(void);
305extern void __init inode_init_early(void); 304extern void __init inode_init_early(void);
306extern void __init mnt_init(unsigned long); 305extern void __init mnt_init(void);
307extern void __init files_init(unsigned long); 306extern void __init files_init(unsigned long);
308 307
309struct buffer_head; 308struct buffer_head;
@@ -330,6 +329,7 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
330#define ATTR_KILL_SUID 2048 329#define ATTR_KILL_SUID 2048
331#define ATTR_KILL_SGID 4096 330#define ATTR_KILL_SGID 4096
332#define ATTR_FILE 8192 331#define ATTR_FILE 8192
332#define ATTR_KILL_PRIV 16384
333 333
334/* 334/*
335 * This is the Inode Attributes structure, used for notify_change(). It 335 * This is the Inode Attributes structure, used for notify_change(). It
@@ -793,7 +793,7 @@ struct file {
793 unsigned int f_uid, f_gid; 793 unsigned int f_uid, f_gid;
794 struct file_ra_state f_ra; 794 struct file_ra_state f_ra;
795 795
796 unsigned long f_version; 796 u64 f_version;
797#ifdef CONFIG_SECURITY 797#ifdef CONFIG_SECURITY
798 void *f_security; 798 void *f_security;
799#endif 799#endif
@@ -1003,6 +1003,7 @@ struct super_block {
1003 struct list_head s_inodes; /* all inodes */ 1003 struct list_head s_inodes; /* all inodes */
1004 struct list_head s_dirty; /* dirty inodes */ 1004 struct list_head s_dirty; /* dirty inodes */
1005 struct list_head s_io; /* parked for writeback */ 1005 struct list_head s_io; /* parked for writeback */
1006 struct list_head s_more_io; /* parked for more writeback */
1006 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1007 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
1007 struct list_head s_files; 1008 struct list_head s_files;
1008 1009
@@ -1261,16 +1262,68 @@ struct super_operations {
1261#endif 1262#endif
1262}; 1263};
1263 1264
1264/* Inode state bits. Protected by inode_lock. */ 1265/*
1265#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */ 1266 * Inode state bits. Protected by inode_lock.
1266#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */ 1267 *
1267#define I_DIRTY_PAGES 4 /* Data-related inode changes pending */ 1268 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
1268#define __I_LOCK 3 1269 * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
1270 *
1271 * Four bits define the lifetime of an inode. Initially, inodes are I_NEW,
1272 * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at
1273 * various stages of removing an inode.
1274 *
1275 * Two bits are used for locking and completion notification, I_LOCK and I_SYNC.
1276 *
1277 * I_DIRTY_SYNC Inode itself is dirty.
1278 * I_DIRTY_DATASYNC Data-related inode changes pending
1279 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean.
1280 * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both
1281 * are cleared by unlock_new_inode(), called from iget().
1282 * I_WILL_FREE Must be set when calling write_inode_now() if i_count
1283 * is zero. I_FREEING must be set when I_WILL_FREE is
1284 * cleared.
1285 * I_FREEING Set when inode is about to be freed but still has dirty
1286 * pages or buffers attached or the inode itself is still
1287 * dirty.
1288 * I_CLEAR Set by clear_inode(). In this state the inode is clean
1289 * and can be destroyed.
1290 *
1291 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1292 * prohibited for many purposes. iget() must wait for
1293 * the inode to be completely released, then create it
1294 * anew. Other functions will just ignore such inodes,
1295 * if appropriate. I_LOCK is used for waiting.
1296 *
1297 * I_LOCK Serves as both a mutex and completion notification.
1298 * New inodes set I_LOCK. If two processes both create
1299 * the same inode, one of them will release its inode and
1300 * wait for I_LOCK to be released before returning.
1301 * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
1302 * also cause waiting on I_LOCK, without I_LOCK actually
1303 * being set. find_inode() uses this to prevent returning
1304 * nearly-dead inodes.
1305 * I_SYNC Similar to I_LOCK, but limited in scope to writeback
1306 * of inode dirty data. Having a seperate lock for this
1307 * purpose reduces latency and prevents some filesystem-
1308 * specific deadlocks.
1309 *
1310 * Q: Why does I_DIRTY_DATASYNC exist? It appears as if it could be replaced
1311 * by (I_DIRTY_SYNC|I_DIRTY_PAGES).
1312 * Q: What is the difference between I_WILL_FREE and I_FREEING?
1313 * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on
1314 * I_CLEAR? If not, why?
1315 */
1316#define I_DIRTY_SYNC 1
1317#define I_DIRTY_DATASYNC 2
1318#define I_DIRTY_PAGES 4
1319#define I_NEW 8
1320#define I_WILL_FREE 16
1321#define I_FREEING 32
1322#define I_CLEAR 64
1323#define __I_LOCK 7
1269#define I_LOCK (1 << __I_LOCK) 1324#define I_LOCK (1 << __I_LOCK)
1270#define I_FREEING 16 1325#define __I_SYNC 8
1271#define I_CLEAR 32 1326#define I_SYNC (1 << __I_SYNC)
1272#define I_NEW 64
1273#define I_WILL_FREE 128
1274 1327
1275#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1328#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1276 1329
@@ -1729,6 +1782,7 @@ extern int bdev_read_only(struct block_device *);
1729extern int set_blocksize(struct block_device *, int); 1782extern int set_blocksize(struct block_device *, int);
1730extern int sb_set_blocksize(struct super_block *, int); 1783extern int sb_set_blocksize(struct super_block *, int);
1731extern int sb_min_blocksize(struct super_block *, int); 1784extern int sb_min_blocksize(struct super_block *, int);
1785extern int sb_has_dirty_inodes(struct super_block *);
1732 1786
1733extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1787extern int generic_file_mmap(struct file *, struct vm_area_struct *);
1734extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1788extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
@@ -1887,8 +1941,6 @@ extern int simple_empty(struct dentry *);
1887extern int simple_readpage(struct file *file, struct page *page); 1941extern int simple_readpage(struct file *file, struct page *page);
1888extern int simple_prepare_write(struct file *file, struct page *page, 1942extern int simple_prepare_write(struct file *file, struct page *page,
1889 unsigned offset, unsigned to); 1943 unsigned offset, unsigned to);
1890extern int simple_commit_write(struct file *file, struct page *page,
1891 unsigned offset, unsigned to);
1892extern int simple_write_begin(struct file *file, struct address_space *mapping, 1944extern int simple_write_begin(struct file *file, struct address_space *mapping,
1893 loff_t pos, unsigned len, unsigned flags, 1945 loff_t pos, unsigned len, unsigned flags,
1894 struct page **pagep, void **fsdata); 1946 struct page **pagep, void **fsdata);
@@ -2032,7 +2084,8 @@ static inline void free_secdata(void *secdata)
2032{ } 2084{ }
2033#endif /* CONFIG_SECURITY */ 2085#endif /* CONFIG_SECURITY */
2034 2086
2035int proc_nr_files(ctl_table *table, int write, struct file *filp, 2087struct ctl_table;
2088int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
2036 void __user *buffer, size_t *lenp, loff_t *ppos); 2089 void __user *buffer, size_t *lenp, loff_t *ppos);
2037 2090
2038 2091
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index 4aba6b0ad41c..ae77daed6c2f 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -24,6 +24,8 @@
24#ifndef _LINUX_IF_FDDI_H 24#ifndef _LINUX_IF_FDDI_H
25#define _LINUX_IF_FDDI_H 25#define _LINUX_IF_FDDI_H
26 26
27#include <linux/types.h>
28
27/* 29/*
28 * Define max and min legal sizes. The frame sizes do not include 30 * Define max and min legal sizes. The frame sizes do not include
29 * 4 byte FCS/CRC (frame check sequence). 31 * 4 byte FCS/CRC (frame check sequence).
diff --git a/include/linux/init.h b/include/linux/init.h
index 9b7a2ba8237e..5141381a7527 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -161,7 +161,7 @@ struct obs_kernel_param {
161 * obs_kernel_param "array" too far apart in .init.setup. 161 * obs_kernel_param "array" too far apart in .init.setup.
162 */ 162 */
163#define __setup_param(str, unique_id, fn, early) \ 163#define __setup_param(str, unique_id, fn, early) \
164 static char __setup_str_##unique_id[] __initdata = str; \ 164 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
165 static struct obs_kernel_param __setup_##unique_id \ 165 static struct obs_kernel_param __setup_##unique_id \
166 __attribute_used__ \ 166 __attribute_used__ \
167 __attribute__((__section__(".init.setup"))) \ 167 __attribute__((__section__(".init.setup"))) \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 513bc3e489f0..d4b2f1c76e12 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -76,7 +76,6 @@ extern struct nsproxy init_nsproxy;
76#define INIT_NSPROXY(nsproxy) { \ 76#define INIT_NSPROXY(nsproxy) { \
77 .pid_ns = &init_pid_ns, \ 77 .pid_ns = &init_pid_ns, \
78 .count = ATOMIC_INIT(1), \ 78 .count = ATOMIC_INIT(1), \
79 .nslock = __SPIN_LOCK_UNLOCKED(nsproxy.nslock), \
80 .uts_ns = &init_uts_ns, \ 79 .uts_ns = &init_uts_ns, \
81 .mnt_ns = NULL, \ 80 .mnt_ns = NULL, \
82 INIT_NET_NS(net_ns) \ 81 INIT_NET_NS(net_ns) \
@@ -171,6 +170,7 @@ extern struct group_info init_groups;
171 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ 170 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
172 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 171 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
173 }, \ 172 }, \
173 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
174 INIT_TRACE_IRQFLAGS \ 174 INIT_TRACE_IRQFLAGS \
175 INIT_LOCKDEP \ 175 INIT_LOCKDEP \
176} 176}
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 8e5f289052a2..2306920fa388 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -55,28 +55,6 @@
55#define IRQF_NOBALANCING 0x00000800 55#define IRQF_NOBALANCING 0x00000800
56#define IRQF_IRQPOLL 0x00001000 56#define IRQF_IRQPOLL 0x00001000
57 57
58/*
59 * Migration helpers. Scheduled for removal in 9/2007
60 * Do not use for new code !
61 */
62static inline
63unsigned long __deprecated deprecated_irq_flag(unsigned long flag)
64{
65 return flag;
66}
67
68#define SA_INTERRUPT deprecated_irq_flag(IRQF_DISABLED)
69#define SA_SAMPLE_RANDOM deprecated_irq_flag(IRQF_SAMPLE_RANDOM)
70#define SA_SHIRQ deprecated_irq_flag(IRQF_SHARED)
71#define SA_PROBEIRQ deprecated_irq_flag(IRQF_PROBE_SHARED)
72#define SA_PERCPU deprecated_irq_flag(IRQF_PERCPU)
73
74#define SA_TRIGGER_LOW deprecated_irq_flag(IRQF_TRIGGER_LOW)
75#define SA_TRIGGER_HIGH deprecated_irq_flag(IRQF_TRIGGER_HIGH)
76#define SA_TRIGGER_FALLING deprecated_irq_flag(IRQF_TRIGGER_FALLING)
77#define SA_TRIGGER_RISING deprecated_irq_flag(IRQF_TRIGGER_RISING)
78#define SA_TRIGGER_MASK deprecated_irq_flag(IRQF_TRIGGER_MASK)
79
80typedef irqreturn_t (*irq_handler_t)(int, void *); 58typedef irqreturn_t (*irq_handler_t)(int, void *);
81 59
82struct irqaction { 60struct irqaction {
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 3fd3ddd5f0d9..ee111834091c 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -49,6 +49,34 @@ struct ipc_perm
49#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger 49#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
50 message sizes, etc. */ 50 message sizes, etc. */
51 51
52/*
53 * These are used to wrap system calls.
54 *
55 * See architecture code for ugly details..
56 */
57struct ipc_kludge {
58 struct msgbuf __user *msgp;
59 long msgtyp;
60};
61
62#define SEMOP 1
63#define SEMGET 2
64#define SEMCTL 3
65#define SEMTIMEDOP 4
66#define MSGSND 11
67#define MSGRCV 12
68#define MSGGET 13
69#define MSGCTL 14
70#define SHMAT 21
71#define SHMDT 22
72#define SHMGET 23
73#define SHMCTL 24
74
75/* Used by the DIPC package, try and avoid reusing it */
76#define DIPC 25
77
78#define IPCCALL(version,op) ((version)<<16 | (op))
79
52#ifdef __KERNEL__ 80#ifdef __KERNEL__
53 81
54#include <linux/kref.h> 82#include <linux/kref.h>
diff --git a/include/linux/kbd_diacr.h b/include/linux/kbd_diacr.h
index 1c1a3ff0535b..7274ec68c246 100644
--- a/include/linux/kbd_diacr.h
+++ b/include/linux/kbd_diacr.h
@@ -2,7 +2,7 @@
2#define _DIACR_H 2#define _DIACR_H
3#include <linux/kd.h> 3#include <linux/kd.h>
4 4
5extern struct kbdiacr accent_table[]; 5extern struct kbdiacruc accent_table[];
6extern unsigned int accent_table_size; 6extern unsigned int accent_table_size;
7 7
8#endif /* _DIACR_H */ 8#endif /* _DIACR_H */
diff --git a/include/linux/kd.h b/include/linux/kd.h
index 28be4fbe9044..c91fc0c9c495 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -125,6 +125,16 @@ struct kbdiacrs {
125#define KDGKBDIACR 0x4B4A /* read kernel accent table */ 125#define KDGKBDIACR 0x4B4A /* read kernel accent table */
126#define KDSKBDIACR 0x4B4B /* write kernel accent table */ 126#define KDSKBDIACR 0x4B4B /* write kernel accent table */
127 127
128struct kbdiacruc {
129 __u32 diacr, base, result;
130};
131struct kbdiacrsuc {
132 unsigned int kb_cnt; /* number of entries in following array */
133 struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */
134};
135#define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */
136#define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */
137
128struct kbkeycode { 138struct kbkeycode {
129 unsigned int scancode, keycode; 139 unsigned int scancode, keycode;
130}; 140};
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5fdbc814c2eb..94bc99656963 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -76,6 +76,13 @@ extern const char linux_proc_banner[];
76#define KERN_INFO "<6>" /* informational */ 76#define KERN_INFO "<6>" /* informational */
77#define KERN_DEBUG "<7>" /* debug-level messages */ 77#define KERN_DEBUG "<7>" /* debug-level messages */
78 78
79/*
80 * Annotation for a "continued" line of log printout (only done after a
81 * line that had no enclosing \n). Only to be used by core/arch code
82 * during early bootup (a continued line is not SMP-safe otherwise).
83 */
84#define KERN_CONT ""
85
79extern int console_printk[]; 86extern int console_printk[];
80 87
81#define console_loglevel (console_printk[0]) 88#define console_loglevel (console_printk[0])
@@ -172,6 +179,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
172 __attribute__ ((format (printf, 1, 0))); 179 __attribute__ ((format (printf, 1, 0)));
173asmlinkage int printk(const char * fmt, ...) 180asmlinkage int printk(const char * fmt, ...)
174 __attribute__ ((format (printf, 1, 2))) __cold; 181 __attribute__ ((format (printf, 1, 2))) __cold;
182extern int log_buf_get_len(void);
183extern int log_buf_read(int idx);
184extern int log_buf_copy(char *dest, int idx, int len);
175#else 185#else
176static inline int vprintk(const char *s, va_list args) 186static inline int vprintk(const char *s, va_list args)
177 __attribute__ ((format (printf, 1, 0))); 187 __attribute__ ((format (printf, 1, 0)));
@@ -179,6 +189,9 @@ static inline int vprintk(const char *s, va_list args) { return 0; }
179static inline int printk(const char *s, ...) 189static inline int printk(const char *s, ...)
180 __attribute__ ((format (printf, 1, 2))); 190 __attribute__ ((format (printf, 1, 2)));
181static inline int __cold printk(const char *s, ...) { return 0; } 191static inline int __cold printk(const char *s, ...) { return 0; }
192static inline int log_buf_get_len(void) { return 0; }
193static inline int log_buf_read(int idx) { return 0; }
194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
182#endif 195#endif
183 196
184unsigned long int_sqrt(unsigned long); 197unsigned long int_sqrt(unsigned long);
@@ -245,10 +258,25 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
245 const void *buf, size_t len); 258 const void *buf, size_t len);
246#define hex_asc(x) "0123456789abcdef"[x] 259#define hex_asc(x) "0123456789abcdef"[x]
247 260
261#define pr_emerg(fmt, arg...) \
262 printk(KERN_EMERG fmt, ##arg)
263#define pr_alert(fmt, arg...) \
264 printk(KERN_ALERT fmt, ##arg)
265#define pr_crit(fmt, arg...) \
266 printk(KERN_CRIT fmt, ##arg)
267#define pr_err(fmt, arg...) \
268 printk(KERN_ERR fmt, ##arg)
269#define pr_warning(fmt, arg...) \
270 printk(KERN_WARNING fmt, ##arg)
271#define pr_notice(fmt, arg...) \
272 printk(KERN_NOTICE fmt, ##arg)
273#define pr_info(fmt, arg...) \
274 printk(KERN_INFO fmt, ##arg)
275
248#ifdef DEBUG 276#ifdef DEBUG
249/* If you are writing a driver, please use dev_dbg instead */ 277/* If you are writing a driver, please use dev_dbg instead */
250#define pr_debug(fmt,arg...) \ 278#define pr_debug(fmt, arg...) \
251 printk(KERN_DEBUG fmt,##arg) 279 printk(KERN_DEBUG fmt, ##arg)
252#else 280#else
253static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...) 281static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
254{ 282{
@@ -256,9 +284,6 @@ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *
256} 284}
257#endif 285#endif
258 286
259#define pr_info(fmt,arg...) \
260 printk(KERN_INFO fmt,##arg)
261
262/* 287/*
263 * Display an IP address in readable format. 288 * Display an IP address in readable format.
264 */ 289 */
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 8c2c7fcd58ce..ad4b82ce84af 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -121,6 +121,30 @@ extern struct page *kimage_alloc_control_pages(struct kimage *image,
121extern void crash_kexec(struct pt_regs *); 121extern void crash_kexec(struct pt_regs *);
122int kexec_should_crash(struct task_struct *); 122int kexec_should_crash(struct task_struct *);
123void crash_save_cpu(struct pt_regs *regs, int cpu); 123void crash_save_cpu(struct pt_regs *regs, int cpu);
124void crash_save_vmcoreinfo(void);
125void arch_crash_save_vmcoreinfo(void);
126void vmcoreinfo_append_str(const char *fmt, ...)
127 __attribute__ ((format (printf, 1, 2)));
128unsigned long paddr_vmcoreinfo_note(void);
129
130#define VMCOREINFO_SYMBOL(name) \
131 vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
132#define VMCOREINFO_SIZE(name) \
133 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
134 (unsigned long)sizeof(struct name))
135#define VMCOREINFO_TYPEDEF_SIZE(name) \
136 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
137 (unsigned long)sizeof(name))
138#define VMCOREINFO_OFFSET(name, field) \
139 vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
140 (unsigned long)&(((struct name *)0)->field))
141#define VMCOREINFO_LENGTH(name, value) \
142 vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
143#define VMCOREINFO_NUMBER(name) \
144 vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
145#define VMCOREINFO_CONFIG(name) \
146 vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
147
124extern struct kimage *kexec_image; 148extern struct kimage *kexec_image;
125extern struct kimage *kexec_crash_image; 149extern struct kimage *kexec_crash_image;
126 150
@@ -148,11 +172,20 @@ extern struct kimage *kexec_crash_image;
148 172
149#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 173#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
150 174
175#define VMCOREINFO_BYTES (4096)
176#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
177#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
178#define VMCOREINFO_NOTE_SIZE (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \
179 + VMCOREINFO_NOTE_NAME_BYTES)
180
151/* Location of a reserved region to hold the crash kernel. 181/* Location of a reserved region to hold the crash kernel.
152 */ 182 */
153extern struct resource crashk_res; 183extern struct resource crashk_res;
154typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; 184typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
155extern note_buf_t *crash_notes; 185extern note_buf_t *crash_notes;
186extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
187extern size_t vmcoreinfo_size;
188extern size_t vmcoreinfo_max_size;
156 189
157 190
158#else /* !CONFIG_KEXEC */ 191#else /* !CONFIG_KEXEC */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
new file mode 100644
index 000000000000..65833d4d5998
--- /dev/null
+++ b/include/linux/key-type.h
@@ -0,0 +1,112 @@
1/* Definitions for key type implementations
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_KEY_TYPE_H
13#define _LINUX_KEY_TYPE_H
14
15#include <linux/key.h>
16
17#ifdef CONFIG_KEYS
18
19/*
20 * key under-construction record
21 * - passed to the request_key actor if supplied
22 */
23struct key_construction {
24 struct key *key; /* key being constructed */
25 struct key *authkey;/* authorisation for key being constructed */
26};
27
28typedef int (*request_key_actor_t)(struct key_construction *key,
29 const char *op, void *aux);
30
31/*
32 * kernel managed key type definition
33 */
34struct key_type {
35 /* name of the type */
36 const char *name;
37
38 /* default payload length for quota precalculation (optional)
39 * - this can be used instead of calling key_payload_reserve(), that
40 * function only needs to be called if the real datalen is different
41 */
42 size_t def_datalen;
43
44 /* instantiate a key of this type
45 * - this method should call key_payload_reserve() to determine if the
46 * user's quota will hold the payload
47 */
48 int (*instantiate)(struct key *key, const void *data, size_t datalen);
49
50 /* update a key of this type (optional)
51 * - this method should call key_payload_reserve() to recalculate the
52 * quota consumption
53 * - the key must be locked against read when modifying
54 */
55 int (*update)(struct key *key, const void *data, size_t datalen);
56
57 /* match a key against a description */
58 int (*match)(const struct key *key, const void *desc);
59
60 /* clear some of the data from a key on revokation (optional)
61 * - the key's semaphore will be write-locked by the caller
62 */
63 void (*revoke)(struct key *key);
64
65 /* clear the data from a key (optional) */
66 void (*destroy)(struct key *key);
67
68 /* describe a key */
69 void (*describe)(const struct key *key, struct seq_file *p);
70
71 /* read a key's data (optional)
72 * - permission checks will be done by the caller
73 * - the key's semaphore will be readlocked by the caller
74 * - should return the amount of data that could be read, no matter how
75 * much is copied into the buffer
76 * - shouldn't do the copy if the buffer is NULL
77 */
78 long (*read)(const struct key *key, char __user *buffer, size_t buflen);
79
80 /* handle request_key() for this type instead of invoking
81 * /sbin/request-key (optional)
82 * - key is the key to instantiate
83 * - authkey is the authority to assume when instantiating this key
84 * - op is the operation to be done, usually "create"
85 * - the call must not return until the instantiation process has run
86 * its course
87 */
88 request_key_actor_t request_key;
89
90 /* internal fields */
91 struct list_head link; /* link in types list */
92};
93
94extern struct key_type key_type_keyring;
95
96extern int register_key_type(struct key_type *ktype);
97extern void unregister_key_type(struct key_type *ktype);
98
99extern int key_payload_reserve(struct key *key, size_t datalen);
100extern int key_instantiate_and_link(struct key *key,
101 const void *data,
102 size_t datalen,
103 struct key *keyring,
104 struct key *instkey);
105extern int key_negate_and_link(struct key *key,
106 unsigned timeout,
107 struct key *keyring,
108 struct key *instkey);
109extern void complete_request_key(struct key_construction *cons, int error);
110
111#endif /* CONFIG_KEYS */
112#endif /* _LINUX_KEY_TYPE_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index a9220e75782e..fcdbd5ed227b 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -1,6 +1,6 @@
1/* key.h: authentication token and access key management 1/* Authentication token and access key management
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -175,78 +175,6 @@ struct key {
175 } payload; 175 } payload;
176}; 176};
177 177
178/*****************************************************************************/
179/*
180 * kernel managed key type definition
181 */
182typedef int (*request_key_actor_t)(struct key *key, struct key *authkey,
183 const char *op, void *aux);
184
185struct key_type {
186 /* name of the type */
187 const char *name;
188
189 /* default payload length for quota precalculation (optional)
190 * - this can be used instead of calling key_payload_reserve(), that
191 * function only needs to be called if the real datalen is different
192 */
193 size_t def_datalen;
194
195 /* instantiate a key of this type
196 * - this method should call key_payload_reserve() to determine if the
197 * user's quota will hold the payload
198 */
199 int (*instantiate)(struct key *key, const void *data, size_t datalen);
200
201 /* update a key of this type (optional)
202 * - this method should call key_payload_reserve() to recalculate the
203 * quota consumption
204 * - the key must be locked against read when modifying
205 */
206 int (*update)(struct key *key, const void *data, size_t datalen);
207
208 /* match a key against a description */
209 int (*match)(const struct key *key, const void *desc);
210
211 /* clear some of the data from a key on revokation (optional)
212 * - the key's semaphore will be write-locked by the caller
213 */
214 void (*revoke)(struct key *key);
215
216 /* clear the data from a key (optional) */
217 void (*destroy)(struct key *key);
218
219 /* describe a key */
220 void (*describe)(const struct key *key, struct seq_file *p);
221
222 /* read a key's data (optional)
223 * - permission checks will be done by the caller
224 * - the key's semaphore will be readlocked by the caller
225 * - should return the amount of data that could be read, no matter how
226 * much is copied into the buffer
227 * - shouldn't do the copy if the buffer is NULL
228 */
229 long (*read)(const struct key *key, char __user *buffer, size_t buflen);
230
231 /* handle request_key() for this type instead of invoking
232 * /sbin/request-key (optional)
233 * - key is the key to instantiate
234 * - authkey is the authority to assume when instantiating this key
235 * - op is the operation to be done, usually "create"
236 * - the call must not return until the instantiation process has run
237 * its course
238 */
239 request_key_actor_t request_key;
240
241 /* internal fields */
242 struct list_head link; /* link in types list */
243};
244
245extern struct key_type key_type_keyring;
246
247extern int register_key_type(struct key_type *ktype);
248extern void unregister_key_type(struct key_type *ktype);
249
250extern struct key *key_alloc(struct key_type *type, 178extern struct key *key_alloc(struct key_type *type,
251 const char *desc, 179 const char *desc,
252 uid_t uid, gid_t gid, 180 uid_t uid, gid_t gid,
@@ -259,16 +187,6 @@ extern struct key *key_alloc(struct key_type *type,
259#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */ 187#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
260#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ 188#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
261 189
262extern int key_payload_reserve(struct key *key, size_t datalen);
263extern int key_instantiate_and_link(struct key *key,
264 const void *data,
265 size_t datalen,
266 struct key *keyring,
267 struct key *instkey);
268extern int key_negate_and_link(struct key *key,
269 unsigned timeout,
270 struct key *keyring,
271 struct key *instkey);
272extern void key_revoke(struct key *key); 190extern void key_revoke(struct key *key);
273extern void key_put(struct key *key); 191extern void key_put(struct key *key);
274 192
@@ -293,6 +211,17 @@ extern struct key *request_key_with_auxdata(struct key_type *type,
293 const char *callout_info, 211 const char *callout_info,
294 void *aux); 212 void *aux);
295 213
214extern struct key *request_key_async(struct key_type *type,
215 const char *description,
216 const char *callout_info);
217
218extern struct key *request_key_async_with_auxdata(struct key_type *type,
219 const char *description,
220 const char *callout_info,
221 void *aux);
222
223extern int wait_for_key_construction(struct key *key, bool intr);
224
296extern int key_validate(struct key *key); 225extern int key_validate(struct key *key);
297 226
298extern key_ref_t key_create_or_update(key_ref_t keyring, 227extern key_ref_t key_create_or_update(key_ref_t keyring,
@@ -328,8 +257,6 @@ extern int keyring_add_key(struct key *keyring,
328 257
329extern struct key *key_lookup(key_serial_t id); 258extern struct key *key_lookup(key_serial_t id);
330 259
331extern void keyring_replace_payload(struct key *key, void *replacement);
332
333#define key_serial(key) ((key) ? (key)->serial : 0) 260#define key_serial(key) ((key) ? (key)->serial : 0)
334 261
335/* 262/*
diff --git a/include/linux/list.h b/include/linux/list.h
index ad9dcb9e3375..b0cf0135fe3e 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -478,6 +478,18 @@ static inline void list_splice_init_rcu(struct list_head *list,
478 pos = n, n = pos->next) 478 pos = n, n = pos->next)
479 479
480/** 480/**
481 * list_for_each_prev_safe - iterate over a list backwards safe against removal
482 of list entry
483 * @pos: the &struct list_head to use as a loop cursor.
484 * @n: another &struct list_head to use as temporary storage
485 * @head: the head for your list.
486 */
487#define list_for_each_prev_safe(pos, n, head) \
488 for (pos = (head)->prev, n = pos->prev; \
489 prefetch(pos->prev), pos != (head); \
490 pos = n, n = pos->prev)
491
492/**
481 * list_for_each_entry - iterate over list of given type 493 * list_for_each_entry - iterate over list of given type
482 * @pos: the type * to use as a loop cursor. 494 * @pos: the type * to use as a loop cursor.
483 * @head: the head for your list. 495 * @head: the head for your list.
diff --git a/include/linux/log2.h b/include/linux/log2.h
index 1b8a2c1cb0e3..c8cf5e8ef171 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -63,6 +63,15 @@ unsigned long __roundup_pow_of_two(unsigned long n)
63 return 1UL << fls_long(n - 1); 63 return 1UL << fls_long(n - 1);
64} 64}
65 65
66/*
67 * round down to nearest power of two
68 */
69static inline __attribute__((const))
70unsigned long __rounddown_pow_of_two(unsigned long n)
71{
72 return 1UL << (fls_long(n) - 1);
73}
74
66/** 75/**
67 * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value 76 * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value
68 * @n - parameter 77 * @n - parameter
@@ -165,4 +174,20 @@ unsigned long __roundup_pow_of_two(unsigned long n)
165 __roundup_pow_of_two(n) \ 174 __roundup_pow_of_two(n) \
166 ) 175 )
167 176
177/**
178 * rounddown_pow_of_two - round the given value down to nearest power of two
179 * @n - parameter
180 *
181 * round the given value down to the nearest power of two
182 * - the result is undefined when n == 0
183 * - this can be used to initialise global variables from constant data
184 */
185#define rounddown_pow_of_two(n) \
186( \
187 __builtin_constant_p(n) ? ( \
188 (n == 1) ? 0 : \
189 (1UL << ilog2(n))) : \
190 __rounddown_pow_of_two(n) \
191 )
192
168#endif /* _LINUX_LOG2_H */ 193#endif /* _LINUX_LOG2_H */
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 36cc20dfd142..722d4755060f 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -38,4 +38,7 @@
38#define SMB_SUPER_MAGIC 0x517B 38#define SMB_SUPER_MAGIC 0x517B
39#define USBDEVICE_SUPER_MAGIC 0x9fa2 39#define USBDEVICE_SUPER_MAGIC 0x9fa2
40 40
41#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
42#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
43
41#endif /* __LINUX_MAGIC_H__ */ 44#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7e87e1b1662e..520238cbae5d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -10,9 +10,7 @@
10#include <linux/mmzone.h> 10#include <linux/mmzone.h>
11#include <linux/rbtree.h> 11#include <linux/rbtree.h>
12#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
13#include <linux/mutex.h>
14#include <linux/debug_locks.h> 13#include <linux/debug_locks.h>
15#include <linux/backing-dev.h>
16#include <linux/mm_types.h> 14#include <linux/mm_types.h>
17 15
18struct mempolicy; 16struct mempolicy;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 877667918452..f4c03e0b355e 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_MM_TYPES_H 1#ifndef _LINUX_MM_TYPES_H
2#define _LINUX_MM_TYPES_H 2#define _LINUX_MM_TYPES_H
3 3
4#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 4#include <linux/auxvec.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <linux/list.h> 7#include <linux/list.h>
@@ -13,6 +13,11 @@
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/mmu.h> 14#include <asm/mmu.h>
15 15
16#ifndef AT_VECTOR_SIZE_ARCH
17#define AT_VECTOR_SIZE_ARCH 0
18#endif
19#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
20
16struct address_space; 21struct address_space;
17 22
18#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 23#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index f4bfe824834f..4c4522a51a3b 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -7,6 +7,7 @@
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/wait.h> 9#include <linux/wait.h>
10#include <linux/bitops.h>
10#include <linux/cache.h> 11#include <linux/cache.h>
11#include <linux/threads.h> 12#include <linux/threads.h>
12#include <linux/numa.h> 13#include <linux/numa.h>
@@ -262,10 +263,7 @@ struct zone {
262 unsigned long nr_scan_active; 263 unsigned long nr_scan_active;
263 unsigned long nr_scan_inactive; 264 unsigned long nr_scan_inactive;
264 unsigned long pages_scanned; /* since last reclaim */ 265 unsigned long pages_scanned; /* since last reclaim */
265 int all_unreclaimable; /* All pages pinned */ 266 unsigned long flags; /* zone flags, see below */
266
267 /* A count of how many reclaimers are scanning this zone */
268 atomic_t reclaim_in_progress;
269 267
270 /* Zone statistics */ 268 /* Zone statistics */
271 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; 269 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
@@ -343,6 +341,42 @@ struct zone {
343 const char *name; 341 const char *name;
344} ____cacheline_internodealigned_in_smp; 342} ____cacheline_internodealigned_in_smp;
345 343
344typedef enum {
345 ZONE_ALL_UNRECLAIMABLE, /* all pages pinned */
346 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
347 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */
348} zone_flags_t;
349
350static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
351{
352 set_bit(flag, &zone->flags);
353}
354
355static inline int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag)
356{
357 return test_and_set_bit(flag, &zone->flags);
358}
359
360static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
361{
362 clear_bit(flag, &zone->flags);
363}
364
365static inline int zone_is_all_unreclaimable(const struct zone *zone)
366{
367 return test_bit(ZONE_ALL_UNRECLAIMABLE, &zone->flags);
368}
369
370static inline int zone_is_reclaim_locked(const struct zone *zone)
371{
372 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
373}
374
375static inline int zone_is_oom_locked(const struct zone *zone)
376{
377 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
378}
379
346/* 380/*
347 * The "priority" of VM scanning is how much of the queues we will scan in one 381 * The "priority" of VM scanning is how much of the queues we will scan in one
348 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 382 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
diff --git a/include/linux/module.h b/include/linux/module.h
index b6a646cea1cb..642f325e4917 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -312,9 +312,6 @@ struct module
312 /* Arch-specific module values */ 312 /* Arch-specific module values */
313 struct mod_arch_specific arch; 313 struct mod_arch_specific arch;
314 314
315 /* Am I unsafe to unload? */
316 int unsafe;
317
318 unsigned int taints; /* same bits as kernel:tainted */ 315 unsigned int taints; /* same bits as kernel:tainted */
319 316
320#ifdef CONFIG_GENERIC_BUG 317#ifdef CONFIG_GENERIC_BUG
@@ -346,6 +343,9 @@ struct module
346 343
347 /* Section attributes */ 344 /* Section attributes */
348 struct module_sect_attrs *sect_attrs; 345 struct module_sect_attrs *sect_attrs;
346
347 /* Notes attributes */
348 struct module_notes_attrs *notes_attrs;
349#endif 349#endif
350 350
351 /* Per-cpu data. */ 351 /* Per-cpu data. */
@@ -441,16 +441,6 @@ static inline void __module_get(struct module *module)
441 __mod ? __mod->name : "kernel"; \ 441 __mod ? __mod->name : "kernel"; \
442}) 442})
443 443
444#define __unsafe(mod) \
445do { \
446 if (mod && !(mod)->unsafe) { \
447 printk(KERN_WARNING \
448 "Module %s cannot be unloaded due to unsafe usage in" \
449 " %s:%u\n", (mod)->name, __FILE__, __LINE__); \
450 (mod)->unsafe = 1; \
451 } \
452} while(0)
453
454/* For kallsyms to ask for address resolution. NULL means not found. */ 444/* For kallsyms to ask for address resolution. NULL means not found. */
455const char *module_address_lookup(unsigned long addr, 445const char *module_address_lookup(unsigned long addr,
456 unsigned long *symbolsize, 446 unsigned long *symbolsize,
@@ -518,8 +508,6 @@ static inline void module_put(struct module *module)
518 508
519#define module_name(mod) "kernel" 509#define module_name(mod) "kernel"
520 510
521#define __unsafe(mod)
522
523/* For kallsyms to ask for address resolution. NULL means not found. */ 511/* For kallsyms to ask for address resolution. NULL means not found. */
524static inline const char *module_address_lookup(unsigned long addr, 512static inline const char *module_address_lookup(unsigned long addr,
525 unsigned long *symbolsize, 513 unsigned long *symbolsize,
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index c83588c8d08b..13410b20600f 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -38,7 +38,11 @@ struct kernel_param {
38 unsigned int perm; 38 unsigned int perm;
39 param_set_fn set; 39 param_set_fn set;
40 param_get_fn get; 40 param_get_fn get;
41 void *arg; 41 union {
42 void *arg;
43 const struct kparam_string *str;
44 const struct kparam_array *arr;
45 };
42}; 46};
43 47
44/* Special one for strings we want to copy into */ 48/* Special one for strings we want to copy into */
@@ -66,11 +70,11 @@ struct kparam_array
66 /* Default value instead of permissions? */ \ 70 /* Default value instead of permissions? */ \
67 static int __param_perm_check_##name __attribute__((unused)) = \ 71 static int __param_perm_check_##name __attribute__((unused)) = \
68 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
69 static char __param_str_##name[] = prefix #name; \ 73 static const char __param_str_##name[] = prefix #name; \
70 static struct kernel_param const __param_##name \ 74 static struct kernel_param const __param_##name \
71 __attribute_used__ \ 75 __attribute_used__ \
72 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
73 = { __param_str_##name, perm, set, get, arg } 77 = { __param_str_##name, perm, set, get, { arg } }
74 78
75#define module_param_call(name, set, get, arg, perm) \ 79#define module_param_call(name, set, get, arg, perm) \
76 __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm) 80 __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm)
@@ -88,10 +92,10 @@ struct kparam_array
88 92
89/* Actually copy string: maxlen param is usually sizeof(string). */ 93/* Actually copy string: maxlen param is usually sizeof(string). */
90#define module_param_string(name, string, len, perm) \ 94#define module_param_string(name, string, len, perm) \
91 static struct kparam_string __param_string_##name \ 95 static const struct kparam_string __param_string_##name \
92 = { len, string }; \ 96 = { len, string }; \
93 module_param_call(name, param_set_copystring, param_get_string, \ 97 module_param_call(name, param_set_copystring, param_get_string, \
94 &__param_string_##name, perm); \ 98 .str = &__param_string_##name, perm); \
95 __MODULE_PARM_TYPE(name, "string") 99 __MODULE_PARM_TYPE(name, "string")
96 100
97/* Called on module insert or kernel boot */ 101/* Called on module insert or kernel boot */
@@ -149,11 +153,11 @@ extern int param_get_invbool(char *buffer, struct kernel_param *kp);
149 153
150/* Comma-separated array: *nump is set to number they actually specified. */ 154/* Comma-separated array: *nump is set to number they actually specified. */
151#define module_param_array_named(name, array, type, nump, perm) \ 155#define module_param_array_named(name, array, type, nump, perm) \
152 static struct kparam_array __param_arr_##name \ 156 static const struct kparam_array __param_arr_##name \
153 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ 157 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\
154 sizeof(array[0]), array }; \ 158 sizeof(array[0]), array }; \
155 module_param_call(name, param_array_set, param_array_get, \ 159 module_param_call(name, param_array_set, param_array_get, \
156 &__param_arr_##name, perm); \ 160 .arr = &__param_arr_##name, perm); \
157 __MODULE_PARM_TYPE(name, "array of " #type) 161 __MODULE_PARM_TYPE(name, "array of " #type)
158 162
159#define module_param_array(name, type, nump, perm) \ 163#define module_param_array(name, type, nump, perm) \
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 6a735c72f23f..601479772b98 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -29,7 +29,8 @@
29 * - task may not exit with mutex held 29 * - task may not exit with mutex held
30 * - memory areas where held locks reside must not be freed 30 * - memory areas where held locks reside must not be freed
31 * - held mutexes must not be reinitialized 31 * - held mutexes must not be reinitialized
32 * - mutexes may not be used in irq contexts 32 * - mutexes may not be used in hardware or software interrupt
33 * contexts such as tasklets and timers
33 * 34 *
34 * These semantics are fully enforced when DEBUG_MUTEXES is 35 * These semantics are fully enforced when DEBUG_MUTEXES is
35 * enabled. Furthermore, besides enforcing the above rules, the mutex 36 * enabled. Furthermore, besides enforcing the above rules, the mutex
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 6c38efbd810f..4cb4f8d2f78d 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -81,8 +81,8 @@ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry
81extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); 81extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
82extern void release_open_intent(struct nameidata *); 82extern void release_open_intent(struct nameidata *);
83 83
84extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 84extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
85extern struct dentry *lookup_one_len_kern(const char *, struct dentry *, int); 85extern struct dentry *lookup_one_noperm(const char *, struct dentry *);
86 86
87extern int follow_down(struct vfsmount **, struct dentry **); 87extern int follow_down(struct vfsmount **, struct dentry **);
88extern int follow_up(struct vfsmount **, struct dentry **); 88extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 0f3e69302540..cc2b47240a8f 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -26,6 +26,7 @@
26#define NBD_PRINT_DEBUG _IO( 0xab, 6 ) 26#define NBD_PRINT_DEBUG _IO( 0xab, 6 )
27#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) 27#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 )
28#define NBD_DISCONNECT _IO( 0xab, 8 ) 28#define NBD_DISCONNECT _IO( 0xab, 8 )
29#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
29 30
30enum { 31enum {
31 NBD_CMD_READ = 0, 32 NBD_CMD_READ = 0,
@@ -65,6 +66,7 @@ struct nbd_device {
65 int blksize; 66 int blksize;
66 u64 bytesize; 67 u64 bytesize;
67 pid_t pid; /* pid of nbd-client, if attached */ 68 pid_t pid; /* pid of nbd-client, if attached */
69 int xmit_timeout;
68}; 70};
69 71
70#endif 72#endif
diff --git a/include/linux/nls.h b/include/linux/nls.h
index 816c04ad7381..6a882208301a 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -7,13 +7,13 @@
7typedef __u16 wchar_t; 7typedef __u16 wchar_t;
8 8
9struct nls_table { 9struct nls_table {
10 char *charset; 10 const char *charset;
11 char *alias; 11 const char *alias;
12 int (*uni2char) (wchar_t uni, unsigned char *out, int boundlen); 12 int (*uni2char) (wchar_t uni, unsigned char *out, int boundlen);
13 int (*char2uni) (const unsigned char *rawstring, int boundlen, 13 int (*char2uni) (const unsigned char *rawstring, int boundlen,
14 wchar_t *uni); 14 wchar_t *uni);
15 unsigned char *charset2lower; 15 const unsigned char *charset2lower;
16 unsigned char *charset2upper; 16 const unsigned char *charset2upper;
17 struct module *owner; 17 struct module *owner;
18 struct nls_table *next; 18 struct nls_table *next;
19}; 19};
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index bec4485e3d76..033a648709b6 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -23,7 +23,6 @@ struct pid_namespace;
23 */ 23 */
24struct nsproxy { 24struct nsproxy {
25 atomic_t count; 25 atomic_t count;
26 spinlock_t nslock;
27 struct uts_namespace *uts_ns; 26 struct uts_namespace *uts_ns;
28 struct ipc_namespace *ipc_ns; 27 struct ipc_namespace *ipc_ns;
29 struct mnt_namespace *mnt_ns; 28 struct mnt_namespace *mnt_ns;
diff --git a/include/linux/oom.h b/include/linux/oom.h
index ad76463629a0..3852436b652a 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -7,4 +7,28 @@
7#define OOM_ADJUST_MIN (-16) 7#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15 8#define OOM_ADJUST_MAX 15
9 9
10#endif 10#ifdef __KERNEL__
11
12#include <linux/types.h>
13
14struct zonelist;
15struct notifier_block;
16
17/*
18 * Types of limitations to the nodes from which allocations may occur
19 */
20enum oom_constraint {
21 CONSTRAINT_NONE,
22 CONSTRAINT_CPUSET,
23 CONSTRAINT_MEMORY_POLICY,
24};
25
26extern int try_set_zone_oom(struct zonelist *zonelist);
27extern void clear_zonelist_oom(struct zonelist *zonelist);
28
29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb);
31extern int unregister_oom_notifier(struct notifier_block *nb);
32
33#endif /* __KERNEL__*/
34#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 3d9f70972cdf..9007ccdfc112 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -30,10 +30,28 @@ struct percpu_counter {
30#define FBC_BATCH (NR_CPUS*4) 30#define FBC_BATCH (NR_CPUS*4)
31#endif 31#endif
32 32
33void percpu_counter_init(struct percpu_counter *fbc, s64 amount); 33int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
34int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
34void percpu_counter_destroy(struct percpu_counter *fbc); 35void percpu_counter_destroy(struct percpu_counter *fbc);
35void percpu_counter_mod(struct percpu_counter *fbc, s32 amount); 36void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
36s64 percpu_counter_sum(struct percpu_counter *fbc); 37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
38s64 __percpu_counter_sum(struct percpu_counter *fbc);
39
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{
42 __percpu_counter_add(fbc, amount, FBC_BATCH);
43}
44
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
46{
47 s64 ret = __percpu_counter_sum(fbc);
48 return ret < 0 ? 0 : ret;
49}
50
51static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
52{
53 return __percpu_counter_sum(fbc);
54}
37 55
38static inline s64 percpu_counter_read(struct percpu_counter *fbc) 56static inline s64 percpu_counter_read(struct percpu_counter *fbc)
39{ 57{
@@ -61,17 +79,28 @@ struct percpu_counter {
61 s64 count; 79 s64 count;
62}; 80};
63 81
64static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount) 82static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
65{ 83{
66 fbc->count = amount; 84 fbc->count = amount;
85 return 0;
67} 86}
68 87
88#define percpu_counter_init_irq percpu_counter_init
89
69static inline void percpu_counter_destroy(struct percpu_counter *fbc) 90static inline void percpu_counter_destroy(struct percpu_counter *fbc)
70{ 91{
71} 92}
72 93
94static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
95{
96 fbc->count = amount;
97}
98
99#define __percpu_counter_add(fbc, amount, batch) \
100 percpu_counter_add(fbc, amount)
101
73static inline void 102static inline void
74percpu_counter_mod(struct percpu_counter *fbc, s32 amount) 103percpu_counter_add(struct percpu_counter *fbc, s64 amount)
75{ 104{
76 preempt_disable(); 105 preempt_disable();
77 fbc->count += amount; 106 fbc->count += amount;
@@ -88,21 +117,31 @@ static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
88 return fbc->count; 117 return fbc->count;
89} 118}
90 119
91static inline s64 percpu_counter_sum(struct percpu_counter *fbc) 120static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
92{ 121{
93 return percpu_counter_read_positive(fbc); 122 return percpu_counter_read_positive(fbc);
94} 123}
95 124
125static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
126{
127 return percpu_counter_read(fbc);
128}
129
96#endif /* CONFIG_SMP */ 130#endif /* CONFIG_SMP */
97 131
98static inline void percpu_counter_inc(struct percpu_counter *fbc) 132static inline void percpu_counter_inc(struct percpu_counter *fbc)
99{ 133{
100 percpu_counter_mod(fbc, 1); 134 percpu_counter_add(fbc, 1);
101} 135}
102 136
103static inline void percpu_counter_dec(struct percpu_counter *fbc) 137static inline void percpu_counter_dec(struct percpu_counter *fbc)
104{ 138{
105 percpu_counter_mod(fbc, -1); 139 percpu_counter_add(fbc, -1);
140}
141
142static inline void percpu_counter_sub(struct percpu_counter *fbc, s64 amount)
143{
144 percpu_counter_add(fbc, -amount);
106} 145}
107 146
108#endif /* _LINUX_PERCPU_COUNTER_H */ 147#endif /* _LINUX_PERCPU_COUNTER_H */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 16b46aace349..664d68cb1fbd 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -243,11 +243,11 @@ struct pnp_fixup {
243#define PNP_CONFIGURABLE 0x0008 243#define PNP_CONFIGURABLE 0x0008
244#define PNP_REMOVABLE 0x0010 244#define PNP_REMOVABLE 0x0010
245 245
246#define pnp_can_read(dev) (((dev)->protocol) && ((dev)->protocol->get) && \ 246#define pnp_can_read(dev) (((dev)->protocol->get) && \
247 ((dev)->capabilities & PNP_READ)) 247 ((dev)->capabilities & PNP_READ))
248#define pnp_can_write(dev) (((dev)->protocol) && ((dev)->protocol->set) && \ 248#define pnp_can_write(dev) (((dev)->protocol->set) && \
249 ((dev)->capabilities & PNP_WRITE)) 249 ((dev)->capabilities & PNP_WRITE))
250#define pnp_can_disable(dev) (((dev)->protocol) && ((dev)->protocol->disable) && \ 250#define pnp_can_disable(dev) (((dev)->protocol->disable) && \
251 ((dev)->capabilities & PNP_DISABLE)) 251 ((dev)->capabilities & PNP_DISABLE))
252#define pnp_can_configure(dev) ((!(dev)->active) && \ 252#define pnp_can_configure(dev) ((!(dev)->active) && \
253 ((dev)->capabilities & PNP_CONFIGURABLE)) 253 ((dev)->capabilities & PNP_CONFIGURABLE))
diff --git a/include/linux/profile.h b/include/linux/profile.h
index eec48f5f9348..ff576d1db67d 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -78,9 +78,6 @@ int profile_event_unregister(enum profile_type, struct notifier_block * n);
78int register_timer_hook(int (*hook)(struct pt_regs *)); 78int register_timer_hook(int (*hook)(struct pt_regs *));
79void unregister_timer_hook(int (*hook)(struct pt_regs *)); 79void unregister_timer_hook(int (*hook)(struct pt_regs *));
80 80
81/* Timer based profiling hook */
82extern int (*timer_hook)(struct pt_regs *);
83
84struct pt_regs; 81struct pt_regs;
85 82
86#else 83#else
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
new file mode 100644
index 000000000000..2c3b3cad92be
--- /dev/null
+++ b/include/linux/proportions.h
@@ -0,0 +1,119 @@
1/*
2 * FLoating proportions
3 *
4 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
5 *
6 * This file contains the public data structure and API definitions.
7 */
8
9#ifndef _LINUX_PROPORTIONS_H
10#define _LINUX_PROPORTIONS_H
11
12#include <linux/percpu_counter.h>
13#include <linux/spinlock.h>
14#include <linux/mutex.h>
15
16struct prop_global {
17 /*
18 * The period over which we differentiate
19 *
20 * period = 2^shift
21 */
22 int shift;
23 /*
24 * The total event counter aka 'time'.
25 *
26 * Treated as an unsigned long; the lower 'shift - 1' bits are the
27 * counter bits, the remaining upper bits the period counter.
28 */
29 struct percpu_counter events;
30};
31
32/*
33 * global proportion descriptor
34 *
35 * this is needed to consitently flip prop_global structures.
36 */
37struct prop_descriptor {
38 int index;
39 struct prop_global pg[2];
40 struct mutex mutex; /* serialize the prop_global switch */
41};
42
43int prop_descriptor_init(struct prop_descriptor *pd, int shift);
44void prop_change_shift(struct prop_descriptor *pd, int new_shift);
45
46/*
47 * ----- PERCPU ------
48 */
49
50struct prop_local_percpu {
51 /*
52 * the local events counter
53 */
54 struct percpu_counter events;
55
56 /*
57 * snapshot of the last seen global state
58 */
59 int shift;
60 unsigned long period;
61 spinlock_t lock; /* protect the snapshot state */
62};
63
64int prop_local_init_percpu(struct prop_local_percpu *pl);
65void prop_local_destroy_percpu(struct prop_local_percpu *pl);
66void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl);
67void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl,
68 long *numerator, long *denominator);
69
70static inline
71void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
72{
73 unsigned long flags;
74
75 local_irq_save(flags);
76 __prop_inc_percpu(pd, pl);
77 local_irq_restore(flags);
78}
79
80/*
81 * ----- SINGLE ------
82 */
83
84struct prop_local_single {
85 /*
86 * the local events counter
87 */
88 unsigned long events;
89
90 /*
91 * snapshot of the last seen global state
92 * and a lock protecting this state
93 */
94 int shift;
95 unsigned long period;
96 spinlock_t lock; /* protect the snapshot state */
97};
98
99#define INIT_PROP_LOCAL_SINGLE(name) \
100{ .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
101}
102
103int prop_local_init_single(struct prop_local_single *pl);
104void prop_local_destroy_single(struct prop_local_single *pl);
105void __prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl);
106void prop_fraction_single(struct prop_descriptor *pd, struct prop_local_single *pl,
107 long *numerator, long *denominator);
108
109static inline
110void prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl)
111{
112 unsigned long flags;
113
114 local_irq_save(flags);
115 __prop_inc_single(pd, pl);
116 local_irq_restore(flags);
117}
118
119#endif /* _LINUX_PROPORTIONS_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 62439828395e..6e0393a5b2ea 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -128,6 +128,37 @@ struct if_dqinfo {
128 __u32 dqi_valid; 128 __u32 dqi_valid;
129}; 129};
130 130
131/*
132 * Definitions for quota netlink interface
133 */
134#define QUOTA_NL_NOWARN 0
135#define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */
136#define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */
137#define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */
138#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */
139#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */
140#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */
141
142enum {
143 QUOTA_NL_C_UNSPEC,
144 QUOTA_NL_C_WARNING,
145 __QUOTA_NL_C_MAX,
146};
147#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
148
149enum {
150 QUOTA_NL_A_UNSPEC,
151 QUOTA_NL_A_QTYPE,
152 QUOTA_NL_A_EXCESS_ID,
153 QUOTA_NL_A_WARNING,
154 QUOTA_NL_A_DEV_MAJOR,
155 QUOTA_NL_A_DEV_MINOR,
156 QUOTA_NL_A_CAUSED_ID,
157 __QUOTA_NL_A_MAX,
158};
159#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
160
161
131#ifdef __KERNEL__ 162#ifdef __KERNEL__
132#include <linux/spinlock.h> 163#include <linux/spinlock.h>
133#include <linux/rwsem.h> 164#include <linux/rwsem.h>
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 75e17a05540e..306a1d1a5af0 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -138,7 +138,6 @@ typedef __u16 bitmap_counter_t;
138 138
139/* use these for bitmap->flags and bitmap->sb->state bit-fields */ 139/* use these for bitmap->flags and bitmap->sb->state bit-fields */
140enum bitmap_state { 140enum bitmap_state {
141 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
142 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */ 141 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */
143 BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */ 142 BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */
144 BITMAP_HOSTENDIAN = 0x8000, 143 BITMAP_HOSTENDIAN = 0x8000,
@@ -258,7 +257,6 @@ struct bitmap {
258int bitmap_create(mddev_t *mddev); 257int bitmap_create(mddev_t *mddev);
259void bitmap_flush(mddev_t *mddev); 258void bitmap_flush(mddev_t *mddev);
260void bitmap_destroy(mddev_t *mddev); 259void bitmap_destroy(mddev_t *mddev);
261int bitmap_active(struct bitmap *bitmap);
262 260
263char *file_path(struct file *file, char *buf, int count); 261char *file_path(struct file *file, char *buf, int count);
264void bitmap_print_sb(struct bitmap *bitmap); 262void bitmap_print_sb(struct bitmap *bitmap);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 76c1a530edc5..cc24a01df940 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -231,6 +231,18 @@ extern struct lockdep_map rcu_lock_map;
231 local_bh_enable(); \ 231 local_bh_enable(); \
232 } while(0) 232 } while(0)
233 233
234/*
235 * Prevent the compiler from merging or refetching accesses. The compiler
236 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
237 * but only when the compiler is aware of some particular ordering. One way
238 * to make the compiler aware of ordering is to put the two invocations of
239 * ACCESS_ONCE() in different C statements.
240 *
241 * This macro does absolutely -nothing- to prevent the CPU from reordering,
242 * merging, or refetching absolutely anything at any time.
243 */
244#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
245
234/** 246/**
235 * rcu_dereference - fetch an RCU-protected pointer in an 247 * rcu_dereference - fetch an RCU-protected pointer in an
236 * RCU read-side critical section. This pointer may later 248 * RCU read-side critical section. This pointer may later
@@ -242,7 +254,7 @@ extern struct lockdep_map rcu_lock_map;
242 */ 254 */
243 255
244#define rcu_dereference(p) ({ \ 256#define rcu_dereference(p) ({ \
245 typeof(p) _________p1 = p; \ 257 typeof(p) _________p1 = ACCESS_ONCE(p); \
246 smp_read_barrier_depends(); \ 258 smp_read_barrier_depends(); \
247 (_________p1); \ 259 (_________p1); \
248 }) 260 })
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 180a9d832dde..8dcf237d3386 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1703,8 +1703,6 @@ static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_ha
1703 return th->t_blocks_allocated - th->t_blocks_logged; 1703 return th->t_blocks_allocated - th->t_blocks_logged;
1704} 1704}
1705 1705
1706int reiserfs_async_progress_wait(struct super_block *s);
1707
1708struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct 1706struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
1709 super_block 1707 super_block
1710 *, 1708 *,
@@ -1859,8 +1857,6 @@ void padd_item(char *item, int total_length, int length);
1859#define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */ 1857#define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */
1860#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ 1858#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
1861 1859
1862int restart_transaction(struct reiserfs_transaction_handle *th,
1863 struct inode *inode, struct treepath *path);
1864void reiserfs_read_locked_inode(struct inode *inode, 1860void reiserfs_read_locked_inode(struct inode *inode,
1865 struct reiserfs_iget_args *args); 1861 struct reiserfs_iget_args *args);
1866int reiserfs_find_actor(struct inode *inode, void *p); 1862int reiserfs_find_actor(struct inode *inode, void *p);
@@ -2137,9 +2133,6 @@ void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th,
2137 struct inode *inode); 2133 struct inode *inode);
2138void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th); 2134void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th);
2139#endif 2135#endif
2140void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, int blocks);
2141void reiserfs_release_claimed_blocks(struct super_block *sb, int blocks);
2142int reiserfs_can_fit_pages(struct super_block *sb);
2143 2136
2144/* hashes.c */ 2137/* hashes.c */
2145__u32 keyed_hash(const signed char *msg, int len); 2138__u32 keyed_hash(const signed char *msg, int len);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 592e3a55f818..3de5aa210feb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -74,6 +74,7 @@ struct sched_param {
74#include <linux/pid.h> 74#include <linux/pid.h>
75#include <linux/percpu.h> 75#include <linux/percpu.h>
76#include <linux/topology.h> 76#include <linux/topology.h>
77#include <linux/proportions.h>
77#include <linux/seccomp.h> 78#include <linux/seccomp.h>
78#include <linux/rcupdate.h> 79#include <linux/rcupdate.h>
79#include <linux/futex.h> 80#include <linux/futex.h>
@@ -260,6 +261,7 @@ extern void softlockup_tick(void);
260extern void spawn_softlockup_task(void); 261extern void spawn_softlockup_task(void);
261extern void touch_softlockup_watchdog(void); 262extern void touch_softlockup_watchdog(void);
262extern void touch_all_softlockup_watchdogs(void); 263extern void touch_all_softlockup_watchdogs(void);
264extern int softlockup_thresh;
263#else 265#else
264static inline void softlockup_tick(void) 266static inline void softlockup_tick(void)
265{ 267{
@@ -357,8 +359,9 @@ extern int get_dumpable(struct mm_struct *mm);
357#define MMF_DUMP_ANON_SHARED 3 359#define MMF_DUMP_ANON_SHARED 3
358#define MMF_DUMP_MAPPED_PRIVATE 4 360#define MMF_DUMP_MAPPED_PRIVATE 4
359#define MMF_DUMP_MAPPED_SHARED 5 361#define MMF_DUMP_MAPPED_SHARED 5
362#define MMF_DUMP_ELF_HEADERS 6
360#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS 363#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
361#define MMF_DUMP_FILTER_BITS 4 364#define MMF_DUMP_FILTER_BITS 5
362#define MMF_DUMP_FILTER_MASK \ 365#define MMF_DUMP_FILTER_MASK \
363 (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT) 366 (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
364#define MMF_DUMP_FILTER_DEFAULT \ 367#define MMF_DUMP_FILTER_DEFAULT \
@@ -515,8 +518,10 @@ struct user_struct {
515 atomic_t inotify_watches; /* How many inotify watches does this user have? */ 518 atomic_t inotify_watches; /* How many inotify watches does this user have? */
516 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ 519 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */
517#endif 520#endif
521#ifdef CONFIG_POSIX_MQUEUE
518 /* protected by mq_lock */ 522 /* protected by mq_lock */
519 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ 523 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
524#endif
520 unsigned long locked_shm; /* How many pages of mlocked shm ? */ 525 unsigned long locked_shm; /* How many pages of mlocked shm ? */
521 526
522#ifdef CONFIG_KEYS 527#ifdef CONFIG_KEYS
@@ -913,6 +918,16 @@ struct task_struct {
913#endif 918#endif
914 919
915 unsigned short ioprio; 920 unsigned short ioprio;
921 /*
922 * fpu_counter contains the number of consecutive context switches
923 * that the FPU is used. If this is over a threshold, the lazy fpu
924 * saving becomes unlazy to save the trap. This is an unsigned char
925 * so that after 256 times the counter wraps and the behavior turns
926 * lazy again; this to deal with bursty apps that only use FPU for
927 * a short time
928 */
929 unsigned char fpu_counter;
930 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
916#ifdef CONFIG_BLK_DEV_IO_TRACE 931#ifdef CONFIG_BLK_DEV_IO_TRACE
917 unsigned int btrace_seq; 932 unsigned int btrace_seq;
918#endif 933#endif
@@ -998,16 +1013,6 @@ struct task_struct {
998 struct key *thread_keyring; /* keyring private to this thread */ 1013 struct key *thread_keyring; /* keyring private to this thread */
999 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 1014 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1000#endif 1015#endif
1001 /*
1002 * fpu_counter contains the number of consecutive context switches
1003 * that the FPU is used. If this is over a threshold, the lazy fpu
1004 * saving becomes unlazy to save the trap. This is an unsigned char
1005 * so that after 256 times the counter wraps and the behavior turns
1006 * lazy again; this to deal with bursty apps that only use FPU for
1007 * a short time
1008 */
1009 unsigned char fpu_counter;
1010 int oomkilladj; /* OOM kill score adjustment (bit shift). */
1011 char comm[TASK_COMM_LEN]; /* executable name excluding path 1016 char comm[TASK_COMM_LEN]; /* executable name excluding path
1012 - access with [gs]et_task_comm (which lock 1017 - access with [gs]et_task_comm (which lock
1013 it with task_lock()) 1018 it with task_lock())
@@ -1039,8 +1044,9 @@ struct task_struct {
1039 int (*notifier)(void *priv); 1044 int (*notifier)(void *priv);
1040 void *notifier_data; 1045 void *notifier_data;
1041 sigset_t *notifier_mask; 1046 sigset_t *notifier_mask;
1042 1047#ifdef CONFIG_SECURITY
1043 void *security; 1048 void *security;
1049#endif
1044 struct audit_context *audit_context; 1050 struct audit_context *audit_context;
1045 seccomp_t seccomp; 1051 seccomp_t seccomp;
1046 1052
@@ -1129,13 +1135,14 @@ struct task_struct {
1129 int cpuset_mems_generation; 1135 int cpuset_mems_generation;
1130 int cpuset_mem_spread_rotor; 1136 int cpuset_mem_spread_rotor;
1131#endif 1137#endif
1138#ifdef CONFIG_FUTEX
1132 struct robust_list_head __user *robust_list; 1139 struct robust_list_head __user *robust_list;
1133#ifdef CONFIG_COMPAT 1140#ifdef CONFIG_COMPAT
1134 struct compat_robust_list_head __user *compat_robust_list; 1141 struct compat_robust_list_head __user *compat_robust_list;
1135#endif 1142#endif
1136 struct list_head pi_state_list; 1143 struct list_head pi_state_list;
1137 struct futex_pi_state *pi_state_cache; 1144 struct futex_pi_state *pi_state_cache;
1138 1145#endif
1139 atomic_t fs_excl; /* holding fs exclusive resources */ 1146 atomic_t fs_excl; /* holding fs exclusive resources */
1140 struct rcu_head rcu; 1147 struct rcu_head rcu;
1141 1148
@@ -1149,6 +1156,7 @@ struct task_struct {
1149#ifdef CONFIG_FAULT_INJECTION 1156#ifdef CONFIG_FAULT_INJECTION
1150 int make_it_fail; 1157 int make_it_fail;
1151#endif 1158#endif
1159 struct prop_local_single dirties;
1152}; 1160};
1153 1161
1154/* 1162/*
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 3ee412bc00ec..ba81ffe9958a 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -47,15 +47,6 @@ struct screen_info {
47 47
48extern struct screen_info screen_info; 48extern struct screen_info screen_info;
49 49
50#define ORIG_X (screen_info.orig_x)
51#define ORIG_Y (screen_info.orig_y)
52#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
53#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
54#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
55#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
56#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
57#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
58
59#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ 50#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
60#define VIDEO_TYPE_CGA 0x11 /* CGA Display */ 51#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
61#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */ 52#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
diff --git a/include/linux/security.h b/include/linux/security.h
index 928d4793c6f4..9b0b63c50f44 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -51,10 +51,16 @@ extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe);
51extern int cap_bprm_secureexec(struct linux_binprm *bprm); 51extern int cap_bprm_secureexec(struct linux_binprm *bprm);
52extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); 52extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);
53extern int cap_inode_removexattr(struct dentry *dentry, char *name); 53extern int cap_inode_removexattr(struct dentry *dentry, char *name);
54extern int cap_inode_need_killpriv(struct dentry *dentry);
55extern int cap_inode_killpriv(struct dentry *dentry);
54extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 56extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
55extern void cap_task_reparent_to_init (struct task_struct *p); 57extern void cap_task_reparent_to_init (struct task_struct *p);
58extern int cap_task_kill(struct task_struct *p, struct siginfo *info, int sig, u32 secid);
59extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp);
60extern int cap_task_setioprio (struct task_struct *p, int ioprio);
61extern int cap_task_setnice (struct task_struct *p, int nice);
56extern int cap_syslog (int type); 62extern int cap_syslog (int type);
57extern int cap_vm_enough_memory (struct mm_struct *mm, long pages); 63extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
58 64
59struct msghdr; 65struct msghdr;
60struct sk_buff; 66struct sk_buff;
@@ -413,6 +419,18 @@ struct request_sock;
413 * is specified by @buffer_size. @buffer may be NULL to request 419 * is specified by @buffer_size. @buffer may be NULL to request
414 * the size of the buffer required. 420 * the size of the buffer required.
415 * Returns number of bytes used/required on success. 421 * Returns number of bytes used/required on success.
422 * @inode_need_killpriv:
423 * Called when an inode has been changed.
424 * @dentry is the dentry being changed.
425 * Return <0 on error to abort the inode change operation.
426 * Return 0 if inode_killpriv does not need to be called.
427 * Return >0 if inode_killpriv does need to be called.
428 * @inode_killpriv:
429 * The setuid bit is being removed. Remove similar security labels.
430 * Called with the dentry->d_inode->i_mutex held.
431 * @dentry is the dentry being changed.
432 * Return 0 on success. If error is returned, then the operation
433 * causing setuid bit removal is failed.
416 * 434 *
417 * Security hooks for file operations 435 * Security hooks for file operations
418 * 436 *
@@ -1140,10 +1158,6 @@ struct request_sock;
1140 * allow module stacking. 1158 * allow module stacking.
1141 * @name contains the name of the security module being stacked. 1159 * @name contains the name of the security module being stacked.
1142 * @ops contains a pointer to the struct security_operations of the module to stack. 1160 * @ops contains a pointer to the struct security_operations of the module to stack.
1143 * @unregister_security:
1144 * remove a stacked module.
1145 * @name contains the name of the security module being unstacked.
1146 * @ops contains a pointer to the struct security_operations of the module to unstack.
1147 * 1161 *
1148 * @secid_to_secctx: 1162 * @secid_to_secctx:
1149 * Convert secid to security context. 1163 * Convert secid to security context.
@@ -1239,7 +1253,8 @@ struct security_operations {
1239 int (*inode_getxattr) (struct dentry *dentry, char *name); 1253 int (*inode_getxattr) (struct dentry *dentry, char *name);
1240 int (*inode_listxattr) (struct dentry *dentry); 1254 int (*inode_listxattr) (struct dentry *dentry);
1241 int (*inode_removexattr) (struct dentry *dentry, char *name); 1255 int (*inode_removexattr) (struct dentry *dentry, char *name);
1242 const char *(*inode_xattr_getsuffix) (void); 1256 int (*inode_need_killpriv) (struct dentry *dentry);
1257 int (*inode_killpriv) (struct dentry *dentry);
1243 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err); 1258 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
1244 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1259 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1245 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1260 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
@@ -1330,8 +1345,6 @@ struct security_operations {
1330 /* allow module stacking */ 1345 /* allow module stacking */
1331 int (*register_security) (const char *name, 1346 int (*register_security) (const char *name,
1332 struct security_operations *ops); 1347 struct security_operations *ops);
1333 int (*unregister_security) (const char *name,
1334 struct security_operations *ops);
1335 1348
1336 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1349 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1337 1350
@@ -1409,748 +1422,10 @@ struct security_operations {
1409 1422
1410}; 1423};
1411 1424
1412/* global variables */
1413extern struct security_operations *security_ops;
1414
1415/* inline stuff */
1416static inline int security_ptrace (struct task_struct * parent, struct task_struct * child)
1417{
1418 return security_ops->ptrace (parent, child);
1419}
1420
1421static inline int security_capget (struct task_struct *target,
1422 kernel_cap_t *effective,
1423 kernel_cap_t *inheritable,
1424 kernel_cap_t *permitted)
1425{
1426 return security_ops->capget (target, effective, inheritable, permitted);
1427}
1428
1429static inline int security_capset_check (struct task_struct *target,
1430 kernel_cap_t *effective,
1431 kernel_cap_t *inheritable,
1432 kernel_cap_t *permitted)
1433{
1434 return security_ops->capset_check (target, effective, inheritable, permitted);
1435}
1436
1437static inline void security_capset_set (struct task_struct *target,
1438 kernel_cap_t *effective,
1439 kernel_cap_t *inheritable,
1440 kernel_cap_t *permitted)
1441{
1442 security_ops->capset_set (target, effective, inheritable, permitted);
1443}
1444
1445static inline int security_capable(struct task_struct *tsk, int cap)
1446{
1447 return security_ops->capable(tsk, cap);
1448}
1449
1450static inline int security_acct (struct file *file)
1451{
1452 return security_ops->acct (file);
1453}
1454
1455static inline int security_sysctl(struct ctl_table *table, int op)
1456{
1457 return security_ops->sysctl(table, op);
1458}
1459
1460static inline int security_quotactl (int cmds, int type, int id,
1461 struct super_block *sb)
1462{
1463 return security_ops->quotactl (cmds, type, id, sb);
1464}
1465
1466static inline int security_quota_on (struct dentry * dentry)
1467{
1468 return security_ops->quota_on (dentry);
1469}
1470
1471static inline int security_syslog(int type)
1472{
1473 return security_ops->syslog(type);
1474}
1475
1476static inline int security_settime(struct timespec *ts, struct timezone *tz)
1477{
1478 return security_ops->settime(ts, tz);
1479}
1480
1481static inline int security_vm_enough_memory(long pages)
1482{
1483 return security_ops->vm_enough_memory(current->mm, pages);
1484}
1485
1486static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1487{
1488 return security_ops->vm_enough_memory(mm, pages);
1489}
1490
1491static inline int security_bprm_alloc (struct linux_binprm *bprm)
1492{
1493 return security_ops->bprm_alloc_security (bprm);
1494}
1495static inline void security_bprm_free (struct linux_binprm *bprm)
1496{
1497 security_ops->bprm_free_security (bprm);
1498}
1499static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
1500{
1501 security_ops->bprm_apply_creds (bprm, unsafe);
1502}
1503static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm)
1504{
1505 security_ops->bprm_post_apply_creds (bprm);
1506}
1507static inline int security_bprm_set (struct linux_binprm *bprm)
1508{
1509 return security_ops->bprm_set_security (bprm);
1510}
1511
1512static inline int security_bprm_check (struct linux_binprm *bprm)
1513{
1514 return security_ops->bprm_check_security (bprm);
1515}
1516
1517static inline int security_bprm_secureexec (struct linux_binprm *bprm)
1518{
1519 return security_ops->bprm_secureexec (bprm);
1520}
1521
1522static inline int security_sb_alloc (struct super_block *sb)
1523{
1524 return security_ops->sb_alloc_security (sb);
1525}
1526
1527static inline void security_sb_free (struct super_block *sb)
1528{
1529 security_ops->sb_free_security (sb);
1530}
1531
1532static inline int security_sb_copy_data (struct file_system_type *type,
1533 void *orig, void *copy)
1534{
1535 return security_ops->sb_copy_data (type, orig, copy);
1536}
1537
1538static inline int security_sb_kern_mount (struct super_block *sb, void *data)
1539{
1540 return security_ops->sb_kern_mount (sb, data);
1541}
1542
1543static inline int security_sb_statfs (struct dentry *dentry)
1544{
1545 return security_ops->sb_statfs (dentry);
1546}
1547
1548static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
1549 char *type, unsigned long flags,
1550 void *data)
1551{
1552 return security_ops->sb_mount (dev_name, nd, type, flags, data);
1553}
1554
1555static inline int security_sb_check_sb (struct vfsmount *mnt,
1556 struct nameidata *nd)
1557{
1558 return security_ops->sb_check_sb (mnt, nd);
1559}
1560
1561static inline int security_sb_umount (struct vfsmount *mnt, int flags)
1562{
1563 return security_ops->sb_umount (mnt, flags);
1564}
1565
1566static inline void security_sb_umount_close (struct vfsmount *mnt)
1567{
1568 security_ops->sb_umount_close (mnt);
1569}
1570
1571static inline void security_sb_umount_busy (struct vfsmount *mnt)
1572{
1573 security_ops->sb_umount_busy (mnt);
1574}
1575
1576static inline void security_sb_post_remount (struct vfsmount *mnt,
1577 unsigned long flags, void *data)
1578{
1579 security_ops->sb_post_remount (mnt, flags, data);
1580}
1581
1582static inline void security_sb_post_mountroot (void)
1583{
1584 security_ops->sb_post_mountroot ();
1585}
1586
1587static inline void security_sb_post_addmount (struct vfsmount *mnt,
1588 struct nameidata *mountpoint_nd)
1589{
1590 security_ops->sb_post_addmount (mnt, mountpoint_nd);
1591}
1592
1593static inline int security_sb_pivotroot (struct nameidata *old_nd,
1594 struct nameidata *new_nd)
1595{
1596 return security_ops->sb_pivotroot (old_nd, new_nd);
1597}
1598
1599static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
1600 struct nameidata *new_nd)
1601{
1602 security_ops->sb_post_pivotroot (old_nd, new_nd);
1603}
1604
1605static inline int security_inode_alloc (struct inode *inode)
1606{
1607 inode->i_security = NULL;
1608 return security_ops->inode_alloc_security (inode);
1609}
1610
1611static inline void security_inode_free (struct inode *inode)
1612{
1613 security_ops->inode_free_security (inode);
1614}
1615
1616static inline int security_inode_init_security (struct inode *inode,
1617 struct inode *dir,
1618 char **name,
1619 void **value,
1620 size_t *len)
1621{
1622 if (unlikely (IS_PRIVATE (inode)))
1623 return -EOPNOTSUPP;
1624 return security_ops->inode_init_security (inode, dir, name, value, len);
1625}
1626
1627static inline int security_inode_create (struct inode *dir,
1628 struct dentry *dentry,
1629 int mode)
1630{
1631 if (unlikely (IS_PRIVATE (dir)))
1632 return 0;
1633 return security_ops->inode_create (dir, dentry, mode);
1634}
1635
1636static inline int security_inode_link (struct dentry *old_dentry,
1637 struct inode *dir,
1638 struct dentry *new_dentry)
1639{
1640 if (unlikely (IS_PRIVATE (old_dentry->d_inode)))
1641 return 0;
1642 return security_ops->inode_link (old_dentry, dir, new_dentry);
1643}
1644
1645static inline int security_inode_unlink (struct inode *dir,
1646 struct dentry *dentry)
1647{
1648 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1649 return 0;
1650 return security_ops->inode_unlink (dir, dentry);
1651}
1652
1653static inline int security_inode_symlink (struct inode *dir,
1654 struct dentry *dentry,
1655 const char *old_name)
1656{
1657 if (unlikely (IS_PRIVATE (dir)))
1658 return 0;
1659 return security_ops->inode_symlink (dir, dentry, old_name);
1660}
1661
1662static inline int security_inode_mkdir (struct inode *dir,
1663 struct dentry *dentry,
1664 int mode)
1665{
1666 if (unlikely (IS_PRIVATE (dir)))
1667 return 0;
1668 return security_ops->inode_mkdir (dir, dentry, mode);
1669}
1670
1671static inline int security_inode_rmdir (struct inode *dir,
1672 struct dentry *dentry)
1673{
1674 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1675 return 0;
1676 return security_ops->inode_rmdir (dir, dentry);
1677}
1678
1679static inline int security_inode_mknod (struct inode *dir,
1680 struct dentry *dentry,
1681 int mode, dev_t dev)
1682{
1683 if (unlikely (IS_PRIVATE (dir)))
1684 return 0;
1685 return security_ops->inode_mknod (dir, dentry, mode, dev);
1686}
1687
1688static inline int security_inode_rename (struct inode *old_dir,
1689 struct dentry *old_dentry,
1690 struct inode *new_dir,
1691 struct dentry *new_dentry)
1692{
1693 if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
1694 (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
1695 return 0;
1696 return security_ops->inode_rename (old_dir, old_dentry,
1697 new_dir, new_dentry);
1698}
1699
1700static inline int security_inode_readlink (struct dentry *dentry)
1701{
1702 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1703 return 0;
1704 return security_ops->inode_readlink (dentry);
1705}
1706
1707static inline int security_inode_follow_link (struct dentry *dentry,
1708 struct nameidata *nd)
1709{
1710 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1711 return 0;
1712 return security_ops->inode_follow_link (dentry, nd);
1713}
1714
1715static inline int security_inode_permission (struct inode *inode, int mask,
1716 struct nameidata *nd)
1717{
1718 if (unlikely (IS_PRIVATE (inode)))
1719 return 0;
1720 return security_ops->inode_permission (inode, mask, nd);
1721}
1722
1723static inline int security_inode_setattr (struct dentry *dentry,
1724 struct iattr *attr)
1725{
1726 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1727 return 0;
1728 return security_ops->inode_setattr (dentry, attr);
1729}
1730
1731static inline int security_inode_getattr (struct vfsmount *mnt,
1732 struct dentry *dentry)
1733{
1734 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1735 return 0;
1736 return security_ops->inode_getattr (mnt, dentry);
1737}
1738
1739static inline void security_inode_delete (struct inode *inode)
1740{
1741 if (unlikely (IS_PRIVATE (inode)))
1742 return;
1743 security_ops->inode_delete (inode);
1744}
1745
1746static inline int security_inode_setxattr (struct dentry *dentry, char *name,
1747 void *value, size_t size, int flags)
1748{
1749 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1750 return 0;
1751 return security_ops->inode_setxattr (dentry, name, value, size, flags);
1752}
1753
1754static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
1755 void *value, size_t size, int flags)
1756{
1757 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1758 return;
1759 security_ops->inode_post_setxattr (dentry, name, value, size, flags);
1760}
1761
1762static inline int security_inode_getxattr (struct dentry *dentry, char *name)
1763{
1764 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1765 return 0;
1766 return security_ops->inode_getxattr (dentry, name);
1767}
1768
1769static inline int security_inode_listxattr (struct dentry *dentry)
1770{
1771 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1772 return 0;
1773 return security_ops->inode_listxattr (dentry);
1774}
1775
1776static inline int security_inode_removexattr (struct dentry *dentry, char *name)
1777{
1778 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1779 return 0;
1780 return security_ops->inode_removexattr (dentry, name);
1781}
1782
1783static inline const char *security_inode_xattr_getsuffix(void)
1784{
1785 return security_ops->inode_xattr_getsuffix();
1786}
1787
1788static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
1789{
1790 if (unlikely (IS_PRIVATE (inode)))
1791 return 0;
1792 return security_ops->inode_getsecurity(inode, name, buffer, size, err);
1793}
1794
1795static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
1796{
1797 if (unlikely (IS_PRIVATE (inode)))
1798 return 0;
1799 return security_ops->inode_setsecurity(inode, name, value, size, flags);
1800}
1801
1802static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
1803{
1804 if (unlikely (IS_PRIVATE (inode)))
1805 return 0;
1806 return security_ops->inode_listsecurity(inode, buffer, buffer_size);
1807}
1808
1809static inline int security_file_permission (struct file *file, int mask)
1810{
1811 return security_ops->file_permission (file, mask);
1812}
1813
1814static inline int security_file_alloc (struct file *file)
1815{
1816 return security_ops->file_alloc_security (file);
1817}
1818
1819static inline void security_file_free (struct file *file)
1820{
1821 security_ops->file_free_security (file);
1822}
1823
1824static inline int security_file_ioctl (struct file *file, unsigned int cmd,
1825 unsigned long arg)
1826{
1827 return security_ops->file_ioctl (file, cmd, arg);
1828}
1829
1830static inline int security_file_mmap (struct file *file, unsigned long reqprot,
1831 unsigned long prot,
1832 unsigned long flags,
1833 unsigned long addr,
1834 unsigned long addr_only)
1835{
1836 return security_ops->file_mmap (file, reqprot, prot, flags, addr,
1837 addr_only);
1838}
1839
1840static inline int security_file_mprotect (struct vm_area_struct *vma,
1841 unsigned long reqprot,
1842 unsigned long prot)
1843{
1844 return security_ops->file_mprotect (vma, reqprot, prot);
1845}
1846
1847static inline int security_file_lock (struct file *file, unsigned int cmd)
1848{
1849 return security_ops->file_lock (file, cmd);
1850}
1851
1852static inline int security_file_fcntl (struct file *file, unsigned int cmd,
1853 unsigned long arg)
1854{
1855 return security_ops->file_fcntl (file, cmd, arg);
1856}
1857
1858static inline int security_file_set_fowner (struct file *file)
1859{
1860 return security_ops->file_set_fowner (file);
1861}
1862
1863static inline int security_file_send_sigiotask (struct task_struct *tsk,
1864 struct fown_struct *fown,
1865 int sig)
1866{
1867 return security_ops->file_send_sigiotask (tsk, fown, sig);
1868}
1869
1870static inline int security_file_receive (struct file *file)
1871{
1872 return security_ops->file_receive (file);
1873}
1874
1875static inline int security_dentry_open (struct file *file)
1876{
1877 return security_ops->dentry_open (file);
1878}
1879
1880static inline int security_task_create (unsigned long clone_flags)
1881{
1882 return security_ops->task_create (clone_flags);
1883}
1884
1885static inline int security_task_alloc (struct task_struct *p)
1886{
1887 return security_ops->task_alloc_security (p);
1888}
1889
1890static inline void security_task_free (struct task_struct *p)
1891{
1892 security_ops->task_free_security (p);
1893}
1894
1895static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
1896 int flags)
1897{
1898 return security_ops->task_setuid (id0, id1, id2, flags);
1899}
1900
1901static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
1902 uid_t old_suid, int flags)
1903{
1904 return security_ops->task_post_setuid (old_ruid, old_euid, old_suid, flags);
1905}
1906
1907static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
1908 int flags)
1909{
1910 return security_ops->task_setgid (id0, id1, id2, flags);
1911}
1912
1913static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
1914{
1915 return security_ops->task_setpgid (p, pgid);
1916}
1917
1918static inline int security_task_getpgid (struct task_struct *p)
1919{
1920 return security_ops->task_getpgid (p);
1921}
1922
1923static inline int security_task_getsid (struct task_struct *p)
1924{
1925 return security_ops->task_getsid (p);
1926}
1927
1928static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
1929{
1930 security_ops->task_getsecid (p, secid);
1931}
1932
1933static inline int security_task_setgroups (struct group_info *group_info)
1934{
1935 return security_ops->task_setgroups (group_info);
1936}
1937
1938static inline int security_task_setnice (struct task_struct *p, int nice)
1939{
1940 return security_ops->task_setnice (p, nice);
1941}
1942
1943static inline int security_task_setioprio (struct task_struct *p, int ioprio)
1944{
1945 return security_ops->task_setioprio (p, ioprio);
1946}
1947
1948static inline int security_task_getioprio (struct task_struct *p)
1949{
1950 return security_ops->task_getioprio (p);
1951}
1952
1953static inline int security_task_setrlimit (unsigned int resource,
1954 struct rlimit *new_rlim)
1955{
1956 return security_ops->task_setrlimit (resource, new_rlim);
1957}
1958
1959static inline int security_task_setscheduler (struct task_struct *p,
1960 int policy,
1961 struct sched_param *lp)
1962{
1963 return security_ops->task_setscheduler (p, policy, lp);
1964}
1965
1966static inline int security_task_getscheduler (struct task_struct *p)
1967{
1968 return security_ops->task_getscheduler (p);
1969}
1970
1971static inline int security_task_movememory (struct task_struct *p)
1972{
1973 return security_ops->task_movememory (p);
1974}
1975
1976static inline int security_task_kill (struct task_struct *p,
1977 struct siginfo *info, int sig,
1978 u32 secid)
1979{
1980 return security_ops->task_kill (p, info, sig, secid);
1981}
1982
1983static inline int security_task_wait (struct task_struct *p)
1984{
1985 return security_ops->task_wait (p);
1986}
1987
1988static inline int security_task_prctl (int option, unsigned long arg2,
1989 unsigned long arg3,
1990 unsigned long arg4,
1991 unsigned long arg5)
1992{
1993 return security_ops->task_prctl (option, arg2, arg3, arg4, arg5);
1994}
1995
1996static inline void security_task_reparent_to_init (struct task_struct *p)
1997{
1998 security_ops->task_reparent_to_init (p);
1999}
2000
2001static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
2002{
2003 security_ops->task_to_inode(p, inode);
2004}
2005
2006static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
2007 short flag)
2008{
2009 return security_ops->ipc_permission (ipcp, flag);
2010}
2011
2012static inline int security_msg_msg_alloc (struct msg_msg * msg)
2013{
2014 return security_ops->msg_msg_alloc_security (msg);
2015}
2016
2017static inline void security_msg_msg_free (struct msg_msg * msg)
2018{
2019 security_ops->msg_msg_free_security(msg);
2020}
2021
2022static inline int security_msg_queue_alloc (struct msg_queue *msq)
2023{
2024 return security_ops->msg_queue_alloc_security (msq);
2025}
2026
2027static inline void security_msg_queue_free (struct msg_queue *msq)
2028{
2029 security_ops->msg_queue_free_security (msq);
2030}
2031
2032static inline int security_msg_queue_associate (struct msg_queue * msq,
2033 int msqflg)
2034{
2035 return security_ops->msg_queue_associate (msq, msqflg);
2036}
2037
2038static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
2039{
2040 return security_ops->msg_queue_msgctl (msq, cmd);
2041}
2042
2043static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
2044 struct msg_msg * msg, int msqflg)
2045{
2046 return security_ops->msg_queue_msgsnd (msq, msg, msqflg);
2047}
2048
2049static inline int security_msg_queue_msgrcv (struct msg_queue * msq,
2050 struct msg_msg * msg,
2051 struct task_struct * target,
2052 long type, int mode)
2053{
2054 return security_ops->msg_queue_msgrcv (msq, msg, target, type, mode);
2055}
2056
2057static inline int security_shm_alloc (struct shmid_kernel *shp)
2058{
2059 return security_ops->shm_alloc_security (shp);
2060}
2061
2062static inline void security_shm_free (struct shmid_kernel *shp)
2063{
2064 security_ops->shm_free_security (shp);
2065}
2066
2067static inline int security_shm_associate (struct shmid_kernel * shp,
2068 int shmflg)
2069{
2070 return security_ops->shm_associate(shp, shmflg);
2071}
2072
2073static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
2074{
2075 return security_ops->shm_shmctl (shp, cmd);
2076}
2077
2078static inline int security_shm_shmat (struct shmid_kernel * shp,
2079 char __user *shmaddr, int shmflg)
2080{
2081 return security_ops->shm_shmat(shp, shmaddr, shmflg);
2082}
2083
2084static inline int security_sem_alloc (struct sem_array *sma)
2085{
2086 return security_ops->sem_alloc_security (sma);
2087}
2088
2089static inline void security_sem_free (struct sem_array *sma)
2090{
2091 security_ops->sem_free_security (sma);
2092}
2093
2094static inline int security_sem_associate (struct sem_array * sma, int semflg)
2095{
2096 return security_ops->sem_associate (sma, semflg);
2097}
2098
2099static inline int security_sem_semctl (struct sem_array * sma, int cmd)
2100{
2101 return security_ops->sem_semctl(sma, cmd);
2102}
2103
2104static inline int security_sem_semop (struct sem_array * sma,
2105 struct sembuf * sops, unsigned nsops,
2106 int alter)
2107{
2108 return security_ops->sem_semop(sma, sops, nsops, alter);
2109}
2110
2111static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
2112{
2113 if (unlikely (inode && IS_PRIVATE (inode)))
2114 return;
2115 security_ops->d_instantiate (dentry, inode);
2116}
2117
2118static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
2119{
2120 return security_ops->getprocattr(p, name, value);
2121}
2122
2123static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
2124{
2125 return security_ops->setprocattr(p, name, value, size);
2126}
2127
2128static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
2129{
2130 return security_ops->netlink_send(sk, skb);
2131}
2132
2133static inline int security_netlink_recv(struct sk_buff * skb, int cap)
2134{
2135 return security_ops->netlink_recv(skb, cap);
2136}
2137
2138static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2139{
2140 return security_ops->secid_to_secctx(secid, secdata, seclen);
2141}
2142
2143static inline void security_release_secctx(char *secdata, u32 seclen)
2144{
2145 return security_ops->release_secctx(secdata, seclen);
2146}
2147
2148/* prototypes */ 1425/* prototypes */
2149extern int security_init (void); 1426extern int security_init (void);
2150extern int register_security (struct security_operations *ops); 1427extern int register_security (struct security_operations *ops);
2151extern int unregister_security (struct security_operations *ops);
2152extern int mod_reg_security (const char *name, struct security_operations *ops); 1428extern int mod_reg_security (const char *name, struct security_operations *ops);
2153extern int mod_unreg_security (const char *name, struct security_operations *ops);
2154extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 1429extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
2155 struct dentry *parent, void *data, 1430 struct dentry *parent, void *data,
2156 const struct file_operations *fops); 1431 const struct file_operations *fops);
@@ -2158,6 +1433,158 @@ extern struct dentry *securityfs_create_dir(const char *name, struct dentry *par
2158extern void securityfs_remove(struct dentry *dentry); 1433extern void securityfs_remove(struct dentry *dentry);
2159 1434
2160 1435
1436/* Security operations */
1437int security_ptrace(struct task_struct *parent, struct task_struct *child);
1438int security_capget(struct task_struct *target,
1439 kernel_cap_t *effective,
1440 kernel_cap_t *inheritable,
1441 kernel_cap_t *permitted);
1442int security_capset_check(struct task_struct *target,
1443 kernel_cap_t *effective,
1444 kernel_cap_t *inheritable,
1445 kernel_cap_t *permitted);
1446void security_capset_set(struct task_struct *target,
1447 kernel_cap_t *effective,
1448 kernel_cap_t *inheritable,
1449 kernel_cap_t *permitted);
1450int security_capable(struct task_struct *tsk, int cap);
1451int security_acct(struct file *file);
1452int security_sysctl(struct ctl_table *table, int op);
1453int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1454int security_quota_on(struct dentry *dentry);
1455int security_syslog(int type);
1456int security_settime(struct timespec *ts, struct timezone *tz);
1457int security_vm_enough_memory(long pages);
1458int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1459int security_bprm_alloc(struct linux_binprm *bprm);
1460void security_bprm_free(struct linux_binprm *bprm);
1461void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
1462void security_bprm_post_apply_creds(struct linux_binprm *bprm);
1463int security_bprm_set(struct linux_binprm *bprm);
1464int security_bprm_check(struct linux_binprm *bprm);
1465int security_bprm_secureexec(struct linux_binprm *bprm);
1466int security_sb_alloc(struct super_block *sb);
1467void security_sb_free(struct super_block *sb);
1468int security_sb_copy_data(struct file_system_type *type, void *orig, void *copy);
1469int security_sb_kern_mount(struct super_block *sb, void *data);
1470int security_sb_statfs(struct dentry *dentry);
1471int security_sb_mount(char *dev_name, struct nameidata *nd,
1472 char *type, unsigned long flags, void *data);
1473int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd);
1474int security_sb_umount(struct vfsmount *mnt, int flags);
1475void security_sb_umount_close(struct vfsmount *mnt);
1476void security_sb_umount_busy(struct vfsmount *mnt);
1477void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1478void security_sb_post_mountroot(void);
1479void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
1480int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
1481void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
1482int security_inode_alloc(struct inode *inode);
1483void security_inode_free(struct inode *inode);
1484int security_inode_init_security(struct inode *inode, struct inode *dir,
1485 char **name, void **value, size_t *len);
1486int security_inode_create(struct inode *dir, struct dentry *dentry, int mode);
1487int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1488 struct dentry *new_dentry);
1489int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1490int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1491 const char *old_name);
1492int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode);
1493int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1494int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
1495int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1496 struct inode *new_dir, struct dentry *new_dentry);
1497int security_inode_readlink(struct dentry *dentry);
1498int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1499int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
1500int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1501int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1502void security_inode_delete(struct inode *inode);
1503int security_inode_setxattr(struct dentry *dentry, char *name,
1504 void *value, size_t size, int flags);
1505void security_inode_post_setxattr(struct dentry *dentry, char *name,
1506 void *value, size_t size, int flags);
1507int security_inode_getxattr(struct dentry *dentry, char *name);
1508int security_inode_listxattr(struct dentry *dentry);
1509int security_inode_removexattr(struct dentry *dentry, char *name);
1510int security_inode_need_killpriv(struct dentry *dentry);
1511int security_inode_killpriv(struct dentry *dentry);
1512int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
1513int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1514int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
1515int security_file_permission(struct file *file, int mask);
1516int security_file_alloc(struct file *file);
1517void security_file_free(struct file *file);
1518int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1519int security_file_mmap(struct file *file, unsigned long reqprot,
1520 unsigned long prot, unsigned long flags,
1521 unsigned long addr, unsigned long addr_only);
1522int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1523 unsigned long prot);
1524int security_file_lock(struct file *file, unsigned int cmd);
1525int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
1526int security_file_set_fowner(struct file *file);
1527int security_file_send_sigiotask(struct task_struct *tsk,
1528 struct fown_struct *fown, int sig);
1529int security_file_receive(struct file *file);
1530int security_dentry_open(struct file *file);
1531int security_task_create(unsigned long clone_flags);
1532int security_task_alloc(struct task_struct *p);
1533void security_task_free(struct task_struct *p);
1534int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1535int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
1536 uid_t old_suid, int flags);
1537int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1538int security_task_setpgid(struct task_struct *p, pid_t pgid);
1539int security_task_getpgid(struct task_struct *p);
1540int security_task_getsid(struct task_struct *p);
1541void security_task_getsecid(struct task_struct *p, u32 *secid);
1542int security_task_setgroups(struct group_info *group_info);
1543int security_task_setnice(struct task_struct *p, int nice);
1544int security_task_setioprio(struct task_struct *p, int ioprio);
1545int security_task_getioprio(struct task_struct *p);
1546int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim);
1547int security_task_setscheduler(struct task_struct *p,
1548 int policy, struct sched_param *lp);
1549int security_task_getscheduler(struct task_struct *p);
1550int security_task_movememory(struct task_struct *p);
1551int security_task_kill(struct task_struct *p, struct siginfo *info,
1552 int sig, u32 secid);
1553int security_task_wait(struct task_struct *p);
1554int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1555 unsigned long arg4, unsigned long arg5);
1556void security_task_reparent_to_init(struct task_struct *p);
1557void security_task_to_inode(struct task_struct *p, struct inode *inode);
1558int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
1559int security_msg_msg_alloc(struct msg_msg *msg);
1560void security_msg_msg_free(struct msg_msg *msg);
1561int security_msg_queue_alloc(struct msg_queue *msq);
1562void security_msg_queue_free(struct msg_queue *msq);
1563int security_msg_queue_associate(struct msg_queue *msq, int msqflg);
1564int security_msg_queue_msgctl(struct msg_queue *msq, int cmd);
1565int security_msg_queue_msgsnd(struct msg_queue *msq,
1566 struct msg_msg *msg, int msqflg);
1567int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
1568 struct task_struct *target, long type, int mode);
1569int security_shm_alloc(struct shmid_kernel *shp);
1570void security_shm_free(struct shmid_kernel *shp);
1571int security_shm_associate(struct shmid_kernel *shp, int shmflg);
1572int security_shm_shmctl(struct shmid_kernel *shp, int cmd);
1573int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg);
1574int security_sem_alloc(struct sem_array *sma);
1575void security_sem_free(struct sem_array *sma);
1576int security_sem_associate(struct sem_array *sma, int semflg);
1577int security_sem_semctl(struct sem_array *sma, int cmd);
1578int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
1579 unsigned nsops, int alter);
1580void security_d_instantiate (struct dentry *dentry, struct inode *inode);
1581int security_getprocattr(struct task_struct *p, char *name, char **value);
1582int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1583int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1584int security_netlink_recv(struct sk_buff *skb, int cap);
1585int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1586void security_release_secctx(char *secdata, u32 seclen);
1587
2161#else /* CONFIG_SECURITY */ 1588#else /* CONFIG_SECURITY */
2162 1589
2163/* 1590/*
@@ -2476,9 +1903,14 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
2476 return cap_inode_removexattr(dentry, name); 1903 return cap_inode_removexattr(dentry, name);
2477} 1904}
2478 1905
2479static inline const char *security_inode_xattr_getsuffix (void) 1906static inline int security_inode_need_killpriv(struct dentry *dentry)
2480{ 1907{
2481 return NULL ; 1908 return cap_inode_need_killpriv(dentry);
1909}
1910
1911static inline int security_inode_killpriv(struct dentry *dentry)
1912{
1913 return cap_inode_killpriv(dentry);
2482} 1914}
2483 1915
2484static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err) 1916static 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)
2620 2052
2621static inline int security_task_setnice (struct task_struct *p, int nice) 2053static inline int security_task_setnice (struct task_struct *p, int nice)
2622{ 2054{
2623 return 0; 2055 return cap_task_setnice(p, nice);
2624} 2056}
2625 2057
2626static inline int security_task_setioprio (struct task_struct *p, int ioprio) 2058static inline int security_task_setioprio (struct task_struct *p, int ioprio)
2627{ 2059{
2628 return 0; 2060 return cap_task_setioprio(p, ioprio);
2629} 2061}
2630 2062
2631static inline int security_task_getioprio (struct task_struct *p) 2063static inline int security_task_getioprio (struct task_struct *p)
@@ -2643,7 +2075,7 @@ static inline int security_task_setscheduler (struct task_struct *p,
2643 int policy, 2075 int policy,
2644 struct sched_param *lp) 2076 struct sched_param *lp)
2645{ 2077{
2646 return 0; 2078 return cap_task_setscheduler(p, policy, lp);
2647} 2079}
2648 2080
2649static inline int security_task_getscheduler (struct task_struct *p) 2081static inline int security_task_getscheduler (struct task_struct *p)
@@ -2660,7 +2092,7 @@ static inline int security_task_kill (struct task_struct *p,
2660 struct siginfo *info, int sig, 2092 struct siginfo *info, int sig,
2661 u32 secid) 2093 u32 secid)
2662{ 2094{
2663 return 0; 2095 return cap_task_kill(p, info, sig, secid);
2664} 2096}
2665 2097
2666static inline int security_task_wait (struct task_struct *p) 2098static inline int security_task_wait (struct task_struct *p)
@@ -2834,170 +2266,43 @@ static inline void security_release_secctx(char *secdata, u32 seclen)
2834#endif /* CONFIG_SECURITY */ 2266#endif /* CONFIG_SECURITY */
2835 2267
2836#ifdef CONFIG_SECURITY_NETWORK 2268#ifdef CONFIG_SECURITY_NETWORK
2837static inline int security_unix_stream_connect(struct socket * sock,
2838 struct socket * other,
2839 struct sock * newsk)
2840{
2841 return security_ops->unix_stream_connect(sock, other, newsk);
2842}
2843 2269
2270int security_unix_stream_connect(struct socket *sock, struct socket *other,
2271 struct sock *newsk);
2272int security_unix_may_send(struct socket *sock, struct socket *other);
2273int security_socket_create(int family, int type, int protocol, int kern);
2274int security_socket_post_create(struct socket *sock, int family,
2275 int type, int protocol, int kern);
2276int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen);
2277int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
2278int security_socket_listen(struct socket *sock, int backlog);
2279int security_socket_accept(struct socket *sock, struct socket *newsock);
2280void security_socket_post_accept(struct socket *sock, struct socket *newsock);
2281int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
2282int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
2283 int size, int flags);
2284int security_socket_getsockname(struct socket *sock);
2285int security_socket_getpeername(struct socket *sock);
2286int security_socket_getsockopt(struct socket *sock, int level, int optname);
2287int security_socket_setsockopt(struct socket *sock, int level, int optname);
2288int security_socket_shutdown(struct socket *sock, int how);
2289int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb);
2290int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
2291 int __user *optlen, unsigned len);
2292int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid);
2293int security_sk_alloc(struct sock *sk, int family, gfp_t priority);
2294void security_sk_free(struct sock *sk);
2295void security_sk_clone(const struct sock *sk, struct sock *newsk);
2296void security_sk_classify_flow(struct sock *sk, struct flowi *fl);
2297void security_req_classify_flow(const struct request_sock *req, struct flowi *fl);
2298void security_sock_graft(struct sock*sk, struct socket *parent);
2299int security_inet_conn_request(struct sock *sk,
2300 struct sk_buff *skb, struct request_sock *req);
2301void security_inet_csk_clone(struct sock *newsk,
2302 const struct request_sock *req);
2303void security_inet_conn_established(struct sock *sk,
2304 struct sk_buff *skb);
2844 2305
2845static inline int security_unix_may_send(struct socket * sock,
2846 struct socket * other)
2847{
2848 return security_ops->unix_may_send(sock, other);
2849}
2850
2851static inline int security_socket_create (int family, int type,
2852 int protocol, int kern)
2853{
2854 return security_ops->socket_create(family, type, protocol, kern);
2855}
2856
2857static inline int security_socket_post_create(struct socket * sock,
2858 int family,
2859 int type,
2860 int protocol, int kern)
2861{
2862 return security_ops->socket_post_create(sock, family, type,
2863 protocol, kern);
2864}
2865
2866static inline int security_socket_bind(struct socket * sock,
2867 struct sockaddr * address,
2868 int addrlen)
2869{
2870 return security_ops->socket_bind(sock, address, addrlen);
2871}
2872
2873static inline int security_socket_connect(struct socket * sock,
2874 struct sockaddr * address,
2875 int addrlen)
2876{
2877 return security_ops->socket_connect(sock, address, addrlen);
2878}
2879
2880static inline int security_socket_listen(struct socket * sock, int backlog)
2881{
2882 return security_ops->socket_listen(sock, backlog);
2883}
2884
2885static inline int security_socket_accept(struct socket * sock,
2886 struct socket * newsock)
2887{
2888 return security_ops->socket_accept(sock, newsock);
2889}
2890
2891static inline void security_socket_post_accept(struct socket * sock,
2892 struct socket * newsock)
2893{
2894 security_ops->socket_post_accept(sock, newsock);
2895}
2896
2897static inline int security_socket_sendmsg(struct socket * sock,
2898 struct msghdr * msg, int size)
2899{
2900 return security_ops->socket_sendmsg(sock, msg, size);
2901}
2902
2903static inline int security_socket_recvmsg(struct socket * sock,
2904 struct msghdr * msg, int size,
2905 int flags)
2906{
2907 return security_ops->socket_recvmsg(sock, msg, size, flags);
2908}
2909
2910static inline int security_socket_getsockname(struct socket * sock)
2911{
2912 return security_ops->socket_getsockname(sock);
2913}
2914
2915static inline int security_socket_getpeername(struct socket * sock)
2916{
2917 return security_ops->socket_getpeername(sock);
2918}
2919
2920static inline int security_socket_getsockopt(struct socket * sock,
2921 int level, int optname)
2922{
2923 return security_ops->socket_getsockopt(sock, level, optname);
2924}
2925
2926static inline int security_socket_setsockopt(struct socket * sock,
2927 int level, int optname)
2928{
2929 return security_ops->socket_setsockopt(sock, level, optname);
2930}
2931
2932static inline int security_socket_shutdown(struct socket * sock, int how)
2933{
2934 return security_ops->socket_shutdown(sock, how);
2935}
2936
2937static inline int security_sock_rcv_skb (struct sock * sk,
2938 struct sk_buff * skb)
2939{
2940 return security_ops->socket_sock_rcv_skb (sk, skb);
2941}
2942
2943static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
2944 int __user *optlen, unsigned len)
2945{
2946 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
2947}
2948
2949static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2950{
2951 return security_ops->socket_getpeersec_dgram(sock, skb, secid);
2952}
2953
2954static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2955{
2956 return security_ops->sk_alloc_security(sk, family, priority);
2957}
2958
2959static inline void security_sk_free(struct sock *sk)
2960{
2961 return security_ops->sk_free_security(sk);
2962}
2963
2964static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
2965{
2966 return security_ops->sk_clone_security(sk, newsk);
2967}
2968
2969static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
2970{
2971 security_ops->sk_getsecid(sk, &fl->secid);
2972}
2973
2974static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
2975{
2976 security_ops->req_classify_flow(req, fl);
2977}
2978
2979static inline void security_sock_graft(struct sock* sk, struct socket *parent)
2980{
2981 security_ops->sock_graft(sk, parent);
2982}
2983
2984static inline int security_inet_conn_request(struct sock *sk,
2985 struct sk_buff *skb, struct request_sock *req)
2986{
2987 return security_ops->inet_conn_request(sk, skb, req);
2988}
2989
2990static inline void security_inet_csk_clone(struct sock *newsk,
2991 const struct request_sock *req)
2992{
2993 security_ops->inet_csk_clone(newsk, req);
2994}
2995
2996static inline void security_inet_conn_established(struct sock *sk,
2997 struct sk_buff *skb)
2998{
2999 security_ops->inet_conn_established(sk, skb);
3000}
3001#else /* CONFIG_SECURITY_NETWORK */ 2306#else /* CONFIG_SECURITY_NETWORK */
3002static inline int security_unix_stream_connect(struct socket * sock, 2307static inline int security_unix_stream_connect(struct socket * sock,
3003 struct socket * other, 2308 struct socket * other,
@@ -3155,77 +2460,24 @@ static inline void security_inet_conn_established(struct sock *sk,
3155#endif /* CONFIG_SECURITY_NETWORK */ 2460#endif /* CONFIG_SECURITY_NETWORK */
3156 2461
3157#ifdef CONFIG_SECURITY_NETWORK_XFRM 2462#ifdef CONFIG_SECURITY_NETWORK_XFRM
3158static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
3159{
3160 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
3161}
3162
3163static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
3164{
3165 return security_ops->xfrm_policy_clone_security(old, new);
3166}
3167
3168static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
3169{
3170 security_ops->xfrm_policy_free_security(xp);
3171}
3172
3173static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
3174{
3175 return security_ops->xfrm_policy_delete_security(xp);
3176}
3177 2463
3178static inline int security_xfrm_state_alloc(struct xfrm_state *x, 2464int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
3179 struct xfrm_user_sec_ctx *sec_ctx) 2465int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new);
3180{ 2466void security_xfrm_policy_free(struct xfrm_policy *xp);
3181 return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0); 2467int security_xfrm_policy_delete(struct xfrm_policy *xp);
3182} 2468int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
3183 2469int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3184static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 2470 struct xfrm_sec_ctx *polsec, u32 secid);
3185 struct xfrm_sec_ctx *polsec, u32 secid) 2471int security_xfrm_state_delete(struct xfrm_state *x);
3186{ 2472void security_xfrm_state_free(struct xfrm_state *x);
3187 if (!polsec) 2473int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
3188 return 0; 2474int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3189 /* 2475 struct xfrm_policy *xp, struct flowi *fl);
3190 * We want the context to be taken from secid which is usually 2476int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
3191 * from the sock. 2477void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
3192 */
3193 return security_ops->xfrm_state_alloc_security(x, NULL, secid);
3194}
3195
3196static inline int security_xfrm_state_delete(struct xfrm_state *x)
3197{
3198 return security_ops->xfrm_state_delete_security(x);
3199}
3200
3201static inline void security_xfrm_state_free(struct xfrm_state *x)
3202{
3203 security_ops->xfrm_state_free_security(x);
3204}
3205
3206static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
3207{
3208 return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
3209}
3210
3211static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3212 struct xfrm_policy *xp, struct flowi *fl)
3213{
3214 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
3215}
3216 2478
3217static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3218{
3219 return security_ops->xfrm_decode_session(skb, secid, 1);
3220}
3221
3222static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
3223{
3224 int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
3225
3226 BUG_ON(rc);
3227}
3228#else /* CONFIG_SECURITY_NETWORK_XFRM */ 2479#else /* CONFIG_SECURITY_NETWORK_XFRM */
2480
3229static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 2481static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
3230{ 2482{
3231 return 0; 2483 return 0;
@@ -3290,24 +2542,11 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
3290 2542
3291#ifdef CONFIG_KEYS 2543#ifdef CONFIG_KEYS
3292#ifdef CONFIG_SECURITY 2544#ifdef CONFIG_SECURITY
3293static inline int security_key_alloc(struct key *key,
3294 struct task_struct *tsk,
3295 unsigned long flags)
3296{
3297 return security_ops->key_alloc(key, tsk, flags);
3298}
3299
3300static inline void security_key_free(struct key *key)
3301{
3302 security_ops->key_free(key);
3303}
3304 2545
3305static inline int security_key_permission(key_ref_t key_ref, 2546int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags);
3306 struct task_struct *context, 2547void security_key_free(struct key *key);
3307 key_perm_t perm) 2548int security_key_permission(key_ref_t key_ref,
3308{ 2549 struct task_struct *context, key_perm_t perm);
3309 return security_ops->key_permission(key_ref, context, perm);
3310}
3311 2550
3312#else 2551#else
3313 2552
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 8bf1e05115b4..ebbc02b325fc 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -18,7 +18,7 @@ struct seq_file {
18 size_t from; 18 size_t from;
19 size_t count; 19 size_t count;
20 loff_t index; 20 loff_t index;
21 loff_t version; 21 u64 version;
22 struct mutex lock; 22 struct mutex lock;
23 const struct seq_operations *op; 23 const struct seq_operations *op;
24 void *private; 24 void *private;
diff --git a/include/linux/shm.h b/include/linux/shm.h
index ad2e3af65997..bea65d9c93ef 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -16,7 +16,9 @@
16#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ 16#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
17#define SHMSEG SHMMNI /* max shared segs per process */ 17#define SHMSEG SHMMNI /* max shared segs per process */
18 18
19#ifdef __KERNEL__
19#include <asm/shmparam.h> 20#include <asm/shmparam.h>
21#endif
20 22
21/* Obsolete, used only for backwards compatibility and libc5 compiles */ 23/* Obsolete, used only for backwards compatibility and libc5 compiles */
22struct shmid_ds { 24struct shmid_ds {
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 4c9ff0910ae0..86f9b1ef0e09 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -10,22 +10,22 @@
10 10
11 11
12struct signalfd_siginfo { 12struct signalfd_siginfo {
13 __u32 signo; 13 __u32 ssi_signo;
14 __s32 err; 14 __s32 ssi_errno;
15 __s32 code; 15 __s32 ssi_code;
16 __u32 pid; 16 __u32 ssi_pid;
17 __u32 uid; 17 __u32 ssi_uid;
18 __s32 fd; 18 __s32 ssi_fd;
19 __u32 tid; 19 __u32 ssi_tid;
20 __u32 band; 20 __u32 ssi_band;
21 __u32 overrun; 21 __u32 ssi_overrun;
22 __u32 trapno; 22 __u32 ssi_trapno;
23 __s32 status; 23 __s32 ssi_status;
24 __s32 svint; 24 __s32 ssi_int;
25 __u64 svptr; 25 __u64 ssi_ptr;
26 __u64 utime; 26 __u64 ssi_utime;
27 __u64 stime; 27 __u64 ssi_stime;
28 __u64 addr; 28 __u64 ssi_addr;
29 29
30 /* 30 /*
31 * Pad strcture to 128 bytes. Remember to update the 31 * Pad strcture to 128 bytes. Remember to update the
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 3a5bad3ad126..f3a8eecd99f3 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -53,7 +53,7 @@ int slab_is_available(void);
53 53
54struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 54struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
55 unsigned long, 55 unsigned long,
56 void (*)(void *, struct kmem_cache *, unsigned long)); 56 void (*)(struct kmem_cache *, void *));
57void kmem_cache_destroy(struct kmem_cache *); 57void kmem_cache_destroy(struct kmem_cache *);
58int kmem_cache_shrink(struct kmem_cache *); 58int kmem_cache_shrink(struct kmem_cache *);
59void kmem_cache_free(struct kmem_cache *, void *); 59void kmem_cache_free(struct kmem_cache *, void *);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index d65159d1d4f5..40801e754afb 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -49,7 +49,7 @@ struct kmem_cache {
49 /* Allocation and freeing of slabs */ 49 /* Allocation and freeing of slabs */
50 int objects; /* Number of objects in slab */ 50 int objects; /* Number of objects in slab */
51 int refcount; /* Refcount for slab cache destroy */ 51 int refcount; /* Refcount for slab cache destroy */
52 void (*ctor)(void *, struct kmem_cache *, unsigned long); 52 void (*ctor)(struct kmem_cache *, void *);
53 int inuse; /* Offset to metadata */ 53 int inuse; /* Offset to metadata */
54 int align; /* Alignment */ 54 int align; /* Alignment */
55 const char *name; /* Name (only for display!) */ 55 const char *name; /* Name (only for display!) */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index edf681a7fd8f..4f3838adbb30 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -158,11 +158,6 @@ struct swap_list_t {
158/* Swap 50% full? Release swapcache more aggressively.. */ 158/* Swap 50% full? Release swapcache more aggressively.. */
159#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 159#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
160 160
161/* linux/mm/oom_kill.c */
162extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
163extern int register_oom_notifier(struct notifier_block *nb);
164extern int unregister_oom_notifier(struct notifier_block *nb);
165
166/* linux/mm/memory.c */ 161/* linux/mm/memory.c */
167extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 162extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
168 163
diff --git a/include/linux/time.h b/include/linux/time.h
index 6a5f503b4f1d..b04136d60a2f 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -92,7 +92,7 @@ static inline struct timespec timespec_sub(struct timespec lhs,
92 92
93extern struct timespec xtime; 93extern struct timespec xtime;
94extern struct timespec wall_to_monotonic; 94extern struct timespec wall_to_monotonic;
95extern seqlock_t xtime_lock __attribute__((weak)); 95extern seqlock_t xtime_lock;
96 96
97extern unsigned long read_persistent_clock(void); 97extern unsigned long read_persistent_clock(void);
98extern int update_persistent_clock(struct timespec now); 98extern int update_persistent_clock(struct timespec now);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 60478f6e5dc6..56164d7ba0ad 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -81,11 +81,6 @@ struct tty_bufhead {
81 int memory_used; /* Buffer space used excluding free queue */ 81 int memory_used; /* Buffer space used excluding free queue */
82}; 82};
83/* 83/*
84 * The pty uses char_buf and flag_buf as a contiguous buffer
85 */
86#define PTY_BUF_SIZE 4*TTY_FLIPBUF_SIZE
87
88/*
89 * When a break, frame error, or parity error happens, these codes are 84 * When a break, frame error, or parity error happens, these codes are
90 * stuffed into the flags buffer. 85 * stuffed into the flags buffer.
91 */ 86 */
@@ -321,6 +316,9 @@ extern void tty_flip_buffer_push(struct tty_struct *tty);
321extern speed_t tty_get_baud_rate(struct tty_struct *tty); 316extern speed_t tty_get_baud_rate(struct tty_struct *tty);
322extern speed_t tty_termios_baud_rate(struct ktermios *termios); 317extern speed_t tty_termios_baud_rate(struct ktermios *termios);
323extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 318extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
319extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud);
320extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud);
321extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
324 322
325extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 323extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
326extern void tty_ldisc_deref(struct tty_ldisc *); 324extern void tty_ldisc_deref(struct tty_ldisc *);
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index daeba22b7656..10b854d3561f 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -46,11 +46,6 @@ typedef __u32 __bitwise __fs32;
46typedef __u16 __bitwise __fs16; 46typedef __u16 __bitwise __fs16;
47#endif 47#endif
48 48
49#ifdef __KERNEL__
50#include <linux/ufs_fs_i.h>
51#include <linux/ufs_fs_sb.h>
52#endif
53
54#define UFS_BBLOCK 0 49#define UFS_BBLOCK 0
55#define UFS_BBSIZE 8192 50#define UFS_BBSIZE 8192
56#define UFS_SBLOCK 8192 51#define UFS_SBLOCK 8192
@@ -170,8 +165,9 @@ typedef __u16 __bitwise __fs16;
170#define UFS_ST_MASK 0x00000700 /* mask for the following */ 165#define UFS_ST_MASK 0x00000700 /* mask for the following */
171#define UFS_ST_OLD 0x00000000 166#define UFS_ST_OLD 0x00000000
172#define UFS_ST_44BSD 0x00000100 167#define UFS_ST_44BSD 0x00000100
173#define UFS_ST_SUN 0x00000200 168#define UFS_ST_SUN 0x00000200 /* Solaris */
174#define UFS_ST_SUNx86 0x00000400 169#define UFS_ST_SUNOS 0x00000300
170#define UFS_ST_SUNx86 0x00000400 /* Solaris x86 */
175/*cylinder group encoding */ 171/*cylinder group encoding */
176#define UFS_CG_MASK 0x00003000 /* mask for the following */ 172#define UFS_CG_MASK 0x00003000 /* mask for the following */
177#define UFS_CG_OLD 0x00000000 173#define UFS_CG_OLD 0x00000000
@@ -187,28 +183,6 @@ typedef __u16 __bitwise __fs16;
187#define UFS_42INODEFMT -1 183#define UFS_42INODEFMT -1
188#define UFS_44INODEFMT 2 184#define UFS_44INODEFMT 2
189 185
190/* mount options */
191#define UFS_MOUNT_ONERROR 0x0000000F
192#define UFS_MOUNT_ONERROR_PANIC 0x00000001
193#define UFS_MOUNT_ONERROR_LOCK 0x00000002
194#define UFS_MOUNT_ONERROR_UMOUNT 0x00000004
195#define UFS_MOUNT_ONERROR_REPAIR 0x00000008
196
197#define UFS_MOUNT_UFSTYPE 0x0000FFF0
198#define UFS_MOUNT_UFSTYPE_OLD 0x00000010
199#define UFS_MOUNT_UFSTYPE_44BSD 0x00000020
200#define UFS_MOUNT_UFSTYPE_SUN 0x00000040
201#define UFS_MOUNT_UFSTYPE_NEXTSTEP 0x00000080
202#define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD 0x00000100
203#define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000200
204#define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400
205#define UFS_MOUNT_UFSTYPE_HP 0x00000800
206#define UFS_MOUNT_UFSTYPE_UFS2 0x00001000
207
208#define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt
209#define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt
210#define ufs_test_opt(o,opt) ((o) & UFS_MOUNT_##opt)
211
212/* 186/*
213 * MINFREE gives the minimum acceptable percentage of file system 187 * MINFREE gives the minimum acceptable percentage of file system
214 * blocks which may be free. If the freelist drops below this level 188 * blocks which may be free. If the freelist drops below this level
@@ -223,19 +197,6 @@ typedef __u16 __bitwise __fs16;
223 */ 197 */
224#define UFS_MINFREE 5 198#define UFS_MINFREE 5
225#define UFS_DEFAULTOPT UFS_OPTTIME 199#define UFS_DEFAULTOPT UFS_OPTTIME
226
227/*
228 * Debug code
229 */
230#ifdef CONFIG_UFS_DEBUG
231# define UFSD(f, a...) { \
232 printk ("UFSD (%s, %d): %s:", \
233 __FILE__, __LINE__, __FUNCTION__); \
234 printk (f, ## a); \
235 }
236#else
237# define UFSD(f, a...) /**/
238#endif
239 200
240/* 201/*
241 * Turn file system block numbers into disk block addresses. 202 * Turn file system block numbers into disk block addresses.
@@ -374,7 +335,14 @@ struct ufs_csum_core {
374 * struct ufs_super_block_(first,second,third) instead. 335 * struct ufs_super_block_(first,second,third) instead.
375 */ 336 */
376struct ufs_super_block { 337struct ufs_super_block {
377 __fs32 fs_link; /* UNUSED */ 338 union {
339 struct {
340 __fs32 fs_link; /* UNUSED */
341 } fs_42;
342 struct {
343 __fs32 fs_state; /* file system state flag */
344 } fs_sun;
345 } fs_u0;
378 __fs32 fs_rlink; /* UNUSED */ 346 __fs32 fs_rlink; /* UNUSED */
379 __fs32 fs_sblkno; /* addr of super-block in filesys */ 347 __fs32 fs_sblkno; /* addr of super-block in filesys */
380 __fs32 fs_cblkno; /* offset of cyl-block in filesys */ 348 __fs32 fs_cblkno; /* offset of cyl-block in filesys */
@@ -545,6 +513,15 @@ struct ufs_super_block {
545#define CG_MAGIC 0x090255 513#define CG_MAGIC 0x090255
546#define ufs_cg_chkmagic(sb, ucg) \ 514#define ufs_cg_chkmagic(sb, ucg) \
547 (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC) 515 (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
516/*
517 * Macros for access to old cylinder group array structures
518 */
519#define ufs_ocg_blktot(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_btot)
520#define ufs_ocg_blks(sb, ucg, cylno) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_b[cylno])
521#define ufs_ocg_inosused(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_iused)
522#define ufs_ocg_blksfree(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_free)
523#define ufs_ocg_chkmagic(sb, ucg) \
524 (fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_magic) == CG_MAGIC)
548 525
549/* 526/*
550 * size of this structure is 172 B 527 * size of this structure is 172 B
@@ -590,6 +567,28 @@ struct ufs_cylinder_group {
590/* actually longer */ 567/* actually longer */
591}; 568};
592 569
570/* Historic Cylinder group info */
571struct ufs_old_cylinder_group {
572 __fs32 cg_link; /* linked list of cyl groups */
573 __fs32 cg_rlink; /* for incore cyl groups */
574 __fs32 cg_time; /* time last written */
575 __fs32 cg_cgx; /* we are the cgx'th cylinder group */
576 __fs16 cg_ncyl; /* number of cyl's this cg */
577 __fs16 cg_niblk; /* number of inode blocks this cg */
578 __fs32 cg_ndblk; /* number of data blocks this cg */
579 struct ufs_csum cg_cs; /* cylinder summary information */
580 __fs32 cg_rotor; /* position of last used block */
581 __fs32 cg_frotor; /* position of last used frag */
582 __fs32 cg_irotor; /* position of last used inode */
583 __fs32 cg_frsum[8]; /* counts of available frags */
584 __fs32 cg_btot[32]; /* block totals per cylinder */
585 __fs16 cg_b[32][8]; /* positions of free blocks */
586 __u8 cg_iused[256]; /* used inode map */
587 __fs32 cg_magic; /* magic number */
588 __u8 cg_free[1]; /* free block map */
589/* actually longer */
590};
591
593/* 592/*
594 * structure of an on-disk inode 593 * structure of an on-disk inode
595 */ 594 */
@@ -796,7 +795,14 @@ struct ufs_sb_private_info {
796 * ufs_super_block_third 356 795 * ufs_super_block_third 356
797 */ 796 */
798struct ufs_super_block_first { 797struct ufs_super_block_first {
799 __fs32 fs_link; 798 union {
799 struct {
800 __fs32 fs_link; /* UNUSED */
801 } fs_42;
802 struct {
803 __fs32 fs_state; /* file system state flag */
804 } fs_sun;
805 } fs_u0;
800 __fs32 fs_rlink; 806 __fs32 fs_rlink;
801 __fs32 fs_sblkno; 807 __fs32 fs_sblkno;
802 __fs32 fs_cblkno; 808 __fs32 fs_cblkno;
@@ -944,89 +950,4 @@ struct ufs_super_block_third {
944 __u8 fs_space[1]; 950 __u8 fs_space[1];
945}; 951};
946 952
947#ifdef __KERNEL__
948
949/* balloc.c */
950extern void ufs_free_fragments (struct inode *, u64, unsigned);
951extern void ufs_free_blocks (struct inode *, u64, unsigned);
952extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
953 unsigned, int *, struct page *);
954
955/* cylinder.c */
956extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
957extern void ufs_put_cylinder (struct super_block *, unsigned);
958
959/* dir.c */
960extern const struct inode_operations ufs_dir_inode_operations;
961extern int ufs_add_link (struct dentry *, struct inode *);
962extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
963extern int ufs_make_empty(struct inode *, struct inode *);
964extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
965extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
966extern int ufs_empty_dir (struct inode *);
967extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
968extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
969 struct page *page, struct inode *inode);
970
971/* file.c */
972extern const struct inode_operations ufs_file_inode_operations;
973extern const struct file_operations ufs_file_operations;
974
975extern const struct address_space_operations ufs_aops;
976
977/* ialloc.c */
978extern void ufs_free_inode (struct inode *inode);
979extern struct inode * ufs_new_inode (struct inode *, int);
980
981/* inode.c */
982extern void ufs_read_inode (struct inode *);
983extern void ufs_put_inode (struct inode *);
984extern int ufs_write_inode (struct inode *, int);
985extern int ufs_sync_inode (struct inode *);
986extern void ufs_delete_inode (struct inode *);
987extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
988extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
989
990/* namei.c */
991extern const struct file_operations ufs_dir_operations;
992
993/* super.c */
994extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
995extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
996extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
997
998/* symlink.c */
999extern const struct inode_operations ufs_fast_symlink_inode_operations;
1000
1001/* truncate.c */
1002extern int ufs_truncate (struct inode *, loff_t);
1003
1004static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
1005{
1006 return sb->s_fs_info;
1007}
1008
1009static inline struct ufs_inode_info *UFS_I(struct inode *inode)
1010{
1011 return container_of(inode, struct ufs_inode_info, vfs_inode);
1012}
1013
1014/*
1015 * Give cylinder group number for a file system block.
1016 * Give cylinder group block number for a file system block.
1017 */
1018/* #define ufs_dtog(d) ((d) / uspi->s_fpg) */
1019static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b)
1020{
1021 do_div(b, uspi->s_fpg);
1022 return b;
1023}
1024/* #define ufs_dtogd(d) ((d) % uspi->s_fpg) */
1025static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
1026{
1027 return do_div(b, uspi->s_fpg);
1028}
1029
1030#endif /* __KERNEL__ */
1031
1032#endif /* __LINUX_UFS_FS_H */ 953#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
index 6496caa82f9e..000000000000
--- a/include/linux/ufs_fs_i.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * linux/include/linux/ufs_fs_i.h
3 *
4 * Copyright (C) 1996
5 * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
6 * Laboratory for Computer Science Research Computing Facility
7 * Rutgers, The State University of New Jersey
8 *
9 * NeXTstep support added on February 5th 1998 by
10 * Niels Kristian Bech Jensen <nkbj@image.dk>.
11 */
12
13#ifndef _LINUX_UFS_FS_I_H
14#define _LINUX_UFS_FS_I_H
15
16struct ufs_inode_info {
17 union {
18 __fs32 i_data[15];
19 __u8 i_symlink[4*15];
20 __fs64 u2_i_data[15];
21 } i_u1;
22 __u32 i_flags;
23 __u32 i_shadow;
24 __u32 i_unused1;
25 __u32 i_unused2;
26 __u32 i_oeftflag;
27 __u16 i_osync;
28 __u64 i_lastfrag;
29 __u32 i_dir_start_lookup;
30 struct inode vfs_inode;
31};
32
33#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
index e114c93fc578..000000000000
--- a/include/linux/ufs_fs_sb.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * linux/include/linux/ufs_fs_sb.h
3 *
4 * Copyright (C) 1996
5 * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
6 * Laboratory for Computer Science Research Computing Facility
7 * Rutgers, The State University of New Jersey
8 *
9 * $Id: ufs_fs_sb.h,v 1.8 1998/05/06 12:04:40 jj Exp $
10 *
11 * Write support by Daniel Pirkl <daniel.pirkl@email.cz>
12 */
13
14#ifndef __LINUX_UFS_FS_SB_H
15#define __LINUX_UFS_FS_SB_H
16
17
18#define UFS_MAX_GROUP_LOADED 8
19#define UFS_CGNO_EMPTY ((unsigned)-1)
20
21struct ufs_sb_private_info;
22struct ufs_cg_private_info;
23struct ufs_csum;
24
25struct ufs_sb_info {
26 struct ufs_sb_private_info * s_uspi;
27 struct ufs_csum * s_csp;
28 unsigned s_bytesex;
29 unsigned s_flags;
30 struct buffer_head ** s_ucg;
31 struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED];
32 unsigned s_cgno[UFS_MAX_GROUP_LOADED];
33 unsigned short s_cg_loaded;
34 unsigned s_mount_opt;
35};
36
37#endif
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 699b7e9864fa..feb5e99a1079 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -87,6 +87,7 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last,
87extern char con_buf[CON_BUF_SIZE]; 87extern char con_buf[CON_BUF_SIZE];
88extern struct mutex con_buf_mtx; 88extern struct mutex con_buf_mtx;
89extern char vt_dont_switch; 89extern char vt_dont_switch;
90extern int default_utf8;
90 91
91struct vt_spawn_console { 92struct vt_spawn_console {
92 spinlock_t lock; 93 spinlock_t lock;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index d1321a81c9c4..bef7d66601cb 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,13 +62,13 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */
65}; 66};
66 67
67/* 68/*
68 * fs/fs-writeback.c 69 * fs/fs-writeback.c
69 */ 70 */
70void writeback_inodes(struct writeback_control *wbc); 71void writeback_inodes(struct writeback_control *wbc);
71void wake_up_inode(struct inode *inode);
72int inode_wait(void *); 72int inode_wait(void *);
73void sync_inodes_sb(struct super_block *, int wait); 73void sync_inodes_sb(struct super_block *, int wait);
74void sync_inodes(int wait); 74void sync_inodes(int wait);
@@ -80,6 +80,13 @@ static inline void wait_on_inode(struct inode *inode)
80 wait_on_bit(&inode->i_state, __I_LOCK, inode_wait, 80 wait_on_bit(&inode->i_state, __I_LOCK, inode_wait,
81 TASK_UNINTERRUPTIBLE); 81 TASK_UNINTERRUPTIBLE);
82} 82}
83static inline void inode_sync_wait(struct inode *inode)
84{
85 might_sleep();
86 wait_on_bit(&inode->i_state, __I_SYNC, inode_wait,
87 TASK_UNINTERRUPTIBLE);
88}
89
83 90
84/* 91/*
85 * mm/page-writeback.c 92 * mm/page-writeback.c
@@ -97,6 +104,10 @@ extern int dirty_expire_interval;
97extern int block_dump; 104extern int block_dump;
98extern int laptop_mode; 105extern int laptop_mode;
99 106
107extern int dirty_ratio_handler(struct ctl_table *table, int write,
108 struct file *filp, void __user *buffer, size_t *lenp,
109 loff_t *ppos);
110
100struct ctl_table; 111struct ctl_table;
101struct file; 112struct file;
102int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, 113int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
deleted file mode 100644
index 744f85011f1e..000000000000
--- a/include/scsi/Kbuild
+++ /dev/null
@@ -1,4 +0,0 @@
1header-y += scsi.h
2
3unifdef-y += scsi_ioctl.h
4unifdef-y += sg.h
diff --git a/init/Kconfig b/init/Kconfig
index 54f31a191b88..a29a688c47d3 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -689,3 +689,6 @@ config STOP_MACHINE
689 Need stop_machine() primitive. 689 Need stop_machine() primitive.
690 690
691source "block/Kconfig" 691source "block/Kconfig"
692
693config PREEMPT_NOTIFIERS
694 bool
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index a88934a1b769..79e24e878c1e 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -15,7 +15,6 @@
15#include <linux/sysctl.h> 15#include <linux/sysctl.h>
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17 17
18#ifdef CONFIG_IPC_NS
19static void *get_ipc(ctl_table *table) 18static void *get_ipc(ctl_table *table)
20{ 19{
21 char *which = table->data; 20 char *which = table->data;
@@ -23,9 +22,6 @@ static void *get_ipc(ctl_table *table)
23 which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns; 22 which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns;
24 return which; 23 return which;
25} 24}
26#else
27#define get_ipc(T) ((T)->data)
28#endif
29 25
30#ifdef CONFIG_PROC_FS 26#ifdef CONFIG_PROC_FS
31static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp, 27static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 24df3347ad4b..774843cff756 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -211,7 +211,7 @@ static int mqueue_get_sb(struct file_system_type *fs_type,
211 return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt); 211 return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt);
212} 212}
213 213
214static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags) 214static void init_once(struct kmem_cache *cachep, void *foo)
215{ 215{
216 struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo; 216 struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo;
217 217
diff --git a/ipc/shm.c b/ipc/shm.c
index a86a3a5c8a19..5fc5cf50cf1b 100644
--- 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)
233} 233}
234 234
235#ifdef CONFIG_NUMA 235#ifdef CONFIG_NUMA
236int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new) 236static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
237{ 237{
238 struct file *file = vma->vm_file; 238 struct file *file = vma->vm_file;
239 struct shm_file_data *sfd = shm_file_data(file); 239 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)
243 return err; 243 return err;
244} 244}
245 245
246struct mempolicy *shm_get_policy(struct vm_area_struct *vma, unsigned long addr) 246static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
247 unsigned long addr)
247{ 248{
248 struct file *file = vma->vm_file; 249 struct file *file = vma->vm_file;
249 struct shm_file_data *sfd = shm_file_data(file); 250 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)
906 goto out_unlock; 907 goto out_unlock;
907 908
908 path.dentry = dget(shp->shm_file->f_path.dentry); 909 path.dentry = dget(shp->shm_file->f_path.dentry);
909 path.mnt = mntget(shp->shm_file->f_path.mnt); 910 path.mnt = shp->shm_file->f_path.mnt;
910 shp->shm_nattch++; 911 shp->shm_nattch++;
911 size = i_size_read(path.dentry->d_inode); 912 size = i_size_read(path.dentry->d_inode);
912 shm_unlock(shp); 913 shm_unlock(shp);
@@ -914,18 +915,16 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
914 err = -ENOMEM; 915 err = -ENOMEM;
915 sfd = kzalloc(sizeof(*sfd), GFP_KERNEL); 916 sfd = kzalloc(sizeof(*sfd), GFP_KERNEL);
916 if (!sfd) 917 if (!sfd)
917 goto out_put_path; 918 goto out_put_dentry;
918 919
919 err = -ENOMEM; 920 err = -ENOMEM;
920 file = get_empty_filp(); 921
922 file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
921 if (!file) 923 if (!file)
922 goto out_free; 924 goto out_free;
923 925
924 file->f_op = &shm_file_operations;
925 file->private_data = sfd; 926 file->private_data = sfd;
926 file->f_path = path;
927 file->f_mapping = shp->shm_file->f_mapping; 927 file->f_mapping = shp->shm_file->f_mapping;
928 file->f_mode = f_mode;
929 sfd->id = shp->id; 928 sfd->id = shp->id;
930 sfd->ns = get_ipc_ns(ns); 929 sfd->ns = get_ipc_ns(ns);
931 sfd->file = shp->shm_file; 930 sfd->file = shp->shm_file;
@@ -976,9 +975,8 @@ out_unlock:
976 975
977out_free: 976out_free:
978 kfree(sfd); 977 kfree(sfd);
979out_put_path: 978out_put_dentry:
980 dput(path.dentry); 979 dput(path.dentry);
981 mntput(path.mnt);
982 goto out_nattch; 980 goto out_nattch;
983} 981}
984 982
diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index 6b066632e40c..c64ce9c14207 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -63,6 +63,3 @@ config PREEMPT_BKL
63 Say Y here if you are building a kernel for a desktop system. 63 Say Y here if you are building a kernel for a desktop system.
64 Say N if you are unsure. 64 Say N if you are unsure.
65 65
66config PREEMPT_NOTIFIERS
67 bool
68
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 0ae703c157ba..938e60a61882 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -45,7 +45,6 @@
45#include <linux/init.h> 45#include <linux/init.h>
46#include <asm/types.h> 46#include <asm/types.h>
47#include <asm/atomic.h> 47#include <asm/atomic.h>
48#include <asm/types.h>
49#include <linux/fs.h> 48#include <linux/fs.h>
50#include <linux/namei.h> 49#include <linux/namei.h>
51#include <linux/mm.h> 50#include <linux/mm.h>
diff --git a/kernel/capability.c b/kernel/capability.c
index c8d3c7762034..4e350a36ed6a 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -17,9 +17,6 @@
17unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */ 17unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */
18kernel_cap_t cap_bset = CAP_INIT_EFF_SET; 18kernel_cap_t cap_bset = CAP_INIT_EFF_SET;
19 19
20EXPORT_SYMBOL(securebits);
21EXPORT_SYMBOL(cap_bset);
22
23/* 20/*
24 * This lock protects task->cap_* for all tasks including current. 21 * This lock protects task->cap_* for all tasks including current.
25 * Locking rule: acquire this prior to tasklist_lock. 22 * Locking rule: acquire this prior to tasklist_lock.
@@ -244,7 +241,6 @@ int __capable(struct task_struct *t, int cap)
244 } 241 }
245 return 0; 242 return 0;
246} 243}
247EXPORT_SYMBOL(__capable);
248 244
249int capable(int cap) 245int capable(int cap)
250{ 246{
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 0864f4097930..2eb2e50db0d6 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2506,41 +2506,20 @@ int cpuset_mem_spread_node(void)
2506EXPORT_SYMBOL_GPL(cpuset_mem_spread_node); 2506EXPORT_SYMBOL_GPL(cpuset_mem_spread_node);
2507 2507
2508/** 2508/**
2509 * cpuset_excl_nodes_overlap - Do we overlap @p's mem_exclusive ancestors? 2509 * cpuset_mems_allowed_intersects - Does @tsk1's mems_allowed intersect @tsk2's?
2510 * @p: pointer to task_struct of some other task. 2510 * @tsk1: pointer to task_struct of some task.
2511 * 2511 * @tsk2: pointer to task_struct of some other task.
2512 * Description: Return true if the nearest mem_exclusive ancestor 2512 *
2513 * cpusets of tasks @p and current overlap. Used by oom killer to 2513 * Description: Return true if @tsk1's mems_allowed intersects the
2514 * determine if task @p's memory usage might impact the memory 2514 * mems_allowed of @tsk2. Used by the OOM killer to determine if
2515 * available to the current task. 2515 * one of the task's memory usage might impact the memory available
2516 * 2516 * to the other.
2517 * Call while holding callback_mutex.
2518 **/ 2517 **/
2519 2518
2520int cpuset_excl_nodes_overlap(const struct task_struct *p) 2519int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
2520 const struct task_struct *tsk2)
2521{ 2521{
2522 const struct cpuset *cs1, *cs2; /* my and p's cpuset ancestors */ 2522 return nodes_intersects(tsk1->mems_allowed, tsk2->mems_allowed);
2523 int overlap = 1; /* do cpusets overlap? */
2524
2525 task_lock(current);
2526 if (current->flags & PF_EXITING) {
2527 task_unlock(current);
2528 goto done;
2529 }
2530 cs1 = nearest_exclusive_ancestor(current->cpuset);
2531 task_unlock(current);
2532
2533 task_lock((struct task_struct *)p);
2534 if (p->flags & PF_EXITING) {
2535 task_unlock((struct task_struct *)p);
2536 goto done;
2537 }
2538 cs2 = nearest_exclusive_ancestor(p->cpuset);
2539 task_unlock((struct task_struct *)p);
2540
2541 overlap = nodes_intersects(cs1->mems_allowed, cs2->mems_allowed);
2542done:
2543 return overlap;
2544} 2523}
2545 2524
2546/* 2525/*
diff --git a/kernel/exit.c b/kernel/exit.c
index 7f7959de4a87..2c704c86edb3 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -44,7 +44,6 @@
44#include <linux/resource.h> 44#include <linux/resource.h>
45#include <linux/blkdev.h> 45#include <linux/blkdev.h>
46#include <linux/task_io_accounting_ops.h> 46#include <linux/task_io_accounting_ops.h>
47#include <linux/freezer.h>
48 47
49#include <asm/uaccess.h> 48#include <asm/uaccess.h>
50#include <asm/unistd.h> 49#include <asm/unistd.h>
@@ -93,10 +92,9 @@ static void __exit_signal(struct task_struct *tsk)
93 * If there is any task waiting for the group exit 92 * If there is any task waiting for the group exit
94 * then notify it: 93 * then notify it:
95 */ 94 */
96 if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count) { 95 if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count)
97 wake_up_process(sig->group_exit_task); 96 wake_up_process(sig->group_exit_task);
98 sig->group_exit_task = NULL; 97
99 }
100 if (tsk == sig->curr_target) 98 if (tsk == sig->curr_target)
101 sig->curr_target = next_thread(tsk); 99 sig->curr_target = next_thread(tsk);
102 /* 100 /*
@@ -593,17 +591,6 @@ static void exit_mm(struct task_struct * tsk)
593 mmput(mm); 591 mmput(mm);
594} 592}
595 593
596static inline void
597choose_new_parent(struct task_struct *p, struct task_struct *reaper)
598{
599 /*
600 * Make sure we're not reparenting to ourselves and that
601 * the parent is not a zombie.
602 */
603 BUG_ON(p == reaper || reaper->exit_state);
604 p->real_parent = reaper;
605}
606
607static void 594static void
608reparent_thread(struct task_struct *p, struct task_struct *father, int traced) 595reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
609{ 596{
@@ -711,7 +698,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
711 698
712 if (father == p->real_parent) { 699 if (father == p->real_parent) {
713 /* reparent with a reaper, real father it's us */ 700 /* reparent with a reaper, real father it's us */
714 choose_new_parent(p, reaper); 701 p->real_parent = reaper;
715 reparent_thread(p, father, 0); 702 reparent_thread(p, father, 0);
716 } else { 703 } else {
717 /* reparent ptraced task to its real parent */ 704 /* reparent ptraced task to its real parent */
@@ -732,7 +719,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
732 } 719 }
733 list_for_each_safe(_p, _n, &father->ptrace_children) { 720 list_for_each_safe(_p, _n, &father->ptrace_children) {
734 p = list_entry(_p, struct task_struct, ptrace_list); 721 p = list_entry(_p, struct task_struct, ptrace_list);
735 choose_new_parent(p, reaper); 722 p->real_parent = reaper;
736 reparent_thread(p, father, 1); 723 reparent_thread(p, father, 1);
737 } 724 }
738} 725}
@@ -759,13 +746,11 @@ static void exit_notify(struct task_struct *tsk)
759 * Now we'll wake all the threads in the group just to make 746 * Now we'll wake all the threads in the group just to make
760 * sure someone gets all the pending signals. 747 * sure someone gets all the pending signals.
761 */ 748 */
762 read_lock(&tasklist_lock);
763 spin_lock_irq(&tsk->sighand->siglock); 749 spin_lock_irq(&tsk->sighand->siglock);
764 for (t = next_thread(tsk); t != tsk; t = next_thread(t)) 750 for (t = next_thread(tsk); t != tsk; t = next_thread(t))
765 if (!signal_pending(t) && !(t->flags & PF_EXITING)) 751 if (!signal_pending(t) && !(t->flags & PF_EXITING))
766 recalc_sigpending_and_wake(t); 752 recalc_sigpending_and_wake(t);
767 spin_unlock_irq(&tsk->sighand->siglock); 753 spin_unlock_irq(&tsk->sighand->siglock);
768 read_unlock(&tasklist_lock);
769 } 754 }
770 755
771 write_lock_irq(&tasklist_lock); 756 write_lock_irq(&tasklist_lock);
@@ -793,9 +778,8 @@ static void exit_notify(struct task_struct *tsk)
793 * and we were the only connection outside, so our pgrp 778 * and we were the only connection outside, so our pgrp
794 * is about to become orphaned. 779 * is about to become orphaned.
795 */ 780 */
796
797 t = tsk->real_parent; 781 t = tsk->real_parent;
798 782
799 pgrp = task_pgrp(tsk); 783 pgrp = task_pgrp(tsk);
800 if ((task_pgrp(t) != pgrp) && 784 if ((task_pgrp(t) != pgrp) &&
801 (task_session(t) == task_session(tsk)) && 785 (task_session(t) == task_session(tsk)) &&
@@ -842,6 +826,11 @@ static void exit_notify(struct task_struct *tsk)
842 state = EXIT_DEAD; 826 state = EXIT_DEAD;
843 tsk->exit_state = state; 827 tsk->exit_state = state;
844 828
829 if (thread_group_leader(tsk) &&
830 tsk->signal->notify_count < 0 &&
831 tsk->signal->group_exit_task)
832 wake_up_process(tsk->signal->group_exit_task);
833
845 write_unlock_irq(&tasklist_lock); 834 write_unlock_irq(&tasklist_lock);
846 835
847 list_for_each_safe(_p, _n, &ptrace_dead) { 836 list_for_each_safe(_p, _n, &ptrace_dead) {
@@ -883,6 +872,14 @@ static void check_stack_usage(void)
883static inline void check_stack_usage(void) {} 872static inline void check_stack_usage(void) {}
884#endif 873#endif
885 874
875static inline void exit_child_reaper(struct task_struct *tsk)
876{
877 if (likely(tsk->group_leader != child_reaper(tsk)))
878 return;
879
880 panic("Attempted to kill init!");
881}
882
886fastcall NORET_TYPE void do_exit(long code) 883fastcall NORET_TYPE void do_exit(long code)
887{ 884{
888 struct task_struct *tsk = current; 885 struct task_struct *tsk = current;
@@ -896,13 +893,6 @@ fastcall NORET_TYPE void do_exit(long code)
896 panic("Aiee, killing interrupt handler!"); 893 panic("Aiee, killing interrupt handler!");
897 if (unlikely(!tsk->pid)) 894 if (unlikely(!tsk->pid))
898 panic("Attempted to kill the idle task!"); 895 panic("Attempted to kill the idle task!");
899 if (unlikely(tsk == child_reaper(tsk))) {
900 if (tsk->nsproxy->pid_ns != &init_pid_ns)
901 tsk->nsproxy->pid_ns->child_reaper = init_pid_ns.child_reaper;
902 else
903 panic("Attempted to kill init!");
904 }
905
906 896
907 if (unlikely(current->ptrace & PT_TRACE_EXIT)) { 897 if (unlikely(current->ptrace & PT_TRACE_EXIT)) {
908 current->ptrace_message = code; 898 current->ptrace_message = code;
@@ -932,13 +922,13 @@ fastcall NORET_TYPE void do_exit(long code)
932 schedule(); 922 schedule();
933 } 923 }
934 924
925 tsk->flags |= PF_EXITING;
935 /* 926 /*
936 * tsk->flags are checked in the futex code to protect against 927 * tsk->flags are checked in the futex code to protect against
937 * an exiting task cleaning up the robust pi futexes. 928 * an exiting task cleaning up the robust pi futexes.
938 */ 929 */
939 spin_lock_irq(&tsk->pi_lock); 930 smp_mb();
940 tsk->flags |= PF_EXITING; 931 spin_unlock_wait(&tsk->pi_lock);
941 spin_unlock_irq(&tsk->pi_lock);
942 932
943 if (unlikely(in_atomic())) 933 if (unlikely(in_atomic()))
944 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", 934 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
@@ -952,16 +942,19 @@ fastcall NORET_TYPE void do_exit(long code)
952 } 942 }
953 group_dead = atomic_dec_and_test(&tsk->signal->live); 943 group_dead = atomic_dec_and_test(&tsk->signal->live);
954 if (group_dead) { 944 if (group_dead) {
945 exit_child_reaper(tsk);
955 hrtimer_cancel(&tsk->signal->real_timer); 946 hrtimer_cancel(&tsk->signal->real_timer);
956 exit_itimers(tsk->signal); 947 exit_itimers(tsk->signal);
957 } 948 }
958 acct_collect(code, group_dead); 949 acct_collect(code, group_dead);
950#ifdef CONFIG_FUTEX
959 if (unlikely(tsk->robust_list)) 951 if (unlikely(tsk->robust_list))
960 exit_robust_list(tsk); 952 exit_robust_list(tsk);
961#if defined(CONFIG_FUTEX) && defined(CONFIG_COMPAT) 953#ifdef CONFIG_COMPAT
962 if (unlikely(tsk->compat_robust_list)) 954 if (unlikely(tsk->compat_robust_list))
963 compat_exit_robust_list(tsk); 955 compat_exit_robust_list(tsk);
964#endif 956#endif
957#endif
965 if (group_dead) 958 if (group_dead)
966 tty_audit_exit(); 959 tty_audit_exit();
967 if (unlikely(tsk->audit_context)) 960 if (unlikely(tsk->audit_context))
@@ -996,6 +989,7 @@ fastcall NORET_TYPE void do_exit(long code)
996 mpol_free(tsk->mempolicy); 989 mpol_free(tsk->mempolicy);
997 tsk->mempolicy = NULL; 990 tsk->mempolicy = NULL;
998#endif 991#endif
992#ifdef CONFIG_FUTEX
999 /* 993 /*
1000 * This must happen late, after the PID is not 994 * This must happen late, after the PID is not
1001 * hashed anymore: 995 * hashed anymore:
@@ -1004,6 +998,7 @@ fastcall NORET_TYPE void do_exit(long code)
1004 exit_pi_state_list(tsk); 998 exit_pi_state_list(tsk);
1005 if (unlikely(current->pi_state_cache)) 999 if (unlikely(current->pi_state_cache))
1006 kfree(current->pi_state_cache); 1000 kfree(current->pi_state_cache);
1001#endif
1007 /* 1002 /*
1008 * Make sure we are holding no locks: 1003 * Make sure we are holding no locks:
1009 */ 1004 */
@@ -1168,8 +1163,7 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
1168 int __user *stat_addr, struct rusage __user *ru) 1163 int __user *stat_addr, struct rusage __user *ru)
1169{ 1164{
1170 unsigned long state; 1165 unsigned long state;
1171 int retval; 1166 int retval, status, traced;
1172 int status;
1173 1167
1174 if (unlikely(noreap)) { 1168 if (unlikely(noreap)) {
1175 pid_t pid = p->pid; 1169 pid_t pid = p->pid;
@@ -1203,15 +1197,11 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
1203 BUG_ON(state != EXIT_DEAD); 1197 BUG_ON(state != EXIT_DEAD);
1204 return 0; 1198 return 0;
1205 } 1199 }
1206 if (unlikely(p->exit_signal == -1 && p->ptrace == 0)) {
1207 /*
1208 * This can only happen in a race with a ptraced thread
1209 * dying on another processor.
1210 */
1211 return 0;
1212 }
1213 1200
1214 if (likely(p->real_parent == p->parent) && likely(p->signal)) { 1201 /* traced means p->ptrace, but not vice versa */
1202 traced = (p->real_parent != p->parent);
1203
1204 if (likely(!traced)) {
1215 struct signal_struct *psig; 1205 struct signal_struct *psig;
1216 struct signal_struct *sig; 1206 struct signal_struct *sig;
1217 1207
@@ -1298,35 +1288,30 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
1298 retval = put_user(p->pid, &infop->si_pid); 1288 retval = put_user(p->pid, &infop->si_pid);
1299 if (!retval && infop) 1289 if (!retval && infop)
1300 retval = put_user(p->uid, &infop->si_uid); 1290 retval = put_user(p->uid, &infop->si_uid);
1301 if (retval) { 1291 if (!retval)
1302 // TODO: is this safe? 1292 retval = p->pid;
1303 p->exit_state = EXIT_ZOMBIE; 1293
1304 return retval; 1294 if (traced) {
1305 }
1306 retval = p->pid;
1307 if (p->real_parent != p->parent) {
1308 write_lock_irq(&tasklist_lock); 1295 write_lock_irq(&tasklist_lock);
1309 /* Double-check with lock held. */ 1296 /* We dropped tasklist, ptracer could die and untrace */
1310 if (p->real_parent != p->parent) { 1297 ptrace_unlink(p);
1311 __ptrace_unlink(p); 1298 /*
1312 // TODO: is this safe? 1299 * If this is not a detached task, notify the parent.
1313 p->exit_state = EXIT_ZOMBIE; 1300 * If it's still not detached after that, don't release
1314 /* 1301 * it now.
1315 * If this is not a detached task, notify the parent. 1302 */
1316 * If it's still not detached after that, don't release 1303 if (p->exit_signal != -1) {
1317 * it now. 1304 do_notify_parent(p, p->exit_signal);
1318 */
1319 if (p->exit_signal != -1) { 1305 if (p->exit_signal != -1) {
1320 do_notify_parent(p, p->exit_signal); 1306 p->exit_state = EXIT_ZOMBIE;
1321 if (p->exit_signal != -1) 1307 p = NULL;
1322 p = NULL;
1323 } 1308 }
1324 } 1309 }
1325 write_unlock_irq(&tasklist_lock); 1310 write_unlock_irq(&tasklist_lock);
1326 } 1311 }
1327 if (p != NULL) 1312 if (p != NULL)
1328 release_task(p); 1313 release_task(p);
1329 BUG_ON(!retval); 1314
1330 return retval; 1315 return retval;
1331} 1316}
1332 1317
@@ -1345,7 +1330,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1345 if (!p->exit_code) 1330 if (!p->exit_code)
1346 return 0; 1331 return 0;
1347 if (delayed_group_leader && !(p->ptrace & PT_PTRACED) && 1332 if (delayed_group_leader && !(p->ptrace & PT_PTRACED) &&
1348 p->signal && p->signal->group_stop_count > 0) 1333 p->signal->group_stop_count > 0)
1349 /* 1334 /*
1350 * A group stop is in progress and this is the group leader. 1335 * A group stop is in progress and this is the group leader.
1351 * We won't report until all threads have stopped. 1336 * We won't report until all threads have stopped.
@@ -1459,9 +1444,6 @@ static int wait_task_continued(struct task_struct *p, int noreap,
1459 pid_t pid; 1444 pid_t pid;
1460 uid_t uid; 1445 uid_t uid;
1461 1446
1462 if (unlikely(!p->signal))
1463 return 0;
1464
1465 if (!(p->signal->flags & SIGNAL_STOP_CONTINUED)) 1447 if (!(p->signal->flags & SIGNAL_STOP_CONTINUED))
1466 return 0; 1448 return 0;
1467 1449
diff --git a/kernel/fork.c b/kernel/fork.c
index 3fc3c1383912..490495a39c7e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -107,6 +107,7 @@ static struct kmem_cache *mm_cachep;
107 107
108void free_task(struct task_struct *tsk) 108void free_task(struct task_struct *tsk)
109{ 109{
110 prop_local_destroy_single(&tsk->dirties);
110 free_thread_info(tsk->stack); 111 free_thread_info(tsk->stack);
111 rt_mutex_debug_task_free(tsk); 112 rt_mutex_debug_task_free(tsk);
112 free_task_struct(tsk); 113 free_task_struct(tsk);
@@ -163,6 +164,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
163{ 164{
164 struct task_struct *tsk; 165 struct task_struct *tsk;
165 struct thread_info *ti; 166 struct thread_info *ti;
167 int err;
166 168
167 prepare_to_copy(orig); 169 prepare_to_copy(orig);
168 170
@@ -178,6 +180,14 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
178 180
179 *tsk = *orig; 181 *tsk = *orig;
180 tsk->stack = ti; 182 tsk->stack = ti;
183
184 err = prop_local_init_single(&tsk->dirties);
185 if (err) {
186 free_thread_info(ti);
187 free_task_struct(tsk);
188 return NULL;
189 }
190
181 setup_thread_stack(tsk, orig); 191 setup_thread_stack(tsk, orig);
182 192
183#ifdef CONFIG_CC_STACKPROTECTOR 193#ifdef CONFIG_CC_STACKPROTECTOR
@@ -1069,7 +1079,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1069 do_posix_clock_monotonic_gettime(&p->start_time); 1079 do_posix_clock_monotonic_gettime(&p->start_time);
1070 p->real_start_time = p->start_time; 1080 p->real_start_time = p->start_time;
1071 monotonic_to_bootbased(&p->real_start_time); 1081 monotonic_to_bootbased(&p->real_start_time);
1082#ifdef CONFIG_SECURITY
1072 p->security = NULL; 1083 p->security = NULL;
1084#endif
1073 p->io_context = NULL; 1085 p->io_context = NULL;
1074 p->io_wait = NULL; 1086 p->io_wait = NULL;
1075 p->audit_context = NULL; 1087 p->audit_context = NULL;
@@ -1146,13 +1158,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1146 * Clear TID on mm_release()? 1158 * Clear TID on mm_release()?
1147 */ 1159 */
1148 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL; 1160 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
1161#ifdef CONFIG_FUTEX
1149 p->robust_list = NULL; 1162 p->robust_list = NULL;
1150#ifdef CONFIG_COMPAT 1163#ifdef CONFIG_COMPAT
1151 p->compat_robust_list = NULL; 1164 p->compat_robust_list = NULL;
1152#endif 1165#endif
1153 INIT_LIST_HEAD(&p->pi_state_list); 1166 INIT_LIST_HEAD(&p->pi_state_list);
1154 p->pi_state_cache = NULL; 1167 p->pi_state_cache = NULL;
1155 1168#endif
1156 /* 1169 /*
1157 * sigaltstack should be cleared when sharing the same VM 1170 * sigaltstack should be cleared when sharing the same VM
1158 */ 1171 */
@@ -1435,8 +1448,7 @@ long do_fork(unsigned long clone_flags,
1435#define ARCH_MIN_MMSTRUCT_ALIGN 0 1448#define ARCH_MIN_MMSTRUCT_ALIGN 0
1436#endif 1449#endif
1437 1450
1438static void sighand_ctor(void *data, struct kmem_cache *cachep, 1451static void sighand_ctor(struct kmem_cache *cachep, void *data)
1439 unsigned long flags)
1440{ 1452{
1441 struct sighand_struct *sighand = data; 1453 struct sighand_struct *sighand = data;
1442 1454
diff --git a/kernel/futex.c b/kernel/futex.c
index fcc94e7b4086..d725676d84f3 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -52,6 +52,7 @@
52#include <linux/syscalls.h> 52#include <linux/syscalls.h>
53#include <linux/signal.h> 53#include <linux/signal.h>
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/magic.h>
55#include <asm/futex.h> 56#include <asm/futex.h>
56 57
57#include "rtmutex_common.h" 58#include "rtmutex_common.h"
@@ -2080,7 +2081,7 @@ static int futexfs_get_sb(struct file_system_type *fs_type,
2080 int flags, const char *dev_name, void *data, 2081 int flags, const char *dev_name, void *data,
2081 struct vfsmount *mnt) 2082 struct vfsmount *mnt)
2082{ 2083{
2083 return get_sb_pseudo(fs_type, "futex", NULL, 0xBAD1DEA, mnt); 2084 return get_sb_pseudo(fs_type, "futex", NULL, FUTEXFS_SUPER_MAGIC, mnt);
2084} 2085}
2085 2086
2086static struct file_system_type futex_fs_type = { 2087static struct file_system_type futex_fs_type = {
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index f1a73f0b54e7..9b5dff6b3f6a 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -503,7 +503,6 @@ out_unlock:
503 spin_unlock(&desc->lock); 503 spin_unlock(&desc->lock);
504} 504}
505 505
506#ifdef CONFIG_SMP
507/** 506/**
508 * handle_percpu_IRQ - Per CPU local irq handler 507 * handle_percpu_IRQ - Per CPU local irq handler
509 * @irq: the interrupt number 508 * @irq: the interrupt number
@@ -529,8 +528,6 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
529 desc->chip->eoi(irq); 528 desc->chip->eoi(irq);
530} 529}
531 530
532#endif /* CONFIG_SMP */
533
534void 531void
535__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, 532__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
536 const char *name) 533 const char *name)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 7230d914eaa2..80eab7a04205 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -405,7 +405,6 @@ void free_irq(unsigned int irq, void *dev_id)
405 struct irq_desc *desc; 405 struct irq_desc *desc;
406 struct irqaction **p; 406 struct irqaction **p;
407 unsigned long flags; 407 unsigned long flags;
408 irqreturn_t (*handler)(int, void *) = NULL;
409 408
410 WARN_ON(in_interrupt()); 409 WARN_ON(in_interrupt());
411 if (irq >= NR_IRQS) 410 if (irq >= NR_IRQS)
@@ -445,8 +444,21 @@ void free_irq(unsigned int irq, void *dev_id)
445 444
446 /* Make sure it's not being used on another CPU */ 445 /* Make sure it's not being used on another CPU */
447 synchronize_irq(irq); 446 synchronize_irq(irq);
448 if (action->flags & IRQF_SHARED) 447#ifdef CONFIG_DEBUG_SHIRQ
449 handler = action->handler; 448 /*
449 * It's a shared IRQ -- the driver ought to be
450 * prepared for it to happen even now it's
451 * being freed, so let's make sure.... We do
452 * this after actually deregistering it, to
453 * make sure that a 'real' IRQ doesn't run in
454 * parallel with our fake
455 */
456 if (action->flags & IRQF_SHARED) {
457 local_irq_save(flags);
458 action->handler(irq, dev_id);
459 local_irq_restore(flags);
460 }
461#endif
450 kfree(action); 462 kfree(action);
451 return; 463 return;
452 } 464 }
@@ -454,19 +466,6 @@ void free_irq(unsigned int irq, void *dev_id)
454 spin_unlock_irqrestore(&desc->lock, flags); 466 spin_unlock_irqrestore(&desc->lock, flags);
455 return; 467 return;
456 } 468 }
457#ifdef CONFIG_DEBUG_SHIRQ
458 if (handler) {
459 /*
460 * It's a shared IRQ -- the driver ought to be prepared for it
461 * to happen even now it's being freed, so let's make sure....
462 * We do this after actually deregistering it, to make sure that
463 * a 'real' IRQ doesn't run in parallel with our fake
464 */
465 local_irq_save(flags);
466 handler(irq, dev_id);
467 local_irq_restore(flags);
468 }
469#endif
470} 469}
471EXPORT_SYMBOL(free_irq); 470EXPORT_SYMBOL(free_irq);
472 471
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 25db14b89e82..7885269b0da2 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -17,21 +17,30 @@
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/syscalls.h> 18#include <linux/syscalls.h>
19#include <linux/reboot.h> 19#include <linux/reboot.h>
20#include <linux/syscalls.h>
21#include <linux/ioport.h> 20#include <linux/ioport.h>
22#include <linux/hardirq.h> 21#include <linux/hardirq.h>
23#include <linux/elf.h> 22#include <linux/elf.h>
24#include <linux/elfcore.h> 23#include <linux/elfcore.h>
24#include <linux/utsrelease.h>
25#include <linux/utsname.h>
26#include <linux/numa.h>
25 27
26#include <asm/page.h> 28#include <asm/page.h>
27#include <asm/uaccess.h> 29#include <asm/uaccess.h>
28#include <asm/io.h> 30#include <asm/io.h>
29#include <asm/system.h> 31#include <asm/system.h>
30#include <asm/semaphore.h> 32#include <asm/semaphore.h>
33#include <asm/sections.h>
31 34
32/* Per cpu memory for storing cpu states in case of system crash. */ 35/* Per cpu memory for storing cpu states in case of system crash. */
33note_buf_t* crash_notes; 36note_buf_t* crash_notes;
34 37
38/* vmcoreinfo stuff */
39unsigned char vmcoreinfo_data[VMCOREINFO_BYTES];
40u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
41size_t vmcoreinfo_size;
42size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data);
43
35/* Location of the reserved area for the crash kernel */ 44/* Location of the reserved area for the crash kernel */
36struct resource crashk_res = { 45struct resource crashk_res = {
37 .name = "Crash kernel", 46 .name = "Crash kernel",
@@ -1061,6 +1070,7 @@ void crash_kexec(struct pt_regs *regs)
1061 if (kexec_crash_image) { 1070 if (kexec_crash_image) {
1062 struct pt_regs fixed_regs; 1071 struct pt_regs fixed_regs;
1063 crash_setup_regs(&fixed_regs, regs); 1072 crash_setup_regs(&fixed_regs, regs);
1073 crash_save_vmcoreinfo();
1064 machine_crash_shutdown(&fixed_regs); 1074 machine_crash_shutdown(&fixed_regs);
1065 machine_kexec(kexec_crash_image); 1075 machine_kexec(kexec_crash_image);
1066 } 1076 }
@@ -1135,3 +1145,104 @@ static int __init crash_notes_memory_init(void)
1135 return 0; 1145 return 0;
1136} 1146}
1137module_init(crash_notes_memory_init) 1147module_init(crash_notes_memory_init)
1148
1149void crash_save_vmcoreinfo(void)
1150{
1151 u32 *buf;
1152
1153 if (!vmcoreinfo_size)
1154 return;
1155
1156 vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds());
1157
1158 buf = (u32 *)vmcoreinfo_note;
1159
1160 buf = append_elf_note(buf, VMCOREINFO_NOTE_NAME, 0, vmcoreinfo_data,
1161 vmcoreinfo_size);
1162
1163 final_note(buf);
1164}
1165
1166void vmcoreinfo_append_str(const char *fmt, ...)
1167{
1168 va_list args;
1169 char buf[0x50];
1170 int r;
1171
1172 va_start(args, fmt);
1173 r = vsnprintf(buf, sizeof(buf), fmt, args);
1174 va_end(args);
1175
1176 if (r + vmcoreinfo_size > vmcoreinfo_max_size)
1177 r = vmcoreinfo_max_size - vmcoreinfo_size;
1178
1179 memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r);
1180
1181 vmcoreinfo_size += r;
1182}
1183
1184/*
1185 * provide an empty default implementation here -- architecture
1186 * code may override this
1187 */
1188void __attribute__ ((weak)) arch_crash_save_vmcoreinfo(void)
1189{}
1190
1191unsigned long __attribute__ ((weak)) paddr_vmcoreinfo_note(void)
1192{
1193 return __pa((unsigned long)(char *)&vmcoreinfo_note);
1194}
1195
1196static int __init crash_save_vmcoreinfo_init(void)
1197{
1198 vmcoreinfo_append_str("OSRELEASE=%s\n", init_uts_ns.name.release);
1199 vmcoreinfo_append_str("PAGESIZE=%ld\n", PAGE_SIZE);
1200
1201 VMCOREINFO_SYMBOL(init_uts_ns);
1202 VMCOREINFO_SYMBOL(node_online_map);
1203 VMCOREINFO_SYMBOL(swapper_pg_dir);
1204 VMCOREINFO_SYMBOL(_stext);
1205
1206#ifndef CONFIG_NEED_MULTIPLE_NODES
1207 VMCOREINFO_SYMBOL(mem_map);
1208 VMCOREINFO_SYMBOL(contig_page_data);
1209#endif
1210#ifdef CONFIG_SPARSEMEM
1211 VMCOREINFO_SYMBOL(mem_section);
1212 VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS);
1213 VMCOREINFO_SIZE(mem_section);
1214 VMCOREINFO_OFFSET(mem_section, section_mem_map);
1215#endif
1216 VMCOREINFO_SIZE(page);
1217 VMCOREINFO_SIZE(pglist_data);
1218 VMCOREINFO_SIZE(zone);
1219 VMCOREINFO_SIZE(free_area);
1220 VMCOREINFO_SIZE(list_head);
1221 VMCOREINFO_TYPEDEF_SIZE(nodemask_t);
1222 VMCOREINFO_OFFSET(page, flags);
1223 VMCOREINFO_OFFSET(page, _count);
1224 VMCOREINFO_OFFSET(page, mapping);
1225 VMCOREINFO_OFFSET(page, lru);
1226 VMCOREINFO_OFFSET(pglist_data, node_zones);
1227 VMCOREINFO_OFFSET(pglist_data, nr_zones);
1228#ifdef CONFIG_FLAT_NODE_MEM_MAP
1229 VMCOREINFO_OFFSET(pglist_data, node_mem_map);
1230#endif
1231 VMCOREINFO_OFFSET(pglist_data, node_start_pfn);
1232 VMCOREINFO_OFFSET(pglist_data, node_spanned_pages);
1233 VMCOREINFO_OFFSET(pglist_data, node_id);
1234 VMCOREINFO_OFFSET(zone, free_area);
1235 VMCOREINFO_OFFSET(zone, vm_stat);
1236 VMCOREINFO_OFFSET(zone, spanned_pages);
1237 VMCOREINFO_OFFSET(free_area, free_list);
1238 VMCOREINFO_OFFSET(list_head, next);
1239 VMCOREINFO_OFFSET(list_head, prev);
1240 VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER);
1241 VMCOREINFO_NUMBER(NR_FREE_PAGES);
1242
1243 arch_crash_save_vmcoreinfo();
1244
1245 return 0;
1246}
1247
1248module_init(crash_save_vmcoreinfo_init)
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 6046939d0804..65daa5373ca6 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -61,6 +61,15 @@ static ssize_t kexec_crash_loaded_show(struct kset *kset, char *page)
61 return sprintf(page, "%d\n", !!kexec_crash_image); 61 return sprintf(page, "%d\n", !!kexec_crash_image);
62} 62}
63KERNEL_ATTR_RO(kexec_crash_loaded); 63KERNEL_ATTR_RO(kexec_crash_loaded);
64
65static ssize_t vmcoreinfo_show(struct kset *kset, char *page)
66{
67 return sprintf(page, "%lx %x\n",
68 paddr_vmcoreinfo_note(),
69 (unsigned int)vmcoreinfo_max_size);
70}
71KERNEL_ATTR_RO(vmcoreinfo);
72
64#endif /* CONFIG_KEXEC */ 73#endif /* CONFIG_KEXEC */
65 74
66/* 75/*
@@ -96,6 +105,7 @@ static struct attribute * kernel_attrs[] = {
96#ifdef CONFIG_KEXEC 105#ifdef CONFIG_KEXEC
97 &kexec_loaded_attr.attr, 106 &kexec_loaded_attr.attr,
98 &kexec_crash_loaded_attr.attr, 107 &kexec_crash_loaded_attr.attr,
108 &vmcoreinfo_attr.attr,
99#endif 109#endif
100 NULL 110 NULL
101}; 111};
diff --git a/kernel/module.c b/kernel/module.c
index db0ead0363e2..a389b423c279 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -20,6 +20,7 @@
20#include <linux/moduleloader.h> 20#include <linux/moduleloader.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kallsyms.h> 22#include <linux/kallsyms.h>
23#include <linux/sysfs.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
25#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
@@ -692,8 +693,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
692 } 693 }
693 694
694 /* If it has an init func, it must have an exit func to unload */ 695 /* If it has an init func, it must have an exit func to unload */
695 if ((mod->init != NULL && mod->exit == NULL) 696 if (mod->init && !mod->exit) {
696 || mod->unsafe) {
697 forced = try_force_unload(flags); 697 forced = try_force_unload(flags);
698 if (!forced) { 698 if (!forced) {
699 /* This module can't be removed */ 699 /* This module can't be removed */
@@ -741,11 +741,6 @@ static void print_unload_info(struct seq_file *m, struct module *mod)
741 seq_printf(m, "%s,", use->module_which_uses->name); 741 seq_printf(m, "%s,", use->module_which_uses->name);
742 } 742 }
743 743
744 if (mod->unsafe) {
745 printed_something = 1;
746 seq_printf(m, "[unsafe],");
747 }
748
749 if (mod->init != NULL && mod->exit == NULL) { 744 if (mod->init != NULL && mod->exit == NULL) {
750 printed_something = 1; 745 printed_something = 1;
751 seq_printf(m, "[permanent],"); 746 seq_printf(m, "[permanent],");
@@ -1053,6 +1048,100 @@ static void remove_sect_attrs(struct module *mod)
1053 } 1048 }
1054} 1049}
1055 1050
1051/*
1052 * /sys/module/foo/notes/.section.name gives contents of SHT_NOTE sections.
1053 */
1054
1055struct module_notes_attrs {
1056 struct kobject *dir;
1057 unsigned int notes;
1058 struct bin_attribute attrs[0];
1059};
1060
1061static ssize_t module_notes_read(struct kobject *kobj,
1062 struct bin_attribute *bin_attr,
1063 char *buf, loff_t pos, size_t count)
1064{
1065 /*
1066 * The caller checked the pos and count against our size.
1067 */
1068 memcpy(buf, bin_attr->private + pos, count);
1069 return count;
1070}
1071
1072static void free_notes_attrs(struct module_notes_attrs *notes_attrs,
1073 unsigned int i)
1074{
1075 if (notes_attrs->dir) {
1076 while (i-- > 0)
1077 sysfs_remove_bin_file(notes_attrs->dir,
1078 &notes_attrs->attrs[i]);
1079 kobject_del(notes_attrs->dir);
1080 }
1081 kfree(notes_attrs);
1082}
1083
1084static void add_notes_attrs(struct module *mod, unsigned int nsect,
1085 char *secstrings, Elf_Shdr *sechdrs)
1086{
1087 unsigned int notes, loaded, i;
1088 struct module_notes_attrs *notes_attrs;
1089 struct bin_attribute *nattr;
1090
1091 /* Count notes sections and allocate structures. */
1092 notes = 0;
1093 for (i = 0; i < nsect; i++)
1094 if ((sechdrs[i].sh_flags & SHF_ALLOC) &&
1095 (sechdrs[i].sh_type == SHT_NOTE))
1096 ++notes;
1097
1098 if (notes == 0)
1099 return;
1100
1101 notes_attrs = kzalloc(sizeof(*notes_attrs)
1102 + notes * sizeof(notes_attrs->attrs[0]),
1103 GFP_KERNEL);
1104 if (notes_attrs == NULL)
1105 return;
1106
1107 notes_attrs->notes = notes;
1108 nattr = &notes_attrs->attrs[0];
1109 for (loaded = i = 0; i < nsect; ++i) {
1110 if (!(sechdrs[i].sh_flags & SHF_ALLOC))
1111 continue;
1112 if (sechdrs[i].sh_type == SHT_NOTE) {
1113 nattr->attr.name = mod->sect_attrs->attrs[loaded].name;
1114 nattr->attr.mode = S_IRUGO;
1115 nattr->size = sechdrs[i].sh_size;
1116 nattr->private = (void *) sechdrs[i].sh_addr;
1117 nattr->read = module_notes_read;
1118 ++nattr;
1119 }
1120 ++loaded;
1121 }
1122
1123 notes_attrs->dir = kobject_add_dir(&mod->mkobj.kobj, "notes");
1124 if (!notes_attrs->dir)
1125 goto out;
1126
1127 for (i = 0; i < notes; ++i)
1128 if (sysfs_create_bin_file(notes_attrs->dir,
1129 &notes_attrs->attrs[i]))
1130 goto out;
1131
1132 mod->notes_attrs = notes_attrs;
1133 return;
1134
1135 out:
1136 free_notes_attrs(notes_attrs, i);
1137}
1138
1139static void remove_notes_attrs(struct module *mod)
1140{
1141 if (mod->notes_attrs)
1142 free_notes_attrs(mod->notes_attrs, mod->notes_attrs->notes);
1143}
1144
1056#else 1145#else
1057 1146
1058static inline void add_sect_attrs(struct module *mod, unsigned int nsect, 1147static 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,
1063static inline void remove_sect_attrs(struct module *mod) 1152static inline void remove_sect_attrs(struct module *mod)
1064{ 1153{
1065} 1154}
1155
1156static inline void add_notes_attrs(struct module *mod, unsigned int nsect,
1157 char *sectstrings, Elf_Shdr *sechdrs)
1158{
1159}
1160
1161static inline void remove_notes_attrs(struct module *mod)
1162{
1163}
1066#endif /* CONFIG_KALLSYMS */ 1164#endif /* CONFIG_KALLSYMS */
1067 1165
1068#ifdef CONFIG_SYSFS 1166#ifdef CONFIG_SYSFS
@@ -1197,6 +1295,7 @@ static void free_module(struct module *mod)
1197{ 1295{
1198 /* Delete from various lists */ 1296 /* Delete from various lists */
1199 stop_machine_run(__unlink_module, mod, NR_CPUS); 1297 stop_machine_run(__unlink_module, mod, NR_CPUS);
1298 remove_notes_attrs(mod);
1200 remove_sect_attrs(mod); 1299 remove_sect_attrs(mod);
1201 mod_kobject_remove(mod); 1300 mod_kobject_remove(mod);
1202 1301
@@ -1782,7 +1881,8 @@ static struct module *load_module(void __user *umod,
1782 module_unload_init(mod); 1881 module_unload_init(mod);
1783 1882
1784 /* Initialize kobject, so we can reference it. */ 1883 /* Initialize kobject, so we can reference it. */
1785 if (mod_sysfs_init(mod) != 0) 1884 err = mod_sysfs_init(mod);
1885 if (err)
1786 goto cleanup; 1886 goto cleanup;
1787 1887
1788 /* Set up license info based on the info section */ 1888 /* Set up license info based on the info section */
@@ -1924,6 +2024,7 @@ static struct module *load_module(void __user *umod,
1924 if (err < 0) 2024 if (err < 0)
1925 goto arch_cleanup; 2025 goto arch_cleanup;
1926 add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2026 add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
2027 add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
1927 2028
1928 /* Size of section 0 is 0, so this works well if no unwind info. */ 2029 /* Size of section 0 is 0, so this works well if no unwind info. */
1929 mod->unwind_info = unwind_add_table(mod, 2030 mod->unwind_info = unwind_add_table(mod,
@@ -2011,15 +2112,10 @@ sys_init_module(void __user *umod,
2011 buggy refcounters. */ 2112 buggy refcounters. */
2012 mod->state = MODULE_STATE_GOING; 2113 mod->state = MODULE_STATE_GOING;
2013 synchronize_sched(); 2114 synchronize_sched();
2014 if (mod->unsafe) 2115 module_put(mod);
2015 printk(KERN_ERR "%s: module is now stuck!\n", 2116 mutex_lock(&module_mutex);
2016 mod->name); 2117 free_module(mod);
2017 else { 2118 mutex_unlock(&module_mutex);
2018 module_put(mod);
2019 mutex_lock(&module_mutex);
2020 free_module(mod);
2021 mutex_unlock(&module_mutex);
2022 }
2023 return ret; 2119 return ret;
2024 } 2120 }
2025 2121
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index f1decd21a534..049e7c0ac566 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -203,8 +203,7 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags,
203 203
204static int __init nsproxy_cache_init(void) 204static int __init nsproxy_cache_init(void)
205{ 205{
206 nsproxy_cachep = kmem_cache_create("nsproxy", sizeof(struct nsproxy), 206 nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC);
207 0, SLAB_PANIC, NULL);
208 return 0; 207 return 0;
209} 208}
210 209
diff --git a/kernel/params.c b/kernel/params.c
index 4e57732fcfb4..1d6aca288cdc 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -252,8 +252,9 @@ int param_get_bool(char *buffer, struct kernel_param *kp)
252int param_set_invbool(const char *val, struct kernel_param *kp) 252int param_set_invbool(const char *val, struct kernel_param *kp)
253{ 253{
254 int boolval, ret; 254 int boolval, ret;
255 struct kernel_param dummy = { .arg = &boolval }; 255 struct kernel_param dummy;
256 256
257 dummy.arg = &boolval;
257 ret = param_set_bool(val, &dummy); 258 ret = param_set_bool(val, &dummy);
258 if (ret == 0) 259 if (ret == 0)
259 *(int *)kp->arg = !boolval; 260 *(int *)kp->arg = !boolval;
@@ -262,11 +263,7 @@ int param_set_invbool(const char *val, struct kernel_param *kp)
262 263
263int param_get_invbool(char *buffer, struct kernel_param *kp) 264int param_get_invbool(char *buffer, struct kernel_param *kp)
264{ 265{
265 int val; 266 return sprintf(buffer, "%c", (*(int *)kp->arg) ? 'N' : 'Y');
266 struct kernel_param dummy = { .arg = &val };
267
268 val = !*(int *)kp->arg;
269 return param_get_bool(buffer, &dummy);
270} 267}
271 268
272/* We break the rule and mangle the string. */ 269/* We break the rule and mangle the string. */
@@ -325,7 +322,7 @@ static int param_array(const char *name,
325 322
326int param_array_set(const char *val, struct kernel_param *kp) 323int param_array_set(const char *val, struct kernel_param *kp)
327{ 324{
328 struct kparam_array *arr = kp->arg; 325 const struct kparam_array *arr = kp->arr;
329 unsigned int temp_num; 326 unsigned int temp_num;
330 327
331 return param_array(kp->name, val, 1, arr->max, arr->elem, 328 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)
335int param_array_get(char *buffer, struct kernel_param *kp) 332int param_array_get(char *buffer, struct kernel_param *kp)
336{ 333{
337 int i, off, ret; 334 int i, off, ret;
338 struct kparam_array *arr = kp->arg; 335 const struct kparam_array *arr = kp->arr;
339 struct kernel_param p; 336 struct kernel_param p;
340 337
341 p = *kp; 338 p = *kp;
@@ -354,7 +351,7 @@ int param_array_get(char *buffer, struct kernel_param *kp)
354 351
355int param_set_copystring(const char *val, struct kernel_param *kp) 352int param_set_copystring(const char *val, struct kernel_param *kp)
356{ 353{
357 struct kparam_string *kps = kp->arg; 354 const struct kparam_string *kps = kp->str;
358 355
359 if (!val) { 356 if (!val) {
360 printk(KERN_ERR "%s: missing param set value\n", kp->name); 357 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)
371 368
372int param_get_string(char *buffer, struct kernel_param *kp) 369int param_get_string(char *buffer, struct kernel_param *kp)
373{ 370{
374 struct kparam_string *kps = kp->arg; 371 const struct kparam_string *kps = kp->str;
375 return strlcpy(buffer, kps->string, kps->maxlen); 372 return strlcpy(buffer, kps->string, kps->maxlen);
376} 373}
377 374
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 57efe0400bc2..d71ed09fe1dd 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -241,7 +241,8 @@ static __init int init_posix_timers(void)
241 register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic); 241 register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
242 242
243 posix_timers_cache = kmem_cache_create("posix_timers_cache", 243 posix_timers_cache = kmem_cache_create("posix_timers_cache",
244 sizeof (struct k_itimer), 0, 0, NULL); 244 sizeof (struct k_itimer), 0, SLAB_PANIC,
245 NULL);
245 idr_init(&posix_timers_id); 246 idr_init(&posix_timers_id);
246 return 0; 247 return 0;
247} 248}
diff --git a/kernel/printk.c b/kernel/printk.c
index b2b5c3a22a36..52493474f0ab 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -220,6 +220,58 @@ static inline void boot_delay_msec(void)
220#endif 220#endif
221 221
222/* 222/*
223 * Return the number of unread characters in the log buffer.
224 */
225int log_buf_get_len(void)
226{
227 return logged_chars;
228}
229
230/*
231 * Copy a range of characters from the log buffer.
232 */
233int log_buf_copy(char *dest, int idx, int len)
234{
235 int ret, max;
236 bool took_lock = false;
237
238 if (!oops_in_progress) {
239 spin_lock_irq(&logbuf_lock);
240 took_lock = true;
241 }
242
243 max = log_buf_get_len();
244 if (idx < 0 || idx >= max) {
245 ret = -1;
246 } else {
247 if (len > max)
248 len = max;
249 ret = len;
250 idx += (log_end - max);
251 while (len-- > 0)
252 dest[len] = LOG_BUF(idx + len);
253 }
254
255 if (took_lock)
256 spin_unlock_irq(&logbuf_lock);
257
258 return ret;
259}
260
261/*
262 * Extract a single character from the log buffer.
263 */
264int log_buf_read(int idx)
265{
266 char ret;
267
268 if (log_buf_copy(&ret, idx, 1) == 1)
269 return ret;
270 else
271 return -1;
272}
273
274/*
223 * Commands to do_syslog: 275 * Commands to do_syslog:
224 * 276 *
225 * 0 -- Close the log. Currently a NOP. 277 * 0 -- Close the log. Currently a NOP.
diff --git a/kernel/profile.c b/kernel/profile.c
index 6f69bf792d96..631b75c25d7e 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -37,7 +37,7 @@ struct profile_hit {
37#define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ) 37#define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ)
38 38
39/* Oprofile timer tick hook */ 39/* Oprofile timer tick hook */
40int (*timer_hook)(struct pt_regs *) __read_mostly; 40static int (*timer_hook)(struct pt_regs *) __read_mostly;
41 41
42static atomic_t *prof_buffer; 42static atomic_t *prof_buffer;
43static unsigned long prof_len, prof_shift; 43static unsigned long prof_len, prof_shift;
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 130214f3d229..a66d4d1615f7 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -45,7 +45,6 @@
45#include <linux/moduleparam.h> 45#include <linux/moduleparam.h>
46#include <linux/percpu.h> 46#include <linux/percpu.h>
47#include <linux/notifier.h> 47#include <linux/notifier.h>
48#include <linux/rcupdate.h>
49#include <linux/cpu.h> 48#include <linux/cpu.h>
50#include <linux/mutex.h> 49#include <linux/mutex.h>
51 50
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index ddff33247785..c3e165c2318f 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -35,14 +35,12 @@
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <asm/atomic.h> 36#include <asm/atomic.h>
37#include <linux/bitops.h> 37#include <linux/bitops.h>
38#include <linux/module.h>
39#include <linux/completion.h> 38#include <linux/completion.h>
40#include <linux/moduleparam.h> 39#include <linux/moduleparam.h>
41#include <linux/percpu.h> 40#include <linux/percpu.h>
42#include <linux/notifier.h> 41#include <linux/notifier.h>
43#include <linux/freezer.h> 42#include <linux/freezer.h>
44#include <linux/cpu.h> 43#include <linux/cpu.h>
45#include <linux/random.h>
46#include <linux/delay.h> 44#include <linux/delay.h>
47#include <linux/byteorder/swabb.h> 45#include <linux/byteorder/swabb.h>
48#include <linux/stat.h> 46#include <linux/stat.h>
@@ -166,16 +164,14 @@ struct rcu_random_state {
166 164
167/* 165/*
168 * Crude but fast random-number generator. Uses a linear congruential 166 * Crude but fast random-number generator. Uses a linear congruential
169 * generator, with occasional help from get_random_bytes(). 167 * generator, with occasional help from cpu_clock().
170 */ 168 */
171static unsigned long 169static unsigned long
172rcu_random(struct rcu_random_state *rrsp) 170rcu_random(struct rcu_random_state *rrsp)
173{ 171{
174 long refresh;
175
176 if (--rrsp->rrs_count < 0) { 172 if (--rrsp->rrs_count < 0) {
177 get_random_bytes(&refresh, sizeof(refresh)); 173 rrsp->rrs_state +=
178 rrsp->rrs_state += refresh; 174 (unsigned long)cpu_clock(raw_smp_processor_id());
179 rrsp->rrs_count = RCU_RANDOM_REFRESH; 175 rrsp->rrs_count = RCU_RANDOM_REFRESH;
180 } 176 }
181 rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD; 177 rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD;
diff --git a/kernel/rtmutex-debug.c b/kernel/rtmutex-debug.c
index 5aedbee014df..6b0703db152d 100644
--- a/kernel/rtmutex-debug.c
+++ b/kernel/rtmutex-debug.c
@@ -82,12 +82,7 @@ do { \
82 * into the tracing code when doing error printk or 82 * into the tracing code when doing error printk or
83 * executing a BUG(): 83 * executing a BUG():
84 */ 84 */
85int rt_trace_on = 1; 85static int rt_trace_on = 1;
86
87void deadlock_trace_off(void)
88{
89 rt_trace_on = 0;
90}
91 86
92static void printk_task(struct task_struct *p) 87static void printk_task(struct task_struct *p)
93{ 88{
diff --git a/kernel/sched.c b/kernel/sched.c
index 0da2b2635c54..c4889abc00b6 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5060,6 +5060,17 @@ wait_to_die:
5060} 5060}
5061 5061
5062#ifdef CONFIG_HOTPLUG_CPU 5062#ifdef CONFIG_HOTPLUG_CPU
5063
5064static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu)
5065{
5066 int ret;
5067
5068 local_irq_disable();
5069 ret = __migrate_task(p, src_cpu, dest_cpu);
5070 local_irq_enable();
5071 return ret;
5072}
5073
5063/* 5074/*
5064 * Figure out where task on dead CPU should go, use force if neccessary. 5075 * Figure out where task on dead CPU should go, use force if neccessary.
5065 * NOTE: interrupts should be disabled by the caller 5076 * 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)
5098 "longer affine to cpu%d\n", 5109 "longer affine to cpu%d\n",
5099 p->pid, p->comm, dead_cpu); 5110 p->pid, p->comm, dead_cpu);
5100 } 5111 }
5101 } while (!__migrate_task(p, dead_cpu, dest_cpu)); 5112 } while (!__migrate_task_irq(p, dead_cpu, dest_cpu));
5102} 5113}
5103 5114
5104/* 5115/*
@@ -5126,7 +5137,7 @@ static void migrate_live_tasks(int src_cpu)
5126{ 5137{
5127 struct task_struct *p, *t; 5138 struct task_struct *p, *t;
5128 5139
5129 write_lock_irq(&tasklist_lock); 5140 read_lock(&tasklist_lock);
5130 5141
5131 do_each_thread(t, p) { 5142 do_each_thread(t, p) {
5132 if (p == current) 5143 if (p == current)
@@ -5136,7 +5147,7 @@ static void migrate_live_tasks(int src_cpu)
5136 move_task_off_dead_cpu(src_cpu, p); 5147 move_task_off_dead_cpu(src_cpu, p);
5137 } while_each_thread(t, p); 5148 } while_each_thread(t, p);
5138 5149
5139 write_unlock_irq(&tasklist_lock); 5150 read_unlock(&tasklist_lock);
5140} 5151}
5141 5152
5142/* 5153/*
@@ -5214,11 +5225,10 @@ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p)
5214 * Drop lock around migration; if someone else moves it, 5225 * Drop lock around migration; if someone else moves it,
5215 * that's OK. No task can be added to this CPU, so iteration is 5226 * that's OK. No task can be added to this CPU, so iteration is
5216 * fine. 5227 * fine.
5217 * NOTE: interrupts should be left disabled --dev@
5218 */ 5228 */
5219 spin_unlock(&rq->lock); 5229 spin_unlock_irq(&rq->lock);
5220 move_task_off_dead_cpu(dead_cpu, p); 5230 move_task_off_dead_cpu(dead_cpu, p);
5221 spin_lock(&rq->lock); 5231 spin_lock_irq(&rq->lock);
5222 5232
5223 put_task_struct(p); 5233 put_task_struct(p);
5224} 5234}
@@ -5447,14 +5457,14 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
5447 kthread_stop(rq->migration_thread); 5457 kthread_stop(rq->migration_thread);
5448 rq->migration_thread = NULL; 5458 rq->migration_thread = NULL;
5449 /* Idle task back to normal (off runqueue, low prio) */ 5459 /* Idle task back to normal (off runqueue, low prio) */
5450 rq = task_rq_lock(rq->idle, &flags); 5460 spin_lock_irq(&rq->lock);
5451 update_rq_clock(rq); 5461 update_rq_clock(rq);
5452 deactivate_task(rq, rq->idle, 0); 5462 deactivate_task(rq, rq->idle, 0);
5453 rq->idle->static_prio = MAX_PRIO; 5463 rq->idle->static_prio = MAX_PRIO;
5454 __setscheduler(rq, rq->idle, SCHED_NORMAL, 0); 5464 __setscheduler(rq, rq->idle, SCHED_NORMAL, 0);
5455 rq->idle->sched_class = &idle_sched_class; 5465 rq->idle->sched_class = &idle_sched_class;
5456 migrate_dead_tasks(cpu); 5466 migrate_dead_tasks(cpu);
5457 task_rq_unlock(rq, &flags); 5467 spin_unlock_irq(&rq->lock);
5458 migrate_nr_uninterruptible(rq); 5468 migrate_nr_uninterruptible(rq);
5459 BUG_ON(rq->nr_running != 0); 5469 BUG_ON(rq->nr_running != 0);
5460 5470
diff --git a/kernel/signal.c b/kernel/signal.c
index 792952381092..2124ffadcfde 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -909,8 +909,7 @@ __group_complete_signal(int sig, struct task_struct *p)
909 do { 909 do {
910 sigaddset(&t->pending.signal, SIGKILL); 910 sigaddset(&t->pending.signal, SIGKILL);
911 signal_wake_up(t, 1); 911 signal_wake_up(t, 1);
912 t = next_thread(t); 912 } while_each_thread(p, t);
913 } while (t != p);
914 return; 913 return;
915 } 914 }
916 915
@@ -928,13 +927,11 @@ __group_complete_signal(int sig, struct task_struct *p)
928 rm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending); 927 rm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending);
929 p->signal->group_stop_count = 0; 928 p->signal->group_stop_count = 0;
930 p->signal->group_exit_task = t; 929 p->signal->group_exit_task = t;
931 t = p; 930 p = t;
932 do { 931 do {
933 p->signal->group_stop_count++; 932 p->signal->group_stop_count++;
934 signal_wake_up(t, 0); 933 signal_wake_up(t, t == p);
935 t = next_thread(t); 934 } while_each_thread(p, t);
936 } while (t != p);
937 wake_up_process(p->signal->group_exit_task);
938 return; 935 return;
939 } 936 }
940 937
@@ -985,9 +982,6 @@ void zap_other_threads(struct task_struct *p)
985 p->signal->flags = SIGNAL_GROUP_EXIT; 982 p->signal->flags = SIGNAL_GROUP_EXIT;
986 p->signal->group_stop_count = 0; 983 p->signal->group_stop_count = 0;
987 984
988 if (thread_group_empty(p))
989 return;
990
991 for (t = next_thread(p); t != p; t = next_thread(t)) { 985 for (t = next_thread(p); t != p; t = next_thread(t)) {
992 /* 986 /*
993 * Don't bother with already dead threads 987 * Don't bother with already dead threads
@@ -2300,15 +2294,6 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2300 k = &current->sighand->action[sig-1]; 2294 k = &current->sighand->action[sig-1];
2301 2295
2302 spin_lock_irq(&current->sighand->siglock); 2296 spin_lock_irq(&current->sighand->siglock);
2303 if (signal_pending(current)) {
2304 /*
2305 * If there might be a fatal signal pending on multiple
2306 * threads, make sure we take it before changing the action.
2307 */
2308 spin_unlock_irq(&current->sighand->siglock);
2309 return -ERESTARTNOINTR;
2310 }
2311
2312 if (oact) 2297 if (oact)
2313 *oact = *k; 2298 *oact = *k;
2314 2299
@@ -2335,7 +2320,6 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2335 rm_from_queue_full(&mask, &t->signal->shared_pending); 2320 rm_from_queue_full(&mask, &t->signal->shared_pending);
2336 do { 2321 do {
2337 rm_from_queue_full(&mask, &t->pending); 2322 rm_from_queue_full(&mask, &t->pending);
2338 recalc_sigpending_and_wake(t);
2339 t = next_thread(t); 2323 t = next_thread(t);
2340 } while (t != current); 2324 } while (t != current);
2341 } 2325 }
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index 708d4882c0c3..edeeef3a6a32 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -15,13 +15,16 @@
15#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/module.h> 16#include <linux/module.h>
17 17
18#include <asm/irq_regs.h>
19
18static DEFINE_SPINLOCK(print_lock); 20static DEFINE_SPINLOCK(print_lock);
19 21
20static DEFINE_PER_CPU(unsigned long, touch_timestamp); 22static DEFINE_PER_CPU(unsigned long, touch_timestamp);
21static DEFINE_PER_CPU(unsigned long, print_timestamp); 23static DEFINE_PER_CPU(unsigned long, print_timestamp);
22static DEFINE_PER_CPU(struct task_struct *, watchdog_task); 24static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
23 25
24static int did_panic = 0; 26static int did_panic;
27int softlockup_thresh = 10;
25 28
26static int 29static int
27softlock_panic(struct notifier_block *this, unsigned long event, void *ptr) 30softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
@@ -40,14 +43,16 @@ static struct notifier_block panic_block = {
40 * resolution, and we don't need to waste time with a big divide when 43 * resolution, and we don't need to waste time with a big divide when
41 * 2^30ns == 1.074s. 44 * 2^30ns == 1.074s.
42 */ 45 */
43static unsigned long get_timestamp(void) 46static unsigned long get_timestamp(int this_cpu)
44{ 47{
45 return sched_clock() >> 30; /* 2^30 ~= 10^9 */ 48 return cpu_clock(this_cpu) >> 30; /* 2^30 ~= 10^9 */
46} 49}
47 50
48void touch_softlockup_watchdog(void) 51void touch_softlockup_watchdog(void)
49{ 52{
50 __raw_get_cpu_var(touch_timestamp) = get_timestamp(); 53 int this_cpu = raw_smp_processor_id();
54
55 __raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
51} 56}
52EXPORT_SYMBOL(touch_softlockup_watchdog); 57EXPORT_SYMBOL(touch_softlockup_watchdog);
53 58
@@ -70,6 +75,7 @@ void softlockup_tick(void)
70 int this_cpu = smp_processor_id(); 75 int this_cpu = smp_processor_id();
71 unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu); 76 unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);
72 unsigned long print_timestamp; 77 unsigned long print_timestamp;
78 struct pt_regs *regs = get_irq_regs();
73 unsigned long now; 79 unsigned long now;
74 80
75 if (touch_timestamp == 0) { 81 if (touch_timestamp == 0) {
@@ -80,10 +86,11 @@ void softlockup_tick(void)
80 print_timestamp = per_cpu(print_timestamp, this_cpu); 86 print_timestamp = per_cpu(print_timestamp, this_cpu);
81 87
82 /* report at most once a second */ 88 /* report at most once a second */
83 if (print_timestamp < (touch_timestamp + 1) || 89 if ((print_timestamp >= touch_timestamp &&
84 did_panic || 90 print_timestamp < (touch_timestamp + 1)) ||
85 !per_cpu(watchdog_task, this_cpu)) 91 did_panic || !per_cpu(watchdog_task, this_cpu)) {
86 return; 92 return;
93 }
87 94
88 /* do not print during early bootup: */ 95 /* do not print during early bootup: */
89 if (unlikely(system_state != SYSTEM_RUNNING)) { 96 if (unlikely(system_state != SYSTEM_RUNNING)) {
@@ -91,28 +98,33 @@ void softlockup_tick(void)
91 return; 98 return;
92 } 99 }
93 100
94 now = get_timestamp(); 101 now = get_timestamp(this_cpu);
95 102
96 /* Wake up the high-prio watchdog task every second: */ 103 /* Wake up the high-prio watchdog task every second: */
97 if (now > (touch_timestamp + 1)) 104 if (now > (touch_timestamp + 1))
98 wake_up_process(per_cpu(watchdog_task, this_cpu)); 105 wake_up_process(per_cpu(watchdog_task, this_cpu));
99 106
100 /* Warn about unreasonable 10+ seconds delays: */ 107 /* Warn about unreasonable 10+ seconds delays: */
101 if (now > (touch_timestamp + 10)) { 108 if (now <= (touch_timestamp + softlockup_thresh))
102 per_cpu(print_timestamp, this_cpu) = touch_timestamp; 109 return;
103 110
104 spin_lock(&print_lock); 111 per_cpu(print_timestamp, this_cpu) = touch_timestamp;
105 printk(KERN_ERR "BUG: soft lockup detected on CPU#%d!\n", 112
106 this_cpu); 113 spin_lock(&print_lock);
114 printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
115 this_cpu, now - touch_timestamp,
116 current->comm, current->pid);
117 if (regs)
118 show_regs(regs);
119 else
107 dump_stack(); 120 dump_stack();
108 spin_unlock(&print_lock); 121 spin_unlock(&print_lock);
109 }
110} 122}
111 123
112/* 124/*
113 * The watchdog thread - runs every second and touches the timestamp. 125 * The watchdog thread - runs every second and touches the timestamp.
114 */ 126 */
115static int watchdog(void * __bind_cpu) 127static int watchdog(void *__bind_cpu)
116{ 128{
117 struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; 129 struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
118 130
@@ -150,13 +162,13 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
150 BUG_ON(per_cpu(watchdog_task, hotcpu)); 162 BUG_ON(per_cpu(watchdog_task, hotcpu));
151 p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu); 163 p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu);
152 if (IS_ERR(p)) { 164 if (IS_ERR(p)) {
153 printk("watchdog for %i failed\n", hotcpu); 165 printk(KERN_ERR "watchdog for %i failed\n", hotcpu);
154 return NOTIFY_BAD; 166 return NOTIFY_BAD;
155 } 167 }
156 per_cpu(touch_timestamp, hotcpu) = 0; 168 per_cpu(touch_timestamp, hotcpu) = 0;
157 per_cpu(watchdog_task, hotcpu) = p; 169 per_cpu(watchdog_task, hotcpu) = p;
158 kthread_bind(p, hotcpu); 170 kthread_bind(p, hotcpu);
159 break; 171 break;
160 case CPU_ONLINE: 172 case CPU_ONLINE:
161 case CPU_ONLINE_FROZEN: 173 case CPU_ONLINE_FROZEN:
162 wake_up_process(per_cpu(watchdog_task, hotcpu)); 174 wake_up_process(per_cpu(watchdog_task, hotcpu));
@@ -176,7 +188,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
176 kthread_stop(p); 188 kthread_stop(p);
177 break; 189 break;
178#endif /* CONFIG_HOTPLUG_CPU */ 190#endif /* CONFIG_HOTPLUG_CPU */
179 } 191 }
180 return NOTIFY_OK; 192 return NOTIFY_OK;
181} 193}
182 194
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index b0ec498a18d9..52c7a151e298 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -4,6 +4,10 @@
4 4
5#include <asm/unistd.h> 5#include <asm/unistd.h>
6 6
7/* we can't #include <linux/syscalls.h> here,
8 but tell gcc to not warn with -Wmissing-prototypes */
9asmlinkage long sys_ni_syscall(void);
10
7/* 11/*
8 * Non-implemented system calls get redirected here. 12 * Non-implemented system calls get redirected here.
9 */ 13 */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 96efbb859997..dde3d53e8adc 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -63,6 +63,7 @@ extern int print_fatal_signals;
63extern int sysctl_overcommit_memory; 63extern int sysctl_overcommit_memory;
64extern int sysctl_overcommit_ratio; 64extern int sysctl_overcommit_ratio;
65extern int sysctl_panic_on_oom; 65extern int sysctl_panic_on_oom;
66extern int sysctl_oom_kill_allocating_task;
66extern int max_threads; 67extern int max_threads;
67extern int core_uses_pid; 68extern int core_uses_pid;
68extern int suid_dumpable; 69extern int suid_dumpable;
@@ -79,6 +80,19 @@ extern int maps_protect;
79extern int sysctl_stat_interval; 80extern int sysctl_stat_interval;
80extern int audit_argv_kb; 81extern int audit_argv_kb;
81 82
83/* Constants used for minimum and maximum */
84#ifdef CONFIG_DETECT_SOFTLOCKUP
85static int one = 1;
86static int sixty = 60;
87#endif
88
89#ifdef CONFIG_MMU
90static int two = 2;
91#endif
92
93static int zero;
94static int one_hundred = 100;
95
82/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ 96/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
83static int maxolduid = 65535; 97static int maxolduid = 65535;
84static int minolduid; 98static int minolduid;
@@ -710,6 +724,19 @@ static ctl_table kern_table[] = {
710 .proc_handler = &proc_dointvec, 724 .proc_handler = &proc_dointvec,
711 }, 725 },
712#endif 726#endif
727#ifdef CONFIG_DETECT_SOFTLOCKUP
728 {
729 .ctl_name = CTL_UNNUMBERED,
730 .procname = "softlockup_thresh",
731 .data = &softlockup_thresh,
732 .maxlen = sizeof(int),
733 .mode = 0644,
734 .proc_handler = &proc_dointvec_minmax,
735 .strategy = &sysctl_intvec,
736 .extra1 = &one,
737 .extra2 = &sixty,
738 },
739#endif
713#ifdef CONFIG_COMPAT 740#ifdef CONFIG_COMPAT
714 { 741 {
715 .ctl_name = KERN_COMPAT_LOG, 742 .ctl_name = KERN_COMPAT_LOG,
@@ -756,13 +783,6 @@ static ctl_table kern_table[] = {
756 { .ctl_name = 0 } 783 { .ctl_name = 0 }
757}; 784};
758 785
759/* Constants for minimum and maximum testing in vm_table.
760 We use these as one-element integer vectors. */
761static int zero;
762static int two = 2;
763static int one_hundred = 100;
764
765
766static ctl_table vm_table[] = { 786static ctl_table vm_table[] = {
767 { 787 {
768 .ctl_name = VM_OVERCOMMIT_MEMORY, 788 .ctl_name = VM_OVERCOMMIT_MEMORY,
@@ -781,6 +801,14 @@ static ctl_table vm_table[] = {
781 .proc_handler = &proc_dointvec, 801 .proc_handler = &proc_dointvec,
782 }, 802 },
783 { 803 {
804 .ctl_name = CTL_UNNUMBERED,
805 .procname = "oom_kill_allocating_task",
806 .data = &sysctl_oom_kill_allocating_task,
807 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
808 .mode = 0644,
809 .proc_handler = &proc_dointvec,
810 },
811 {
784 .ctl_name = VM_OVERCOMMIT_RATIO, 812 .ctl_name = VM_OVERCOMMIT_RATIO,
785 .procname = "overcommit_ratio", 813 .procname = "overcommit_ratio",
786 .data = &sysctl_overcommit_ratio, 814 .data = &sysctl_overcommit_ratio,
@@ -813,7 +841,7 @@ static ctl_table vm_table[] = {
813 .data = &vm_dirty_ratio, 841 .data = &vm_dirty_ratio,
814 .maxlen = sizeof(vm_dirty_ratio), 842 .maxlen = sizeof(vm_dirty_ratio),
815 .mode = 0644, 843 .mode = 0644,
816 .proc_handler = &proc_dointvec_minmax, 844 .proc_handler = &dirty_ratio_handler,
817 .strategy = &sysctl_intvec, 845 .strategy = &sysctl_intvec,
818 .extra1 = &zero, 846 .extra1 = &zero,
819 .extra2 = &one_hundred, 847 .extra2 = &one_hundred,
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 059431ed67db..7d4d7f9c1bb2 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -20,7 +20,6 @@
20#include <linux/taskstats_kern.h> 20#include <linux/taskstats_kern.h>
21#include <linux/tsacct_kern.h> 21#include <linux/tsacct_kern.h>
22#include <linux/delayacct.h> 22#include <linux/delayacct.h>
23#include <linux/tsacct_kern.h>
24#include <linux/cpumask.h> 23#include <linux/cpumask.h>
25#include <linux/percpu.h> 24#include <linux/percpu.h>
26#include <net/genetlink.h> 25#include <net/genetlink.h>
diff --git a/kernel/time.c b/kernel/time.c
index 1afcc78dc3b1..2d5b6a682138 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -34,7 +34,6 @@
34#include <linux/syscalls.h> 34#include <linux/syscalls.h>
35#include <linux/security.h> 35#include <linux/security.h>
36#include <linux/fs.h> 36#include <linux/fs.h>
37#include <linux/module.h>
38 37
39#include <asm/uaccess.h> 38#include <asm/uaccess.h>
40#include <asm/unistd.h> 39#include <asm/unistd.h>
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index fc3fc79b3d59..fab9dd8bbd6b 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -274,21 +274,12 @@ out:
274 */ 274 */
275void tick_broadcast_on_off(unsigned long reason, int *oncpu) 275void tick_broadcast_on_off(unsigned long reason, int *oncpu)
276{ 276{
277 int cpu = get_cpu(); 277 if (!cpu_isset(*oncpu, cpu_online_map))
278
279 if (!cpu_isset(*oncpu, cpu_online_map)) {
280 printk(KERN_ERR "tick-braodcast: ignoring broadcast for " 278 printk(KERN_ERR "tick-braodcast: ignoring broadcast for "
281 "offline CPU #%d\n", *oncpu); 279 "offline CPU #%d\n", *oncpu);
282 } else { 280 else
283 281 smp_call_function_single(*oncpu, tick_do_broadcast_on_off,
284 if (cpu == *oncpu) 282 &reason, 1, 1);
285 tick_do_broadcast_on_off(&reason);
286 else
287 smp_call_function_single(*oncpu,
288 tick_do_broadcast_on_off,
289 &reason, 1, 1);
290 }
291 put_cpu();
292} 283}
293 284
294/* 285/*
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 8c3fef1db09c..ce89ffb474d0 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -570,7 +570,7 @@ void tick_setup_sched_timer(void)
570 /* Get the next period (per cpu) */ 570 /* Get the next period (per cpu) */
571 ts->sched_timer.expires = tick_init_jiffy_update(); 571 ts->sched_timer.expires = tick_init_jiffy_update();
572 offset = ktime_to_ns(tick_period) >> 1; 572 offset = ktime_to_ns(tick_period) >> 1;
573 do_div(offset, NR_CPUS); 573 do_div(offset, num_possible_cpus());
574 offset *= smp_processor_id(); 574 offset *= smp_processor_id();
575 ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset); 575 ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset);
576 576
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 7e8983aecf83..e5e466b27598 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -24,9 +24,7 @@
24 * This read-write spinlock protects us from races in SMP while 24 * This read-write spinlock protects us from races in SMP while
25 * playing with xtime and avenrun. 25 * playing with xtime and avenrun.
26 */ 26 */
27__attribute__((weak)) __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock); 27__cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
28
29EXPORT_SYMBOL(xtime_lock);
30 28
31 29
32/* 30/*
@@ -47,7 +45,6 @@ EXPORT_SYMBOL(xtime_lock);
47struct timespec xtime __attribute__ ((aligned (16))); 45struct timespec xtime __attribute__ ((aligned (16)));
48struct timespec wall_to_monotonic __attribute__ ((aligned (16))); 46struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
49static unsigned long total_sleep_time; /* seconds */ 47static unsigned long total_sleep_time; /* seconds */
50EXPORT_SYMBOL(xtime);
51 48
52static struct timespec xtime_cache __attribute__ ((aligned (16))); 49static struct timespec xtime_cache __attribute__ ((aligned (16)));
53static inline void update_xtime_cache(u64 nsec) 50static inline void update_xtime_cache(u64 nsec)
diff --git a/kernel/user.c b/kernel/user.c
index f0e561e6d085..9cb6f6403561 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -44,7 +44,6 @@ struct user_struct root_user = {
44 .processes = ATOMIC_INIT(1), 44 .processes = ATOMIC_INIT(1),
45 .files = ATOMIC_INIT(0), 45 .files = ATOMIC_INIT(0),
46 .sigpending = ATOMIC_INIT(0), 46 .sigpending = ATOMIC_INIT(0),
47 .mq_bytes = 0,
48 .locked_shm = 0, 47 .locked_shm = 0,
49#ifdef CONFIG_KEYS 48#ifdef CONFIG_KEYS
50 .uid_keyring = &root_user_keyring, 49 .uid_keyring = &root_user_keyring,
@@ -58,19 +57,17 @@ struct user_struct root_user = {
58/* 57/*
59 * These routines must be called with the uidhash spinlock held! 58 * These routines must be called with the uidhash spinlock held!
60 */ 59 */
61static inline void uid_hash_insert(struct user_struct *up, 60static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
62 struct hlist_head *hashent)
63{ 61{
64 hlist_add_head(&up->uidhash_node, hashent); 62 hlist_add_head(&up->uidhash_node, hashent);
65} 63}
66 64
67static inline void uid_hash_remove(struct user_struct *up) 65static void uid_hash_remove(struct user_struct *up)
68{ 66{
69 hlist_del_init(&up->uidhash_node); 67 hlist_del_init(&up->uidhash_node);
70} 68}
71 69
72static inline struct user_struct *uid_hash_find(uid_t uid, 70static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
73 struct hlist_head *hashent)
74{ 71{
75 struct user_struct *user; 72 struct user_struct *user;
76 struct hlist_node *h; 73 struct hlist_node *h;
@@ -343,8 +340,9 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
343 atomic_set(&new->inotify_watches, 0); 340 atomic_set(&new->inotify_watches, 0);
344 atomic_set(&new->inotify_devs, 0); 341 atomic_set(&new->inotify_devs, 0);
345#endif 342#endif
346 343#ifdef CONFIG_POSIX_MQUEUE
347 new->mq_bytes = 0; 344 new->mq_bytes = 0;
345#endif
348 new->locked_shm = 0; 346 new->locked_shm = 0;
349 347
350 if (alloc_uid_keyring(new, current) < 0) { 348 if (alloc_uid_keyring(new, current) < 0) {
diff --git a/lib/Makefile b/lib/Makefile
index 6c4ea33bb2cb..c5f215d509d3 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,7 +5,8 @@
5lib-y := ctype.o string.o vsprintf.o cmdline.o \ 5lib-y := ctype.o string.o vsprintf.o cmdline.o \
6 rbtree.o radix-tree.o dump_stack.o \ 6 rbtree.o radix-tree.o dump_stack.o \
7 idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \ 7 idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \
8 sha1.o irq_regs.o reciprocal_div.o argv_split.o 8 sha1.o irq_regs.o reciprocal_div.o argv_split.o \
9 proportions.o
9 10
10lib-$(CONFIG_MMU) += ioremap.o 11lib-$(CONFIG_MMU) += ioremap.o
11lib-$(CONFIG_SMP) += cpumask.o 12lib-$(CONFIG_SMP) += cpumask.o
diff --git a/lib/argv_split.c b/lib/argv_split.c
index 4096ed42f490..fad6ce4f7b57 100644
--- a/lib/argv_split.c
+++ b/lib/argv_split.c
@@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
75 if (argv == NULL) 75 if (argv == NULL)
76 goto out; 76 goto out;
77 77
78 *argcp = argc; 78 if (argcp)
79 *argcp = argc;
80
79 argvp = argv; 81 argvp = argv;
80 82
81 while (*str) { 83 while (*str) {
diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c
index accb35658169..486da62b2b07 100644
--- a/lib/bust_spinlocks.c
+++ b/lib/bust_spinlocks.c
@@ -17,13 +17,13 @@
17void __attribute__((weak)) bust_spinlocks(int yes) 17void __attribute__((weak)) bust_spinlocks(int yes)
18{ 18{
19 if (yes) { 19 if (yes) {
20 oops_in_progress = 1; 20 ++oops_in_progress;
21 } else { 21 } else {
22#ifdef CONFIG_VT 22#ifdef CONFIG_VT
23 unblank_screen(); 23 unblank_screen();
24#endif 24#endif
25 oops_in_progress = 0; 25 if (--oops_in_progress == 0)
26 wake_up_klogd(); 26 wake_up_klogd();
27 } 27 }
28} 28}
29 29
diff --git a/lib/idr.c b/lib/idr.c
index 09cbe2b69edb..afbb0b1023d4 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -580,8 +580,7 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
580} 580}
581EXPORT_SYMBOL(idr_replace); 581EXPORT_SYMBOL(idr_replace);
582 582
583static void idr_cache_ctor(void * idr_layer, struct kmem_cache *idr_layer_cache, 583static void idr_cache_ctor(struct kmem_cache *idr_layer_cache, void *idr_layer)
584 unsigned long flags)
585{ 584{
586 memset(idr_layer, 0, sizeof(struct idr_layer)); 585 memset(idr_layer, 0, sizeof(struct idr_layer));
587} 586}
diff --git a/lib/iomap.c b/lib/iomap.c
index 864f2ec1966e..72c42687ba10 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -40,7 +40,7 @@ static void bad_io_access(unsigned long port, const char *access)
40 static int count = 10; 40 static int count = 10;
41 if (count) { 41 if (count) {
42 count--; 42 count--;
43 printk(KERN_ERR "Bad IO access at port %lx (%s)\n", port, access); 43 printk(KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access);
44 WARN_ON(1); 44 WARN_ON(1);
45 } 45 }
46} 46}
diff --git a/lib/ioremap.c b/lib/ioremap.c
index 760521417b69..14c6078f17a2 100644
--- a/lib/ioremap.c
+++ b/lib/ioremap.c
@@ -8,6 +8,7 @@
8#include <linux/vmalloc.h> 8#include <linux/vmalloc.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/io.h>
11#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
12#include <asm/pgtable.h> 13#include <asm/pgtable.h>
13 14
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index cf22c617baa4..9659eabffc31 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -14,15 +14,29 @@ static LIST_HEAD(percpu_counters);
14static DEFINE_MUTEX(percpu_counters_lock); 14static DEFINE_MUTEX(percpu_counters_lock);
15#endif 15#endif
16 16
17void percpu_counter_mod(struct percpu_counter *fbc, s32 amount) 17void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
18{ 18{
19 long count; 19 int cpu;
20
21 spin_lock(&fbc->lock);
22 for_each_possible_cpu(cpu) {
23 s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
24 *pcount = 0;
25 }
26 fbc->count = amount;
27 spin_unlock(&fbc->lock);
28}
29EXPORT_SYMBOL(percpu_counter_set);
30
31void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
32{
33 s64 count;
20 s32 *pcount; 34 s32 *pcount;
21 int cpu = get_cpu(); 35 int cpu = get_cpu();
22 36
23 pcount = per_cpu_ptr(fbc->counters, cpu); 37 pcount = per_cpu_ptr(fbc->counters, cpu);
24 count = *pcount + amount; 38 count = *pcount + amount;
25 if (count >= FBC_BATCH || count <= -FBC_BATCH) { 39 if (count >= batch || count <= -batch) {
26 spin_lock(&fbc->lock); 40 spin_lock(&fbc->lock);
27 fbc->count += count; 41 fbc->count += count;
28 *pcount = 0; 42 *pcount = 0;
@@ -32,13 +46,13 @@ void percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
32 } 46 }
33 put_cpu(); 47 put_cpu();
34} 48}
35EXPORT_SYMBOL(percpu_counter_mod); 49EXPORT_SYMBOL(__percpu_counter_add);
36 50
37/* 51/*
38 * Add up all the per-cpu counts, return the result. This is a more accurate 52 * Add up all the per-cpu counts, return the result. This is a more accurate
39 * but much slower version of percpu_counter_read_positive() 53 * but much slower version of percpu_counter_read_positive()
40 */ 54 */
41s64 percpu_counter_sum(struct percpu_counter *fbc) 55s64 __percpu_counter_sum(struct percpu_counter *fbc)
42{ 56{
43 s64 ret; 57 s64 ret;
44 int cpu; 58 int cpu;
@@ -50,25 +64,43 @@ s64 percpu_counter_sum(struct percpu_counter *fbc)
50 ret += *pcount; 64 ret += *pcount;
51 } 65 }
52 spin_unlock(&fbc->lock); 66 spin_unlock(&fbc->lock);
53 return ret < 0 ? 0 : ret; 67 return ret;
54} 68}
55EXPORT_SYMBOL(percpu_counter_sum); 69EXPORT_SYMBOL(__percpu_counter_sum);
70
71static struct lock_class_key percpu_counter_irqsafe;
56 72
57void percpu_counter_init(struct percpu_counter *fbc, s64 amount) 73int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
58{ 74{
59 spin_lock_init(&fbc->lock); 75 spin_lock_init(&fbc->lock);
60 fbc->count = amount; 76 fbc->count = amount;
61 fbc->counters = alloc_percpu(s32); 77 fbc->counters = alloc_percpu(s32);
78 if (!fbc->counters)
79 return -ENOMEM;
62#ifdef CONFIG_HOTPLUG_CPU 80#ifdef CONFIG_HOTPLUG_CPU
63 mutex_lock(&percpu_counters_lock); 81 mutex_lock(&percpu_counters_lock);
64 list_add(&fbc->list, &percpu_counters); 82 list_add(&fbc->list, &percpu_counters);
65 mutex_unlock(&percpu_counters_lock); 83 mutex_unlock(&percpu_counters_lock);
66#endif 84#endif
85 return 0;
67} 86}
68EXPORT_SYMBOL(percpu_counter_init); 87EXPORT_SYMBOL(percpu_counter_init);
69 88
89int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount)
90{
91 int err;
92
93 err = percpu_counter_init(fbc, amount);
94 if (!err)
95 lockdep_set_class(&fbc->lock, &percpu_counter_irqsafe);
96 return err;
97}
98
70void percpu_counter_destroy(struct percpu_counter *fbc) 99void percpu_counter_destroy(struct percpu_counter *fbc)
71{ 100{
101 if (!fbc->counters)
102 return;
103
72 free_percpu(fbc->counters); 104 free_percpu(fbc->counters);
73#ifdef CONFIG_HOTPLUG_CPU 105#ifdef CONFIG_HOTPLUG_CPU
74 mutex_lock(&percpu_counters_lock); 106 mutex_lock(&percpu_counters_lock);
diff --git a/lib/proportions.c b/lib/proportions.c
new file mode 100644
index 000000000000..332d8c58184d
--- /dev/null
+++ b/lib/proportions.c
@@ -0,0 +1,384 @@
1/*
2 * Floating proportions
3 *
4 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
5 *
6 * Description:
7 *
8 * The floating proportion is a time derivative with an exponentially decaying
9 * history:
10 *
11 * p_{j} = \Sum_{i=0} (dx_{j}/dt_{-i}) / 2^(1+i)
12 *
13 * Where j is an element from {prop_local}, x_{j} is j's number of events,
14 * and i the time period over which the differential is taken. So d/dt_{-i} is
15 * the differential over the i-th last period.
16 *
17 * The decaying history gives smooth transitions. The time differential carries
18 * the notion of speed.
19 *
20 * The denominator is 2^(1+i) because we want the series to be normalised, ie.
21 *
22 * \Sum_{i=0} 1/2^(1+i) = 1
23 *
24 * Further more, if we measure time (t) in the same events as x; so that:
25 *
26 * t = \Sum_{j} x_{j}
27 *
28 * we get that:
29 *
30 * \Sum_{j} p_{j} = 1
31 *
32 * Writing this in an iterative fashion we get (dropping the 'd's):
33 *
34 * if (++x_{j}, ++t > period)
35 * t /= 2;
36 * for_each (j)
37 * x_{j} /= 2;
38 *
39 * so that:
40 *
41 * p_{j} = x_{j} / t;
42 *
43 * We optimize away the '/= 2' for the global time delta by noting that:
44 *
45 * if (++t > period) t /= 2:
46 *
47 * Can be approximated by:
48 *
49 * period/2 + (++t % period/2)
50 *
51 * [ Furthermore, when we choose period to be 2^n it can be written in terms of
52 * binary operations and wraparound artefacts disappear. ]
53 *
54 * Also note that this yields a natural counter of the elapsed periods:
55 *
56 * c = t / (period/2)
57 *
58 * [ Its monotonic increasing property can be applied to mitigate the wrap-
59 * around issue. ]
60 *
61 * This allows us to do away with the loop over all prop_locals on each period
62 * expiration. By remembering the period count under which it was last accessed
63 * as c_{j}, we can obtain the number of 'missed' cycles from:
64 *
65 * c - c_{j}
66 *
67 * We can then lazily catch up to the global period count every time we are
68 * going to use x_{j}, by doing:
69 *
70 * x_{j} /= 2^(c - c_{j}), c_{j} = c
71 */
72
73#include <linux/proportions.h>
74#include <linux/rcupdate.h>
75
76/*
77 * Limit the time part in order to ensure there are some bits left for the
78 * cycle counter.
79 */
80#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
81
82int prop_descriptor_init(struct prop_descriptor *pd, int shift)
83{
84 int err;
85
86 if (shift > PROP_MAX_SHIFT)
87 shift = PROP_MAX_SHIFT;
88
89 pd->index = 0;
90 pd->pg[0].shift = shift;
91 mutex_init(&pd->mutex);
92 err = percpu_counter_init_irq(&pd->pg[0].events, 0);
93 if (err)
94 goto out;
95
96 err = percpu_counter_init_irq(&pd->pg[1].events, 0);
97 if (err)
98 percpu_counter_destroy(&pd->pg[0].events);
99
100out:
101 return err;
102}
103
104/*
105 * We have two copies, and flip between them to make it seem like an atomic
106 * update. The update is not really atomic wrt the events counter, but
107 * it is internally consistent with the bit layout depending on shift.
108 *
109 * We copy the events count, move the bits around and flip the index.
110 */
111void prop_change_shift(struct prop_descriptor *pd, int shift)
112{
113 int index;
114 int offset;
115 u64 events;
116 unsigned long flags;
117
118 if (shift > PROP_MAX_SHIFT)
119 shift = PROP_MAX_SHIFT;
120
121 mutex_lock(&pd->mutex);
122
123 index = pd->index ^ 1;
124 offset = pd->pg[pd->index].shift - shift;
125 if (!offset)
126 goto out;
127
128 pd->pg[index].shift = shift;
129
130 local_irq_save(flags);
131 events = percpu_counter_sum(&pd->pg[pd->index].events);
132 if (offset < 0)
133 events <<= -offset;
134 else
135 events >>= offset;
136 percpu_counter_set(&pd->pg[index].events, events);
137
138 /*
139 * ensure the new pg is fully written before the switch
140 */
141 smp_wmb();
142 pd->index = index;
143 local_irq_restore(flags);
144
145 synchronize_rcu();
146
147out:
148 mutex_unlock(&pd->mutex);
149}
150
151/*
152 * wrap the access to the data in an rcu_read_lock() section;
153 * this is used to track the active references.
154 */
155static struct prop_global *prop_get_global(struct prop_descriptor *pd)
156{
157 int index;
158
159 rcu_read_lock();
160 index = pd->index;
161 /*
162 * match the wmb from vcd_flip()
163 */
164 smp_rmb();
165 return &pd->pg[index];
166}
167
168static void prop_put_global(struct prop_descriptor *pd, struct prop_global *pg)
169{
170 rcu_read_unlock();
171}
172
173static void
174prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift)
175{
176 int offset = *pl_shift - new_shift;
177
178 if (!offset)
179 return;
180
181 if (offset < 0)
182 *pl_period <<= -offset;
183 else
184 *pl_period >>= offset;
185
186 *pl_shift = new_shift;
187}
188
189/*
190 * PERCPU
191 */
192
193int prop_local_init_percpu(struct prop_local_percpu *pl)
194{
195 spin_lock_init(&pl->lock);
196 pl->shift = 0;
197 pl->period = 0;
198 return percpu_counter_init_irq(&pl->events, 0);
199}
200
201void prop_local_destroy_percpu(struct prop_local_percpu *pl)
202{
203 percpu_counter_destroy(&pl->events);
204}
205
206/*
207 * Catch up with missed period expirations.
208 *
209 * until (c_{j} == c)
210 * x_{j} -= x_{j}/2;
211 * c_{j}++;
212 */
213static
214void prop_norm_percpu(struct prop_global *pg, struct prop_local_percpu *pl)
215{
216 unsigned long period = 1UL << (pg->shift - 1);
217 unsigned long period_mask = ~(period - 1);
218 unsigned long global_period;
219 unsigned long flags;
220
221 global_period = percpu_counter_read(&pg->events);
222 global_period &= period_mask;
223
224 /*
225 * Fast path - check if the local and global period count still match
226 * outside of the lock.
227 */
228 if (pl->period == global_period)
229 return;
230
231 spin_lock_irqsave(&pl->lock, flags);
232 prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
233 /*
234 * For each missed period, we half the local counter.
235 * basically:
236 * pl->events >> (global_period - pl->period);
237 *
238 * but since the distributed nature of percpu counters make division
239 * rather hard, use a regular subtraction loop. This is safe, because
240 * the events will only every be incremented, hence the subtraction
241 * can never result in a negative number.
242 */
243 while (pl->period != global_period) {
244 unsigned long val = percpu_counter_read(&pl->events);
245 unsigned long half = (val + 1) >> 1;
246
247 /*
248 * Half of zero won't be much less, break out.
249 * This limits the loop to shift iterations, even
250 * if we missed a million.
251 */
252 if (!val)
253 break;
254
255 percpu_counter_add(&pl->events, -half);
256 pl->period += period;
257 }
258 pl->period = global_period;
259 spin_unlock_irqrestore(&pl->lock, flags);
260}
261
262/*
263 * ++x_{j}, ++t
264 */
265void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
266{
267 struct prop_global *pg = prop_get_global(pd);
268
269 prop_norm_percpu(pg, pl);
270 percpu_counter_add(&pl->events, 1);
271 percpu_counter_add(&pg->events, 1);
272 prop_put_global(pd, pg);
273}
274
275/*
276 * Obtain a fraction of this proportion
277 *
278 * p_{j} = x_{j} / (period/2 + t % period/2)
279 */
280void prop_fraction_percpu(struct prop_descriptor *pd,
281 struct prop_local_percpu *pl,
282 long *numerator, long *denominator)
283{
284 struct prop_global *pg = prop_get_global(pd);
285 unsigned long period_2 = 1UL << (pg->shift - 1);
286 unsigned long counter_mask = period_2 - 1;
287 unsigned long global_count;
288
289 prop_norm_percpu(pg, pl);
290 *numerator = percpu_counter_read_positive(&pl->events);
291
292 global_count = percpu_counter_read(&pg->events);
293 *denominator = period_2 + (global_count & counter_mask);
294
295 prop_put_global(pd, pg);
296}
297
298/*
299 * SINGLE
300 */
301
302int prop_local_init_single(struct prop_local_single *pl)
303{
304 spin_lock_init(&pl->lock);
305 pl->shift = 0;
306 pl->period = 0;
307 pl->events = 0;
308 return 0;
309}
310
311void prop_local_destroy_single(struct prop_local_single *pl)
312{
313}
314
315/*
316 * Catch up with missed period expirations.
317 */
318static
319void prop_norm_single(struct prop_global *pg, struct prop_local_single *pl)
320{
321 unsigned long period = 1UL << (pg->shift - 1);
322 unsigned long period_mask = ~(period - 1);
323 unsigned long global_period;
324 unsigned long flags;
325
326 global_period = percpu_counter_read(&pg->events);
327 global_period &= period_mask;
328
329 /*
330 * Fast path - check if the local and global period count still match
331 * outside of the lock.
332 */
333 if (pl->period == global_period)
334 return;
335
336 spin_lock_irqsave(&pl->lock, flags);
337 prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
338 /*
339 * For each missed period, we half the local counter.
340 */
341 period = (global_period - pl->period) >> (pg->shift - 1);
342 if (likely(period < BITS_PER_LONG))
343 pl->events >>= period;
344 else
345 pl->events = 0;
346 pl->period = global_period;
347 spin_unlock_irqrestore(&pl->lock, flags);
348}
349
350/*
351 * ++x_{j}, ++t
352 */
353void __prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl)
354{
355 struct prop_global *pg = prop_get_global(pd);
356
357 prop_norm_single(pg, pl);
358 pl->events++;
359 percpu_counter_add(&pg->events, 1);
360 prop_put_global(pd, pg);
361}
362
363/*
364 * Obtain a fraction of this proportion
365 *
366 * p_{j} = x_{j} / (period/2 + t % period/2)
367 */
368void prop_fraction_single(struct prop_descriptor *pd,
369 struct prop_local_single *pl,
370 long *numerator, long *denominator)
371{
372 struct prop_global *pg = prop_get_global(pd);
373 unsigned long period_2 = 1UL << (pg->shift - 1);
374 unsigned long counter_mask = period_2 - 1;
375 unsigned long global_count;
376
377 prop_norm_single(pg, pl);
378 *numerator = pl->events;
379
380 global_count = percpu_counter_read(&pg->events);
381 *denominator = period_2 + (global_count & counter_mask);
382
383 prop_put_global(pd, pg);
384}
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 6b26f9d39800..48c250fe2233 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -1042,19 +1042,21 @@ int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag)
1042EXPORT_SYMBOL(radix_tree_tagged); 1042EXPORT_SYMBOL(radix_tree_tagged);
1043 1043
1044static void 1044static void
1045radix_tree_node_ctor(void *node, struct kmem_cache *cachep, unsigned long flags) 1045radix_tree_node_ctor(struct kmem_cache *cachep, void *node)
1046{ 1046{
1047 memset(node, 0, sizeof(struct radix_tree_node)); 1047 memset(node, 0, sizeof(struct radix_tree_node));
1048} 1048}
1049 1049
1050static __init unsigned long __maxindex(unsigned int height) 1050static __init unsigned long __maxindex(unsigned int height)
1051{ 1051{
1052 unsigned int tmp = height * RADIX_TREE_MAP_SHIFT; 1052 unsigned int width = height * RADIX_TREE_MAP_SHIFT;
1053 unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1; 1053 int shift = RADIX_TREE_INDEX_BITS - width;
1054 1054
1055 if (tmp >= RADIX_TREE_INDEX_BITS) 1055 if (shift < 0)
1056 index = ~0UL; 1056 return ~0UL;
1057 return index; 1057 if (shift >= BITS_PER_LONG)
1058 return 0UL;
1059 return ~0UL >> shift;
1058} 1060}
1059 1061
1060static __init void radix_tree_init_maxindex(void) 1062static __init void radix_tree_init_maxindex(void)
diff --git a/lib/sort.c b/lib/sort.c
index 961567894d16..6abbaf3d5858 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -67,7 +67,7 @@ void sort(void *base, size_t num, size_t size,
67 } 67 }
68 68
69 /* sort */ 69 /* sort */
70 for (i = n - size; i >= 0; i -= size) { 70 for (i = n - size; i > 0; i -= size) {
71 swap(base, base + i, size); 71 swap(base, base + i, size);
72 for (r = 0; r * 2 + size < i; r = c) { 72 for (r = 0; r * 2 + size < i; r = c) {
73 c = r * 2 + size; 73 c = r * 2 + size;
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index f50a2811f9dc..b0ceb29da4c7 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -5,6 +5,41 @@
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/module.h> 6#include <linux/module.h>
7 7
8int bdi_init(struct backing_dev_info *bdi)
9{
10 int i, j;
11 int err;
12
13 for (i = 0; i < NR_BDI_STAT_ITEMS; i++) {
14 err = percpu_counter_init_irq(&bdi->bdi_stat[i], 0);
15 if (err)
16 goto err;
17 }
18
19 bdi->dirty_exceeded = 0;
20 err = prop_local_init_percpu(&bdi->completions);
21
22 if (err) {
23err:
24 for (j = 0; j < i; j++)
25 percpu_counter_destroy(&bdi->bdi_stat[i]);
26 }
27
28 return err;
29}
30EXPORT_SYMBOL(bdi_init);
31
32void bdi_destroy(struct backing_dev_info *bdi)
33{
34 int i;
35
36 for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
37 percpu_counter_destroy(&bdi->bdi_stat[i]);
38
39 prop_local_destroy_percpu(&bdi->completions);
40}
41EXPORT_SYMBOL(bdi_destroy);
42
8static wait_queue_head_t congestion_wqh[2] = { 43static wait_queue_head_t congestion_wqh[2] = {
9 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), 44 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
10 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) 45 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
@@ -55,15 +90,3 @@ long congestion_wait(int rw, long timeout)
55} 90}
56EXPORT_SYMBOL(congestion_wait); 91EXPORT_SYMBOL(congestion_wait);
57 92
58/**
59 * congestion_end - wake up sleepers on a congested backing_dev_info
60 * @rw: READ or WRITE
61 */
62void congestion_end(int rw)
63{
64 wait_queue_head_t *wqh = &congestion_wqh[rw];
65
66 if (waitqueue_active(wqh))
67 wake_up(wqh);
68}
69EXPORT_SYMBOL(congestion_end);
diff --git a/mm/filemap.c b/mm/filemap.c
index c6049e947cd9..79f24a969cb4 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -63,6 +63,7 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
63 * ->private_lock (__free_pte->__set_page_dirty_buffers) 63 * ->private_lock (__free_pte->__set_page_dirty_buffers)
64 * ->swap_lock (exclusive_swap_page, others) 64 * ->swap_lock (exclusive_swap_page, others)
65 * ->mapping->tree_lock 65 * ->mapping->tree_lock
66 * ->zone.lock
66 * 67 *
67 * ->i_mutex 68 * ->i_mutex
68 * ->i_mmap_lock (truncate->unmap_mapping_range) 69 * ->i_mmap_lock (truncate->unmap_mapping_range)
@@ -1626,12 +1627,18 @@ int __remove_suid(struct dentry *dentry, int kill)
1626 1627
1627int remove_suid(struct dentry *dentry) 1628int remove_suid(struct dentry *dentry)
1628{ 1629{
1629 int kill = should_remove_suid(dentry); 1630 int killsuid = should_remove_suid(dentry);
1631 int killpriv = security_inode_need_killpriv(dentry);
1632 int error = 0;
1630 1633
1631 if (unlikely(kill)) 1634 if (killpriv < 0)
1632 return __remove_suid(dentry, kill); 1635 return killpriv;
1636 if (killpriv)
1637 error = security_inode_killpriv(dentry);
1638 if (!error && killsuid)
1639 error = __remove_suid(dentry, killsuid);
1633 1640
1634 return 0; 1641 return error;
1635} 1642}
1636EXPORT_SYMBOL(remove_suid); 1643EXPORT_SYMBOL(remove_suid);
1637 1644
diff --git a/mm/fremap.c b/mm/fremap.c
index 95bcb5641c72..14bd3bf7826e 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * started by Ingo Molnar, Copyright (C) 2002, 2003 6 * started by Ingo Molnar, Copyright (C) 2002, 2003
7 */ 7 */
8 8#include <linux/backing-dev.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/swap.h> 10#include <linux/swap.h>
11#include <linux/file.h> 11#include <linux/file.h>
@@ -97,26 +97,28 @@ static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma,
97 97
98} 98}
99 99
100/*** 100/**
101 * sys_remap_file_pages - remap arbitrary pages of a shared backing store 101 * sys_remap_file_pages - remap arbitrary pages of an existing VM_SHARED vma
102 * file within an existing vma.
103 * @start: start of the remapped virtual memory range 102 * @start: start of the remapped virtual memory range
104 * @size: size of the remapped virtual memory range 103 * @size: size of the remapped virtual memory range
105 * @prot: new protection bits of the range 104 * @prot: new protection bits of the range (see NOTE)
106 * @pgoff: to be mapped page of the backing store file 105 * @pgoff: to-be-mapped page of the backing store file
107 * @flags: 0 or MAP_NONBLOCKED - the later will cause no IO. 106 * @flags: 0 or MAP_NONBLOCKED - the later will cause no IO.
108 * 107 *
109 * this syscall works purely via pagetables, so it's the most efficient 108 * sys_remap_file_pages remaps arbitrary pages of an existing VM_SHARED vma
109 * (shared backing store file).
110 *
111 * This syscall works purely via pagetables, so it's the most efficient
110 * way to map the same (large) file into a given virtual window. Unlike 112 * way to map the same (large) file into a given virtual window. Unlike
111 * mmap()/mremap() it does not create any new vmas. The new mappings are 113 * mmap()/mremap() it does not create any new vmas. The new mappings are
112 * also safe across swapout. 114 * also safe across swapout.
113 * 115 *
114 * NOTE: the 'prot' parameter right now is ignored, and the vma's default 116 * NOTE: the 'prot' parameter right now is ignored (but must be zero),
115 * protection is used. Arbitrary protections might be implemented in the 117 * and the vma's default protection is used. Arbitrary protections
116 * future. 118 * might be implemented in the future.
117 */ 119 */
118asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, 120asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
119 unsigned long __prot, unsigned long pgoff, unsigned long flags) 121 unsigned long prot, unsigned long pgoff, unsigned long flags)
120{ 122{
121 struct mm_struct *mm = current->mm; 123 struct mm_struct *mm = current->mm;
122 struct address_space *mapping; 124 struct address_space *mapping;
@@ -125,7 +127,7 @@ asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
125 int err = -EINVAL; 127 int err = -EINVAL;
126 int has_write_lock = 0; 128 int has_write_lock = 0;
127 129
128 if (__prot) 130 if (prot)
129 return err; 131 return err;
130 /* 132 /*
131 * Sanitize the syscall parameters: 133 * Sanitize the syscall parameters:
diff --git a/mm/mmap.c b/mm/mmap.c
index 0d40e66c841b..4275e81e25ba 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/backing-dev.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/shm.h> 12#include <linux/shm.h>
12#include <linux/mman.h> 13#include <linux/mman.h>
@@ -180,8 +181,6 @@ error:
180 return -ENOMEM; 181 return -ENOMEM;
181} 182}
182 183
183EXPORT_SYMBOL(__vm_enough_memory);
184
185/* 184/*
186 * Requires inode->i_mapping->i_mmap_lock 185 * Requires inode->i_mapping->i_mmap_lock
187 */ 186 */
diff --git a/mm/nommu.c b/mm/nommu.c
index 8ed0cb43118a..42fb84e9e815 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -44,7 +44,6 @@ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
44int heap_stack_gap = 0; 44int heap_stack_gap = 0;
45 45
46EXPORT_SYMBOL(mem_map); 46EXPORT_SYMBOL(mem_map);
47EXPORT_SYMBOL(__vm_enough_memory);
48EXPORT_SYMBOL(num_physpages); 47EXPORT_SYMBOL(num_physpages);
49 48
50/* list of shareable VMAs */ 49/* list of shareable VMAs */
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 41b4e362221d..a64decb5b13f 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -27,6 +27,8 @@
27#include <linux/notifier.h> 27#include <linux/notifier.h>
28 28
29int sysctl_panic_on_oom; 29int sysctl_panic_on_oom;
30int sysctl_oom_kill_allocating_task;
31static DEFINE_SPINLOCK(zone_scan_mutex);
30/* #define DEBUG */ 32/* #define DEBUG */
31 33
32/** 34/**
@@ -141,7 +143,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
141 * because p may have allocated or otherwise mapped memory on 143 * because p may have allocated or otherwise mapped memory on
142 * this node before. However it will be less likely. 144 * this node before. However it will be less likely.
143 */ 145 */
144 if (!cpuset_excl_nodes_overlap(p)) 146 if (!cpuset_mems_allowed_intersects(current, p))
145 points /= 8; 147 points /= 8;
146 148
147 /* 149 /*
@@ -164,16 +166,10 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
164} 166}
165 167
166/* 168/*
167 * Types of limitations to the nodes from which allocations may occur
168 */
169#define CONSTRAINT_NONE 1
170#define CONSTRAINT_MEMORY_POLICY 2
171#define CONSTRAINT_CPUSET 3
172
173/*
174 * Determine the type of allocation constraint. 169 * Determine the type of allocation constraint.
175 */ 170 */
176static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask) 171static inline enum oom_constraint constrained_alloc(struct zonelist *zonelist,
172 gfp_t gfp_mask)
177{ 173{
178#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
179 struct zone **z; 175 struct zone **z;
@@ -337,12 +333,20 @@ static int oom_kill_task(struct task_struct *p)
337 return 0; 333 return 0;
338} 334}
339 335
340static int oom_kill_process(struct task_struct *p, unsigned long points, 336static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
341 const char *message) 337 unsigned long points, const char *message)
342{ 338{
343 struct task_struct *c; 339 struct task_struct *c;
344 struct list_head *tsk; 340 struct list_head *tsk;
345 341
342 if (printk_ratelimit()) {
343 printk(KERN_WARNING "%s invoked oom-killer: "
344 "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
345 current->comm, gfp_mask, order, current->oomkilladj);
346 dump_stack();
347 show_mem();
348 }
349
346 /* 350 /*
347 * If the task is already exiting, don't alarm the sysadmin or kill 351 * If the task is already exiting, don't alarm the sysadmin or kill
348 * its children or threads, just set TIF_MEMDIE so it can die quickly 352 * 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)
380} 384}
381EXPORT_SYMBOL_GPL(unregister_oom_notifier); 385EXPORT_SYMBOL_GPL(unregister_oom_notifier);
382 386
387/*
388 * Try to acquire the OOM killer lock for the zones in zonelist. Returns zero
389 * if a parallel OOM killing is already taking place that includes a zone in
390 * the zonelist. Otherwise, locks all zones in the zonelist and returns 1.
391 */
392int try_set_zone_oom(struct zonelist *zonelist)
393{
394 struct zone **z;
395 int ret = 1;
396
397 z = zonelist->zones;
398
399 spin_lock(&zone_scan_mutex);
400 do {
401 if (zone_is_oom_locked(*z)) {
402 ret = 0;
403 goto out;
404 }
405 } while (*(++z) != NULL);
406
407 /*
408 * Lock each zone in the zonelist under zone_scan_mutex so a parallel
409 * invocation of try_set_zone_oom() doesn't succeed when it shouldn't.
410 */
411 z = zonelist->zones;
412 do {
413 zone_set_flag(*z, ZONE_OOM_LOCKED);
414 } while (*(++z) != NULL);
415out:
416 spin_unlock(&zone_scan_mutex);
417 return ret;
418}
419
420/*
421 * Clears the ZONE_OOM_LOCKED flag for all zones in the zonelist so that failed
422 * allocation attempts with zonelists containing them may now recall the OOM
423 * killer, if necessary.
424 */
425void clear_zonelist_oom(struct zonelist *zonelist)
426{
427 struct zone **z;
428
429 z = zonelist->zones;
430
431 spin_lock(&zone_scan_mutex);
432 do {
433 zone_clear_flag(*z, ZONE_OOM_LOCKED);
434 } while (*(++z) != NULL);
435 spin_unlock(&zone_scan_mutex);
436}
437
383/** 438/**
384 * out_of_memory - kill the "best" process when we run out of memory 439 * out_of_memory - kill the "best" process when we run out of memory
385 * 440 *
@@ -393,21 +448,13 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
393 struct task_struct *p; 448 struct task_struct *p;
394 unsigned long points = 0; 449 unsigned long points = 0;
395 unsigned long freed = 0; 450 unsigned long freed = 0;
396 int constraint; 451 enum oom_constraint constraint;
397 452
398 blocking_notifier_call_chain(&oom_notify_list, 0, &freed); 453 blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
399 if (freed > 0) 454 if (freed > 0)
400 /* Got some memory back in the last second. */ 455 /* Got some memory back in the last second. */
401 return; 456 return;
402 457
403 if (printk_ratelimit()) {
404 printk(KERN_WARNING "%s invoked oom-killer: "
405 "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
406 current->comm, gfp_mask, order, current->oomkilladj);
407 dump_stack();
408 show_mem();
409 }
410
411 if (sysctl_panic_on_oom == 2) 458 if (sysctl_panic_on_oom == 2)
412 panic("out of memory. Compulsory panic_on_oom is selected.\n"); 459 panic("out of memory. Compulsory panic_on_oom is selected.\n");
413 460
@@ -416,23 +463,24 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
416 * NUMA) that may require different handling. 463 * NUMA) that may require different handling.
417 */ 464 */
418 constraint = constrained_alloc(zonelist, gfp_mask); 465 constraint = constrained_alloc(zonelist, gfp_mask);
419 cpuset_lock();
420 read_lock(&tasklist_lock); 466 read_lock(&tasklist_lock);
421 467
422 switch (constraint) { 468 switch (constraint) {
423 case CONSTRAINT_MEMORY_POLICY: 469 case CONSTRAINT_MEMORY_POLICY:
424 oom_kill_process(current, points, 470 oom_kill_process(current, gfp_mask, order, points,
425 "No available memory (MPOL_BIND)"); 471 "No available memory (MPOL_BIND)");
426 break; 472 break;
427 473
428 case CONSTRAINT_CPUSET:
429 oom_kill_process(current, points,
430 "No available memory in cpuset");
431 break;
432
433 case CONSTRAINT_NONE: 474 case CONSTRAINT_NONE:
434 if (sysctl_panic_on_oom) 475 if (sysctl_panic_on_oom)
435 panic("out of memory. panic_on_oom is selected\n"); 476 panic("out of memory. panic_on_oom is selected\n");
477 /* Fall-through */
478 case CONSTRAINT_CPUSET:
479 if (sysctl_oom_kill_allocating_task) {
480 oom_kill_process(current, gfp_mask, order, points,
481 "Out of memory (oom_kill_allocating_task)");
482 break;
483 }
436retry: 484retry:
437 /* 485 /*
438 * Rambo mode: Shoot down a process and hope it solves whatever 486 * Rambo mode: Shoot down a process and hope it solves whatever
@@ -446,11 +494,11 @@ retry:
446 /* Found nothing?!?! Either we hang forever, or we panic. */ 494 /* Found nothing?!?! Either we hang forever, or we panic. */
447 if (!p) { 495 if (!p) {
448 read_unlock(&tasklist_lock); 496 read_unlock(&tasklist_lock);
449 cpuset_unlock();
450 panic("Out of memory and no killable processes...\n"); 497 panic("Out of memory and no killable processes...\n");
451 } 498 }
452 499
453 if (oom_kill_process(p, points, "Out of memory")) 500 if (oom_kill_process(p, points, gfp_mask, order,
501 "Out of memory"))
454 goto retry; 502 goto retry;
455 503
456 break; 504 break;
@@ -458,7 +506,6 @@ retry:
458 506
459out: 507out:
460 read_unlock(&tasklist_lock); 508 read_unlock(&tasklist_lock);
461 cpuset_unlock();
462 509
463 /* 510 /*
464 * Give "p" a good chance of killing itself before we 511 * Give "p" a good chance of killing itself before we
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index d821321326e3..7845462064f4 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2,6 +2,7 @@
2 * mm/page-writeback.c 2 * mm/page-writeback.c
3 * 3 *
4 * Copyright (C) 2002, Linus Torvalds. 4 * Copyright (C) 2002, Linus Torvalds.
5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
5 * 6 *
6 * Contains functions related to writing back dirty pages at the 7 * Contains functions related to writing back dirty pages at the
7 * address_space level. 8 * address_space level.
@@ -36,7 +37,7 @@
36 37
37/* 38/*
38 * The maximum number of pages to writeout in a single bdflush/kupdate 39 * The maximum number of pages to writeout in a single bdflush/kupdate
39 * operation. We do this so we don't hold I_LOCK against an inode for 40 * operation. We do this so we don't hold I_SYNC against an inode for
40 * enormous amounts of time, which would block a userspace task which has 41 * enormous amounts of time, which would block a userspace task which has
41 * been forced to throttle against that inode. Also, the code reevaluates 42 * been forced to throttle against that inode. Also, the code reevaluates
42 * the dirty each time it has written this many pages. 43 * the dirty each time it has written this many pages.
@@ -49,8 +50,6 @@
49 */ 50 */
50static long ratelimit_pages = 32; 51static long ratelimit_pages = 32;
51 52
52static int dirty_exceeded __cacheline_aligned_in_smp; /* Dirty mem may be over limit */
53
54/* 53/*
55 * When balance_dirty_pages decides that the caller needs to perform some 54 * When balance_dirty_pages decides that the caller needs to perform some
56 * non-background writeback, this is how many pages it will attempt to write. 55 * non-background writeback, this is how many pages it will attempt to write.
@@ -103,6 +102,141 @@ EXPORT_SYMBOL(laptop_mode);
103static void background_writeout(unsigned long _min_pages); 102static void background_writeout(unsigned long _min_pages);
104 103
105/* 104/*
105 * Scale the writeback cache size proportional to the relative writeout speeds.
106 *
107 * We do this by keeping a floating proportion between BDIs, based on page
108 * writeback completions [end_page_writeback()]. Those devices that write out
109 * pages fastest will get the larger share, while the slower will get a smaller
110 * share.
111 *
112 * We use page writeout completions because we are interested in getting rid of
113 * dirty pages. Having them written out is the primary goal.
114 *
115 * We introduce a concept of time, a period over which we measure these events,
116 * because demand can/will vary over time. The length of this period itself is
117 * measured in page writeback completions.
118 *
119 */
120static struct prop_descriptor vm_completions;
121static struct prop_descriptor vm_dirties;
122
123static unsigned long determine_dirtyable_memory(void);
124
125/*
126 * couple the period to the dirty_ratio:
127 *
128 * period/2 ~ roundup_pow_of_two(dirty limit)
129 */
130static int calc_period_shift(void)
131{
132 unsigned long dirty_total;
133
134 dirty_total = (vm_dirty_ratio * determine_dirtyable_memory()) / 100;
135 return 2 + ilog2(dirty_total - 1);
136}
137
138/*
139 * update the period when the dirty ratio changes.
140 */
141int dirty_ratio_handler(struct ctl_table *table, int write,
142 struct file *filp, void __user *buffer, size_t *lenp,
143 loff_t *ppos)
144{
145 int old_ratio = vm_dirty_ratio;
146 int ret = proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos);
147 if (ret == 0 && write && vm_dirty_ratio != old_ratio) {
148 int shift = calc_period_shift();
149 prop_change_shift(&vm_completions, shift);
150 prop_change_shift(&vm_dirties, shift);
151 }
152 return ret;
153}
154
155/*
156 * Increment the BDI's writeout completion count and the global writeout
157 * completion count. Called from test_clear_page_writeback().
158 */
159static inline void __bdi_writeout_inc(struct backing_dev_info *bdi)
160{
161 __prop_inc_percpu(&vm_completions, &bdi->completions);
162}
163
164static inline void task_dirty_inc(struct task_struct *tsk)
165{
166 prop_inc_single(&vm_dirties, &tsk->dirties);
167}
168
169/*
170 * Obtain an accurate fraction of the BDI's portion.
171 */
172static void bdi_writeout_fraction(struct backing_dev_info *bdi,
173 long *numerator, long *denominator)
174{
175 if (bdi_cap_writeback_dirty(bdi)) {
176 prop_fraction_percpu(&vm_completions, &bdi->completions,
177 numerator, denominator);
178 } else {
179 *numerator = 0;
180 *denominator = 1;
181 }
182}
183
184/*
185 * Clip the earned share of dirty pages to that which is actually available.
186 * This avoids exceeding the total dirty_limit when the floating averages
187 * fluctuate too quickly.
188 */
189static void
190clip_bdi_dirty_limit(struct backing_dev_info *bdi, long dirty, long *pbdi_dirty)
191{
192 long avail_dirty;
193
194 avail_dirty = dirty -
195 (global_page_state(NR_FILE_DIRTY) +
196 global_page_state(NR_WRITEBACK) +
197 global_page_state(NR_UNSTABLE_NFS));
198
199 if (avail_dirty < 0)
200 avail_dirty = 0;
201
202 avail_dirty += bdi_stat(bdi, BDI_RECLAIMABLE) +
203 bdi_stat(bdi, BDI_WRITEBACK);
204
205 *pbdi_dirty = min(*pbdi_dirty, avail_dirty);
206}
207
208static inline void task_dirties_fraction(struct task_struct *tsk,
209 long *numerator, long *denominator)
210{
211 prop_fraction_single(&vm_dirties, &tsk->dirties,
212 numerator, denominator);
213}
214
215/*
216 * scale the dirty limit
217 *
218 * task specific dirty limit:
219 *
220 * dirty -= (dirty/8) * p_{t}
221 */
222void task_dirty_limit(struct task_struct *tsk, long *pdirty)
223{
224 long numerator, denominator;
225 long dirty = *pdirty;
226 u64 inv = dirty >> 3;
227
228 task_dirties_fraction(tsk, &numerator, &denominator);
229 inv *= numerator;
230 do_div(inv, denominator);
231
232 dirty -= inv;
233 if (dirty < *pdirty/2)
234 dirty = *pdirty/2;
235
236 *pdirty = dirty;
237}
238
239/*
106 * Work out the current dirty-memory clamping and background writeout 240 * Work out the current dirty-memory clamping and background writeout
107 * thresholds. 241 * thresholds.
108 * 242 *
@@ -158,8 +292,8 @@ static unsigned long determine_dirtyable_memory(void)
158} 292}
159 293
160static void 294static void
161get_dirty_limits(long *pbackground, long *pdirty, 295get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
162 struct address_space *mapping) 296 struct backing_dev_info *bdi)
163{ 297{
164 int background_ratio; /* Percentages */ 298 int background_ratio; /* Percentages */
165 int dirty_ratio; 299 int dirty_ratio;
@@ -193,6 +327,23 @@ get_dirty_limits(long *pbackground, long *pdirty,
193 } 327 }
194 *pbackground = background; 328 *pbackground = background;
195 *pdirty = dirty; 329 *pdirty = dirty;
330
331 if (bdi) {
332 u64 bdi_dirty = dirty;
333 long numerator, denominator;
334
335 /*
336 * Calculate this BDI's share of the dirty ratio.
337 */
338 bdi_writeout_fraction(bdi, &numerator, &denominator);
339
340 bdi_dirty *= numerator;
341 do_div(bdi_dirty, denominator);
342
343 *pbdi_dirty = bdi_dirty;
344 clip_bdi_dirty_limit(bdi, dirty, pbdi_dirty);
345 task_dirty_limit(current, pbdi_dirty);
346 }
196} 347}
197 348
198/* 349/*
@@ -204,9 +355,11 @@ get_dirty_limits(long *pbackground, long *pdirty,
204 */ 355 */
205static void balance_dirty_pages(struct address_space *mapping) 356static void balance_dirty_pages(struct address_space *mapping)
206{ 357{
207 long nr_reclaimable; 358 long bdi_nr_reclaimable;
359 long bdi_nr_writeback;
208 long background_thresh; 360 long background_thresh;
209 long dirty_thresh; 361 long dirty_thresh;
362 long bdi_thresh;
210 unsigned long pages_written = 0; 363 unsigned long pages_written = 0;
211 unsigned long write_chunk = sync_writeback_pages(); 364 unsigned long write_chunk = sync_writeback_pages();
212 365
@@ -221,15 +374,15 @@ static void balance_dirty_pages(struct address_space *mapping)
221 .range_cyclic = 1, 374 .range_cyclic = 1,
222 }; 375 };
223 376
224 get_dirty_limits(&background_thresh, &dirty_thresh, mapping); 377 get_dirty_limits(&background_thresh, &dirty_thresh,
225 nr_reclaimable = global_page_state(NR_FILE_DIRTY) + 378 &bdi_thresh, bdi);
226 global_page_state(NR_UNSTABLE_NFS); 379 bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
227 if (nr_reclaimable + global_page_state(NR_WRITEBACK) <= 380 bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
228 dirty_thresh) 381 if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
229 break; 382 break;
230 383
231 if (!dirty_exceeded) 384 if (!bdi->dirty_exceeded)
232 dirty_exceeded = 1; 385 bdi->dirty_exceeded = 1;
233 386
234 /* Note: nr_reclaimable denotes nr_dirty + nr_unstable. 387 /* Note: nr_reclaimable denotes nr_dirty + nr_unstable.
235 * Unstable writes are a feature of certain networked 388 * Unstable writes are a feature of certain networked
@@ -237,26 +390,42 @@ static void balance_dirty_pages(struct address_space *mapping)
237 * written to the server's write cache, but has not yet 390 * written to the server's write cache, but has not yet
238 * been flushed to permanent storage. 391 * been flushed to permanent storage.
239 */ 392 */
240 if (nr_reclaimable) { 393 if (bdi_nr_reclaimable) {
241 writeback_inodes(&wbc); 394 writeback_inodes(&wbc);
242 get_dirty_limits(&background_thresh,
243 &dirty_thresh, mapping);
244 nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
245 global_page_state(NR_UNSTABLE_NFS);
246 if (nr_reclaimable +
247 global_page_state(NR_WRITEBACK)
248 <= dirty_thresh)
249 break;
250 pages_written += write_chunk - wbc.nr_to_write; 395 pages_written += write_chunk - wbc.nr_to_write;
251 if (pages_written >= write_chunk) 396 get_dirty_limits(&background_thresh, &dirty_thresh,
252 break; /* We've done our duty */ 397 &bdi_thresh, bdi);
398 }
399
400 /*
401 * In order to avoid the stacked BDI deadlock we need
402 * to ensure we accurately count the 'dirty' pages when
403 * the threshold is low.
404 *
405 * Otherwise it would be possible to get thresh+n pages
406 * reported dirty, even though there are thresh-m pages
407 * actually dirty; with m+n sitting in the percpu
408 * deltas.
409 */
410 if (bdi_thresh < 2*bdi_stat_error(bdi)) {
411 bdi_nr_reclaimable = bdi_stat_sum(bdi, BDI_RECLAIMABLE);
412 bdi_nr_writeback = bdi_stat_sum(bdi, BDI_WRITEBACK);
413 } else if (bdi_nr_reclaimable) {
414 bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
415 bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
253 } 416 }
417
418 if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
419 break;
420 if (pages_written >= write_chunk)
421 break; /* We've done our duty */
422
254 congestion_wait(WRITE, HZ/10); 423 congestion_wait(WRITE, HZ/10);
255 } 424 }
256 425
257 if (nr_reclaimable + global_page_state(NR_WRITEBACK) 426 if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh &&
258 <= dirty_thresh && dirty_exceeded) 427 bdi->dirty_exceeded)
259 dirty_exceeded = 0; 428 bdi->dirty_exceeded = 0;
260 429
261 if (writeback_in_progress(bdi)) 430 if (writeback_in_progress(bdi))
262 return; /* pdflush is already working this queue */ 431 return; /* pdflush is already working this queue */
@@ -270,7 +439,9 @@ static void balance_dirty_pages(struct address_space *mapping)
270 * background_thresh, to keep the amount of dirty memory low. 439 * background_thresh, to keep the amount of dirty memory low.
271 */ 440 */
272 if ((laptop_mode && pages_written) || 441 if ((laptop_mode && pages_written) ||
273 (!laptop_mode && (nr_reclaimable > background_thresh))) 442 (!laptop_mode && (global_page_state(NR_FILE_DIRTY)
443 + global_page_state(NR_UNSTABLE_NFS)
444 > background_thresh)))
274 pdflush_operation(background_writeout, 0); 445 pdflush_operation(background_writeout, 0);
275} 446}
276 447
@@ -306,7 +477,7 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
306 unsigned long *p; 477 unsigned long *p;
307 478
308 ratelimit = ratelimit_pages; 479 ratelimit = ratelimit_pages;
309 if (dirty_exceeded) 480 if (mapping->backing_dev_info->dirty_exceeded)
310 ratelimit = 8; 481 ratelimit = 8;
311 482
312 /* 483 /*
@@ -331,18 +502,8 @@ void throttle_vm_writeout(gfp_t gfp_mask)
331 long background_thresh; 502 long background_thresh;
332 long dirty_thresh; 503 long dirty_thresh;
333 504
334 if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO)) {
335 /*
336 * The caller might hold locks which can prevent IO completion
337 * or progress in the filesystem. So we cannot just sit here
338 * waiting for IO to complete.
339 */
340 congestion_wait(WRITE, HZ/10);
341 return;
342 }
343
344 for ( ; ; ) { 505 for ( ; ; ) {
345 get_dirty_limits(&background_thresh, &dirty_thresh, NULL); 506 get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
346 507
347 /* 508 /*
348 * Boost the allowable dirty threshold a bit for page 509 * Boost the allowable dirty threshold a bit for page
@@ -354,6 +515,14 @@ void throttle_vm_writeout(gfp_t gfp_mask)
354 global_page_state(NR_WRITEBACK) <= dirty_thresh) 515 global_page_state(NR_WRITEBACK) <= dirty_thresh)
355 break; 516 break;
356 congestion_wait(WRITE, HZ/10); 517 congestion_wait(WRITE, HZ/10);
518
519 /*
520 * The caller might hold locks which can prevent IO completion
521 * or progress in the filesystem. So we cannot just sit here
522 * waiting for IO to complete.
523 */
524 if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO))
525 break;
357 } 526 }
358} 527}
359 528
@@ -377,11 +546,12 @@ static void background_writeout(unsigned long _min_pages)
377 long background_thresh; 546 long background_thresh;
378 long dirty_thresh; 547 long dirty_thresh;
379 548
380 get_dirty_limits(&background_thresh, &dirty_thresh, NULL); 549 get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
381 if (global_page_state(NR_FILE_DIRTY) + 550 if (global_page_state(NR_FILE_DIRTY) +
382 global_page_state(NR_UNSTABLE_NFS) < background_thresh 551 global_page_state(NR_UNSTABLE_NFS) < background_thresh
383 && min_pages <= 0) 552 && min_pages <= 0)
384 break; 553 break;
554 wbc.more_io = 0;
385 wbc.encountered_congestion = 0; 555 wbc.encountered_congestion = 0;
386 wbc.nr_to_write = MAX_WRITEBACK_PAGES; 556 wbc.nr_to_write = MAX_WRITEBACK_PAGES;
387 wbc.pages_skipped = 0; 557 wbc.pages_skipped = 0;
@@ -389,8 +559,9 @@ static void background_writeout(unsigned long _min_pages)
389 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; 559 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
390 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { 560 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
391 /* Wrote less than expected */ 561 /* Wrote less than expected */
392 congestion_wait(WRITE, HZ/10); 562 if (wbc.encountered_congestion || wbc.more_io)
393 if (!wbc.encountered_congestion) 563 congestion_wait(WRITE, HZ/10);
564 else
394 break; 565 break;
395 } 566 }
396 } 567 }
@@ -455,11 +626,12 @@ static void wb_kupdate(unsigned long arg)
455 global_page_state(NR_UNSTABLE_NFS) + 626 global_page_state(NR_UNSTABLE_NFS) +
456 (inodes_stat.nr_inodes - inodes_stat.nr_unused); 627 (inodes_stat.nr_inodes - inodes_stat.nr_unused);
457 while (nr_to_write > 0) { 628 while (nr_to_write > 0) {
629 wbc.more_io = 0;
458 wbc.encountered_congestion = 0; 630 wbc.encountered_congestion = 0;
459 wbc.nr_to_write = MAX_WRITEBACK_PAGES; 631 wbc.nr_to_write = MAX_WRITEBACK_PAGES;
460 writeback_inodes(&wbc); 632 writeback_inodes(&wbc);
461 if (wbc.nr_to_write > 0) { 633 if (wbc.nr_to_write > 0) {
462 if (wbc.encountered_congestion) 634 if (wbc.encountered_congestion || wbc.more_io)
463 congestion_wait(WRITE, HZ/10); 635 congestion_wait(WRITE, HZ/10);
464 else 636 else
465 break; /* All the old data is written */ 637 break; /* All the old data is written */
@@ -580,9 +752,15 @@ static struct notifier_block __cpuinitdata ratelimit_nb = {
580 */ 752 */
581void __init page_writeback_init(void) 753void __init page_writeback_init(void)
582{ 754{
755 int shift;
756
583 mod_timer(&wb_timer, jiffies + dirty_writeback_interval); 757 mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
584 writeback_set_ratelimit(); 758 writeback_set_ratelimit();
585 register_cpu_notifier(&ratelimit_nb); 759 register_cpu_notifier(&ratelimit_nb);
760
761 shift = calc_period_shift();
762 prop_descriptor_init(&vm_completions, shift);
763 prop_descriptor_init(&vm_dirties, shift);
586} 764}
587 765
588/** 766/**
@@ -672,8 +850,10 @@ retry:
672 850
673 ret = (*writepage)(page, wbc, data); 851 ret = (*writepage)(page, wbc, data);
674 852
675 if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) 853 if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) {
676 unlock_page(page); 854 unlock_page(page);
855 ret = 0;
856 }
677 if (ret || (--(wbc->nr_to_write) <= 0)) 857 if (ret || (--(wbc->nr_to_write) <= 0))
678 done = 1; 858 done = 1;
679 if (wbc->nonblocking && bdi_write_congested(bdi)) { 859 if (wbc->nonblocking && bdi_write_congested(bdi)) {
@@ -827,6 +1007,8 @@ int __set_page_dirty_nobuffers(struct page *page)
827 WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page)); 1007 WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
828 if (mapping_cap_account_dirty(mapping)) { 1008 if (mapping_cap_account_dirty(mapping)) {
829 __inc_zone_page_state(page, NR_FILE_DIRTY); 1009 __inc_zone_page_state(page, NR_FILE_DIRTY);
1010 __inc_bdi_stat(mapping->backing_dev_info,
1011 BDI_RECLAIMABLE);
830 task_io_account_write(PAGE_CACHE_SIZE); 1012 task_io_account_write(PAGE_CACHE_SIZE);
831 } 1013 }
832 radix_tree_tag_set(&mapping->page_tree, 1014 radix_tree_tag_set(&mapping->page_tree,
@@ -859,7 +1041,7 @@ EXPORT_SYMBOL(redirty_page_for_writepage);
859 * If the mapping doesn't provide a set_page_dirty a_op, then 1041 * If the mapping doesn't provide a set_page_dirty a_op, then
860 * just fall through and assume that it wants buffer_heads. 1042 * just fall through and assume that it wants buffer_heads.
861 */ 1043 */
862int fastcall set_page_dirty(struct page *page) 1044static int __set_page_dirty(struct page *page)
863{ 1045{
864 struct address_space *mapping = page_mapping(page); 1046 struct address_space *mapping = page_mapping(page);
865 1047
@@ -877,6 +1059,14 @@ int fastcall set_page_dirty(struct page *page)
877 } 1059 }
878 return 0; 1060 return 0;
879} 1061}
1062
1063int fastcall set_page_dirty(struct page *page)
1064{
1065 int ret = __set_page_dirty(page);
1066 if (ret)
1067 task_dirty_inc(current);
1068 return ret;
1069}
880EXPORT_SYMBOL(set_page_dirty); 1070EXPORT_SYMBOL(set_page_dirty);
881 1071
882/* 1072/*
@@ -961,6 +1151,8 @@ int clear_page_dirty_for_io(struct page *page)
961 */ 1151 */
962 if (TestClearPageDirty(page)) { 1152 if (TestClearPageDirty(page)) {
963 dec_zone_page_state(page, NR_FILE_DIRTY); 1153 dec_zone_page_state(page, NR_FILE_DIRTY);
1154 dec_bdi_stat(mapping->backing_dev_info,
1155 BDI_RECLAIMABLE);
964 return 1; 1156 return 1;
965 } 1157 }
966 return 0; 1158 return 0;
@@ -975,14 +1167,20 @@ int test_clear_page_writeback(struct page *page)
975 int ret; 1167 int ret;
976 1168
977 if (mapping) { 1169 if (mapping) {
1170 struct backing_dev_info *bdi = mapping->backing_dev_info;
978 unsigned long flags; 1171 unsigned long flags;
979 1172
980 write_lock_irqsave(&mapping->tree_lock, flags); 1173 write_lock_irqsave(&mapping->tree_lock, flags);
981 ret = TestClearPageWriteback(page); 1174 ret = TestClearPageWriteback(page);
982 if (ret) 1175 if (ret) {
983 radix_tree_tag_clear(&mapping->page_tree, 1176 radix_tree_tag_clear(&mapping->page_tree,
984 page_index(page), 1177 page_index(page),
985 PAGECACHE_TAG_WRITEBACK); 1178 PAGECACHE_TAG_WRITEBACK);
1179 if (bdi_cap_writeback_dirty(bdi)) {
1180 __dec_bdi_stat(bdi, BDI_WRITEBACK);
1181 __bdi_writeout_inc(bdi);
1182 }
1183 }
986 write_unlock_irqrestore(&mapping->tree_lock, flags); 1184 write_unlock_irqrestore(&mapping->tree_lock, flags);
987 } else { 1185 } else {
988 ret = TestClearPageWriteback(page); 1186 ret = TestClearPageWriteback(page);
@@ -998,14 +1196,18 @@ int test_set_page_writeback(struct page *page)
998 int ret; 1196 int ret;
999 1197
1000 if (mapping) { 1198 if (mapping) {
1199 struct backing_dev_info *bdi = mapping->backing_dev_info;
1001 unsigned long flags; 1200 unsigned long flags;
1002 1201
1003 write_lock_irqsave(&mapping->tree_lock, flags); 1202 write_lock_irqsave(&mapping->tree_lock, flags);
1004 ret = TestSetPageWriteback(page); 1203 ret = TestSetPageWriteback(page);
1005 if (!ret) 1204 if (!ret) {
1006 radix_tree_tag_set(&mapping->page_tree, 1205 radix_tree_tag_set(&mapping->page_tree,
1007 page_index(page), 1206 page_index(page),
1008 PAGECACHE_TAG_WRITEBACK); 1207 PAGECACHE_TAG_WRITEBACK);
1208 if (bdi_cap_writeback_dirty(bdi))
1209 __inc_bdi_stat(bdi, BDI_WRITEBACK);
1210 }
1009 if (!PageDirty(page)) 1211 if (!PageDirty(page))
1010 radix_tree_tag_clear(&mapping->page_tree, 1212 radix_tree_tag_clear(&mapping->page_tree,
1011 page_index(page), 1213 page_index(page),
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d315e1127dc9..43f757fcf30f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -27,6 +27,7 @@
27#include <linux/pagevec.h> 27#include <linux/pagevec.h>
28#include <linux/blkdev.h> 28#include <linux/blkdev.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/oom.h>
30#include <linux/notifier.h> 31#include <linux/notifier.h>
31#include <linux/topology.h> 32#include <linux/topology.h>
32#include <linux/sysctl.h> 33#include <linux/sysctl.h>
@@ -489,7 +490,7 @@ static void free_pages_bulk(struct zone *zone, int count,
489 struct list_head *list, int order) 490 struct list_head *list, int order)
490{ 491{
491 spin_lock(&zone->lock); 492 spin_lock(&zone->lock);
492 zone->all_unreclaimable = 0; 493 zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE);
493 zone->pages_scanned = 0; 494 zone->pages_scanned = 0;
494 while (count--) { 495 while (count--) {
495 struct page *page; 496 struct page *page;
@@ -506,7 +507,7 @@ static void free_pages_bulk(struct zone *zone, int count,
506static void free_one_page(struct zone *zone, struct page *page, int order) 507static void free_one_page(struct zone *zone, struct page *page, int order)
507{ 508{
508 spin_lock(&zone->lock); 509 spin_lock(&zone->lock);
509 zone->all_unreclaimable = 0; 510 zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE);
510 zone->pages_scanned = 0; 511 zone->pages_scanned = 0;
511 __free_one_page(page, zone, order); 512 __free_one_page(page, zone, order);
512 spin_unlock(&zone->lock); 513 spin_unlock(&zone->lock);
@@ -1586,6 +1587,11 @@ nofail_alloc:
1586 if (page) 1587 if (page)
1587 goto got_pg; 1588 goto got_pg;
1588 } else if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) { 1589 } else if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) {
1590 if (!try_set_zone_oom(zonelist)) {
1591 schedule_timeout_uninterruptible(1);
1592 goto restart;
1593 }
1594
1589 /* 1595 /*
1590 * Go through the zonelist yet one more time, keep 1596 * Go through the zonelist yet one more time, keep
1591 * very high watermark here, this is only to catch 1597 * very high watermark here, this is only to catch
@@ -1594,14 +1600,19 @@ nofail_alloc:
1594 */ 1600 */
1595 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, 1601 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order,
1596 zonelist, ALLOC_WMARK_HIGH|ALLOC_CPUSET); 1602 zonelist, ALLOC_WMARK_HIGH|ALLOC_CPUSET);
1597 if (page) 1603 if (page) {
1604 clear_zonelist_oom(zonelist);
1598 goto got_pg; 1605 goto got_pg;
1606 }
1599 1607
1600 /* The OOM killer will not help higher order allocs so fail */ 1608 /* The OOM killer will not help higher order allocs so fail */
1601 if (order > PAGE_ALLOC_COSTLY_ORDER) 1609 if (order > PAGE_ALLOC_COSTLY_ORDER) {
1610 clear_zonelist_oom(zonelist);
1602 goto nopage; 1611 goto nopage;
1612 }
1603 1613
1604 out_of_memory(zonelist, gfp_mask, order); 1614 out_of_memory(zonelist, gfp_mask, order);
1615 clear_zonelist_oom(zonelist);
1605 goto restart; 1616 goto restart;
1606 } 1617 }
1607 1618
@@ -1850,7 +1861,7 @@ void show_free_areas(void)
1850 K(zone_page_state(zone, NR_INACTIVE)), 1861 K(zone_page_state(zone, NR_INACTIVE)),
1851 K(zone->present_pages), 1862 K(zone->present_pages),
1852 zone->pages_scanned, 1863 zone->pages_scanned,
1853 (zone->all_unreclaimable ? "yes" : "no") 1864 (zone_is_all_unreclaimable(zone) ? "yes" : "no")
1854 ); 1865 );
1855 printk("lowmem_reserve[]:"); 1866 printk("lowmem_reserve[]:");
1856 for (i = 0; i < MAX_NR_ZONES; i++) 1867 for (i = 0; i < MAX_NR_ZONES; i++)
@@ -3371,7 +3382,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
3371 zone->nr_scan_active = 0; 3382 zone->nr_scan_active = 0;
3372 zone->nr_scan_inactive = 0; 3383 zone->nr_scan_inactive = 0;
3373 zap_zone_vm_stats(zone); 3384 zap_zone_vm_stats(zone);
3374 atomic_set(&zone->reclaim_in_progress, 0); 3385 zone->flags = 0;
3375 if (!size) 3386 if (!size)
3376 continue; 3387 continue;
3377 3388
diff --git a/mm/readahead.c b/mm/readahead.c
index 229788884010..c9c50ca1ec38 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -233,6 +233,12 @@ unsigned long max_sane_readahead(unsigned long nr)
233 + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); 233 + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2);
234} 234}
235 235
236static int __init readahead_init(void)
237{
238 return bdi_init(&default_backing_dev_info);
239}
240subsys_initcall(readahead_init);
241
236/* 242/*
237 * Submit IO for the read-ahead request in file_ra_state. 243 * Submit IO for the read-ahead request in file_ra_state.
238 */ 244 */
diff --git a/mm/rmap.c b/mm/rmap.c
index 2b9f413c9c00..8990f909492f 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -36,6 +36,7 @@
36 * mapping->tree_lock (widely used, in set_page_dirty, 36 * mapping->tree_lock (widely used, in set_page_dirty,
37 * in arch-dependent flush_dcache_mmap_lock, 37 * in arch-dependent flush_dcache_mmap_lock,
38 * within inode_lock in __sync_single_inode) 38 * within inode_lock in __sync_single_inode)
39 * zone->lock (within radix tree node alloc)
39 */ 40 */
40 41
41#include <linux/mm.h> 42#include <linux/mm.h>
@@ -137,8 +138,7 @@ void anon_vma_unlink(struct vm_area_struct *vma)
137 anon_vma_free(anon_vma); 138 anon_vma_free(anon_vma);
138} 139}
139 140
140static void anon_vma_ctor(void *data, struct kmem_cache *cachep, 141static void anon_vma_ctor(struct kmem_cache *cachep, void *data)
141 unsigned long flags)
142{ 142{
143 struct anon_vma *anon_vma = data; 143 struct anon_vma *anon_vma = data;
144 144
diff --git a/mm/shmem.c b/mm/shmem.c
index 8a82342a8595..289dbb0a6fd6 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2328,8 +2328,7 @@ static void shmem_destroy_inode(struct inode *inode)
2328 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); 2328 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
2329} 2329}
2330 2330
2331static void init_once(void *foo, struct kmem_cache *cachep, 2331static void init_once(struct kmem_cache *cachep, void *foo)
2332 unsigned long flags)
2333{ 2332{
2334 struct shmem_inode_info *p = (struct shmem_inode_info *) foo; 2333 struct shmem_inode_info *p = (struct shmem_inode_info *) foo;
2335 2334
@@ -2344,9 +2343,7 @@ static int init_inodecache(void)
2344{ 2343{
2345 shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", 2344 shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
2346 sizeof(struct shmem_inode_info), 2345 sizeof(struct shmem_inode_info),
2347 0, 0, init_once); 2346 0, SLAB_PANIC, init_once);
2348 if (shmem_inode_cachep == NULL)
2349 return -ENOMEM;
2350 return 0; 2347 return 0;
2351} 2348}
2352 2349
@@ -2464,6 +2461,10 @@ static int __init init_tmpfs(void)
2464{ 2461{
2465 int error; 2462 int error;
2466 2463
2464 error = bdi_init(&shmem_backing_dev_info);
2465 if (error)
2466 goto out4;
2467
2467 error = init_inodecache(); 2468 error = init_inodecache();
2468 if (error) 2469 if (error)
2469 goto out3; 2470 goto out3;
@@ -2488,6 +2489,8 @@ out1:
2488out2: 2489out2:
2489 destroy_inodecache(); 2490 destroy_inodecache();
2490out3: 2491out3:
2492 bdi_destroy(&shmem_backing_dev_info);
2493out4:
2491 shm_mnt = ERR_PTR(error); 2494 shm_mnt = ERR_PTR(error);
2492 return error; 2495 return error;
2493} 2496}
@@ -2540,11 +2543,8 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
2540 d_instantiate(dentry, inode); 2543 d_instantiate(dentry, inode);
2541 inode->i_size = size; 2544 inode->i_size = size;
2542 inode->i_nlink = 0; /* It is unlinked */ 2545 inode->i_nlink = 0; /* It is unlinked */
2543 file->f_path.mnt = mntget(shm_mnt); 2546 init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
2544 file->f_path.dentry = dentry; 2547 &shmem_file_operations);
2545 file->f_mapping = inode->i_mapping;
2546 file->f_op = &shmem_file_operations;
2547 file->f_mode = FMODE_WRITE | FMODE_READ;
2548 return file; 2548 return file;
2549 2549
2550close_file: 2550close_file:
diff --git a/mm/slab.c b/mm/slab.c
index e34bcb87a6ee..3ce9bc024d67 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -267,11 +267,10 @@ struct array_cache {
267 unsigned int batchcount; 267 unsigned int batchcount;
268 unsigned int touched; 268 unsigned int touched;
269 spinlock_t lock; 269 spinlock_t lock;
270 void *entry[0]; /* 270 void *entry[]; /*
271 * Must have this definition in here for the proper 271 * Must have this definition in here for the proper
272 * alignment of array_cache. Also simplifies accessing 272 * alignment of array_cache. Also simplifies accessing
273 * the entries. 273 * the entries.
274 * [0] is for gcc 2.95. It should really be [].
275 */ 274 */
276}; 275};
277 276
@@ -408,7 +407,7 @@ struct kmem_cache {
408 unsigned int dflags; /* dynamic flags */ 407 unsigned int dflags; /* dynamic flags */
409 408
410 /* constructor func */ 409 /* constructor func */
411 void (*ctor) (void *, struct kmem_cache *, unsigned long); 410 void (*ctor)(struct kmem_cache *, void *);
412 411
413/* 5) cache creation/removal */ 412/* 5) cache creation/removal */
414 const char *name; 413 const char *name;
@@ -2129,7 +2128,7 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
2129struct kmem_cache * 2128struct kmem_cache *
2130kmem_cache_create (const char *name, size_t size, size_t align, 2129kmem_cache_create (const char *name, size_t size, size_t align,
2131 unsigned long flags, 2130 unsigned long flags,
2132 void (*ctor)(void*, struct kmem_cache *, unsigned long)) 2131 void (*ctor)(struct kmem_cache *, void *))
2133{ 2132{
2134 size_t left_over, slab_size, ralign; 2133 size_t left_over, slab_size, ralign;
2135 struct kmem_cache *cachep = NULL, *pc; 2134 struct kmem_cache *cachep = NULL, *pc;
@@ -2636,8 +2635,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
2636 * They must also be threaded. 2635 * They must also be threaded.
2637 */ 2636 */
2638 if (cachep->ctor && !(cachep->flags & SLAB_POISON)) 2637 if (cachep->ctor && !(cachep->flags & SLAB_POISON))
2639 cachep->ctor(objp + obj_offset(cachep), cachep, 2638 cachep->ctor(cachep, objp + obj_offset(cachep));
2640 0);
2641 2639
2642 if (cachep->flags & SLAB_RED_ZONE) { 2640 if (cachep->flags & SLAB_RED_ZONE) {
2643 if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) 2641 if (*dbg_redzone2(cachep, objp) != RED_INACTIVE)
@@ -2653,7 +2651,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
2653 cachep->buffer_size / PAGE_SIZE, 0); 2651 cachep->buffer_size / PAGE_SIZE, 0);
2654#else 2652#else
2655 if (cachep->ctor) 2653 if (cachep->ctor)
2656 cachep->ctor(objp, cachep, 0); 2654 cachep->ctor(cachep, objp);
2657#endif 2655#endif
2658 slab_bufctl(slabp)[i] = i + 1; 2656 slab_bufctl(slabp)[i] = i + 1;
2659 } 2657 }
@@ -3078,7 +3076,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
3078#endif 3076#endif
3079 objp += obj_offset(cachep); 3077 objp += obj_offset(cachep);
3080 if (cachep->ctor && cachep->flags & SLAB_POISON) 3078 if (cachep->ctor && cachep->flags & SLAB_POISON)
3081 cachep->ctor(objp, cachep, 0); 3079 cachep->ctor(cachep, objp);
3082#if ARCH_SLAB_MINALIGN 3080#if ARCH_SLAB_MINALIGN
3083 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { 3081 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) {
3084 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", 3082 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n",
diff --git a/mm/slob.c b/mm/slob.c
index de5d5563a46c..5bc2ceb692ec 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -499,12 +499,12 @@ struct kmem_cache {
499 unsigned int size, align; 499 unsigned int size, align;
500 unsigned long flags; 500 unsigned long flags;
501 const char *name; 501 const char *name;
502 void (*ctor)(void *, struct kmem_cache *, unsigned long); 502 void (*ctor)(struct kmem_cache *, void *);
503}; 503};
504 504
505struct kmem_cache *kmem_cache_create(const char *name, size_t size, 505struct kmem_cache *kmem_cache_create(const char *name, size_t size,
506 size_t align, unsigned long flags, 506 size_t align, unsigned long flags,
507 void (*ctor)(void*, struct kmem_cache *, unsigned long)) 507 void (*ctor)(struct kmem_cache *, void *))
508{ 508{
509 struct kmem_cache *c; 509 struct kmem_cache *c;
510 510
@@ -548,7 +548,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
548 b = slob_new_page(flags, get_order(c->size), node); 548 b = slob_new_page(flags, get_order(c->size), node);
549 549
550 if (c->ctor) 550 if (c->ctor)
551 c->ctor(b, c, 0); 551 c->ctor(c, b);
552 552
553 return b; 553 return b;
554} 554}
diff --git a/mm/slub.c b/mm/slub.c
index f426f9bc644b..e29a42988c78 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -980,7 +980,7 @@ __setup("slub_debug", setup_slub_debug);
980 980
981static unsigned long kmem_cache_flags(unsigned long objsize, 981static unsigned long kmem_cache_flags(unsigned long objsize,
982 unsigned long flags, const char *name, 982 unsigned long flags, const char *name,
983 void (*ctor)(void *, struct kmem_cache *, unsigned long)) 983 void (*ctor)(struct kmem_cache *, void *))
984{ 984{
985 /* 985 /*
986 * The page->offset field is only 16 bit wide. This is an offset 986 * 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,
1027static inline void add_full(struct kmem_cache_node *n, struct page *page) {} 1027static inline void add_full(struct kmem_cache_node *n, struct page *page) {}
1028static inline unsigned long kmem_cache_flags(unsigned long objsize, 1028static inline unsigned long kmem_cache_flags(unsigned long objsize,
1029 unsigned long flags, const char *name, 1029 unsigned long flags, const char *name,
1030 void (*ctor)(void *, struct kmem_cache *, unsigned long)) 1030 void (*ctor)(struct kmem_cache *, void *))
1031{ 1031{
1032 return flags; 1032 return flags;
1033} 1033}
@@ -1071,7 +1071,7 @@ static void setup_object(struct kmem_cache *s, struct page *page,
1071{ 1071{
1072 setup_object_debug(s, page, object); 1072 setup_object_debug(s, page, object);
1073 if (unlikely(s->ctor)) 1073 if (unlikely(s->ctor))
1074 s->ctor(object, s, 0); 1074 s->ctor(s, object);
1075} 1075}
1076 1076
1077static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) 1077static 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)
1085 1085
1086 BUG_ON(flags & GFP_SLAB_BUG_MASK); 1086 BUG_ON(flags & GFP_SLAB_BUG_MASK);
1087 1087
1088 if (flags & __GFP_WAIT)
1089 local_irq_enable();
1090
1091 page = allocate_slab(s, 1088 page = allocate_slab(s,
1092 flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); 1089 flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node);
1093 if (!page) 1090 if (!page)
@@ -1120,8 +1117,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
1120 page->freelist = start; 1117 page->freelist = start;
1121 page->inuse = 0; 1118 page->inuse = 0;
1122out: 1119out:
1123 if (flags & __GFP_WAIT)
1124 local_irq_disable();
1125 return page; 1120 return page;
1126} 1121}
1127 1122
@@ -1505,7 +1500,14 @@ new_slab:
1505 goto load_freelist; 1500 goto load_freelist;
1506 } 1501 }
1507 1502
1503 if (gfpflags & __GFP_WAIT)
1504 local_irq_enable();
1505
1508 new = new_slab(s, gfpflags, node); 1506 new = new_slab(s, gfpflags, node);
1507
1508 if (gfpflags & __GFP_WAIT)
1509 local_irq_disable();
1510
1509 if (new) { 1511 if (new) {
1510 c = get_cpu_slab(s, smp_processor_id()); 1512 c = get_cpu_slab(s, smp_processor_id());
1511 if (c->page) { 1513 if (c->page) {
@@ -2039,12 +2041,6 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags,
2039 init_kmem_cache_node(n); 2041 init_kmem_cache_node(n);
2040 atomic_long_inc(&n->nr_slabs); 2042 atomic_long_inc(&n->nr_slabs);
2041 add_partial(n, page); 2043 add_partial(n, page);
2042
2043 /*
2044 * new_slab() disables interupts. If we do not reenable interrupts here
2045 * then bootup would continue with interrupts disabled.
2046 */
2047 local_irq_enable();
2048 return n; 2044 return n;
2049} 2045}
2050 2046
@@ -2215,7 +2211,7 @@ static int calculate_sizes(struct kmem_cache *s)
2215static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, 2211static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
2216 const char *name, size_t size, 2212 const char *name, size_t size,
2217 size_t align, unsigned long flags, 2213 size_t align, unsigned long flags,
2218 void (*ctor)(void *, struct kmem_cache *, unsigned long)) 2214 void (*ctor)(struct kmem_cache *, void *))
2219{ 2215{
2220 memset(s, 0, kmem_size); 2216 memset(s, 0, kmem_size);
2221 s->name = name; 2217 s->name = name;
@@ -2805,7 +2801,7 @@ static int slab_unmergeable(struct kmem_cache *s)
2805 2801
2806static struct kmem_cache *find_mergeable(size_t size, 2802static struct kmem_cache *find_mergeable(size_t size,
2807 size_t align, unsigned long flags, const char *name, 2803 size_t align, unsigned long flags, const char *name,
2808 void (*ctor)(void *, struct kmem_cache *, unsigned long)) 2804 void (*ctor)(struct kmem_cache *, void *))
2809{ 2805{
2810 struct kmem_cache *s; 2806 struct kmem_cache *s;
2811 2807
@@ -2846,7 +2842,7 @@ static struct kmem_cache *find_mergeable(size_t size,
2846 2842
2847struct kmem_cache *kmem_cache_create(const char *name, size_t size, 2843struct kmem_cache *kmem_cache_create(const char *name, size_t size,
2848 size_t align, unsigned long flags, 2844 size_t align, unsigned long flags,
2849 void (*ctor)(void *, struct kmem_cache *, unsigned long)) 2845 void (*ctor)(struct kmem_cache *, void *))
2850{ 2846{
2851 struct kmem_cache *s; 2847 struct kmem_cache *s;
2852 2848
diff --git a/mm/swap.c b/mm/swap.c
index d034b2128d2b..a65eff8a517a 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -28,6 +28,7 @@
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30#include <linux/notifier.h> 30#include <linux/notifier.h>
31#include <linux/backing-dev.h>
31 32
32/* How many pages do we try to swap or page in/out together? */ 33/* How many pages do we try to swap or page in/out together? */
33int page_cluster; 34int page_cluster;
@@ -547,6 +548,10 @@ void __init swap_setup(void)
547{ 548{
548 unsigned long megs = num_physpages >> (20 - PAGE_SHIFT); 549 unsigned long megs = num_physpages >> (20 - PAGE_SHIFT);
549 550
551#ifdef CONFIG_SWAP
552 bdi_init(swapper_space.backing_dev_info);
553#endif
554
550 /* Use a smaller cluster for small-memory machines */ 555 /* Use a smaller cluster for small-memory machines */
551 if (megs < 16) 556 if (megs < 16)
552 page_cluster = 2; 557 page_cluster = 2;
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c
index 8803471593fd..d436a9c82db7 100644
--- a/mm/tiny-shmem.c
+++ b/mm/tiny-shmem.c
@@ -66,24 +66,19 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
66 if (!dentry) 66 if (!dentry)
67 goto put_memory; 67 goto put_memory;
68 68
69 error = -ENFILE;
70 file = get_empty_filp();
71 if (!file)
72 goto put_dentry;
73
74 error = -ENOSPC; 69 error = -ENOSPC;
75 inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); 70 inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
76 if (!inode) 71 if (!inode)
77 goto close_file; 72 goto put_dentry;
78 73
79 d_instantiate(dentry, inode); 74 d_instantiate(dentry, inode);
80 inode->i_nlink = 0; /* It is unlinked */ 75 error = -ENFILE;
76 file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
77 &ramfs_file_operations);
78 if (!file)
79 goto put_dentry;
81 80
82 file->f_path.mnt = mntget(shm_mnt); 81 inode->i_nlink = 0; /* It is unlinked */
83 file->f_path.dentry = dentry;
84 file->f_mapping = inode->i_mapping;
85 file->f_op = &ramfs_file_operations;
86 file->f_mode = FMODE_WRITE | FMODE_READ;
87 82
88 /* notify everyone as to the change of file size */ 83 /* notify everyone as to the change of file size */
89 error = do_truncate(dentry, size, 0, file); 84 error = do_truncate(dentry, size, 0, file);
diff --git a/mm/truncate.c b/mm/truncate.c
index 5cdfbc1a59fd..cadc15653dde 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/backing-dev.h>
11#include <linux/mm.h> 12#include <linux/mm.h>
12#include <linux/swap.h> 13#include <linux/swap.h>
13#include <linux/module.h> 14#include <linux/module.h>
@@ -72,6 +73,8 @@ void cancel_dirty_page(struct page *page, unsigned int account_size)
72 struct address_space *mapping = page->mapping; 73 struct address_space *mapping = page->mapping;
73 if (mapping && mapping_cap_account_dirty(mapping)) { 74 if (mapping && mapping_cap_account_dirty(mapping)) {
74 dec_zone_page_state(page, NR_FILE_DIRTY); 75 dec_zone_page_state(page, NR_FILE_DIRTY);
76 dec_bdi_stat(mapping->backing_dev_info,
77 BDI_RECLAIMABLE);
75 if (account_size) 78 if (account_size)
76 task_io_account_cancelled_write(account_size); 79 task_io_account_cancelled_write(account_size);
77 } 80 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index bbd194630c5b..e1471385d001 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1108,8 +1108,6 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
1108 unsigned long nr_to_scan; 1108 unsigned long nr_to_scan;
1109 unsigned long nr_reclaimed = 0; 1109 unsigned long nr_reclaimed = 0;
1110 1110
1111 atomic_inc(&zone->reclaim_in_progress);
1112
1113 /* 1111 /*
1114 * Add one to `nr_to_scan' just to make sure that the kernel will 1112 * Add one to `nr_to_scan' just to make sure that the kernel will
1115 * slowly sift through the active list. 1113 * slowly sift through the active list.
@@ -1148,8 +1146,6 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
1148 } 1146 }
1149 1147
1150 throttle_vm_writeout(sc->gfp_mask); 1148 throttle_vm_writeout(sc->gfp_mask);
1151
1152 atomic_dec(&zone->reclaim_in_progress);
1153 return nr_reclaimed; 1149 return nr_reclaimed;
1154} 1150}
1155 1151
@@ -1187,7 +1183,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
1187 1183
1188 note_zone_scanning_priority(zone, priority); 1184 note_zone_scanning_priority(zone, priority);
1189 1185
1190 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 1186 if (zone_is_all_unreclaimable(zone) && priority != DEF_PRIORITY)
1191 continue; /* Let kswapd poll it */ 1187 continue; /* Let kswapd poll it */
1192 1188
1193 sc->all_unreclaimable = 0; 1189 sc->all_unreclaimable = 0;
@@ -1368,7 +1364,8 @@ loop_again:
1368 if (!populated_zone(zone)) 1364 if (!populated_zone(zone))
1369 continue; 1365 continue;
1370 1366
1371 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 1367 if (zone_is_all_unreclaimable(zone) &&
1368 priority != DEF_PRIORITY)
1372 continue; 1369 continue;
1373 1370
1374 if (!zone_watermark_ok(zone, order, zone->pages_high, 1371 if (!zone_watermark_ok(zone, order, zone->pages_high,
@@ -1403,7 +1400,8 @@ loop_again:
1403 if (!populated_zone(zone)) 1400 if (!populated_zone(zone))
1404 continue; 1401 continue;
1405 1402
1406 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 1403 if (zone_is_all_unreclaimable(zone) &&
1404 priority != DEF_PRIORITY)
1407 continue; 1405 continue;
1408 1406
1409 if (!zone_watermark_ok(zone, order, zone->pages_high, 1407 if (!zone_watermark_ok(zone, order, zone->pages_high,
@@ -1424,12 +1422,13 @@ loop_again:
1424 lru_pages); 1422 lru_pages);
1425 nr_reclaimed += reclaim_state->reclaimed_slab; 1423 nr_reclaimed += reclaim_state->reclaimed_slab;
1426 total_scanned += sc.nr_scanned; 1424 total_scanned += sc.nr_scanned;
1427 if (zone->all_unreclaimable) 1425 if (zone_is_all_unreclaimable(zone))
1428 continue; 1426 continue;
1429 if (nr_slab == 0 && zone->pages_scanned >= 1427 if (nr_slab == 0 && zone->pages_scanned >=
1430 (zone_page_state(zone, NR_ACTIVE) 1428 (zone_page_state(zone, NR_ACTIVE)
1431 + zone_page_state(zone, NR_INACTIVE)) * 6) 1429 + zone_page_state(zone, NR_INACTIVE)) * 6)
1432 zone->all_unreclaimable = 1; 1430 zone_set_flag(zone,
1431 ZONE_ALL_UNRECLAIMABLE);
1433 /* 1432 /*
1434 * If we've done a decent amount of scanning and 1433 * If we've done a decent amount of scanning and
1435 * the reclaim ratio is low, start doing writepage 1434 * the reclaim ratio is low, start doing writepage
@@ -1595,7 +1594,7 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio,
1595 if (!populated_zone(zone)) 1594 if (!populated_zone(zone))
1596 continue; 1595 continue;
1597 1596
1598 if (zone->all_unreclaimable && prio != DEF_PRIORITY) 1597 if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY)
1599 continue; 1598 continue;
1600 1599
1601 /* For pass = 0 we don't shrink the active list */ 1600 /* 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)
1897int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) 1896int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1898{ 1897{
1899 int node_id; 1898 int node_id;
1899 int ret;
1900 1900
1901 /* 1901 /*
1902 * Zone reclaim reclaims unmapped file backed pages and 1902 * 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)
1914 <= zone->min_slab_pages) 1914 <= zone->min_slab_pages)
1915 return 0; 1915 return 0;
1916 1916
1917 if (zone_is_all_unreclaimable(zone))
1918 return 0;
1919
1917 /* 1920 /*
1918 * Avoid concurrent zone reclaims, do not reclaim in a zone that does 1921 * Do not scan if the allocation should not be delayed.
1919 * not have reclaimable pages and if we should not delay the allocation
1920 * then do not scan.
1921 */ 1922 */
1922 if (!(gfp_mask & __GFP_WAIT) || 1923 if (!(gfp_mask & __GFP_WAIT) || (current->flags & PF_MEMALLOC))
1923 zone->all_unreclaimable ||
1924 atomic_read(&zone->reclaim_in_progress) > 0 ||
1925 (current->flags & PF_MEMALLOC))
1926 return 0; 1924 return 0;
1927 1925
1928 /* 1926 /*
@@ -1934,6 +1932,12 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1934 node_id = zone_to_nid(zone); 1932 node_id = zone_to_nid(zone);
1935 if (node_state(node_id, N_CPU) && node_id != numa_node_id()) 1933 if (node_state(node_id, N_CPU) && node_id != numa_node_id())
1936 return 0; 1934 return 0;
1937 return __zone_reclaim(zone, gfp_mask, order); 1935
1936 if (zone_test_and_set_flag(zone, ZONE_RECLAIM_LOCKED))
1937 return 0;
1938 ret = __zone_reclaim(zone, gfp_mask, order);
1939 zone_clear_flag(zone, ZONE_RECLAIM_LOCKED);
1940
1941 return ret;
1938} 1942}
1939#endif 1943#endif
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 3b5e9043e7db..4651bf153f35 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -704,7 +704,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
704 "\n all_unreclaimable: %u" 704 "\n all_unreclaimable: %u"
705 "\n prev_priority: %i" 705 "\n prev_priority: %i"
706 "\n start_pfn: %lu", 706 "\n start_pfn: %lu",
707 zone->all_unreclaimable, 707 zone_is_all_unreclaimable(zone),
708 zone->prev_priority, 708 zone->prev_priority,
709 zone->zone_start_pfn); 709 zone->zone_start_pfn);
710 seq_putc(m, '\n'); 710 seq_putc(m, '\n');
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 0803f305ed08..c680017f5c8e 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -14,6 +14,7 @@
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
15#include <linux/poll.h> 15#include <linux/poll.h>
16#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
17#include <linux/key-type.h>
17#include <net/net_namespace.h> 18#include <net/net_namespace.h>
18#include <net/sock.h> 19#include <net/sock.h>
19#include <net/af_rxrpc.h> 20#include <net/af_rxrpc.h>
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
index 7e049ff6ae60..9a8ff684da79 100644
--- a/net/rxrpc/ar-key.c
+++ b/net/rxrpc/ar-key.c
@@ -15,7 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/net.h> 16#include <linux/net.h>
17#include <linux/skbuff.h> 17#include <linux/skbuff.h>
18#include <linux/key.h> 18#include <linux/key-type.h>
19#include <linux/crypto.h> 19#include <linux/crypto.h>
20#include <net/sock.h> 20#include <net/sock.h>
21#include <net/af_rxrpc.h> 21#include <net/af_rxrpc.h>
@@ -40,7 +40,6 @@ struct key_type key_type_rxrpc = {
40 .destroy = rxrpc_destroy, 40 .destroy = rxrpc_destroy,
41 .describe = rxrpc_describe, 41 .describe = rxrpc_describe,
42}; 42};
43
44EXPORT_SYMBOL(key_type_rxrpc); 43EXPORT_SYMBOL(key_type_rxrpc);
45 44
46/* 45/*
@@ -330,5 +329,32 @@ error:
330 _leave(" = -ENOMEM [ins %d]", ret); 329 _leave(" = -ENOMEM [ins %d]", ret);
331 return -ENOMEM; 330 return -ENOMEM;
332} 331}
333
334EXPORT_SYMBOL(rxrpc_get_server_data_key); 332EXPORT_SYMBOL(rxrpc_get_server_data_key);
333
334/**
335 * rxrpc_get_null_key - Generate a null RxRPC key
336 * @keyname: The name to give the key.
337 *
338 * Generate a null RxRPC key that can be used to indicate anonymous security is
339 * required for a particular domain.
340 */
341struct key *rxrpc_get_null_key(const char *keyname)
342{
343 struct key *key;
344 int ret;
345
346 key = key_alloc(&key_type_rxrpc, keyname, 0, 0, current,
347 KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
348 if (IS_ERR(key))
349 return key;
350
351 ret = key_instantiate_and_link(key, NULL, 0, NULL, NULL);
352 if (ret < 0) {
353 key_revoke(key);
354 key_put(key);
355 return ERR_PTR(ret);
356 }
357
358 return key;
359}
360EXPORT_SYMBOL(rxrpc_get_null_key);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 81b26c5ffd4b..f5cd96f5fe74 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1228,7 +1228,6 @@ SCTP_STATIC __init int sctp_init(void)
1228 if (status) 1228 if (status)
1229 goto err_v6_add_protocol; 1229 goto err_v6_add_protocol;
1230 1230
1231 __unsafe(THIS_MODULE);
1232 status = 0; 1231 status = 0;
1233out: 1232out:
1234 return status; 1233 return status;
diff --git a/net/socket.c b/net/socket.c
index 379b3a390755..540013ea8620 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -258,7 +258,7 @@ static void sock_destroy_inode(struct inode *inode)
258 container_of(inode, struct socket_alloc, vfs_inode)); 258 container_of(inode, struct socket_alloc, vfs_inode));
259} 259}
260 260
261static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) 261static void init_once(struct kmem_cache *cachep, void *foo)
262{ 262{
263 struct socket_alloc *ei = (struct socket_alloc *)foo; 263 struct socket_alloc *ei = (struct socket_alloc *)foo;
264 264
@@ -364,26 +364,26 @@ static int sock_alloc_fd(struct file **filep)
364 364
365static int sock_attach_fd(struct socket *sock, struct file *file) 365static int sock_attach_fd(struct socket *sock, struct file *file)
366{ 366{
367 struct dentry *dentry;
367 struct qstr name = { .name = "" }; 368 struct qstr name = { .name = "" };
368 369
369 file->f_path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name); 370 dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
370 if (unlikely(!file->f_path.dentry)) 371 if (unlikely(!dentry))
371 return -ENOMEM; 372 return -ENOMEM;
372 373
373 file->f_path.dentry->d_op = &sockfs_dentry_operations; 374 dentry->d_op = &sockfs_dentry_operations;
374 /* 375 /*
375 * We dont want to push this dentry into global dentry hash table. 376 * We dont want to push this dentry into global dentry hash table.
376 * We pretend dentry is already hashed, by unsetting DCACHE_UNHASHED 377 * We pretend dentry is already hashed, by unsetting DCACHE_UNHASHED
377 * This permits a working /proc/$pid/fd/XXX on sockets 378 * This permits a working /proc/$pid/fd/XXX on sockets
378 */ 379 */
379 file->f_path.dentry->d_flags &= ~DCACHE_UNHASHED; 380 dentry->d_flags &= ~DCACHE_UNHASHED;
380 d_instantiate(file->f_path.dentry, SOCK_INODE(sock)); 381 d_instantiate(dentry, SOCK_INODE(sock));
381 file->f_path.mnt = mntget(sock_mnt);
382 file->f_mapping = file->f_path.dentry->d_inode->i_mapping;
383 382
384 sock->file = file; 383 sock->file = file;
385 file->f_op = SOCK_INODE(sock)->i_fop = &socket_file_ops; 384 init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
386 file->f_mode = FMODE_READ | FMODE_WRITE; 385 &socket_file_ops);
386 SOCK_INODE(sock)->i_fop = &socket_file_ops;
387 file->f_flags = O_RDWR; 387 file->f_flags = O_RDWR;
388 file->f_pos = 0; 388 file->f_pos = 0;
389 file->private_data = sock; 389 file->private_data = sock;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index c8433e8865aa..18f0a8dcc095 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -842,7 +842,7 @@ static struct file_system_type rpc_pipe_fs_type = {
842}; 842};
843 843
844static void 844static void
845init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) 845init_once(struct kmem_cache * cachep, void *foo)
846{ 846{
847 struct rpc_inode *rpci = (struct rpc_inode *) foo; 847 struct rpc_inode *rpci = (struct rpc_inode *) foo;
848 848
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dae7d30dca0f..59ad83caa210 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.09'; 12my $V = '0.10';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -212,6 +212,11 @@ sub ctx_block_level {
212 212
213 return ctx_block_get($linenr, $remain, 0, '{', '}', 0); 213 return ctx_block_get($linenr, $remain, 0, '{', '}', 0);
214} 214}
215sub ctx_statement_level {
216 my ($linenr, $remain, $off) = @_;
217
218 return ctx_block_get($linenr, $remain, 0, '(', ')', $off);
219}
215 220
216sub ctx_locate_comment { 221sub ctx_locate_comment {
217 my ($first_line, $end_line) = @_; 222 my ($first_line, $end_line) = @_;
@@ -255,13 +260,42 @@ sub ctx_has_comment {
255 return ($cmt ne ''); 260 return ($cmt ne '');
256} 261}
257 262
263sub ctx_expr_before {
264 my ($line) = @_;
265
266 ##print "CHECK<$line>\n";
267
268 my $pos = length($line) - 1;
269 my $count = 0;
270 my $c;
271
272 for (; $pos >= 0; $pos--) {
273 $c = substr($line, $pos, 1);
274 ##print "CHECK: c<$c> count<$count>\n";
275 if ($c eq ')') {
276 $count++;
277 } elsif ($c eq '(') {
278 last if (--$count == 0);
279 }
280 }
281
282 ##print "CHECK: result<" . substr($line, 0, $pos) . ">\n";
283
284 return substr($line, 0, $pos);
285}
286
258sub cat_vet { 287sub cat_vet {
259 my ($vet) = @_; 288 my ($vet) = @_;
289 my ($res, $coded);
260 290
261 $vet =~ s/\t/^I/; 291 $res = '';
262 $vet =~ s/$/\$/; 292 while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]])/g) {
293 $coded = sprintf("^%c", unpack('C', $2) + 64);
294 $res .= $1 . $coded;
295 }
296 $res =~ s/$/\$/;
263 297
264 return $vet; 298 return $res;
265} 299}
266 300
267my @report = (); 301my @report = ();
@@ -310,8 +344,17 @@ sub process {
310 my $first_line = 0; 344 my $first_line = 0;
311 345
312 my $Ident = qr{[A-Za-z\d_]+}; 346 my $Ident = qr{[A-Za-z\d_]+};
313 my $Storage = qr{extern|static}; 347 my $Storage = qr{extern|static|asmlinkage};
314 my $Sparse = qr{__user|__kernel|__force|__iomem|__must_check|__init_refok}; 348 my $Sparse = qr{
349 __user|
350 __kernel|
351 __force|
352 __iomem|
353 __must_check|
354 __init_refok|
355 fastcall
356 }x;
357 my $Inline = qr{inline|__always_inline|noinline};
315 my $NonptrType = qr{ 358 my $NonptrType = qr{
316 \b 359 \b
317 (?:const\s+)? 360 (?:const\s+)?
@@ -345,11 +388,18 @@ sub process {
345 (?:\s+$Sparse)* 388 (?:\s+$Sparse)*
346 }x; 389 }x;
347 my $Declare = qr{(?:$Storage\s+)?$Type}; 390 my $Declare = qr{(?:$Storage\s+)?$Type};
348 my $Attribute = qr{const|__read_mostly|__init|__initdata|__meminit}; 391 my $Attribute = qr{
349 392 const|
393 __read_mostly|
394 __(?:mem|cpu|dev|)(?:initdata|init)
395 }x;
350 my $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; 396 my $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
351 my $Lval = qr{$Ident(?:$Member)*}; 397 my $Lval = qr{$Ident(?:$Member)*};
352 398
399 # Possible bare types.
400 my @bare = ();
401 my $Bare = $NonptrType;
402
353 # Pre-scan the patch looking for any __setup documentation. 403 # Pre-scan the patch looking for any __setup documentation.
354 my @setup_docs = (); 404 my @setup_docs = ();
355 my $setup_docs = 0; 405 my $setup_docs = 0;
@@ -477,7 +527,11 @@ sub process {
477 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); 527 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
478 528
479#trailing whitespace 529#trailing whitespace
480 if ($line =~ /^\+.*\S\s+$/ || $line =~ /^\+\s+$/) { 530 if ($line =~ /^\+.*\015/) {
531 my $herevet = "$here\n" . cat_vet($line) . "\n";
532 ERROR("DOS line endings\n" . $herevet);
533
534 } elsif ($line =~ /^\+.*\S\s+$/ || $line =~ /^\+\s+$/) {
481 my $herevet = "$here\n" . cat_vet($line) . "\n"; 535 my $herevet = "$here\n" . cat_vet($line) . "\n";
482 ERROR("trailing whitespace\n" . $herevet); 536 ERROR("trailing whitespace\n" . $herevet);
483 } 537 }
@@ -509,6 +563,30 @@ sub process {
509# Standardise the strings and chars within the input to simplify matching. 563# Standardise the strings and chars within the input to simplify matching.
510 $line = sanitise_line($line); 564 $line = sanitise_line($line);
511 565
566# Check for potential 'bare' types
567 if ($realcnt &&
568 $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ &&
569 $line !~ /$Ident:\s*$/ &&
570 $line !~ /^.\s*$Ident\s*\(/ &&
571 ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ ||
572 $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/)) {
573 my $possible = $1;
574 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
575 $possible ne 'goto' && $possible ne 'return' &&
576 $possible ne 'struct' && $possible ne 'enum' &&
577 $possible ne 'case' && $possible ne 'else' &&
578 $possible ne 'typedef') {
579 #print "POSSIBLE<$possible>\n";
580 push(@bare, $possible);
581 my $bare = join("|", @bare);
582 $Bare = qr{
583 \b(?:$bare)\b
584 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
585 (?:\s+$Sparse)*
586 }x;
587 }
588 }
589
512# 590#
513# Checks which may be anchored in the context. 591# Checks which may be anchored in the context.
514# 592#
@@ -531,18 +609,19 @@ sub process {
531 } 609 }
532 } 610 }
533 if ($err ne '') { 611 if ($err ne '') {
534 ERROR("switch and case should be at the same indent\n$hereline\n$err\n"); 612 ERROR("switch and case should be at the same indent\n$hereline$err");
535 } 613 }
536 } 614 }
537 615
538# if/while/etc brace do not go on next line, unless defining a do while loop, 616# if/while/etc brace do not go on next line, unless defining a do while loop,
539# or if that brace on the next line is for something else 617# or if that brace on the next line is for something else
540 if ($line =~ /\b(?:(if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.#/) { 618 if ($line =~ /\b(?:(if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.#/) {
541 my @ctx = ctx_statement($linenr, $realcnt, 0); 619 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
542 my $ctx_ln = $linenr + $#ctx + 1; 620 my $ctx_ln = $linenr + $#ctx + 1;
543 my $ctx_cnt = $realcnt - $#ctx - 1; 621 my $ctx_cnt = $realcnt - $#ctx - 1;
544 my $ctx = join("\n", @ctx); 622 my $ctx = join("\n", @ctx);
545 623
624 # Skip over any removed lines in the context following statement.
546 while ($ctx_cnt > 0 && $lines[$ctx_ln - 1] =~ /^-/) { 625 while ($ctx_cnt > 0 && $lines[$ctx_ln - 1] =~ /^-/) {
547 $ctx_ln++; 626 $ctx_ln++;
548 $ctx_cnt--; 627 $ctx_cnt--;
@@ -553,6 +632,13 @@ sub process {
553 ERROR("That open brace { should be on the previous line\n" . 632 ERROR("That open brace { should be on the previous line\n" .
554 "$here\n$ctx\n$lines[$ctx_ln - 1]"); 633 "$here\n$ctx\n$lines[$ctx_ln - 1]");
555 } 634 }
635 if ($level == 0 && $ctx =~ /\)\s*\;\s*$/ && defined $lines[$ctx_ln - 1]) {
636 my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]);
637 if ($nindent > $indent) {
638 WARN("Trailing semicolon indicates no statements, indent implies otherwise\n" .
639 "$here\n$ctx\n$lines[$ctx_ln - 1]");
640 }
641 }
556 } 642 }
557 643
558#ignore lines not being added 644#ignore lines not being added
@@ -619,7 +705,7 @@ sub process {
619# check for new typedefs, only function parameters and sparse annotations 705# check for new typedefs, only function parameters and sparse annotations
620# make sense. 706# make sense.
621 if ($line =~ /\btypedef\s/ && 707 if ($line =~ /\btypedef\s/ &&
622 $line !~ /\btypedef\s+$Type\s+\(\s*\*$Ident\s*\)\s*\(/ && 708 $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ &&
623 $line !~ /\b__bitwise(?:__|)\b/) { 709 $line !~ /\b__bitwise(?:__|)\b/) {
624 WARN("do not add new typedefs\n" . $herecurr); 710 WARN("do not add new typedefs\n" . $herecurr);
625 } 711 }
@@ -633,11 +719,11 @@ sub process {
633 ERROR("\"(foo $1 )\" should be \"(foo $1)\"\n" . 719 ERROR("\"(foo $1 )\" should be \"(foo $1)\"\n" .
634 $herecurr); 720 $herecurr);
635 721
636 } elsif ($line =~ m{$NonptrType(\*+)(?:\s+$Attribute)?\s+[A-Za-z\d_]+}) { 722 } elsif ($line =~ m{$NonptrType(\*+)(?:\s+(?:$Attribute|$Sparse))?\s+[A-Za-z\d_]+}) {
637 ERROR("\"foo$1 bar\" should be \"foo $1bar\"\n" . 723 ERROR("\"foo$1 bar\" should be \"foo $1bar\"\n" .
638 $herecurr); 724 $herecurr);
639 725
640 } elsif ($line =~ m{$NonptrType\s+(\*+)(?!\s+$Attribute)\s+[A-Za-z\d_]+}) { 726 } elsif ($line =~ m{$NonptrType\s+(\*+)(?!\s+(?:$Attribute|$Sparse))\s+[A-Za-z\d_]+}) {
641 ERROR("\"foo $1 bar\" should be \"foo $1bar\"\n" . 727 ERROR("\"foo $1 bar\" should be \"foo $1bar\"\n" .
642 $herecurr); 728 $herecurr);
643 } 729 }
@@ -693,7 +779,13 @@ sub process {
693 $opline = expand_tabs($opline); 779 $opline = expand_tabs($opline);
694 $opline =~ s/^./ /; 780 $opline =~ s/^./ /;
695 if (!($line=~/\#\s*include/)) { 781 if (!($line=~/\#\s*include/)) {
696 my @elements = split(/(<<=|>>=|<=|>=|==|!=|\+=|-=|\*=|\/=|%=|\^=|\|=|&=|=>|->|<<|>>|<|>|=|!|~|&&|\|\||,|\^|\+\+|--|;|&|\||\+|-|\*|\/\/|\/)/, $opline); 782 my $ops = qr{
783 <<=|>>=|<=|>=|==|!=|
784 \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
785 =>|->|<<|>>|<|>|=|!|~|
786 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/
787 }x;
788 my @elements = split(/($ops|;)/, $opline);
697 my $off = 0; 789 my $off = 0;
698 for (my $n = 0; $n < $#elements; $n += 2) { 790 for (my $n = 0; $n < $#elements; $n += 2) {
699 $off += length($elements[$n]); 791 $off += length($elements[$n]);
@@ -733,7 +825,60 @@ sub process {
733 my $ptr = (" " x $off) . "^"; 825 my $ptr = (" " x $off) . "^";
734 my $hereptr = "$hereline$ptr\n"; 826 my $hereptr = "$hereline$ptr\n";
735 827
736 ##print "<$s1:$op:$s2> <$elements[$n]:$elements[$n + 1]:$elements[$n + 2]>\n"; 828 # Classify operators into binary, unary, or
829 # definitions (* only) where they have more
830 # than one mode.
831 my $unary_ctx = $prevline . $ca;
832 $unary_ctx =~ s/^./ /;
833 my $is_unary = 0;
834 my $Unary = qr{
835 (?:
836 ^|;|,|$ops|\(|\?|:|
837 \(\s*$Type\s*\)|
838 $Type|
839 return|case|else|
840 \{|\}|
841 \[|
842 ^.\#\s*define\s+$Ident\s*(?:\([^\)]*\))?|
843 ^.\#\s*else|
844 ^.\#\s*endif|
845 ^.\#\s*(?:if|ifndef|ifdef)\b.*
846 )\s*(?:|\\)\s*$
847 }x;
848 my $UnaryFalse = qr{
849 sizeof\s*\(\s*$Type\s*\)\s*$
850 }x;
851 my $UnaryDefine = qr{
852 (?:$Type|$Bare)\s*|
853 (?:$Type|$Bare).*,\s*\**
854 }x;
855 if ($op eq '-' || $op eq '&' || $op eq '*') {
856 # An operator is binary if the left hand
857 # side is a value. Pick out the known
858 # non-values.
859 if ($unary_ctx =~ /$Unary$/s &&
860 $unary_ctx !~ /$UnaryFalse$/s) {
861 $is_unary = 1;
862
863 # Special handling for ')' check if this
864 # brace represents a conditional, if so
865 # we are unary.
866 } elsif ($unary_ctx =~ /\)\s*$/) {
867 my $before = ctx_expr_before($unary_ctx);
868 if ($before =~ /(?:for|if|while)\s*$/) {
869 $is_unary = 1;
870 }
871 }
872
873 # Check for type definition for of '*'.
874 if ($op eq '*' && $unary_ctx =~ /$UnaryDefine$/) {
875 $is_unary = 2;
876 }
877 }
878
879 #if ($op eq '-' || $op eq '&' || $op eq '*') {
880 # print "UNARY: <$is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n";
881 #}
737 882
738 # ; should have either the end of line or a space or \ after it 883 # ; should have either the end of line or a space or \ after it
739 if ($op eq ';') { 884 if ($op eq ';') {
@@ -757,9 +902,16 @@ sub process {
757 ERROR("need space after that '$op' $at\n" . $hereptr); 902 ERROR("need space after that '$op' $at\n" . $hereptr);
758 } 903 }
759 904
760 # unary ! and unary ~ are allowed no space on the right 905 # '*' as part of a type definition -- reported already.
761 } elsif ($op eq '!' or $op eq '~') { 906 } elsif ($op eq '*' && $is_unary == 2) {
762 if ($ctx !~ /[WOEB]x./) { 907 #warn "'*' is part of type\n";
908
909 # unary operators should have a space before and
910 # none after. May be left adjacent to another
911 # unary operator, or a cast
912 } elsif ($op eq '!' || $op eq '~' ||
913 ($is_unary && ($op eq '*' || $op eq '-' || $op eq '&'))) {
914 if ($ctx !~ /[WEB]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
763 ERROR("need space before that '$op' $at\n" . $hereptr); 915 ERROR("need space before that '$op' $at\n" . $hereptr);
764 } 916 }
765 if ($ctx =~ /.xW/) { 917 if ($ctx =~ /.xW/) {
@@ -775,39 +927,13 @@ sub process {
775 ERROR("no space before that '$op' $at\n" . $hereptr); 927 ERROR("no space before that '$op' $at\n" . $hereptr);
776 } 928 }
777 929
778 # & is both unary and binary
779 # unary:
780 # a &b
781 # binary (consistent spacing):
782 # a&b OK
783 # a & b OK
784 #
785 # boiling down to: if there is a space on the right then there
786 # should be one on the left.
787 #
788 # - is the same
789 #
790 } elsif ($op eq '&' or $op eq '-') {
791 if ($ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]/) {
792 ERROR("need space before that '$op' $at\n" . $hereptr);
793 }
794
795 # * is the same as & only adding:
796 # type:
797 # (foo *)
798 # (foo **)
799 #
800 } elsif ($op eq '*') {
801 if ($ca !~ /$Type$/ && $cb !~ /(\*$;|$;\*)/ &&
802 $ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]|OxV|WxB|BxB/) {
803 ERROR("need space before that '$op' $at\n" . $hereptr);
804 }
805
806 # << and >> may either have or not have spaces both sides 930 # << and >> may either have or not have spaces both sides
807 } elsif ($op eq '<<' or $op eq '>>' or $op eq '+' or $op eq '/' or 931 } elsif ($op eq '<<' or $op eq '>>' or
808 $op eq '^' or $op eq '|') 932 $op eq '&' or $op eq '^' or $op eq '|' or
933 $op eq '+' or $op eq '-' or
934 $op eq '*' or $op eq '/')
809 { 935 {
810 if ($ctx !~ /VxV|WxW|VxE|WxE/) { 936 if ($ctx !~ /VxV|WxW|VxE|WxE|VxO/) {
811 ERROR("need consistent spacing around '$op' $at\n" . 937 ERROR("need consistent spacing around '$op' $at\n" .
812 $hereptr); 938 $hereptr);
813 } 939 }
@@ -865,10 +991,12 @@ sub process {
865 } 991 }
866 992
867# check spacing on paretheses 993# check spacing on paretheses
868 if ($line =~ /\(\s/ && $line !~ /\(\s*$/) { 994 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
995 $line !~ /for\s*\(\s+;/) {
869 ERROR("no space after that open parenthesis '('\n" . $herecurr); 996 ERROR("no space after that open parenthesis '('\n" . $herecurr);
870 } 997 }
871 if ($line =~ /\s\)/) { 998 if ($line =~ /\s\)/ && $line !~ /^.\s*\)/ &&
999 $line !~ /for\s*\(.*;\s+\)/) {
872 ERROR("no space before that close parenthesis ')'\n" . $herecurr); 1000 ERROR("no space before that close parenthesis ')'\n" . $herecurr);
873 } 1001 }
874 1002
@@ -926,10 +1054,10 @@ sub process {
926# multi-statement macros should be enclosed in a do while loop, grab the 1054# multi-statement macros should be enclosed in a do while loop, grab the
927# first statement and ensure its the whole macro if its not enclosed 1055# first statement and ensure its the whole macro if its not enclosed
928# in a known goot container 1056# in a known goot container
929 if (($prevline=~/\#define.*\\/) and 1057 if ($prevline =~ /\#define.*\\/ &&
930 !($prevline=~/do\s+{/) and !($prevline=~/\(\{/) and 1058 $prevline !~/(?:do\s+{|\(\{|\{)/ &&
931 !($line=~/do.*{/) and !($line=~/\(\{/) and 1059 $line !~ /(?:do\s+{|\(\{|\{)/ &&
932 !($line=~/^.\s*$Declare\s/)) { 1060 $line !~ /^.\s*$Declare\s/) {
933 # Grab the first statement, if that is the entire macro 1061 # Grab the first statement, if that is the entire macro
934 # its ok. This may start either on the #define line 1062 # its ok. This may start either on the #define line
935 # or the one below. 1063 # or the one below.
@@ -1027,6 +1155,11 @@ sub process {
1027 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); 1155 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
1028 } 1156 }
1029 1157
1158# SPIN_LOCK_UNLOCKED & RW_LOCK_UNLOCKED are deprecated
1159 if ($line =~ /\b(SPIN_LOCK_UNLOCKED|RW_LOCK_UNLOCKED)/) {
1160 ERROR("Use of $1 is deprecated: see Documentation/spinlocks.txt\n" . $herecurr);
1161 }
1162
1030# warn about #if 0 1163# warn about #if 0
1031 if ($line =~ /^.#\s*if\s+0\b/) { 1164 if ($line =~ /^.#\s*if\s+0\b/) {
1032 CHK("if this code is redundant consider removing it\n" . 1165 CHK("if this code is redundant consider removing it\n" .
@@ -1073,8 +1206,8 @@ sub process {
1073 1206
1074# check the location of the inline attribute, that it is between 1207# check the location of the inline attribute, that it is between
1075# storage class and type. 1208# storage class and type.
1076 if ($line =~ /$Type\s+(?:inline|__always_inline|noinline)\b/ || 1209 if ($line =~ /\b$Type\s+$Inline\b/ ||
1077 $line =~ /\b(?:inline|__always_inline|noinline)\s+$Storage/) { 1210 $line =~ /\b$Inline\s+$Storage\b/) {
1078 ERROR("inline keyword should sit between storage class and type\n" . $herecurr); 1211 ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
1079 } 1212 }
1080 1213
@@ -1091,6 +1224,11 @@ sub process {
1091 CHK("__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr); 1224 CHK("__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr);
1092 } 1225 }
1093 } 1226 }
1227
1228# check for pointless casting of kmalloc return
1229 if ($line =~ /\*\s*\)\s*k[czm]alloc\b/) {
1230 WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
1231 }
1094 } 1232 }
1095 1233
1096 if ($chk_patch && !$is_patch) { 1234 if ($chk_patch && !$is_patch) {
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index 663158627155..b458e2acb4ac 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -78,6 +78,9 @@ my (@stack, $re, $x, $xs);
78 # pair for larger users. -- PFM. 78 # pair for larger users. -- PFM.
79 #a00048e0: d4fc40f0 addi.l r15,-240,r15 79 #a00048e0: d4fc40f0 addi.l r15,-240,r15
80 $re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o; 80 $re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o;
81 } elsif ($arch =~ /^blackfin$/) {
82 # 0: 00 e8 38 01 LINK 0x4e0;
83 $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
81 } else { 84 } else {
82 print("wrong or unknown architecture\n"); 85 print("wrong or unknown architecture\n");
83 exit 86 exit
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 1f5835115cad..1d1401807e95 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -5,6 +5,7 @@ use strict;
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## 5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ## 7## Copyright (C) 2001 Simon Huggins ##
8## Copyright (C) 2005-2007 Randy Dunlap ##
8## ## 9## ##
9## #define enhancements by Armin Kuster <akuster@mvista.com> ## 10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
10## Copyright (c) 2000 MontaVista Software, Inc. ## 11## Copyright (c) 2000 MontaVista Software, Inc. ##
@@ -161,7 +162,7 @@ my $type_constant = '\%([-_\w]+)';
161my $type_func = '(\w+)\(\)'; 162my $type_func = '(\w+)\(\)';
162my $type_param = '\@(\w+)'; 163my $type_param = '\@(\w+)';
163my $type_struct = '\&((struct\s*)*[_\w]+)'; 164my $type_struct = '\&((struct\s*)*[_\w]+)';
164my $type_struct_xml = '\\\amp;((struct\s*)*[_\w]+)'; 165my $type_struct_xml = '\\&amp;((struct\s*)*[_\w]+)';
165my $type_env = '(\$\w+)'; 166my $type_env = '(\$\w+)';
166 167
167# Output conversion substitutions. 168# Output conversion substitutions.
@@ -173,7 +174,9 @@ my %highlights_html = ( $type_constant, "<i>\$1</i>",
173 $type_struct_xml, "<i>\$1</i>", 174 $type_struct_xml, "<i>\$1</i>",
174 $type_env, "<b><i>\$1</i></b>", 175 $type_env, "<b><i>\$1</i></b>",
175 $type_param, "<tt><b>\$1</b></tt>" ); 176 $type_param, "<tt><b>\$1</b></tt>" );
176my $blankline_html = "<p>"; 177my $local_lt = "\\\\\\\\lt:";
178my $local_gt = "\\\\\\\\gt:";
179my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
177 180
178# XML, docbook format 181# XML, docbook format
179my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 182my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>",
@@ -391,17 +394,19 @@ sub output_highlight {
391# confess "output_highlight got called with no args?\n"; 394# confess "output_highlight got called with no args?\n";
392# } 395# }
393 396
397 if ($output_mode eq "html") {
398 $contents = local_unescape($contents);
399 # convert data read & converted thru xml_escape() into &xyz; format:
400 $contents =~ s/\\\\\\/&/g;
401 }
394# print STDERR "contents b4:$contents\n"; 402# print STDERR "contents b4:$contents\n";
395 eval $dohighlight; 403 eval $dohighlight;
396 die $@ if $@; 404 die $@ if $@;
397 if ($output_mode eq "html") {
398 $contents =~ s/\\\\//;
399 }
400# print STDERR "contents af:$contents\n"; 405# print STDERR "contents af:$contents\n";
401 406
402 foreach $line (split "\n", $contents) { 407 foreach $line (split "\n", $contents) {
403 if ($line eq ""){ 408 if ($line eq ""){
404 print $lineprefix, $blankline; 409 print $lineprefix, local_unescape($blankline);
405 } else { 410 } else {
406 $line =~ s/\\\\\\/\&/g; 411 $line =~ s/\\\\\\/\&/g;
407 if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { 412 if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
@@ -1752,7 +1757,13 @@ sub process_state3_type($$) {
1752 } 1757 }
1753} 1758}
1754 1759
1755# replace <, >, and & 1760# xml_escape: replace <, >, and & in the text stream;
1761#
1762# however, formatting controls that are generated internally/locally in the
1763# kernel-doc script are not escaped here; instead, they begin life like
1764# $blankline_html (4 of '\' followed by a mnemonic + ':'), then these strings
1765# are converted to their mnemonic-expected output, without the 4 * '\' & ':',
1766# just before actual output; (this is done by local_unescape())
1756sub xml_escape($) { 1767sub xml_escape($) {
1757 my $text = shift; 1768 my $text = shift;
1758 if (($output_mode eq "text") || ($output_mode eq "man")) { 1769 if (($output_mode eq "text") || ($output_mode eq "man")) {
@@ -1764,6 +1775,18 @@ sub xml_escape($) {
1764 return $text; 1775 return $text;
1765} 1776}
1766 1777
1778# convert local escape strings to html
1779# local escape strings look like: '\\\\menmonic:' (that's 4 backslashes)
1780sub local_unescape($) {
1781 my $text = shift;
1782 if (($output_mode eq "text") || ($output_mode eq "man")) {
1783 return $text;
1784 }
1785 $text =~ s/\\\\\\\\lt:/</g;
1786 $text =~ s/\\\\\\\\gt:/>/g;
1787 return $text;
1788}
1789
1767sub process_file($) { 1790sub process_file($) {
1768 my $file; 1791 my $file;
1769 my $identifier; 1792 my $identifier;
@@ -1903,7 +1926,7 @@ sub process_file($) {
1903 } elsif ($state == 4) { 1926 } elsif ($state == 4) {
1904 # Documentation block 1927 # Documentation block
1905 if (/$doc_block/) { 1928 if (/$doc_block/) {
1906 dump_section($section, $contents); 1929 dump_section($section, xml_escape($contents));
1907 output_intro({'sectionlist' => \@sectionlist, 1930 output_intro({'sectionlist' => \@sectionlist,
1908 'sections' => \%sections }); 1931 'sections' => \%sections });
1909 $contents = ""; 1932 $contents = "";
@@ -1923,7 +1946,7 @@ sub process_file($) {
1923 } 1946 }
1924 elsif (/$doc_end/) 1947 elsif (/$doc_end/)
1925 { 1948 {
1926 dump_section($section, $contents); 1949 dump_section($section, xml_escape($contents));
1927 output_intro({'sectionlist' => \@sectionlist, 1950 output_intro({'sectionlist' => \@sectionlist,
1928 'sections' => \%sections }); 1951 'sections' => \%sections });
1929 $contents = ""; 1952 $contents = "";
diff --git a/security/Kconfig b/security/Kconfig
index 460e5c9cf496..8086e61058e3 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -74,15 +74,25 @@ config SECURITY_NETWORK_XFRM
74 If you are unsure how to answer this question, answer N. 74 If you are unsure how to answer this question, answer N.
75 75
76config SECURITY_CAPABILITIES 76config SECURITY_CAPABILITIES
77 tristate "Default Linux Capabilities" 77 bool "Default Linux Capabilities"
78 depends on SECURITY 78 depends on SECURITY
79 help 79 help
80 This enables the "default" Linux capabilities functionality. 80 This enables the "default" Linux capabilities functionality.
81 If you are unsure how to answer this question, answer Y. 81 If you are unsure how to answer this question, answer Y.
82 82
83config SECURITY_FILE_CAPABILITIES
84 bool "File POSIX Capabilities (EXPERIMENTAL)"
85 depends on (SECURITY=n || SECURITY_CAPABILITIES!=n) && EXPERIMENTAL
86 default n
87 help
88 This enables filesystem capabilities, allowing you to give
89 binaries a subset of root's powers without using setuid 0.
90
91 If in doubt, answer N.
92
83config SECURITY_ROOTPLUG 93config SECURITY_ROOTPLUG
84 tristate "Root Plug Support" 94 bool "Root Plug Support"
85 depends on USB && SECURITY 95 depends on USB=y && SECURITY
86 help 96 help
87 This is a sample LSM module that should only be used as such. 97 This is a sample LSM module that should only be used as such.
88 It prevents any programs running with egid == 0 if a specific 98 It prevents any programs running with egid == 0 if a specific
diff --git a/security/capability.c b/security/capability.c
index 38296a005465..9e99f36a8b5c 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -8,7 +8,6 @@
8 * 8 *
9 */ 9 */
10 10
11#include <linux/module.h>
12#include <linux/init.h> 11#include <linux/init.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/security.h> 13#include <linux/security.h>
@@ -38,7 +37,13 @@ static struct security_operations capability_ops = {
38 37
39 .inode_setxattr = cap_inode_setxattr, 38 .inode_setxattr = cap_inode_setxattr,
40 .inode_removexattr = cap_inode_removexattr, 39 .inode_removexattr = cap_inode_removexattr,
40 .inode_need_killpriv = cap_inode_need_killpriv,
41 .inode_killpriv = cap_inode_killpriv,
41 42
43 .task_kill = cap_task_kill,
44 .task_setscheduler = cap_task_setscheduler,
45 .task_setioprio = cap_task_setioprio,
46 .task_setnice = cap_task_setnice,
42 .task_post_setuid = cap_task_post_setuid, 47 .task_post_setuid = cap_task_post_setuid,
43 .task_reparent_to_init = cap_task_reparent_to_init, 48 .task_reparent_to_init = cap_task_reparent_to_init,
44 49
@@ -52,7 +57,6 @@ static int secondary;
52 57
53static int capability_disable; 58static int capability_disable;
54module_param_named(disable, capability_disable, int, 0); 59module_param_named(disable, capability_disable, int, 0);
55MODULE_PARM_DESC(disable, "To disable capabilities module set disable = 1");
56 60
57static int __init capability_init (void) 61static int __init capability_init (void)
58{ 62{
@@ -75,26 +79,4 @@ static int __init capability_init (void)
75 return 0; 79 return 0;
76} 80}
77 81
78static void __exit capability_exit (void)
79{
80 if (capability_disable)
81 return;
82 /* remove ourselves from the security framework */
83 if (secondary) {
84 if (mod_unreg_security (KBUILD_MODNAME, &capability_ops))
85 printk (KERN_INFO "Failure unregistering capabilities "
86 "with primary module.\n");
87 return;
88 }
89
90 if (unregister_security (&capability_ops)) {
91 printk (KERN_INFO
92 "Failure unregistering capabilities with the kernel\n");
93 }
94}
95
96security_initcall (capability_init); 82security_initcall (capability_init);
97module_exit (capability_exit);
98
99MODULE_DESCRIPTION("Standard Linux Capabilities Security Module");
100MODULE_LICENSE("GPL");
diff --git a/security/commoncap.c b/security/commoncap.c
index 7520361663e8..778cb0cfc5d8 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -22,6 +22,7 @@
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/xattr.h> 23#include <linux/xattr.h>
24#include <linux/hugetlb.h> 24#include <linux/hugetlb.h>
25#include <linux/mount.h>
25 26
26int cap_netlink_send(struct sock *sk, struct sk_buff *skb) 27int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
27{ 28{
@@ -29,8 +30,6 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
29 return 0; 30 return 0;
30} 31}
31 32
32EXPORT_SYMBOL(cap_netlink_send);
33
34int cap_netlink_recv(struct sk_buff *skb, int cap) 33int cap_netlink_recv(struct sk_buff *skb, int cap)
35{ 34{
36 if (!cap_raised(NETLINK_CB(skb).eff_cap, cap)) 35 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,
108 target->cap_permitted = *permitted; 107 target->cap_permitted = *permitted;
109} 108}
110 109
110static inline void bprm_clear_caps(struct linux_binprm *bprm)
111{
112 cap_clear(bprm->cap_inheritable);
113 cap_clear(bprm->cap_permitted);
114 bprm->cap_effective = false;
115}
116
117#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
118
119int cap_inode_need_killpriv(struct dentry *dentry)
120{
121 struct inode *inode = dentry->d_inode;
122 int error;
123
124 if (!inode->i_op || !inode->i_op->getxattr)
125 return 0;
126
127 error = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, NULL, 0);
128 if (error <= 0)
129 return 0;
130 return 1;
131}
132
133int cap_inode_killpriv(struct dentry *dentry)
134{
135 struct inode *inode = dentry->d_inode;
136
137 if (!inode->i_op || !inode->i_op->removexattr)
138 return 0;
139
140 return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS);
141}
142
143static inline int cap_from_disk(__le32 *caps, struct linux_binprm *bprm,
144 int size)
145{
146 __u32 magic_etc;
147
148 if (size != XATTR_CAPS_SZ)
149 return -EINVAL;
150
151 magic_etc = le32_to_cpu(caps[0]);
152
153 switch ((magic_etc & VFS_CAP_REVISION_MASK)) {
154 case VFS_CAP_REVISION:
155 if (magic_etc & VFS_CAP_FLAGS_EFFECTIVE)
156 bprm->cap_effective = true;
157 else
158 bprm->cap_effective = false;
159 bprm->cap_permitted = to_cap_t( le32_to_cpu(caps[1]) );
160 bprm->cap_inheritable = to_cap_t( le32_to_cpu(caps[2]) );
161 return 0;
162 default:
163 return -EINVAL;
164 }
165}
166
167/* Locate any VFS capabilities: */
168static int get_file_caps(struct linux_binprm *bprm)
169{
170 struct dentry *dentry;
171 int rc = 0;
172 __le32 v1caps[XATTR_CAPS_SZ];
173 struct inode *inode;
174
175 if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) {
176 bprm_clear_caps(bprm);
177 return 0;
178 }
179
180 dentry = dget(bprm->file->f_dentry);
181 inode = dentry->d_inode;
182 if (!inode->i_op || !inode->i_op->getxattr)
183 goto out;
184
185 rc = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, &v1caps,
186 XATTR_CAPS_SZ);
187 if (rc == -ENODATA || rc == -EOPNOTSUPP) {
188 /* no data, that's ok */
189 rc = 0;
190 goto out;
191 }
192 if (rc < 0)
193 goto out;
194
195 rc = cap_from_disk(v1caps, bprm, rc);
196 if (rc)
197 printk(KERN_NOTICE "%s: cap_from_disk returned %d for %s\n",
198 __FUNCTION__, rc, bprm->filename);
199
200out:
201 dput(dentry);
202 if (rc)
203 bprm_clear_caps(bprm);
204
205 return rc;
206}
207
208#else
209int cap_inode_need_killpriv(struct dentry *dentry)
210{
211 return 0;
212}
213
214int cap_inode_killpriv(struct dentry *dentry)
215{
216 return 0;
217}
218
219static inline int get_file_caps(struct linux_binprm *bprm)
220{
221 bprm_clear_caps(bprm);
222 return 0;
223}
224#endif
225
111int cap_bprm_set_security (struct linux_binprm *bprm) 226int cap_bprm_set_security (struct linux_binprm *bprm)
112{ 227{
113 /* Copied from fs/exec.c:prepare_binprm. */ 228 int ret;
114 229
115 /* We don't have VFS support for capabilities yet */ 230 ret = get_file_caps(bprm);
116 cap_clear (bprm->cap_inheritable); 231 if (ret)
117 cap_clear (bprm->cap_permitted); 232 printk(KERN_NOTICE "%s: get_file_caps returned %d for %s\n",
118 cap_clear (bprm->cap_effective); 233 __FUNCTION__, ret, bprm->filename);
119 234
120 /* To support inheritance of root-permissions and suid-root 235 /* To support inheritance of root-permissions and suid-root
121 * executables under compatibility mode, we raise all three 236 * executables under compatibility mode, we raise all three
@@ -131,9 +246,10 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
131 cap_set_full (bprm->cap_permitted); 246 cap_set_full (bprm->cap_permitted);
132 } 247 }
133 if (bprm->e_uid == 0) 248 if (bprm->e_uid == 0)
134 cap_set_full (bprm->cap_effective); 249 bprm->cap_effective = true;
135 } 250 }
136 return 0; 251
252 return ret;
137} 253}
138 254
139void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe) 255void 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)
149 if (bprm->e_uid != current->uid || bprm->e_gid != current->gid || 265 if (bprm->e_uid != current->uid || bprm->e_gid != current->gid ||
150 !cap_issubset (new_permitted, current->cap_permitted)) { 266 !cap_issubset (new_permitted, current->cap_permitted)) {
151 set_dumpable(current->mm, suid_dumpable); 267 set_dumpable(current->mm, suid_dumpable);
268 current->pdeath_signal = 0;
152 269
153 if (unsafe & ~LSM_UNSAFE_PTRACE_CAP) { 270 if (unsafe & ~LSM_UNSAFE_PTRACE_CAP) {
154 if (!capable(CAP_SETUID)) { 271 if (!capable(CAP_SETUID)) {
@@ -170,8 +287,8 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
170 * capability rules */ 287 * capability rules */
171 if (!is_init(current)) { 288 if (!is_init(current)) {
172 current->cap_permitted = new_permitted; 289 current->cap_permitted = new_permitted;
173 current->cap_effective = 290 current->cap_effective = bprm->cap_effective ?
174 cap_intersect (new_permitted, bprm->cap_effective); 291 new_permitted : 0;
175 } 292 }
176 293
177 /* AUD: Audit candidate if current->cap_effective is set */ 294 /* AUD: Audit candidate if current->cap_effective is set */
@@ -181,11 +298,15 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
181 298
182int cap_bprm_secureexec (struct linux_binprm *bprm) 299int cap_bprm_secureexec (struct linux_binprm *bprm)
183{ 300{
184 /* If/when this module is enhanced to incorporate capability 301 if (current->uid != 0) {
185 bits on files, the test below should be extended to also perform a 302 if (bprm->cap_effective)
186 test between the old and new capability sets. For now, 303 return 1;
187 it simply preserves the legacy decision algorithm used by 304 if (!cap_isclear(bprm->cap_permitted))
188 the old userland. */ 305 return 1;
306 if (!cap_isclear(bprm->cap_inheritable))
307 return 1;
308 }
309
189 return (current->euid != current->uid || 310 return (current->euid != current->uid ||
190 current->egid != current->gid); 311 current->egid != current->gid);
191} 312}
@@ -193,7 +314,11 @@ int cap_bprm_secureexec (struct linux_binprm *bprm)
193int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, 314int cap_inode_setxattr(struct dentry *dentry, char *name, void *value,
194 size_t size, int flags) 315 size_t size, int flags)
195{ 316{
196 if (!strncmp(name, XATTR_SECURITY_PREFIX, 317 if (!strcmp(name, XATTR_NAME_CAPS)) {
318 if (!capable(CAP_SETFCAP))
319 return -EPERM;
320 return 0;
321 } else if (!strncmp(name, XATTR_SECURITY_PREFIX,
197 sizeof(XATTR_SECURITY_PREFIX) - 1) && 322 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
198 !capable(CAP_SYS_ADMIN)) 323 !capable(CAP_SYS_ADMIN))
199 return -EPERM; 324 return -EPERM;
@@ -202,7 +327,11 @@ int cap_inode_setxattr(struct dentry *dentry, char *name, void *value,
202 327
203int cap_inode_removexattr(struct dentry *dentry, char *name) 328int cap_inode_removexattr(struct dentry *dentry, char *name)
204{ 329{
205 if (!strncmp(name, XATTR_SECURITY_PREFIX, 330 if (!strcmp(name, XATTR_NAME_CAPS)) {
331 if (!capable(CAP_SETFCAP))
332 return -EPERM;
333 return 0;
334 } else if (!strncmp(name, XATTR_SECURITY_PREFIX,
206 sizeof(XATTR_SECURITY_PREFIX) - 1) && 335 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
207 !capable(CAP_SYS_ADMIN)) 336 !capable(CAP_SYS_ADMIN))
208 return -EPERM; 337 return -EPERM;
@@ -299,6 +428,83 @@ int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid,
299 return 0; 428 return 0;
300} 429}
301 430
431#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
432/*
433 * Rationale: code calling task_setscheduler, task_setioprio, and
434 * task_setnice, assumes that
435 * . if capable(cap_sys_nice), then those actions should be allowed
436 * . if not capable(cap_sys_nice), but acting on your own processes,
437 * then those actions should be allowed
438 * This is insufficient now since you can call code without suid, but
439 * yet with increased caps.
440 * So we check for increased caps on the target process.
441 */
442static inline int cap_safe_nice(struct task_struct *p)
443{
444 if (!cap_issubset(p->cap_permitted, current->cap_permitted) &&
445 !__capable(current, CAP_SYS_NICE))
446 return -EPERM;
447 return 0;
448}
449
450int cap_task_setscheduler (struct task_struct *p, int policy,
451 struct sched_param *lp)
452{
453 return cap_safe_nice(p);
454}
455
456int cap_task_setioprio (struct task_struct *p, int ioprio)
457{
458 return cap_safe_nice(p);
459}
460
461int cap_task_setnice (struct task_struct *p, int nice)
462{
463 return cap_safe_nice(p);
464}
465
466int cap_task_kill(struct task_struct *p, struct siginfo *info,
467 int sig, u32 secid)
468{
469 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
470 return 0;
471
472 if (secid)
473 /*
474 * Signal sent as a particular user.
475 * Capabilities are ignored. May be wrong, but it's the
476 * only thing we can do at the moment.
477 * Used only by usb drivers?
478 */
479 return 0;
480 if (cap_issubset(p->cap_permitted, current->cap_permitted))
481 return 0;
482 if (capable(CAP_KILL))
483 return 0;
484
485 return -EPERM;
486}
487#else
488int cap_task_setscheduler (struct task_struct *p, int policy,
489 struct sched_param *lp)
490{
491 return 0;
492}
493int cap_task_setioprio (struct task_struct *p, int ioprio)
494{
495 return 0;
496}
497int cap_task_setnice (struct task_struct *p, int nice)
498{
499 return 0;
500}
501int cap_task_kill(struct task_struct *p, struct siginfo *info,
502 int sig, u32 secid)
503{
504 return 0;
505}
506#endif
507
302void cap_task_reparent_to_init (struct task_struct *p) 508void cap_task_reparent_to_init (struct task_struct *p)
303{ 509{
304 p->cap_effective = CAP_INIT_EFF_SET; 510 p->cap_effective = CAP_INIT_EFF_SET;
@@ -324,21 +530,3 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages)
324 return __vm_enough_memory(mm, pages, cap_sys_admin); 530 return __vm_enough_memory(mm, pages, cap_sys_admin);
325} 531}
326 532
327EXPORT_SYMBOL(cap_capable);
328EXPORT_SYMBOL(cap_settime);
329EXPORT_SYMBOL(cap_ptrace);
330EXPORT_SYMBOL(cap_capget);
331EXPORT_SYMBOL(cap_capset_check);
332EXPORT_SYMBOL(cap_capset_set);
333EXPORT_SYMBOL(cap_bprm_set_security);
334EXPORT_SYMBOL(cap_bprm_apply_creds);
335EXPORT_SYMBOL(cap_bprm_secureexec);
336EXPORT_SYMBOL(cap_inode_setxattr);
337EXPORT_SYMBOL(cap_inode_removexattr);
338EXPORT_SYMBOL(cap_task_post_setuid);
339EXPORT_SYMBOL(cap_task_reparent_to_init);
340EXPORT_SYMBOL(cap_syslog);
341EXPORT_SYMBOL(cap_vm_enough_memory);
342
343MODULE_DESCRIPTION("Standard Linux Common Capabilities Security Module");
344MODULE_LICENSE("GPL");
diff --git a/security/dummy.c b/security/dummy.c
index 64b647a0d9a6..bc43d4c7383e 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -15,7 +15,6 @@
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/capability.h> 17#include <linux/capability.h>
18#include <linux/module.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/mman.h> 19#include <linux/mman.h>
21#include <linux/pagemap.h> 20#include <linux/pagemap.h>
@@ -377,6 +376,16 @@ static int dummy_inode_removexattr (struct dentry *dentry, char *name)
377 return 0; 376 return 0;
378} 377}
379 378
379static int dummy_inode_need_killpriv(struct dentry *dentry)
380{
381 return 0;
382}
383
384static int dummy_inode_killpriv(struct dentry *dentry)
385{
386 return 0;
387}
388
380static int dummy_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err) 389static int dummy_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
381{ 390{
382 return -EOPNOTSUPP; 391 return -EOPNOTSUPP;
@@ -392,11 +401,6 @@ static int dummy_inode_listsecurity(struct inode *inode, char *buffer, size_t bu
392 return 0; 401 return 0;
393} 402}
394 403
395static const char *dummy_inode_xattr_getsuffix(void)
396{
397 return NULL;
398}
399
400static int dummy_file_permission (struct file *file, int mask) 404static int dummy_file_permission (struct file *file, int mask)
401{ 405{
402 return 0; 406 return 0;
@@ -906,11 +910,6 @@ static int dummy_register_security (const char *name, struct security_operations
906 return -EINVAL; 910 return -EINVAL;
907} 911}
908 912
909static int dummy_unregister_security (const char *name, struct security_operations *ops)
910{
911 return -EINVAL;
912}
913
914static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode) 913static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode)
915{ 914{
916 return; 915 return;
@@ -1023,7 +1022,8 @@ void security_fixup_ops (struct security_operations *ops)
1023 set_to_dummy_if_null(ops, inode_getxattr); 1022 set_to_dummy_if_null(ops, inode_getxattr);
1024 set_to_dummy_if_null(ops, inode_listxattr); 1023 set_to_dummy_if_null(ops, inode_listxattr);
1025 set_to_dummy_if_null(ops, inode_removexattr); 1024 set_to_dummy_if_null(ops, inode_removexattr);
1026 set_to_dummy_if_null(ops, inode_xattr_getsuffix); 1025 set_to_dummy_if_null(ops, inode_need_killpriv);
1026 set_to_dummy_if_null(ops, inode_killpriv);
1027 set_to_dummy_if_null(ops, inode_getsecurity); 1027 set_to_dummy_if_null(ops, inode_getsecurity);
1028 set_to_dummy_if_null(ops, inode_setsecurity); 1028 set_to_dummy_if_null(ops, inode_setsecurity);
1029 set_to_dummy_if_null(ops, inode_listsecurity); 1029 set_to_dummy_if_null(ops, inode_listsecurity);
@@ -1084,7 +1084,6 @@ void security_fixup_ops (struct security_operations *ops)
1084 set_to_dummy_if_null(ops, netlink_send); 1084 set_to_dummy_if_null(ops, netlink_send);
1085 set_to_dummy_if_null(ops, netlink_recv); 1085 set_to_dummy_if_null(ops, netlink_recv);
1086 set_to_dummy_if_null(ops, register_security); 1086 set_to_dummy_if_null(ops, register_security);
1087 set_to_dummy_if_null(ops, unregister_security);
1088 set_to_dummy_if_null(ops, d_instantiate); 1087 set_to_dummy_if_null(ops, d_instantiate);
1089 set_to_dummy_if_null(ops, getprocattr); 1088 set_to_dummy_if_null(ops, getprocattr);
1090 set_to_dummy_if_null(ops, setprocattr); 1089 set_to_dummy_if_null(ops, setprocattr);
diff --git a/security/inode.c b/security/inode.c
index 307211ac7346..b28a8acae34d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -332,14 +332,6 @@ static int __init securityfs_init(void)
332 return retval; 332 return retval;
333} 333}
334 334
335static void __exit securityfs_exit(void)
336{
337 simple_release_fs(&mount, &mount_count);
338 unregister_filesystem(&fs_type);
339 subsystem_unregister(&security_subsys);
340}
341
342core_initcall(securityfs_init); 335core_initcall(securityfs_init);
343module_exit(securityfs_exit);
344MODULE_LICENSE("GPL"); 336MODULE_LICENSE("GPL");
345 337
diff --git a/security/keys/internal.h b/security/keys/internal.h
index 1bb416f4bbce..d36d69393356 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -1,6 +1,6 @@
1/* internal.h: authentication token and access key management internal defs 1/* internal.h: authentication token and access key management internal defs
2 * 2 *
3 * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2003-5, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -12,17 +12,28 @@
12#ifndef _INTERNAL_H 12#ifndef _INTERNAL_H
13#define _INTERNAL_H 13#define _INTERNAL_H
14 14
15#include <linux/key.h> 15#include <linux/key-type.h>
16#include <linux/key-ui.h> 16#include <linux/key-ui.h>
17 17
18#if 0 18static inline __attribute__((format(printf, 1, 2)))
19#define kenter(FMT, a...) printk("==> %s("FMT")\n",__FUNCTION__ , ## a) 19void no_printk(const char *fmt, ...)
20#define kleave(FMT, a...) printk("<== %s()"FMT"\n",__FUNCTION__ , ## a) 20{
21#define kdebug(FMT, a...) printk(FMT"\n" , ## a) 21}
22
23#ifdef __KDEBUG
24#define kenter(FMT, ...) \
25 printk(KERN_DEBUG "==> %s("FMT")\n", __FUNCTION__, ##__VA_ARGS__)
26#define kleave(FMT, ...) \
27 printk(KERN_DEBUG "<== %s()"FMT"\n", __FUNCTION__, ##__VA_ARGS__)
28#define kdebug(FMT, ...) \
29 printk(KERN_DEBUG "xxx" FMT"yyy\n", ##__VA_ARGS__)
22#else 30#else
23#define kenter(FMT, a...) do {} while(0) 31#define kenter(FMT, ...) \
24#define kleave(FMT, a...) do {} while(0) 32 no_printk(KERN_DEBUG "==> %s("FMT")\n", __FUNCTION__, ##__VA_ARGS__)
25#define kdebug(FMT, a...) do {} while(0) 33#define kleave(FMT, ...) \
34 no_printk(KERN_DEBUG "<== %s()"FMT"\n", __FUNCTION__, ##__VA_ARGS__)
35#define kdebug(FMT, ...) \
36 no_printk(KERN_DEBUG FMT"\n", ##__VA_ARGS__)
26#endif 37#endif
27 38
28extern struct key_type key_type_user; 39extern struct key_type key_type_user;
@@ -36,7 +47,7 @@ extern struct key_type key_type_user;
36 */ 47 */
37struct key_user { 48struct key_user {
38 struct rb_node node; 49 struct rb_node node;
39 struct list_head consq; /* construction queue */ 50 struct mutex cons_lock; /* construction initiation lock */
40 spinlock_t lock; 51 spinlock_t lock;
41 atomic_t usage; /* for accessing qnkeys & qnbytes */ 52 atomic_t usage; /* for accessing qnkeys & qnbytes */
42 atomic_t nkeys; /* number of keys */ 53 atomic_t nkeys; /* number of keys */
@@ -62,7 +73,7 @@ extern void key_user_put(struct key_user *user);
62extern struct rb_root key_serial_tree; 73extern struct rb_root key_serial_tree;
63extern spinlock_t key_serial_lock; 74extern spinlock_t key_serial_lock;
64extern struct semaphore key_alloc_sem; 75extern struct semaphore key_alloc_sem;
65extern struct rw_semaphore key_construction_sem; 76extern struct mutex key_construction_mutex;
66extern wait_queue_head_t request_key_conswq; 77extern wait_queue_head_t request_key_conswq;
67 78
68 79
@@ -109,7 +120,7 @@ extern struct key *request_key_and_link(struct key_type *type,
109struct request_key_auth { 120struct request_key_auth {
110 struct key *target_key; 121 struct key *target_key;
111 struct task_struct *context; 122 struct task_struct *context;
112 const char *callout_info; 123 char *callout_info;
113 pid_t pid; 124 pid_t pid;
114}; 125};
115 126
diff --git a/security/keys/key.c b/security/keys/key.c
index 01bbc6d9d19b..fdd5ca6d89fc 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -1,6 +1,6 @@
1/* key.c: basic authentication token and access key management 1/* Basic authentication token and access key management
2 * 2 *
3 * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@ static void key_cleanup(struct work_struct *work);
34static DECLARE_WORK(key_cleanup_task, key_cleanup); 34static DECLARE_WORK(key_cleanup_task, key_cleanup);
35 35
36/* we serialise key instantiation and link */ 36/* we serialise key instantiation and link */
37DECLARE_RWSEM(key_construction_sem); 37DEFINE_MUTEX(key_construction_mutex);
38 38
39/* any key who's type gets unegistered will be re-typed to this */ 39/* any key who's type gets unegistered will be re-typed to this */
40static struct key_type key_type_dead = { 40static struct key_type key_type_dead = {
@@ -104,7 +104,7 @@ struct key_user *key_user_lookup(uid_t uid)
104 candidate->qnkeys = 0; 104 candidate->qnkeys = 0;
105 candidate->qnbytes = 0; 105 candidate->qnbytes = 0;
106 spin_lock_init(&candidate->lock); 106 spin_lock_init(&candidate->lock);
107 INIT_LIST_HEAD(&candidate->consq); 107 mutex_init(&candidate->cons_lock);
108 108
109 rb_link_node(&candidate->node, parent, p); 109 rb_link_node(&candidate->node, parent, p);
110 rb_insert_color(&candidate->node, &key_user_tree); 110 rb_insert_color(&candidate->node, &key_user_tree);
@@ -418,7 +418,7 @@ static int __key_instantiate_and_link(struct key *key,
418 awaken = 0; 418 awaken = 0;
419 ret = -EBUSY; 419 ret = -EBUSY;
420 420
421 down_write(&key_construction_sem); 421 mutex_lock(&key_construction_mutex);
422 422
423 /* can't instantiate twice */ 423 /* can't instantiate twice */
424 if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) { 424 if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
@@ -443,11 +443,11 @@ static int __key_instantiate_and_link(struct key *key,
443 } 443 }
444 } 444 }
445 445
446 up_write(&key_construction_sem); 446 mutex_unlock(&key_construction_mutex);
447 447
448 /* wake up anyone waiting for a key to be constructed */ 448 /* wake up anyone waiting for a key to be constructed */
449 if (awaken) 449 if (awaken)
450 wake_up_all(&request_key_conswq); 450 wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
451 451
452 return ret; 452 return ret;
453 453
@@ -500,7 +500,7 @@ int key_negate_and_link(struct key *key,
500 if (keyring) 500 if (keyring)
501 down_write(&keyring->sem); 501 down_write(&keyring->sem);
502 502
503 down_write(&key_construction_sem); 503 mutex_lock(&key_construction_mutex);
504 504
505 /* can't instantiate twice */ 505 /* can't instantiate twice */
506 if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) { 506 if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
@@ -525,14 +525,14 @@ int key_negate_and_link(struct key *key,
525 key_revoke(instkey); 525 key_revoke(instkey);
526 } 526 }
527 527
528 up_write(&key_construction_sem); 528 mutex_unlock(&key_construction_mutex);
529 529
530 if (keyring) 530 if (keyring)
531 up_write(&keyring->sem); 531 up_write(&keyring->sem);
532 532
533 /* wake up anyone waiting for a key to be constructed */ 533 /* wake up anyone waiting for a key to be constructed */
534 if (awaken) 534 if (awaken)
535 wake_up_all(&request_key_conswq); 535 wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
536 536
537 return ret; 537 return ret;
538 538
@@ -899,12 +899,14 @@ void key_revoke(struct key *key)
899{ 899{
900 key_check(key); 900 key_check(key);
901 901
902 /* make sure no one's trying to change or use the key when we mark 902 /* make sure no one's trying to change or use the key when we mark it
903 * it */ 903 * - we tell lockdep that we might nest because we might be revoking an
904 down_write(&key->sem); 904 * authorisation key whilst holding the sem on a key we've just
905 set_bit(KEY_FLAG_REVOKED, &key->flags); 905 * instantiated
906 906 */
907 if (key->type->revoke) 907 down_write_nested(&key->sem, 1);
908 if (!test_and_set_bit(KEY_FLAG_REVOKED, &key->flags) &&
909 key->type->revoke)
908 key->type->revoke(key); 910 key->type->revoke(key);
909 911
910 up_write(&key->sem); 912 up_write(&key->sem);
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index b6f86808475a..2a0eb946fc7e 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -26,7 +26,7 @@ static DEFINE_MUTEX(key_session_mutex);
26/* the root user's tracking struct */ 26/* the root user's tracking struct */
27struct key_user root_key_user = { 27struct key_user root_key_user = {
28 .usage = ATOMIC_INIT(3), 28 .usage = ATOMIC_INIT(3),
29 .consq = LIST_HEAD_INIT(root_key_user.consq), 29 .cons_lock = __MUTEX_INITIALIZER(root_key_user.cons_lock),
30 .lock = __SPIN_LOCK_UNLOCKED(root_key_user.lock), 30 .lock = __SPIN_LOCK_UNLOCKED(root_key_user.lock),
31 .nkeys = ATOMIC_INIT(2), 31 .nkeys = ATOMIC_INIT(2),
32 .nikeys = ATOMIC_INIT(2), 32 .nikeys = ATOMIC_INIT(2),
@@ -679,8 +679,18 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id,
679 break; 679 break;
680 } 680 }
681 681
682 /* check the status */ 682 if (!partial) {
683 if (perm) { 683 ret = wait_for_key_construction(key, true);
684 switch (ret) {
685 case -ERESTARTSYS:
686 goto invalid_key;
687 default:
688 if (perm)
689 goto invalid_key;
690 case 0:
691 break;
692 }
693 } else if (perm) {
684 ret = key_validate(key); 694 ret = key_validate(key);
685 if (ret < 0) 695 if (ret < 0)
686 goto invalid_key; 696 goto invalid_key;
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 557500110a13..6381e616c477 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -1,6 +1,6 @@
1/* request_key.c: request a key from userspace 1/* Request a key from userspace
2 * 2 *
3 * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -18,27 +18,54 @@
18#include <linux/keyctl.h> 18#include <linux/keyctl.h>
19#include "internal.h" 19#include "internal.h"
20 20
21struct key_construction { 21/*
22 struct list_head link; /* link in construction queue */ 22 * wait_on_bit() sleep function for uninterruptible waiting
23 struct key *key; /* key being constructed */ 23 */
24}; 24static int key_wait_bit(void *flags)
25{
26 schedule();
27 return 0;
28}
29
30/*
31 * wait_on_bit() sleep function for interruptible waiting
32 */
33static int key_wait_bit_intr(void *flags)
34{
35 schedule();
36 return signal_pending(current) ? -ERESTARTSYS : 0;
37}
38
39/*
40 * call to complete the construction of a key
41 */
42void complete_request_key(struct key_construction *cons, int error)
43{
44 kenter("{%d,%d},%d", cons->key->serial, cons->authkey->serial, error);
25 45
26/* when waiting for someone else's keys, you get added to this */ 46 if (error < 0)
27DECLARE_WAIT_QUEUE_HEAD(request_key_conswq); 47 key_negate_and_link(cons->key, key_negative_timeout, NULL,
48 cons->authkey);
49 else
50 key_revoke(cons->authkey);
51
52 key_put(cons->key);
53 key_put(cons->authkey);
54 kfree(cons);
55}
56EXPORT_SYMBOL(complete_request_key);
28 57
29/*****************************************************************************/
30/* 58/*
31 * request userspace finish the construction of a key 59 * request userspace finish the construction of a key
32 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>" 60 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>"
33 */ 61 */
34static int call_sbin_request_key(struct key *key, 62static int call_sbin_request_key(struct key_construction *cons,
35 struct key *authkey,
36 const char *op, 63 const char *op,
37 void *aux) 64 void *aux)
38{ 65{
39 struct task_struct *tsk = current; 66 struct task_struct *tsk = current;
40 key_serial_t prkey, sskey; 67 key_serial_t prkey, sskey;
41 struct key *keyring; 68 struct key *key = cons->key, *authkey = cons->authkey, *keyring;
42 char *argv[9], *envp[3], uid_str[12], gid_str[12]; 69 char *argv[9], *envp[3], uid_str[12], gid_str[12];
43 char key_str[12], keyring_str[3][12]; 70 char key_str[12], keyring_str[3][12];
44 char desc[20]; 71 char desc[20];
@@ -82,8 +109,7 @@ static int call_sbin_request_key(struct key *key,
82 rcu_read_lock(); 109 rcu_read_lock();
83 sskey = rcu_dereference(tsk->signal->session_keyring)->serial; 110 sskey = rcu_dereference(tsk->signal->session_keyring)->serial;
84 rcu_read_unlock(); 111 rcu_read_unlock();
85 } 112 } else {
86 else {
87 sskey = tsk->user->session_keyring->serial; 113 sskey = tsk->user->session_keyring->serial;
88 } 114 }
89 115
@@ -110,228 +136,77 @@ static int call_sbin_request_key(struct key *key,
110 /* do it */ 136 /* do it */
111 ret = call_usermodehelper_keys(argv[0], argv, envp, keyring, 137 ret = call_usermodehelper_keys(argv[0], argv, envp, keyring,
112 UMH_WAIT_PROC); 138 UMH_WAIT_PROC);
139 kdebug("usermode -> 0x%x", ret);
140 if (ret >= 0) {
141 /* ret is the exit/wait code */
142 if (test_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags) ||
143 key_validate(key) < 0)
144 ret = -ENOKEY;
145 else
146 /* ignore any errors from userspace if the key was
147 * instantiated */
148 ret = 0;
149 }
113 150
114error_link: 151error_link:
115 key_put(keyring); 152 key_put(keyring);
116 153
117error_alloc: 154error_alloc:
118 kleave(" = %d", ret); 155 kleave(" = %d", ret);
156 complete_request_key(cons, ret);
119 return ret; 157 return ret;
158}
120 159
121} /* end call_sbin_request_key() */
122
123/*****************************************************************************/
124/* 160/*
125 * call out to userspace for the key 161 * call out to userspace for key construction
126 * - called with the construction sem held, but the sem is dropped here
127 * - we ignore program failure and go on key status instead 162 * - we ignore program failure and go on key status instead
128 */ 163 */
129static struct key *__request_key_construction(struct key_type *type, 164static int construct_key(struct key *key, const char *callout_info, void *aux)
130 const char *description,
131 const char *callout_info,
132 void *aux,
133 unsigned long flags)
134{ 165{
166 struct key_construction *cons;
135 request_key_actor_t actor; 167 request_key_actor_t actor;
136 struct key_construction cons; 168 struct key *authkey;
137 struct timespec now; 169 int ret;
138 struct key *key, *authkey;
139 int ret, negated;
140 170
141 kenter("%s,%s,%s,%lx", type->name, description, callout_info, flags); 171 kenter("%d,%s,%p", key->serial, callout_info, aux);
142 172
143 /* create a key and add it to the queue */ 173 cons = kmalloc(sizeof(*cons), GFP_KERNEL);
144 key = key_alloc(type, description, 174 if (!cons)
145 current->fsuid, current->fsgid, current, KEY_POS_ALL, 175 return -ENOMEM;
146 flags);
147 if (IS_ERR(key))
148 goto alloc_failed;
149
150 set_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
151
152 cons.key = key;
153 list_add_tail(&cons.link, &key->user->consq);
154
155 /* we drop the construction sem here on behalf of the caller */
156 up_write(&key_construction_sem);
157 176
158 /* allocate an authorisation key */ 177 /* allocate an authorisation key */
159 authkey = request_key_auth_new(key, callout_info); 178 authkey = request_key_auth_new(key, callout_info);
160 if (IS_ERR(authkey)) { 179 if (IS_ERR(authkey)) {
180 kfree(cons);
161 ret = PTR_ERR(authkey); 181 ret = PTR_ERR(authkey);
162 authkey = NULL; 182 authkey = NULL;
163 goto alloc_authkey_failed; 183 } else {
164 } 184 cons->authkey = key_get(authkey);
165 185 cons->key = key_get(key);
166 /* make the call */ 186
167 actor = call_sbin_request_key; 187 /* make the call */
168 if (type->request_key) 188 actor = call_sbin_request_key;
169 actor = type->request_key; 189 if (key->type->request_key)
170 ret = actor(key, authkey, "create", aux); 190 actor = key->type->request_key;
171 if (ret < 0) 191
172 goto request_failed; 192 ret = actor(cons, "create", aux);
173 193
174 /* if the key wasn't instantiated, then we want to give an error */ 194 /* check that the actor called complete_request_key() prior to
175 ret = -ENOKEY; 195 * returning an error */
176 if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) 196 WARN_ON(ret < 0 &&
177 goto request_failed; 197 !test_bit(KEY_FLAG_REVOKED, &authkey->flags));
178 198 key_put(authkey);
179 key_revoke(authkey);
180 key_put(authkey);
181
182 down_write(&key_construction_sem);
183 list_del(&cons.link);
184 up_write(&key_construction_sem);
185
186 /* also give an error if the key was negatively instantiated */
187check_not_negative:
188 if (test_bit(KEY_FLAG_NEGATIVE, &key->flags)) {
189 key_put(key);
190 key = ERR_PTR(-ENOKEY);
191 }
192
193out:
194 kleave(" = %p", key);
195 return key;
196
197request_failed:
198 key_revoke(authkey);
199 key_put(authkey);
200
201alloc_authkey_failed:
202 /* it wasn't instantiated
203 * - remove from construction queue
204 * - mark the key as dead
205 */
206 negated = 0;
207 down_write(&key_construction_sem);
208
209 list_del(&cons.link);
210
211 /* check it didn't get instantiated between the check and the down */
212 if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
213 set_bit(KEY_FLAG_NEGATIVE, &key->flags);
214 set_bit(KEY_FLAG_INSTANTIATED, &key->flags);
215 negated = 1;
216 }
217
218 clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
219
220 up_write(&key_construction_sem);
221
222 if (!negated)
223 goto check_not_negative; /* surprisingly, the key got
224 * instantiated */
225
226 /* set the timeout and store in the session keyring if we can */
227 now = current_kernel_time();
228 key->expiry = now.tv_sec + key_negative_timeout;
229
230 if (current->signal->session_keyring) {
231 struct key *keyring;
232
233 rcu_read_lock();
234 keyring = rcu_dereference(current->signal->session_keyring);
235 atomic_inc(&keyring->usage);
236 rcu_read_unlock();
237
238 key_link(keyring, key);
239 key_put(keyring);
240 }
241
242 key_put(key);
243
244 /* notify anyone who was waiting */
245 wake_up_all(&request_key_conswq);
246
247 key = ERR_PTR(ret);
248 goto out;
249
250alloc_failed:
251 up_write(&key_construction_sem);
252 goto out;
253
254} /* end __request_key_construction() */
255
256/*****************************************************************************/
257/*
258 * call out to userspace to request the key
259 * - we check the construction queue first to see if an appropriate key is
260 * already being constructed by userspace
261 */
262static struct key *request_key_construction(struct key_type *type,
263 const char *description,
264 const char *callout_info,
265 void *aux,
266 struct key_user *user,
267 unsigned long flags)
268{
269 struct key_construction *pcons;
270 struct key *key, *ckey;
271
272 DECLARE_WAITQUEUE(myself, current);
273
274 kenter("%s,%s,{%d},%s,%lx",
275 type->name, description, user->uid, callout_info, flags);
276
277 /* see if there's such a key under construction already */
278 down_write(&key_construction_sem);
279
280 list_for_each_entry(pcons, &user->consq, link) {
281 ckey = pcons->key;
282
283 if (ckey->type != type)
284 continue;
285
286 if (type->match(ckey, description))
287 goto found_key_under_construction;
288 } 199 }
289 200
290 /* see about getting userspace to construct the key */ 201 kleave(" = %d", ret);
291 key = __request_key_construction(type, description, callout_info, aux, 202 return ret;
292 flags); 203}
293 error:
294 kleave(" = %p", key);
295 return key;
296
297 /* someone else has the same key under construction
298 * - we want to keep an eye on their key
299 */
300 found_key_under_construction:
301 atomic_inc(&ckey->usage);
302 up_write(&key_construction_sem);
303
304 /* wait for the key to be completed one way or another */
305 add_wait_queue(&request_key_conswq, &myself);
306
307 for (;;) {
308 set_current_state(TASK_INTERRUPTIBLE);
309 if (!test_bit(KEY_FLAG_USER_CONSTRUCT, &ckey->flags))
310 break;
311 if (signal_pending(current))
312 break;
313 schedule();
314 }
315
316 set_current_state(TASK_RUNNING);
317 remove_wait_queue(&request_key_conswq, &myself);
318
319 /* we'll need to search this process's keyrings to see if the key is
320 * now there since we can't automatically assume it's also available
321 * there */
322 key_put(ckey);
323 ckey = NULL;
324
325 key = NULL; /* request a retry */
326 goto error;
327
328} /* end request_key_construction() */
329 204
330/*****************************************************************************/
331/* 205/*
332 * link a freshly minted key to an appropriate destination keyring 206 * link a key to the appropriate destination keyring
207 * - the caller must hold a write lock on the destination keyring
333 */ 208 */
334static void request_key_link(struct key *key, struct key *dest_keyring) 209static void construct_key_make_link(struct key *key, struct key *dest_keyring)
335{ 210{
336 struct task_struct *tsk = current; 211 struct task_struct *tsk = current;
337 struct key *drop = NULL; 212 struct key *drop = NULL;
@@ -363,11 +238,11 @@ static void request_key_link(struct key *key, struct key *dest_keyring)
363 break; 238 break;
364 239
365 case KEY_REQKEY_DEFL_USER_SESSION_KEYRING: 240 case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
366 dest_keyring = current->user->session_keyring; 241 dest_keyring = tsk->user->session_keyring;
367 break; 242 break;
368 243
369 case KEY_REQKEY_DEFL_USER_KEYRING: 244 case KEY_REQKEY_DEFL_USER_KEYRING:
370 dest_keyring = current->user->uid_keyring; 245 dest_keyring = tsk->user->uid_keyring;
371 break; 246 break;
372 247
373 case KEY_REQKEY_DEFL_GROUP_KEYRING: 248 case KEY_REQKEY_DEFL_GROUP_KEYRING:
@@ -377,15 +252,115 @@ static void request_key_link(struct key *key, struct key *dest_keyring)
377 } 252 }
378 253
379 /* and attach the key to it */ 254 /* and attach the key to it */
380 key_link(dest_keyring, key); 255 __key_link(dest_keyring, key);
381
382 key_put(drop); 256 key_put(drop);
383
384 kleave(""); 257 kleave("");
258}
385 259
386} /* end request_key_link() */ 260/*
261 * allocate a new key in under-construction state and attempt to link it in to
262 * the requested place
263 * - may return a key that's already under construction instead
264 */
265static int construct_alloc_key(struct key_type *type,
266 const char *description,
267 struct key *dest_keyring,
268 unsigned long flags,
269 struct key_user *user,
270 struct key **_key)
271{
272 struct key *key;
273 key_ref_t key_ref;
274
275 kenter("%s,%s,,,", type->name, description);
276
277 mutex_lock(&user->cons_lock);
278
279 key = key_alloc(type, description,
280 current->fsuid, current->fsgid, current, KEY_POS_ALL,
281 flags);
282 if (IS_ERR(key))
283 goto alloc_failed;
284
285 set_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
286
287 if (dest_keyring)
288 down_write(&dest_keyring->sem);
289
290 /* attach the key to the destination keyring under lock, but we do need
291 * to do another check just in case someone beat us to it whilst we
292 * waited for locks */
293 mutex_lock(&key_construction_mutex);
294
295 key_ref = search_process_keyrings(type, description, type->match,
296 current);
297 if (!IS_ERR(key_ref))
298 goto key_already_present;
299
300 if (dest_keyring)
301 construct_key_make_link(key, dest_keyring);
302
303 mutex_unlock(&key_construction_mutex);
304 if (dest_keyring)
305 up_write(&dest_keyring->sem);
306 mutex_unlock(&user->cons_lock);
307 *_key = key;
308 kleave(" = 0 [%d]", key_serial(key));
309 return 0;
310
311key_already_present:
312 mutex_unlock(&key_construction_mutex);
313 if (dest_keyring)
314 up_write(&dest_keyring->sem);
315 mutex_unlock(&user->cons_lock);
316 key_put(key);
317 *_key = key = key_ref_to_ptr(key_ref);
318 kleave(" = -EINPROGRESS [%d]", key_serial(key));
319 return -EINPROGRESS;
320
321alloc_failed:
322 mutex_unlock(&user->cons_lock);
323 *_key = NULL;
324 kleave(" = %ld", PTR_ERR(key));
325 return PTR_ERR(key);
326}
327
328/*
329 * commence key construction
330 */
331static struct key *construct_key_and_link(struct key_type *type,
332 const char *description,
333 const char *callout_info,
334 void *aux,
335 struct key *dest_keyring,
336 unsigned long flags)
337{
338 struct key_user *user;
339 struct key *key;
340 int ret;
341
342 user = key_user_lookup(current->fsuid);
343 if (!user)
344 return ERR_PTR(-ENOMEM);
345
346 ret = construct_alloc_key(type, description, dest_keyring, flags, user,
347 &key);
348 key_user_put(user);
349
350 if (ret == 0) {
351 ret = construct_key(key, callout_info, aux);
352 if (ret < 0)
353 goto construction_failed;
354 }
355
356 return key;
357
358construction_failed:
359 key_negate_and_link(key, key_negative_timeout, NULL, NULL);
360 key_put(key);
361 return ERR_PTR(ret);
362}
387 363
388/*****************************************************************************/
389/* 364/*
390 * request a key 365 * request a key
391 * - search the process's keyrings 366 * - search the process's keyrings
@@ -400,7 +375,6 @@ struct key *request_key_and_link(struct key_type *type,
400 struct key *dest_keyring, 375 struct key *dest_keyring,
401 unsigned long flags) 376 unsigned long flags)
402{ 377{
403 struct key_user *user;
404 struct key *key; 378 struct key *key;
405 key_ref_t key_ref; 379 key_ref_t key_ref;
406 380
@@ -412,112 +386,124 @@ struct key *request_key_and_link(struct key_type *type,
412 key_ref = search_process_keyrings(type, description, type->match, 386 key_ref = search_process_keyrings(type, description, type->match,
413 current); 387 current);
414 388
415 kdebug("search 1: %p", key_ref);
416
417 if (!IS_ERR(key_ref)) { 389 if (!IS_ERR(key_ref)) {
418 key = key_ref_to_ptr(key_ref); 390 key = key_ref_to_ptr(key_ref);
419 } 391 } else if (PTR_ERR(key_ref) != -EAGAIN) {
420 else if (PTR_ERR(key_ref) != -EAGAIN) {
421 key = ERR_PTR(PTR_ERR(key_ref)); 392 key = ERR_PTR(PTR_ERR(key_ref));
422 } 393 } else {
423 else {
424 /* the search failed, but the keyrings were searchable, so we 394 /* the search failed, but the keyrings were searchable, so we
425 * should consult userspace if we can */ 395 * should consult userspace if we can */
426 key = ERR_PTR(-ENOKEY); 396 key = ERR_PTR(-ENOKEY);
427 if (!callout_info) 397 if (!callout_info)
428 goto error; 398 goto error;
429 399
430 /* - get hold of the user's construction queue */ 400 key = construct_key_and_link(type, description, callout_info,
431 user = key_user_lookup(current->fsuid); 401 aux, dest_keyring, flags);
432 if (!user)
433 goto nomem;
434
435 for (;;) {
436 if (signal_pending(current))
437 goto interrupted;
438
439 /* ask userspace (returns NULL if it waited on a key
440 * being constructed) */
441 key = request_key_construction(type, description,
442 callout_info, aux,
443 user, flags);
444 if (key)
445 break;
446
447 /* someone else made the key we want, so we need to
448 * search again as it might now be available to us */
449 key_ref = search_process_keyrings(type, description,
450 type->match,
451 current);
452
453 kdebug("search 2: %p", key_ref);
454
455 if (!IS_ERR(key_ref)) {
456 key = key_ref_to_ptr(key_ref);
457 break;
458 }
459
460 if (PTR_ERR(key_ref) != -EAGAIN) {
461 key = ERR_PTR(PTR_ERR(key_ref));
462 break;
463 }
464 }
465
466 key_user_put(user);
467
468 /* link the new key into the appropriate keyring */
469 if (!IS_ERR(key))
470 request_key_link(key, dest_keyring);
471 } 402 }
472 403
473error: 404error:
474 kleave(" = %p", key); 405 kleave(" = %p", key);
475 return key; 406 return key;
407}
476 408
477nomem: 409/*
478 key = ERR_PTR(-ENOMEM); 410 * wait for construction of a key to complete
479 goto error; 411 */
480 412int wait_for_key_construction(struct key *key, bool intr)
481interrupted: 413{
482 key_user_put(user); 414 int ret;
483 key = ERR_PTR(-EINTR);
484 goto error;
485 415
486} /* end request_key_and_link() */ 416 ret = wait_on_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT,
417 intr ? key_wait_bit_intr : key_wait_bit,
418 intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
419 if (ret < 0)
420 return ret;
421 return key_validate(key);
422}
423EXPORT_SYMBOL(wait_for_key_construction);
487 424
488/*****************************************************************************/
489/* 425/*
490 * request a key 426 * request a key
491 * - search the process's keyrings 427 * - search the process's keyrings
492 * - check the list of keys being created or updated 428 * - check the list of keys being created or updated
493 * - call out to userspace for a key if supplementary info was provided 429 * - call out to userspace for a key if supplementary info was provided
430 * - waits uninterruptible for creation to complete
494 */ 431 */
495struct key *request_key(struct key_type *type, 432struct key *request_key(struct key_type *type,
496 const char *description, 433 const char *description,
497 const char *callout_info) 434 const char *callout_info)
498{ 435{
499 return request_key_and_link(type, description, callout_info, NULL, 436 struct key *key;
500 NULL, KEY_ALLOC_IN_QUOTA); 437 int ret;
501 438
502} /* end request_key() */ 439 key = request_key_and_link(type, description, callout_info, NULL,
503 440 NULL, KEY_ALLOC_IN_QUOTA);
441 if (!IS_ERR(key)) {
442 ret = wait_for_key_construction(key, false);
443 if (ret < 0) {
444 key_put(key);
445 return ERR_PTR(ret);
446 }
447 }
448 return key;
449}
504EXPORT_SYMBOL(request_key); 450EXPORT_SYMBOL(request_key);
505 451
506/*****************************************************************************/
507/* 452/*
508 * request a key with auxiliary data for the upcaller 453 * request a key with auxiliary data for the upcaller
509 * - search the process's keyrings 454 * - search the process's keyrings
510 * - check the list of keys being created or updated 455 * - check the list of keys being created or updated
511 * - call out to userspace for a key if supplementary info was provided 456 * - call out to userspace for a key if supplementary info was provided
457 * - waits uninterruptible for creation to complete
512 */ 458 */
513struct key *request_key_with_auxdata(struct key_type *type, 459struct key *request_key_with_auxdata(struct key_type *type,
514 const char *description, 460 const char *description,
515 const char *callout_info, 461 const char *callout_info,
516 void *aux) 462 void *aux)
517{ 463{
518 return request_key_and_link(type, description, callout_info, aux, 464 struct key *key;
519 NULL, KEY_ALLOC_IN_QUOTA); 465 int ret;
466
467 key = request_key_and_link(type, description, callout_info, aux,
468 NULL, KEY_ALLOC_IN_QUOTA);
469 if (!IS_ERR(key)) {
470 ret = wait_for_key_construction(key, false);
471 if (ret < 0) {
472 key_put(key);
473 return ERR_PTR(ret);
474 }
475 }
476 return key;
477}
478EXPORT_SYMBOL(request_key_with_auxdata);
520 479
521} /* end request_key_with_auxdata() */ 480/*
481 * request a key (allow async construction)
482 * - search the process's keyrings
483 * - check the list of keys being created or updated
484 * - call out to userspace for a key if supplementary info was provided
485 */
486struct key *request_key_async(struct key_type *type,
487 const char *description,
488 const char *callout_info)
489{
490 return request_key_and_link(type, description, callout_info, NULL,
491 NULL, KEY_ALLOC_IN_QUOTA);
492}
493EXPORT_SYMBOL(request_key_async);
522 494
523EXPORT_SYMBOL(request_key_with_auxdata); 495/*
496 * request a key with auxiliary data for the upcaller (allow async construction)
497 * - search the process's keyrings
498 * - check the list of keys being created or updated
499 * - call out to userspace for a key if supplementary info was provided
500 */
501struct key *request_key_async_with_auxdata(struct key_type *type,
502 const char *description,
503 const char *callout_info,
504 void *aux)
505{
506 return request_key_and_link(type, description, callout_info, aux,
507 NULL, KEY_ALLOC_IN_QUOTA);
508}
509EXPORT_SYMBOL(request_key_async_with_auxdata);
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index cbf58a91b00a..510f7be73a2d 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -127,6 +127,7 @@ static void request_key_auth_destroy(struct key *key)
127 } 127 }
128 128
129 key_put(rka->target_key); 129 key_put(rka->target_key);
130 kfree(rka->callout_info);
130 kfree(rka); 131 kfree(rka);
131 132
132} /* end request_key_auth_destroy() */ 133} /* end request_key_auth_destroy() */
@@ -151,6 +152,12 @@ struct key *request_key_auth_new(struct key *target, const char *callout_info)
151 kleave(" = -ENOMEM"); 152 kleave(" = -ENOMEM");
152 return ERR_PTR(-ENOMEM); 153 return ERR_PTR(-ENOMEM);
153 } 154 }
155 rka->callout_info = kmalloc(strlen(callout_info) + 1, GFP_KERNEL);
156 if (!rka->callout_info) {
157 kleave(" = -ENOMEM");
158 kfree(rka);
159 return ERR_PTR(-ENOMEM);
160 }
154 161
155 /* see if the calling process is already servicing the key request of 162 /* see if the calling process is already servicing the key request of
156 * another process */ 163 * another process */
@@ -179,7 +186,7 @@ struct key *request_key_auth_new(struct key *target, const char *callout_info)
179 } 186 }
180 187
181 rka->target_key = key_get(target); 188 rka->target_key = key_get(target);
182 rka->callout_info = callout_info; 189 strcpy(rka->callout_info, callout_info);
183 190
184 /* allocate the auth key */ 191 /* allocate the auth key */
185 sprintf(desc, "%x", target->serial); 192 sprintf(desc, "%x", target->serial);
@@ -203,6 +210,7 @@ struct key *request_key_auth_new(struct key *target, const char *callout_info)
203 210
204auth_key_revoked: 211auth_key_revoked:
205 up_read(&current->request_key_auth->sem); 212 up_read(&current->request_key_auth->sem);
213 kfree(rka->callout_info);
206 kfree(rka); 214 kfree(rka);
207 kleave("= -EKEYREVOKED"); 215 kleave("= -EKEYREVOKED");
208 return ERR_PTR(-EKEYREVOKED); 216 return ERR_PTR(-EKEYREVOKED);
@@ -212,6 +220,7 @@ error_inst:
212 key_put(authkey); 220 key_put(authkey);
213error_alloc: 221error_alloc:
214 key_put(rka->target_key); 222 key_put(rka->target_key);
223 kfree(rka->callout_info);
215 kfree(rka); 224 kfree(rka);
216 kleave("= %d", ret); 225 kleave("= %d", ret);
217 return ERR_PTR(ret); 226 return ERR_PTR(ret);
diff --git a/security/root_plug.c b/security/root_plug.c
index 38dd4f3e641f..870f13095bb6 100644
--- a/security/root_plug.c
+++ b/security/root_plug.c
@@ -22,11 +22,11 @@
22 * License. 22 * License.
23 */ 23 */
24 24
25#include <linux/module.h>
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/security.h> 27#include <linux/security.h>
29#include <linux/usb.h> 28#include <linux/usb.h>
29#include <linux/moduleparam.h>
30 30
31/* flag to keep track of how we were registered */ 31/* flag to keep track of how we were registered */
32static int secondary; 32static int secondary;
@@ -36,22 +36,14 @@ static int vendor_id = 0x0557;
36static int product_id = 0x2008; 36static int product_id = 0x2008;
37 37
38module_param(vendor_id, uint, 0400); 38module_param(vendor_id, uint, 0400);
39MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for");
40
41module_param(product_id, uint, 0400); 39module_param(product_id, uint, 0400);
42MODULE_PARM_DESC(product_id, "USB Product ID of device to look for");
43 40
44/* should we print out debug messages */ 41/* should we print out debug messages */
45static int debug = 0; 42static int debug = 0;
46 43
47module_param(debug, bool, 0600); 44module_param(debug, bool, 0600);
48MODULE_PARM_DESC(debug, "Debug enabled or not");
49 45
50#if defined(CONFIG_SECURITY_ROOTPLUG_MODULE)
51#define MY_NAME THIS_MODULE->name
52#else
53#define MY_NAME "root_plug" 46#define MY_NAME "root_plug"
54#endif
55 47
56#define root_dbg(fmt, arg...) \ 48#define root_dbg(fmt, arg...) \
57 do { \ 49 do { \
@@ -117,25 +109,4 @@ static int __init rootplug_init (void)
117 return 0; 109 return 0;
118} 110}
119 111
120static void __exit rootplug_exit (void)
121{
122 /* remove ourselves from the security framework */
123 if (secondary) {
124 if (mod_unreg_security (MY_NAME, &rootplug_security_ops))
125 printk (KERN_INFO "Failure unregistering Root Plug "
126 " module with primary module.\n");
127 } else {
128 if (unregister_security (&rootplug_security_ops)) {
129 printk (KERN_INFO "Failure unregistering Root Plug "
130 "module with the kernel\n");
131 }
132 }
133 printk (KERN_INFO "Root Plug module removed\n");
134}
135
136security_initcall (rootplug_init); 112security_initcall (rootplug_init);
137module_exit (rootplug_exit);
138
139MODULE_DESCRIPTION("Root Plug sample LSM module, written for Linux Journal article");
140MODULE_LICENSE("GPL");
141
diff --git a/security/security.c b/security/security.c
index 27e5863d30f1..0e1f1f124368 100644
--- a/security/security.c
+++ b/security/security.c
@@ -17,7 +17,6 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/security.h> 18#include <linux/security.h>
19 19
20#define SECURITY_FRAMEWORK_VERSION "1.0.0"
21 20
22/* things that live in dummy.c */ 21/* things that live in dummy.c */
23extern struct security_operations dummy_security_ops; 22extern struct security_operations dummy_security_ops;
@@ -52,8 +51,7 @@ static void __init do_security_initcalls(void)
52 */ 51 */
53int __init security_init(void) 52int __init security_init(void)
54{ 53{
55 printk(KERN_INFO "Security Framework v" SECURITY_FRAMEWORK_VERSION 54 printk(KERN_INFO "Security Framework initialized\n");
56 " initialized\n");
57 55
58 if (verify(&dummy_security_ops)) { 56 if (verify(&dummy_security_ops)) {
59 printk(KERN_ERR "%s could not verify " 57 printk(KERN_ERR "%s could not verify "
@@ -73,8 +71,7 @@ int __init security_init(void)
73 * 71 *
74 * This function is to allow a security module to register itself with the 72 * This function is to allow a security module to register itself with the
75 * kernel security subsystem. Some rudimentary checking is done on the @ops 73 * kernel security subsystem. Some rudimentary checking is done on the @ops
76 * value passed to this function. A call to unregister_security() should be 74 * value passed to this function.
77 * done to remove this security_options structure from the kernel.
78 * 75 *
79 * If there is already a security module registered with the kernel, 76 * If there is already a security module registered with the kernel,
80 * an error will be returned. Otherwise 0 is returned on success. 77 * an error will be returned. Otherwise 0 is returned on success.
@@ -96,31 +93,6 @@ int register_security(struct security_operations *ops)
96} 93}
97 94
98/** 95/**
99 * unregister_security - unregisters a security framework with the kernel
100 * @ops: a pointer to the struct security_options that is to be registered
101 *
102 * This function removes a struct security_operations variable that had
103 * previously been registered with a successful call to register_security().
104 *
105 * If @ops does not match the valued previously passed to register_security()
106 * an error is returned. Otherwise the default security options is set to the
107 * the dummy_security_ops structure, and 0 is returned.
108 */
109int unregister_security(struct security_operations *ops)
110{
111 if (ops != security_ops) {
112 printk(KERN_INFO "%s: trying to unregister "
113 "a security_opts structure that is not "
114 "registered, failing.\n", __FUNCTION__);
115 return -EINVAL;
116 }
117
118 security_ops = &dummy_security_ops;
119
120 return 0;
121}
122
123/**
124 * mod_reg_security - allows security modules to be "stacked" 96 * mod_reg_security - allows security modules to be "stacked"
125 * @name: a pointer to a string with the name of the security_options to be registered 97 * @name: a pointer to a string with the name of the security_options to be registered
126 * @ops: a pointer to the struct security_options that is to be registered 98 * @ops: a pointer to the struct security_options that is to be registered
@@ -149,32 +121,962 @@ int mod_reg_security(const char *name, struct security_operations *ops)
149 return security_ops->register_security(name, ops); 121 return security_ops->register_security(name, ops);
150} 122}
151 123
152/** 124/* Security operations */
153 * mod_unreg_security - allows a security module registered with mod_reg_security() to be unloaded 125
154 * @name: a pointer to a string with the name of the security_options to be removed 126int security_ptrace(struct task_struct *parent, struct task_struct *child)
155 * @ops: a pointer to the struct security_options that is to be removed
156 *
157 * This function allows security modules that have been successfully registered
158 * with a call to mod_reg_security() to be unloaded from the system.
159 * This calls the currently loaded security module's unregister_security() call
160 * with the @name and @ops variables.
161 *
162 * The return value depends on the currently loaded security module, with 0 as
163 * success.
164 */
165int mod_unreg_security(const char *name, struct security_operations *ops)
166{ 127{
167 if (ops == security_ops) { 128 return security_ops->ptrace(parent, child);
168 printk(KERN_INFO "%s invalid attempt to unregister " 129}
169 " primary security ops.\n", __FUNCTION__); 130
170 return -EINVAL; 131int security_capget(struct task_struct *target,
171 } 132 kernel_cap_t *effective,
133 kernel_cap_t *inheritable,
134 kernel_cap_t *permitted)
135{
136 return security_ops->capget(target, effective, inheritable, permitted);
137}
138
139int security_capset_check(struct task_struct *target,
140 kernel_cap_t *effective,
141 kernel_cap_t *inheritable,
142 kernel_cap_t *permitted)
143{
144 return security_ops->capset_check(target, effective, inheritable, permitted);
145}
146
147void security_capset_set(struct task_struct *target,
148 kernel_cap_t *effective,
149 kernel_cap_t *inheritable,
150 kernel_cap_t *permitted)
151{
152 security_ops->capset_set(target, effective, inheritable, permitted);
153}
154
155int security_capable(struct task_struct *tsk, int cap)
156{
157 return security_ops->capable(tsk, cap);
158}
159
160int security_acct(struct file *file)
161{
162 return security_ops->acct(file);
163}
164
165int security_sysctl(struct ctl_table *table, int op)
166{
167 return security_ops->sysctl(table, op);
168}
169
170int security_quotactl(int cmds, int type, int id, struct super_block *sb)
171{
172 return security_ops->quotactl(cmds, type, id, sb);
173}
174
175int security_quota_on(struct dentry *dentry)
176{
177 return security_ops->quota_on(dentry);
178}
179
180int security_syslog(int type)
181{
182 return security_ops->syslog(type);
183}
184
185int security_settime(struct timespec *ts, struct timezone *tz)
186{
187 return security_ops->settime(ts, tz);
188}
189
190int security_vm_enough_memory(long pages)
191{
192 return security_ops->vm_enough_memory(current->mm, pages);
193}
194
195int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
196{
197 return security_ops->vm_enough_memory(mm, pages);
198}
199
200int security_bprm_alloc(struct linux_binprm *bprm)
201{
202 return security_ops->bprm_alloc_security(bprm);
203}
204
205void security_bprm_free(struct linux_binprm *bprm)
206{
207 security_ops->bprm_free_security(bprm);
208}
209
210void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
211{
212 security_ops->bprm_apply_creds(bprm, unsafe);
213}
214
215void security_bprm_post_apply_creds(struct linux_binprm *bprm)
216{
217 security_ops->bprm_post_apply_creds(bprm);
218}
219
220int security_bprm_set(struct linux_binprm *bprm)
221{
222 return security_ops->bprm_set_security(bprm);
223}
224
225int security_bprm_check(struct linux_binprm *bprm)
226{
227 return security_ops->bprm_check_security(bprm);
228}
229
230int security_bprm_secureexec(struct linux_binprm *bprm)
231{
232 return security_ops->bprm_secureexec(bprm);
233}
234
235int security_sb_alloc(struct super_block *sb)
236{
237 return security_ops->sb_alloc_security(sb);
238}
239
240void security_sb_free(struct super_block *sb)
241{
242 security_ops->sb_free_security(sb);
243}
244
245int security_sb_copy_data(struct file_system_type *type, void *orig, void *copy)
246{
247 return security_ops->sb_copy_data(type, orig, copy);
248}
249
250int security_sb_kern_mount(struct super_block *sb, void *data)
251{
252 return security_ops->sb_kern_mount(sb, data);
253}
254
255int security_sb_statfs(struct dentry *dentry)
256{
257 return security_ops->sb_statfs(dentry);
258}
259
260int security_sb_mount(char *dev_name, struct nameidata *nd,
261 char *type, unsigned long flags, void *data)
262{
263 return security_ops->sb_mount(dev_name, nd, type, flags, data);
264}
265
266int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd)
267{
268 return security_ops->sb_check_sb(mnt, nd);
269}
270
271int security_sb_umount(struct vfsmount *mnt, int flags)
272{
273 return security_ops->sb_umount(mnt, flags);
274}
275
276void security_sb_umount_close(struct vfsmount *mnt)
277{
278 security_ops->sb_umount_close(mnt);
279}
280
281void security_sb_umount_busy(struct vfsmount *mnt)
282{
283 security_ops->sb_umount_busy(mnt);
284}
285
286void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data)
287{
288 security_ops->sb_post_remount(mnt, flags, data);
289}
290
291void security_sb_post_mountroot(void)
292{
293 security_ops->sb_post_mountroot();
294}
295
296void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd)
297{
298 security_ops->sb_post_addmount(mnt, mountpoint_nd);
299}
300
301int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd)
302{
303 return security_ops->sb_pivotroot(old_nd, new_nd);
304}
305
306void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd)
307{
308 security_ops->sb_post_pivotroot(old_nd, new_nd);
309}
310
311int security_inode_alloc(struct inode *inode)
312{
313 inode->i_security = NULL;
314 return security_ops->inode_alloc_security(inode);
315}
316
317void security_inode_free(struct inode *inode)
318{
319 security_ops->inode_free_security(inode);
320}
321
322int security_inode_init_security(struct inode *inode, struct inode *dir,
323 char **name, void **value, size_t *len)
324{
325 if (unlikely(IS_PRIVATE(inode)))
326 return -EOPNOTSUPP;
327 return security_ops->inode_init_security(inode, dir, name, value, len);
328}
329EXPORT_SYMBOL(security_inode_init_security);
330
331int security_inode_create(struct inode *dir, struct dentry *dentry, int mode)
332{
333 if (unlikely(IS_PRIVATE(dir)))
334 return 0;
335 return security_ops->inode_create(dir, dentry, mode);
336}
337
338int security_inode_link(struct dentry *old_dentry, struct inode *dir,
339 struct dentry *new_dentry)
340{
341 if (unlikely(IS_PRIVATE(old_dentry->d_inode)))
342 return 0;
343 return security_ops->inode_link(old_dentry, dir, new_dentry);
344}
345
346int security_inode_unlink(struct inode *dir, struct dentry *dentry)
347{
348 if (unlikely(IS_PRIVATE(dentry->d_inode)))
349 return 0;
350 return security_ops->inode_unlink(dir, dentry);
351}
352
353int security_inode_symlink(struct inode *dir, struct dentry *dentry,
354 const char *old_name)
355{
356 if (unlikely(IS_PRIVATE(dir)))
357 return 0;
358 return security_ops->inode_symlink(dir, dentry, old_name);
359}
360
361int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode)
362{
363 if (unlikely(IS_PRIVATE(dir)))
364 return 0;
365 return security_ops->inode_mkdir(dir, dentry, mode);
366}
367
368int security_inode_rmdir(struct inode *dir, struct dentry *dentry)
369{
370 if (unlikely(IS_PRIVATE(dentry->d_inode)))
371 return 0;
372 return security_ops->inode_rmdir(dir, dentry);
373}
374
375int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
376{
377 if (unlikely(IS_PRIVATE(dir)))
378 return 0;
379 return security_ops->inode_mknod(dir, dentry, mode, dev);
380}
381
382int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
383 struct inode *new_dir, struct dentry *new_dentry)
384{
385 if (unlikely(IS_PRIVATE(old_dentry->d_inode) ||
386 (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode))))
387 return 0;
388 return security_ops->inode_rename(old_dir, old_dentry,
389 new_dir, new_dentry);
390}
391
392int security_inode_readlink(struct dentry *dentry)
393{
394 if (unlikely(IS_PRIVATE(dentry->d_inode)))
395 return 0;
396 return security_ops->inode_readlink(dentry);
397}
398
399int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
400{
401 if (unlikely(IS_PRIVATE(dentry->d_inode)))
402 return 0;
403 return security_ops->inode_follow_link(dentry, nd);
404}
405
406int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
407{
408 if (unlikely(IS_PRIVATE(inode)))
409 return 0;
410 return security_ops->inode_permission(inode, mask, nd);
411}
412
413int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
414{
415 if (unlikely(IS_PRIVATE(dentry->d_inode)))
416 return 0;
417 return security_ops->inode_setattr(dentry, attr);
418}
419
420int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
421{
422 if (unlikely(IS_PRIVATE(dentry->d_inode)))
423 return 0;
424 return security_ops->inode_getattr(mnt, dentry);
425}
426
427void security_inode_delete(struct inode *inode)
428{
429 if (unlikely(IS_PRIVATE(inode)))
430 return;
431 security_ops->inode_delete(inode);
432}
433
434int security_inode_setxattr(struct dentry *dentry, char *name,
435 void *value, size_t size, int flags)
436{
437 if (unlikely(IS_PRIVATE(dentry->d_inode)))
438 return 0;
439 return security_ops->inode_setxattr(dentry, name, value, size, flags);
440}
441
442void security_inode_post_setxattr(struct dentry *dentry, char *name,
443 void *value, size_t size, int flags)
444{
445 if (unlikely(IS_PRIVATE(dentry->d_inode)))
446 return;
447 security_ops->inode_post_setxattr(dentry, name, value, size, flags);
448}
449
450int security_inode_getxattr(struct dentry *dentry, char *name)
451{
452 if (unlikely(IS_PRIVATE(dentry->d_inode)))
453 return 0;
454 return security_ops->inode_getxattr(dentry, name);
455}
456
457int security_inode_listxattr(struct dentry *dentry)
458{
459 if (unlikely(IS_PRIVATE(dentry->d_inode)))
460 return 0;
461 return security_ops->inode_listxattr(dentry);
462}
463
464int security_inode_removexattr(struct dentry *dentry, char *name)
465{
466 if (unlikely(IS_PRIVATE(dentry->d_inode)))
467 return 0;
468 return security_ops->inode_removexattr(dentry, name);
469}
470
471int security_inode_need_killpriv(struct dentry *dentry)
472{
473 return security_ops->inode_need_killpriv(dentry);
474}
475
476int security_inode_killpriv(struct dentry *dentry)
477{
478 return security_ops->inode_killpriv(dentry);
479}
480
481int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
482{
483 if (unlikely(IS_PRIVATE(inode)))
484 return 0;
485 return security_ops->inode_getsecurity(inode, name, buffer, size, err);
486}
487
488int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
489{
490 if (unlikely(IS_PRIVATE(inode)))
491 return 0;
492 return security_ops->inode_setsecurity(inode, name, value, size, flags);
493}
494
495int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
496{
497 if (unlikely(IS_PRIVATE(inode)))
498 return 0;
499 return security_ops->inode_listsecurity(inode, buffer, buffer_size);
500}
501
502int security_file_permission(struct file *file, int mask)
503{
504 return security_ops->file_permission(file, mask);
505}
506
507int security_file_alloc(struct file *file)
508{
509 return security_ops->file_alloc_security(file);
510}
511
512void security_file_free(struct file *file)
513{
514 security_ops->file_free_security(file);
515}
516
517int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
518{
519 return security_ops->file_ioctl(file, cmd, arg);
520}
521
522int security_file_mmap(struct file *file, unsigned long reqprot,
523 unsigned long prot, unsigned long flags,
524 unsigned long addr, unsigned long addr_only)
525{
526 return security_ops->file_mmap(file, reqprot, prot, flags, addr, addr_only);
527}
528
529int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
530 unsigned long prot)
531{
532 return security_ops->file_mprotect(vma, reqprot, prot);
533}
534
535int security_file_lock(struct file *file, unsigned int cmd)
536{
537 return security_ops->file_lock(file, cmd);
538}
539
540int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
541{
542 return security_ops->file_fcntl(file, cmd, arg);
543}
544
545int security_file_set_fowner(struct file *file)
546{
547 return security_ops->file_set_fowner(file);
548}
549
550int security_file_send_sigiotask(struct task_struct *tsk,
551 struct fown_struct *fown, int sig)
552{
553 return security_ops->file_send_sigiotask(tsk, fown, sig);
554}
555
556int security_file_receive(struct file *file)
557{
558 return security_ops->file_receive(file);
559}
560
561int security_dentry_open(struct file *file)
562{
563 return security_ops->dentry_open(file);
564}
565
566int security_task_create(unsigned long clone_flags)
567{
568 return security_ops->task_create(clone_flags);
569}
570
571int security_task_alloc(struct task_struct *p)
572{
573 return security_ops->task_alloc_security(p);
574}
575
576void security_task_free(struct task_struct *p)
577{
578 security_ops->task_free_security(p);
579}
580
581int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags)
582{
583 return security_ops->task_setuid(id0, id1, id2, flags);
584}
585
586int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
587 uid_t old_suid, int flags)
588{
589 return security_ops->task_post_setuid(old_ruid, old_euid, old_suid, flags);
590}
591
592int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags)
593{
594 return security_ops->task_setgid(id0, id1, id2, flags);
595}
172 596
173 return security_ops->unregister_security(name, ops); 597int security_task_setpgid(struct task_struct *p, pid_t pgid)
598{
599 return security_ops->task_setpgid(p, pgid);
600}
601
602int security_task_getpgid(struct task_struct *p)
603{
604 return security_ops->task_getpgid(p);
605}
606
607int security_task_getsid(struct task_struct *p)
608{
609 return security_ops->task_getsid(p);
610}
611
612void security_task_getsecid(struct task_struct *p, u32 *secid)
613{
614 security_ops->task_getsecid(p, secid);
615}
616EXPORT_SYMBOL(security_task_getsecid);
617
618int security_task_setgroups(struct group_info *group_info)
619{
620 return security_ops->task_setgroups(group_info);
621}
622
623int security_task_setnice(struct task_struct *p, int nice)
624{
625 return security_ops->task_setnice(p, nice);
626}
627
628int security_task_setioprio(struct task_struct *p, int ioprio)
629{
630 return security_ops->task_setioprio(p, ioprio);
631}
632
633int security_task_getioprio(struct task_struct *p)
634{
635 return security_ops->task_getioprio(p);
636}
637
638int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim)
639{
640 return security_ops->task_setrlimit(resource, new_rlim);
641}
642
643int security_task_setscheduler(struct task_struct *p,
644 int policy, struct sched_param *lp)
645{
646 return security_ops->task_setscheduler(p, policy, lp);
647}
648
649int security_task_getscheduler(struct task_struct *p)
650{
651 return security_ops->task_getscheduler(p);
652}
653
654int security_task_movememory(struct task_struct *p)
655{
656 return security_ops->task_movememory(p);
657}
658
659int security_task_kill(struct task_struct *p, struct siginfo *info,
660 int sig, u32 secid)
661{
662 return security_ops->task_kill(p, info, sig, secid);
663}
664
665int security_task_wait(struct task_struct *p)
666{
667 return security_ops->task_wait(p);
668}
669
670int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
671 unsigned long arg4, unsigned long arg5)
672{
673 return security_ops->task_prctl(option, arg2, arg3, arg4, arg5);
674}
675
676void security_task_reparent_to_init(struct task_struct *p)
677{
678 security_ops->task_reparent_to_init(p);
679}
680
681void security_task_to_inode(struct task_struct *p, struct inode *inode)
682{
683 security_ops->task_to_inode(p, inode);
684}
685
686int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag)
687{
688 return security_ops->ipc_permission(ipcp, flag);
689}
690
691int security_msg_msg_alloc(struct msg_msg *msg)
692{
693 return security_ops->msg_msg_alloc_security(msg);
694}
695
696void security_msg_msg_free(struct msg_msg *msg)
697{
698 security_ops->msg_msg_free_security(msg);
699}
700
701int security_msg_queue_alloc(struct msg_queue *msq)
702{
703 return security_ops->msg_queue_alloc_security(msq);
704}
705
706void security_msg_queue_free(struct msg_queue *msq)
707{
708 security_ops->msg_queue_free_security(msq);
709}
710
711int security_msg_queue_associate(struct msg_queue *msq, int msqflg)
712{
713 return security_ops->msg_queue_associate(msq, msqflg);
714}
715
716int security_msg_queue_msgctl(struct msg_queue *msq, int cmd)
717{
718 return security_ops->msg_queue_msgctl(msq, cmd);
719}
720
721int security_msg_queue_msgsnd(struct msg_queue *msq,
722 struct msg_msg *msg, int msqflg)
723{
724 return security_ops->msg_queue_msgsnd(msq, msg, msqflg);
725}
726
727int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
728 struct task_struct *target, long type, int mode)
729{
730 return security_ops->msg_queue_msgrcv(msq, msg, target, type, mode);
731}
732
733int security_shm_alloc(struct shmid_kernel *shp)
734{
735 return security_ops->shm_alloc_security(shp);
736}
737
738void security_shm_free(struct shmid_kernel *shp)
739{
740 security_ops->shm_free_security(shp);
741}
742
743int security_shm_associate(struct shmid_kernel *shp, int shmflg)
744{
745 return security_ops->shm_associate(shp, shmflg);
746}
747
748int security_shm_shmctl(struct shmid_kernel *shp, int cmd)
749{
750 return security_ops->shm_shmctl(shp, cmd);
751}
752
753int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg)
754{
755 return security_ops->shm_shmat(shp, shmaddr, shmflg);
756}
757
758int security_sem_alloc(struct sem_array *sma)
759{
760 return security_ops->sem_alloc_security(sma);
761}
762
763void security_sem_free(struct sem_array *sma)
764{
765 security_ops->sem_free_security(sma);
766}
767
768int security_sem_associate(struct sem_array *sma, int semflg)
769{
770 return security_ops->sem_associate(sma, semflg);
771}
772
773int security_sem_semctl(struct sem_array *sma, int cmd)
774{
775 return security_ops->sem_semctl(sma, cmd);
776}
777
778int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
779 unsigned nsops, int alter)
780{
781 return security_ops->sem_semop(sma, sops, nsops, alter);
782}
783
784void security_d_instantiate(struct dentry *dentry, struct inode *inode)
785{
786 if (unlikely(inode && IS_PRIVATE(inode)))
787 return;
788 security_ops->d_instantiate(dentry, inode);
789}
790EXPORT_SYMBOL(security_d_instantiate);
791
792int security_getprocattr(struct task_struct *p, char *name, char **value)
793{
794 return security_ops->getprocattr(p, name, value);
795}
796
797int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
798{
799 return security_ops->setprocattr(p, name, value, size);
800}
801
802int security_netlink_send(struct sock *sk, struct sk_buff *skb)
803{
804 return security_ops->netlink_send(sk, skb);
805}
806
807int security_netlink_recv(struct sk_buff *skb, int cap)
808{
809 return security_ops->netlink_recv(skb, cap);
810}
811EXPORT_SYMBOL(security_netlink_recv);
812
813int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
814{
815 return security_ops->secid_to_secctx(secid, secdata, seclen);
816}
817EXPORT_SYMBOL(security_secid_to_secctx);
818
819void security_release_secctx(char *secdata, u32 seclen)
820{
821 return security_ops->release_secctx(secdata, seclen);
822}
823EXPORT_SYMBOL(security_release_secctx);
824
825#ifdef CONFIG_SECURITY_NETWORK
826
827int security_unix_stream_connect(struct socket *sock, struct socket *other,
828 struct sock *newsk)
829{
830 return security_ops->unix_stream_connect(sock, other, newsk);
831}
832EXPORT_SYMBOL(security_unix_stream_connect);
833
834int security_unix_may_send(struct socket *sock, struct socket *other)
835{
836 return security_ops->unix_may_send(sock, other);
837}
838EXPORT_SYMBOL(security_unix_may_send);
839
840int security_socket_create(int family, int type, int protocol, int kern)
841{
842 return security_ops->socket_create(family, type, protocol, kern);
843}
844
845int security_socket_post_create(struct socket *sock, int family,
846 int type, int protocol, int kern)
847{
848 return security_ops->socket_post_create(sock, family, type,
849 protocol, kern);
850}
851
852int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen)
853{
854 return security_ops->socket_bind(sock, address, addrlen);
855}
856
857int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen)
858{
859 return security_ops->socket_connect(sock, address, addrlen);
860}
861
862int security_socket_listen(struct socket *sock, int backlog)
863{
864 return security_ops->socket_listen(sock, backlog);
865}
866
867int security_socket_accept(struct socket *sock, struct socket *newsock)
868{
869 return security_ops->socket_accept(sock, newsock);
870}
871
872void security_socket_post_accept(struct socket *sock, struct socket *newsock)
873{
874 security_ops->socket_post_accept(sock, newsock);
875}
876
877int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size)
878{
879 return security_ops->socket_sendmsg(sock, msg, size);
880}
881
882int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
883 int size, int flags)
884{
885 return security_ops->socket_recvmsg(sock, msg, size, flags);
886}
887
888int security_socket_getsockname(struct socket *sock)
889{
890 return security_ops->socket_getsockname(sock);
891}
892
893int security_socket_getpeername(struct socket *sock)
894{
895 return security_ops->socket_getpeername(sock);
896}
897
898int security_socket_getsockopt(struct socket *sock, int level, int optname)
899{
900 return security_ops->socket_getsockopt(sock, level, optname);
901}
902
903int security_socket_setsockopt(struct socket *sock, int level, int optname)
904{
905 return security_ops->socket_setsockopt(sock, level, optname);
906}
907
908int security_socket_shutdown(struct socket *sock, int how)
909{
910 return security_ops->socket_shutdown(sock, how);
911}
912
913int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
914{
915 return security_ops->socket_sock_rcv_skb(sk, skb);
916}
917EXPORT_SYMBOL(security_sock_rcv_skb);
918
919int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
920 int __user *optlen, unsigned len)
921{
922 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
923}
924
925int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
926{
927 return security_ops->socket_getpeersec_dgram(sock, skb, secid);
928}
929EXPORT_SYMBOL(security_socket_getpeersec_dgram);
930
931int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
932{
933 return security_ops->sk_alloc_security(sk, family, priority);
934}
935
936void security_sk_free(struct sock *sk)
937{
938 return security_ops->sk_free_security(sk);
939}
940
941void security_sk_clone(const struct sock *sk, struct sock *newsk)
942{
943 return security_ops->sk_clone_security(sk, newsk);
944}
945
946void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
947{
948 security_ops->sk_getsecid(sk, &fl->secid);
949}
950EXPORT_SYMBOL(security_sk_classify_flow);
951
952void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
953{
954 security_ops->req_classify_flow(req, fl);
955}
956EXPORT_SYMBOL(security_req_classify_flow);
957
958void security_sock_graft(struct sock *sk, struct socket *parent)
959{
960 security_ops->sock_graft(sk, parent);
961}
962EXPORT_SYMBOL(security_sock_graft);
963
964int security_inet_conn_request(struct sock *sk,
965 struct sk_buff *skb, struct request_sock *req)
966{
967 return security_ops->inet_conn_request(sk, skb, req);
968}
969EXPORT_SYMBOL(security_inet_conn_request);
970
971void security_inet_csk_clone(struct sock *newsk,
972 const struct request_sock *req)
973{
974 security_ops->inet_csk_clone(newsk, req);
975}
976
977void security_inet_conn_established(struct sock *sk,
978 struct sk_buff *skb)
979{
980 security_ops->inet_conn_established(sk, skb);
981}
982
983#endif /* CONFIG_SECURITY_NETWORK */
984
985#ifdef CONFIG_SECURITY_NETWORK_XFRM
986
987int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
988{
989 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
990}
991EXPORT_SYMBOL(security_xfrm_policy_alloc);
992
993int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
994{
995 return security_ops->xfrm_policy_clone_security(old, new);
996}
997
998void security_xfrm_policy_free(struct xfrm_policy *xp)
999{
1000 security_ops->xfrm_policy_free_security(xp);
1001}
1002EXPORT_SYMBOL(security_xfrm_policy_free);
1003
1004int security_xfrm_policy_delete(struct xfrm_policy *xp)
1005{
1006 return security_ops->xfrm_policy_delete_security(xp);
1007}
1008
1009int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
1010{
1011 return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0);
1012}
1013EXPORT_SYMBOL(security_xfrm_state_alloc);
1014
1015int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
1016 struct xfrm_sec_ctx *polsec, u32 secid)
1017{
1018 if (!polsec)
1019 return 0;
1020 /*
1021 * We want the context to be taken from secid which is usually
1022 * from the sock.
1023 */
1024 return security_ops->xfrm_state_alloc_security(x, NULL, secid);
1025}
1026
1027int security_xfrm_state_delete(struct xfrm_state *x)
1028{
1029 return security_ops->xfrm_state_delete_security(x);
1030}
1031EXPORT_SYMBOL(security_xfrm_state_delete);
1032
1033void security_xfrm_state_free(struct xfrm_state *x)
1034{
1035 security_ops->xfrm_state_free_security(x);
1036}
1037
1038int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
1039{
1040 return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
1041}
1042
1043int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
1044 struct xfrm_policy *xp, struct flowi *fl)
1045{
1046 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
1047}
1048
1049int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
1050{
1051 return security_ops->xfrm_decode_session(skb, secid, 1);
1052}
1053
1054void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
1055{
1056 int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
1057
1058 BUG_ON(rc);
1059}
1060EXPORT_SYMBOL(security_skb_classify_flow);
1061
1062#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1063
1064#ifdef CONFIG_KEYS
1065
1066int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags)
1067{
1068 return security_ops->key_alloc(key, tsk, flags);
1069}
1070
1071void security_key_free(struct key *key)
1072{
1073 security_ops->key_free(key);
1074}
1075
1076int security_key_permission(key_ref_t key_ref,
1077 struct task_struct *context, key_perm_t perm)
1078{
1079 return security_ops->key_permission(key_ref, context, perm);
174} 1080}
175 1081
176EXPORT_SYMBOL_GPL(register_security); 1082#endif /* CONFIG_KEYS */
177EXPORT_SYMBOL_GPL(unregister_security);
178EXPORT_SYMBOL_GPL(mod_reg_security);
179EXPORT_SYMBOL_GPL(mod_unreg_security);
180EXPORT_SYMBOL(security_ops);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 97b7e2738097..24e1b1885de7 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -22,7 +22,6 @@
22 * as published by the Free Software Foundation. 22 * as published by the Free Software Foundation.
23 */ 23 */
24 24
25#include <linux/module.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/ptrace.h> 27#include <linux/ptrace.h>
@@ -86,6 +85,7 @@
86extern unsigned int policydb_loaded_version; 85extern unsigned int policydb_loaded_version;
87extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); 86extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
88extern int selinux_compat_net; 87extern int selinux_compat_net;
88extern struct security_operations *security_ops;
89 89
90#ifdef CONFIG_SECURITY_SELINUX_DEVELOP 90#ifdef CONFIG_SECURITY_SELINUX_DEVELOP
91int selinux_enforcing = 0; 91int selinux_enforcing = 0;
@@ -2297,6 +2297,25 @@ static int selinux_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
2297 return dentry_has_perm(current, mnt, dentry, FILE__GETATTR); 2297 return dentry_has_perm(current, mnt, dentry, FILE__GETATTR);
2298} 2298}
2299 2299
2300static int selinux_inode_setotherxattr(struct dentry *dentry, char *name)
2301{
2302 if (!strncmp(name, XATTR_SECURITY_PREFIX,
2303 sizeof XATTR_SECURITY_PREFIX - 1)) {
2304 if (!strcmp(name, XATTR_NAME_CAPS)) {
2305 if (!capable(CAP_SETFCAP))
2306 return -EPERM;
2307 } else if (!capable(CAP_SYS_ADMIN)) {
2308 /* A different attribute in the security namespace.
2309 Restrict to administrator. */
2310 return -EPERM;
2311 }
2312 }
2313
2314 /* Not an attribute we recognize, so just check the
2315 ordinary setattr permission. */
2316 return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);
2317}
2318
2300static int selinux_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags) 2319static int selinux_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags)
2301{ 2320{
2302 struct task_security_struct *tsec = current->security; 2321 struct task_security_struct *tsec = current->security;
@@ -2307,19 +2326,8 @@ static int selinux_inode_setxattr(struct dentry *dentry, char *name, void *value
2307 u32 newsid; 2326 u32 newsid;
2308 int rc = 0; 2327 int rc = 0;
2309 2328
2310 if (strcmp(name, XATTR_NAME_SELINUX)) { 2329 if (strcmp(name, XATTR_NAME_SELINUX))
2311 if (!strncmp(name, XATTR_SECURITY_PREFIX, 2330 return selinux_inode_setotherxattr(dentry, name);
2312 sizeof XATTR_SECURITY_PREFIX - 1) &&
2313 !capable(CAP_SYS_ADMIN)) {
2314 /* A different attribute in the security namespace.
2315 Restrict to administrator. */
2316 return -EPERM;
2317 }
2318
2319 /* Not an attribute we recognize, so just check the
2320 ordinary setattr permission. */
2321 return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);
2322 }
2323 2331
2324 sbsec = inode->i_sb->s_security; 2332 sbsec = inode->i_sb->s_security;
2325 if (sbsec->behavior == SECURITY_FS_USE_MNTPOINT) 2333 if (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)
@@ -2393,31 +2401,14 @@ static int selinux_inode_listxattr (struct dentry *dentry)
2393 2401
2394static int selinux_inode_removexattr (struct dentry *dentry, char *name) 2402static int selinux_inode_removexattr (struct dentry *dentry, char *name)
2395{ 2403{
2396 if (strcmp(name, XATTR_NAME_SELINUX)) { 2404 if (strcmp(name, XATTR_NAME_SELINUX))
2397 if (!strncmp(name, XATTR_SECURITY_PREFIX, 2405 return selinux_inode_setotherxattr(dentry, name);
2398 sizeof XATTR_SECURITY_PREFIX - 1) &&
2399 !capable(CAP_SYS_ADMIN)) {
2400 /* A different attribute in the security namespace.
2401 Restrict to administrator. */
2402 return -EPERM;
2403 }
2404
2405 /* Not an attribute we recognize, so just check the
2406 ordinary setattr permission. Might want a separate
2407 permission for removexattr. */
2408 return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);
2409 }
2410 2406
2411 /* No one is allowed to remove a SELinux security label. 2407 /* No one is allowed to remove a SELinux security label.
2412 You can change the label, but all data must be labeled. */ 2408 You can change the label, but all data must be labeled. */
2413 return -EACCES; 2409 return -EACCES;
2414} 2410}
2415 2411
2416static const char *selinux_inode_xattr_getsuffix(void)
2417{
2418 return XATTR_SELINUX_SUFFIX;
2419}
2420
2421/* 2412/*
2422 * Copy the in-core inode security context value to the user. If the 2413 * Copy the in-core inode security context value to the user. If the
2423 * getxattr() prior to this succeeded, check to see if we need to 2414 * 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
2464 return len; 2455 return len;
2465} 2456}
2466 2457
2458static int selinux_inode_need_killpriv(struct dentry *dentry)
2459{
2460 return secondary_ops->inode_need_killpriv(dentry);
2461}
2462
2463static int selinux_inode_killpriv(struct dentry *dentry)
2464{
2465 return secondary_ops->inode_killpriv(dentry);
2466}
2467
2467/* file security operations */ 2468/* file security operations */
2468 2469
2469static int selinux_revalidate_file_permission(struct file *file, int mask) 2470static 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)
2882 2883
2883static int selinux_task_setioprio(struct task_struct *p, int ioprio) 2884static int selinux_task_setioprio(struct task_struct *p, int ioprio)
2884{ 2885{
2886 int rc;
2887
2888 rc = secondary_ops->task_setioprio(p, ioprio);
2889 if (rc)
2890 return rc;
2891
2885 return task_has_perm(current, p, PROCESS__SETSCHED); 2892 return task_has_perm(current, p, PROCESS__SETSCHED);
2886} 2893}
2887 2894
@@ -2911,6 +2918,12 @@ static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim
2911 2918
2912static int selinux_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp) 2919static int selinux_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp)
2913{ 2920{
2921 int rc;
2922
2923 rc = secondary_ops->task_setscheduler(p, policy, lp);
2924 if (rc)
2925 return rc;
2926
2914 return task_has_perm(current, p, PROCESS__SETSCHED); 2927 return task_has_perm(current, p, PROCESS__SETSCHED);
2915} 2928}
2916 2929
@@ -4536,19 +4549,6 @@ static int selinux_register_security (const char *name, struct security_operatio
4536 return 0; 4549 return 0;
4537} 4550}
4538 4551
4539static int selinux_unregister_security (const char *name, struct security_operations *ops)
4540{
4541 if (ops != secondary_ops) {
4542 printk(KERN_ERR "%s: trying to unregister a security module "
4543 "that is not registered.\n", __FUNCTION__);
4544 return -EINVAL;
4545 }
4546
4547 secondary_ops = original_ops;
4548
4549 return 0;
4550}
4551
4552static void selinux_d_instantiate (struct dentry *dentry, struct inode *inode) 4552static void selinux_d_instantiate (struct dentry *dentry, struct inode *inode)
4553{ 4553{
4554 if (inode) 4554 if (inode)
@@ -4826,10 +4826,11 @@ static struct security_operations selinux_ops = {
4826 .inode_getxattr = selinux_inode_getxattr, 4826 .inode_getxattr = selinux_inode_getxattr,
4827 .inode_listxattr = selinux_inode_listxattr, 4827 .inode_listxattr = selinux_inode_listxattr,
4828 .inode_removexattr = selinux_inode_removexattr, 4828 .inode_removexattr = selinux_inode_removexattr,
4829 .inode_xattr_getsuffix = selinux_inode_xattr_getsuffix,
4830 .inode_getsecurity = selinux_inode_getsecurity, 4829 .inode_getsecurity = selinux_inode_getsecurity,
4831 .inode_setsecurity = selinux_inode_setsecurity, 4830 .inode_setsecurity = selinux_inode_setsecurity,
4832 .inode_listsecurity = selinux_inode_listsecurity, 4831 .inode_listsecurity = selinux_inode_listsecurity,
4832 .inode_need_killpriv = selinux_inode_need_killpriv,
4833 .inode_killpriv = selinux_inode_killpriv,
4833 4834
4834 .file_permission = selinux_file_permission, 4835 .file_permission = selinux_file_permission,
4835 .file_alloc_security = selinux_file_alloc_security, 4836 .file_alloc_security = selinux_file_alloc_security,
@@ -4894,7 +4895,6 @@ static struct security_operations selinux_ops = {
4894 .sem_semop = selinux_sem_semop, 4895 .sem_semop = selinux_sem_semop,
4895 4896
4896 .register_security = selinux_register_security, 4897 .register_security = selinux_register_security,
4897 .unregister_security = selinux_unregister_security,
4898 4898
4899 .d_instantiate = selinux_d_instantiate, 4899 .d_instantiate = selinux_d_instantiate,
4900 4900
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index ba715f40b658..cb008d9f0a82 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -31,7 +31,6 @@
31 * 2. Emulating a reasonable SO_PEERSEC across machines 31 * 2. Emulating a reasonable SO_PEERSEC across machines
32 * 3. Testing addition of sk_policy's with security context via setsockopt 32 * 3. Testing addition of sk_policy's with security context via setsockopt
33 */ 33 */
34#include <linux/module.h>
35#include <linux/kernel.h> 34#include <linux/kernel.h>
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/security.h> 36#include <linux/security.h>