aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
AgeCommit message (Expand)Author
2016-07-28Merge tag 'libnvdimm-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/gi...Linus Torvalds
2016-07-12pmem: kill __pmem address spaceDan Williams
2016-06-14locking/barriers: Move smp_cond_load_acquire() to asm-generic/barrier.hPeter Zijlstra
2016-06-14locking/barriers: Introduce smp_acquire__after_ctrl_dep()Peter Zijlstra
2016-06-14locking/barriers: Replace smp_cond_acquire() with smp_cond_load_acquire()Peter Zijlstra
2016-06-08locking/barriers: Validate lockless_dereference() is used on a pointer typePeter Zijlstra
2016-05-19compiler.h: add support for malloc attributeRasmus Villemoes
2016-03-15Merge commit 'fixes.2015.02.23a' into core/rcuIngo Molnar
2016-02-29Merge tag 'v4.5-rc6' into locking/core, to pick up fixesIngo Molnar
2016-02-23sparse: Add __private to privatize members of structsBoqun Feng
2016-02-15tracing: Fix freak link error caused by branch tracerArnd Bergmann
2016-02-09locking/atomics: Update comment about READ_ONCE() and structuresKonrad Rzeszutek Wilk
2015-12-04locking, sched: Introduce smp_cond_acquire() and use itPeter Zijlstra
2015-11-05compiler.h: add support for function attribute assume_alignedRasmus Villemoes
2015-11-04Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s39...Linus Torvalds
2015-11-03atomic: remove all traces of READ_ONCE_CTRL() and atomic*_read_ctrl()Linus Torvalds
2015-10-20compiler, atomics, kasan: Provide READ_ONCE_NOCHECK()Andrey Ryabinin
2015-10-14s390/compiler.h Fix sparse vs. hotpatchChristian Borntraeger
2015-08-12locking, compiler.h: Cast away attributes in the WRITE_ONCE() magicChristian Borntraeger
2015-07-11Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/g...Linus Torvalds
2015-07-01Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds
2015-06-30sparse: fix misplaced __pmem definitionDan Williams
2015-06-29Merge tag 'libnvdimm-for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/gi...Linus Torvalds
2015-06-26arch, x86: pmem api for ensuring durability of persistent memory updatesRoss Zwisler
2015-06-24rcu: merge fix for Convert ACCESS_ONCE() to READ_ONCE() and WRITE_ONCE()Stephen Rothwell
2015-06-22Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/k...Linus Torvalds
2015-05-28rcu: Move lockless_dereference() out of rcupdate.hPeter Zijlstra
2015-05-27smp: Make control dependencies work on Alpha, improve documentationPaul E. McKenney
2015-05-19locking/arch: Add WRITE_ONCE() to set_mb()Peter Zijlstra
2015-05-08kernel: Replace reference to ASSIGN_ONCE() with WRITE_ONCE() in commentPreeti U Murthy
2015-05-04lib: make memzero_explicit more robust against dead store eliminationDaniel Borkmann
2015-03-27locking: Remove atomicy checks from {READ,WRITE}_ONCEPeter Zijlstra
2015-02-21kernel: make READ_ONCE() valid on const argumentsLinus Torvalds
2015-02-14Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/borntr...Linus Torvalds
2015-02-11Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s39...Linus Torvalds
2015-01-29ftrace: let notrace function attribute disable hotpatching if necessaryHeiko Carstens
2015-01-21Merge branch 'for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/pau...Ingo Molnar
2015-01-19kernel: Fix sparse warning for ACCESS_ONCEChristian Borntraeger
2015-01-19kernel: tighten rules for ACCESS ONCEChristian Borntraeger
2015-01-13kernel: Change ASSIGN_ONCE(val, x) to WRITE_ONCE(x, val)Christian Borntraeger
2015-01-06compiler: Allow 1- and 2-byte smp_load_acquire() and smp_store_release()Paul E. McKenney
2014-12-18kernel: Provide READ_ONCE and ASSIGN_ONCEChristian Borntraeger
2014-06-12Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds
2014-06-04compiler.h: avoid sparse errors in __compiletime_error_fallback()James Hogan
2014-04-24kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklistMasami Hiramatsu
2014-04-09LLVMLinux: Add support for clang to compiler.h and new compiler-clang.hMark Charlebois
2014-01-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6Linus Torvalds
2014-01-12arch: Introduce smp_load_acquire(), smp_store_release()Peter Zijlstra
2013-12-05crypto: more robust crypto_memneqCesar Eduardo Barros
2013-04-08kprobes: Move __kprobes definition into compiler.hMasami Hiramatsu
-rpi Yocto Linux Embedded kernelGrokmirror user
aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/upcase.c
blob: e2f72ca98037a44755f7837d9b59823f96914eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * upcase.c - Generate the full NTFS Unicode upcase table in little endian.
 *	      Part of the Linux-NTFS project.
 *
 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org>
 * Copyright (c) 2001-2006 Anton Altaparmakov
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (in the main directory of the Linux-NTFS source
 * in the file COPYING); if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "malloc.h"
#include "ntfs.h"

ntfschar *generate_default_upcase(void)
{
	static const int uc_run_table[][3] = { /* Start, End, Add */
	{0x0061, 0x007B,  -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72,  74},
	{0x00E0, 0x00F7,  -32}, {0x045E, 0x0460, -80}, {0x1F72, 0x1F76,  86},
	{0x00F8, 0x00FF,  -32}, {0x0561, 0x0587, -48}, {0x1F76, 0x1F78, 100},
	{0x0256, 0x0258, -205}, {0x1F00, 0x1F08,   8}, {0x1F78, 0x1F7A, 128},
	{0x028A, 0x028C, -217}, {0x1F10, 0x1F16,   8}, {0x1F7A, 0x1F7C, 112},
	{0x03AC, 0x03AD,  -38}, {0x1F20, 0x1F28,   8}, {0x1F7C, 0x1F7E, 126},
	{0x03AD, 0x03B0,  -37}, {0x1F30, 0x1F38,   8}, {0x1FB0, 0x1FB2,   8},
	{0x03B1, 0x03C2,  -32}, {0x1F40, 0x1F46,   8}, {0x1FD0, 0x1FD2,   8},
	{0x03C2, 0x03C3,  -31}, {0x1F51, 0x1F52,   8}, {0x1FE0, 0x1FE2,   8},
	{0x03C3, 0x03CC,  -32}, {0x1F53, 0x1F54,   8}, {0x1FE5, 0x1FE6,   7},
	{0x03CC, 0x03CD,  -64}, {0x1F55, 0x1F56,   8}, {0x2170, 0x2180, -16},
	{0x03CD, 0x03CF,  -63}, {0x1F57, 0x1F58,   8}, {0x24D0, 0x24EA, -26},
	{0x0430, 0x0450,  -32}, {0x1F60, 0x1F68,   8}, {0xFF41, 0xFF5B, -32},
	{0}
	};

	static const int uc_dup_table[][2] = { /* Start, End */
	{0x0100, 0x012F}, {0x01A0, 0x01A6}, {0x03E2, 0x03EF}, {0x04CB, 0x04CC},
	{0x0132, 0x0137}, {0x01B3, 0x01B7}, {0x0460, 0x0481}, {0x04D0, 0x04EB},
	{0x0139, 0x0149}, {0x01CD, 0x01DD}, {0x0490, 0x04BF}, {0x04EE, 0x04F5},
	{0x014A, 0x0178}, {0x01DE, 0x01EF}, {0x04BF, 0x04BF}, {0x04F8, 0x04F9},
	{0x0179, 0x017E}, {0x01F4, 0x01F5}, {0x04C1, 0x04C4}, {0x1E00, 0x1E95},
	{0x018B, 0x018B}, {0x01FA, 0x0218}, {0x04C7, 0x04C8}, {0x1EA0, 0x1EF9},
	{0}
	};

	static const int uc_word_table[][2] = { /* Offset, Value */
	{0x00FF, 0x0178}, {0x01AD, 0x01AC}, {0x01F3, 0x01F1}, {0x0269, 0x0196},
	{0x0183, 0x0182}, {0x01B0, 0x01AF}, {0x0253, 0x0181}, {0x026F, 0x019C},
	{0x0185, 0x0184}, {0x01B9, 0x01B8}, {0x0254, 0x0186}, {0x0272, 0x019D},
	{0x0188, 0x0187}, {0x01BD, 0x01BC}, {0x0259, 0x018F}, {0x0275, 0x019F},
	{0x018C, 0x018B}, {0x01C6, 0x01C4}, {0x025B, 0x0190}, {0x0283, 0x01A9},
	{0x0192, 0x0191}, {0x01C9, 0x01C7}, {0x0260, 0x0193}, {0x0288, 0x01AE},
	{0x0199, 0x0198}, {0x01CC, 0x01CA}, {0x0263, 0x0194}, {0x0292, 0x01B7},
	{0x01A8, 0x01A7}, {0x01DD, 0x018E}, {0x0268, 0x0197},
	{0}
	};

	int i, r;
	ntfschar *uc;

	uc = ntfs_malloc_nofs(default_upcase_len * sizeof(ntfschar));
	if (!uc)
		return uc;
	memset(uc, 0, default_upcase_len * sizeof(ntfschar));
	/* Generate the little endian Unicode upcase table used by ntfs. */
	for (i = 0; i < default_upcase_len; i++)
		uc[i] = cpu_to_le16(i);
	for (r = 0; uc_run_table[r][0]; r++)
		for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++)
			le16_add_cpu(&uc[i], uc_run_table[r][2]);
	for (r = 0; uc_dup_table[r][0]; r++)
		for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2)
			le16_add_cpu(&uc[i + 1], -1);
	for (r = 0; uc_word_table[r][0]; r++)
		uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]);
	return uc;
}