diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 21:54:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 21:54:50 -0400 |
| commit | dfe2c6dcc8ca2cdc662d7c0473e9811b72ef3370 (patch) | |
| tree | 9ed639a08c16322cdf136d576f42df5b97cd1549 /include/linux | |
| parent | a45d572841a24db02a62cf05e1157c35fdd3705b (diff) | |
| parent | 64e455079e1bd7787cc47be30b7f601ce682a5f6 (diff) | |
Merge branch 'akpm' (patches from Andrew Morton)
Merge second patch-bomb from Andrew Morton:
- a few hotfixes
- drivers/dma updates
- MAINTAINERS updates
- Quite a lot of lib/ updates
- checkpatch updates
- binfmt updates
- autofs4
- drivers/rtc/
- various small tweaks to less used filesystems
- ipc/ updates
- kernel/watchdog.c changes
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (135 commits)
mm: softdirty: enable write notifications on VMAs after VM_SOFTDIRTY cleared
kernel/param: consolidate __{start,stop}___param[] in <linux/moduleparam.h>
ia64: remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[]
frv: remove unused declarations of __start___ex_table and __stop___ex_table
kvm: ensure hard lockup detection is disabled by default
kernel/watchdog.c: control hard lockup detection default
staging: rtl8192u: use %*pEn to escape buffer
staging: rtl8192e: use %*pEn to escape buffer
staging: wlan-ng: use %*pEhp to print SN
lib80211: remove unused print_ssid()
wireless: hostap: proc: print properly escaped SSID
wireless: ipw2x00: print SSID via %*pE
wireless: libertas: print esaped string via %*pE
lib/vsprintf: add %*pE[achnops] format specifier
lib / string_helpers: introduce string_escape_mem()
lib / string_helpers: refactoring the test suite
lib / string_helpers: move documentation to c-file
include/linux: remove strict_strto* definitions
arch/x86/mm/numa.c: fix boot failure when all nodes are hotpluggable
fs: check bh blocknr earlier when searching lru
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cma.h | 3 | ||||
| -rw-r--r-- | include/linux/compiler-gcc5.h | 66 | ||||
| -rw-r--r-- | include/linux/kernel.h | 4 | ||||
| -rw-r--r-- | include/linux/kexec.h | 1 | ||||
| -rw-r--r-- | include/linux/list.h | 1 | ||||
| -rw-r--r-- | include/linux/mm.h | 6 | ||||
| -rw-r--r-- | include/linux/moduleparam.h | 2 | ||||
| -rw-r--r-- | include/linux/nmi.h | 13 | ||||
| -rw-r--r-- | include/linux/prio_heap.h | 58 | ||||
| -rw-r--r-- | include/linux/rbtree_augmented.h | 10 | ||||
| -rw-r--r-- | include/linux/signal.h | 29 | ||||
| -rw-r--r-- | include/linux/string.h | 2 | ||||
| -rw-r--r-- | include/linux/string_helpers.h | 65 |
13 files changed, 147 insertions, 113 deletions
diff --git a/include/linux/cma.h b/include/linux/cma.h index 371b93042520..0430ed05d3b9 100644 --- a/include/linux/cma.h +++ b/include/linux/cma.h | |||
| @@ -22,6 +22,9 @@ extern int __init cma_declare_contiguous(phys_addr_t size, | |||
| 22 | phys_addr_t base, phys_addr_t limit, | 22 | phys_addr_t base, phys_addr_t limit, |
| 23 | phys_addr_t alignment, unsigned int order_per_bit, | 23 | phys_addr_t alignment, unsigned int order_per_bit, |
| 24 | bool fixed, struct cma **res_cma); | 24 | bool fixed, struct cma **res_cma); |
| 25 | extern int cma_init_reserved_mem(phys_addr_t size, | ||
| 26 | phys_addr_t base, int order_per_bit, | ||
| 27 | struct cma **res_cma); | ||
| 25 | extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); | 28 | extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); |
| 26 | extern bool cma_release(struct cma *cma, struct page *pages, int count); | 29 | extern bool cma_release(struct cma *cma, struct page *pages, int count); |
| 27 | #endif | 30 | #endif |
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h new file mode 100644 index 000000000000..cdd1cc202d51 --- /dev/null +++ b/include/linux/compiler-gcc5.h | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | #ifndef __LINUX_COMPILER_H | ||
| 2 | #error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead." | ||
| 3 | #endif | ||
| 4 | |||
| 5 | #define __used __attribute__((__used__)) | ||
| 6 | #define __must_check __attribute__((warn_unused_result)) | ||
| 7 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ||
| 8 | |||
| 9 | /* Mark functions as cold. gcc will assume any path leading to a call | ||
| 10 | to them will be unlikely. This means a lot of manual unlikely()s | ||
| 11 | are unnecessary now for any paths leading to the usual suspects | ||
| 12 | like BUG(), printk(), panic() etc. [but let's keep them for now for | ||
| 13 | older compilers] | ||
| 14 | |||
| 15 | Early snapshots of gcc 4.3 don't support this and we can't detect this | ||
| 16 | in the preprocessor, but we can live with this because they're unreleased. | ||
| 17 | Maketime probing would be overkill here. | ||
| 18 | |||
| 19 | gcc also has a __attribute__((__hot__)) to move hot functions into | ||
| 20 | a special section, but I don't see any sense in this right now in | ||
| 21 | the kernel context */ | ||
| 22 | #define __cold __attribute__((__cold__)) | ||
| 23 | |||
| 24 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) | ||
| 25 | |||
| 26 | #ifndef __CHECKER__ | ||
| 27 | # define __compiletime_warning(message) __attribute__((warning(message))) | ||
| 28 | # define __compiletime_error(message) __attribute__((error(message))) | ||
| 29 | #endif /* __CHECKER__ */ | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Mark a position in code as unreachable. This can be used to | ||
| 33 | * suppress control flow warnings after asm blocks that transfer | ||
| 34 | * control elsewhere. | ||
| 35 | * | ||
| 36 | * Early snapshots of gcc 4.5 don't support this and we can't detect | ||
| 37 | * this in the preprocessor, but we can live with this because they're | ||
| 38 | * unreleased. Really, we need to have autoconf for the kernel. | ||
| 39 | */ | ||
| 40 | #define unreachable() __builtin_unreachable() | ||
| 41 | |||
| 42 | /* Mark a function definition as prohibited from being cloned. */ | ||
| 43 | #define __noclone __attribute__((__noclone__)) | ||
| 44 | |||
| 45 | /* | ||
| 46 | * Tell the optimizer that something else uses this function or variable. | ||
| 47 | */ | ||
| 48 | #define __visible __attribute__((externally_visible)) | ||
| 49 | |||
| 50 | /* | ||
| 51 | * GCC 'asm goto' miscompiles certain code sequences: | ||
| 52 | * | ||
| 53 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 | ||
| 54 | * | ||
| 55 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. | ||
| 56 | * Fixed in GCC 4.8.2 and later versions. | ||
| 57 | * | ||
| 58 | * (asm goto is automatically volatile - the naming reflects this.) | ||
| 59 | */ | ||
| 60 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ||
| 61 | |||
| 62 | #ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP | ||
| 63 | #define __HAVE_BUILTIN_BSWAP32__ | ||
| 64 | #define __HAVE_BUILTIN_BSWAP64__ | ||
| 65 | #define __HAVE_BUILTIN_BSWAP16__ | ||
| 66 | #endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 35c8ffb0136f..40728cf1c452 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -376,10 +376,6 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int); | |||
| 376 | extern long simple_strtol(const char *,char **,unsigned int); | 376 | extern long simple_strtol(const char *,char **,unsigned int); |
| 377 | extern unsigned long long simple_strtoull(const char *,char **,unsigned int); | 377 | extern unsigned long long simple_strtoull(const char *,char **,unsigned int); |
| 378 | extern long long simple_strtoll(const char *,char **,unsigned int); | 378 | extern long long simple_strtoll(const char *,char **,unsigned int); |
| 379 | #define strict_strtoul kstrtoul | ||
| 380 | #define strict_strtol kstrtol | ||
| 381 | #define strict_strtoull kstrtoull | ||
| 382 | #define strict_strtoll kstrtoll | ||
| 383 | 379 | ||
| 384 | extern int num_to_str(char *buf, int size, unsigned long long num); | 380 | extern int num_to_str(char *buf, int size, unsigned long long num); |
| 385 | 381 | ||
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 4b2a0e11cc5b..9d957b7ae095 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
| @@ -178,6 +178,7 @@ struct kexec_buf { | |||
| 178 | struct kimage *image; | 178 | struct kimage *image; |
| 179 | char *buffer; | 179 | char *buffer; |
| 180 | unsigned long bufsz; | 180 | unsigned long bufsz; |
| 181 | unsigned long mem; | ||
| 181 | unsigned long memsz; | 182 | unsigned long memsz; |
| 182 | unsigned long buf_align; | 183 | unsigned long buf_align; |
| 183 | unsigned long buf_min; | 184 | unsigned long buf_min; |
diff --git a/include/linux/list.h b/include/linux/list.h index cbbb96fcead9..f33f831eb3c8 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
| 6 | #include <linux/poison.h> | 6 | #include <linux/poison.h> |
| 7 | #include <linux/const.h> | 7 | #include <linux/const.h> |
| 8 | #include <linux/kernel.h> | ||
| 8 | 9 | ||
| 9 | /* | 10 | /* |
| 10 | * Simple doubly linked list implementation. | 11 | * Simple doubly linked list implementation. |
diff --git a/include/linux/mm.h b/include/linux/mm.h index fa0d74e06428..02d11ee7f19d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -347,6 +347,7 @@ static inline int put_page_unless_one(struct page *page) | |||
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | extern int page_is_ram(unsigned long pfn); | 349 | extern int page_is_ram(unsigned long pfn); |
| 350 | extern int region_is_ram(resource_size_t phys_addr, unsigned long size); | ||
| 350 | 351 | ||
| 351 | /* Support for virtually mapped pages */ | 352 | /* Support for virtually mapped pages */ |
| 352 | struct page *vmalloc_to_page(const void *addr); | 353 | struct page *vmalloc_to_page(const void *addr); |
| @@ -1973,11 +1974,16 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm, | |||
| 1973 | 1974 | ||
| 1974 | #ifdef CONFIG_MMU | 1975 | #ifdef CONFIG_MMU |
| 1975 | pgprot_t vm_get_page_prot(unsigned long vm_flags); | 1976 | pgprot_t vm_get_page_prot(unsigned long vm_flags); |
| 1977 | void vma_set_page_prot(struct vm_area_struct *vma); | ||
| 1976 | #else | 1978 | #else |
| 1977 | static inline pgprot_t vm_get_page_prot(unsigned long vm_flags) | 1979 | static inline pgprot_t vm_get_page_prot(unsigned long vm_flags) |
| 1978 | { | 1980 | { |
| 1979 | return __pgprot(0); | 1981 | return __pgprot(0); |
| 1980 | } | 1982 | } |
| 1983 | static inline void vma_set_page_prot(struct vm_area_struct *vma) | ||
| 1984 | { | ||
| 1985 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | ||
| 1986 | } | ||
| 1981 | #endif | 1987 | #endif |
| 1982 | 1988 | ||
| 1983 | #ifdef CONFIG_NUMA_BALANCING | 1989 | #ifdef CONFIG_NUMA_BALANCING |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index b43f4752304e..1c9effa25e26 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
| @@ -78,6 +78,8 @@ struct kernel_param { | |||
| 78 | }; | 78 | }; |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | extern const struct kernel_param __start___param[], __stop___param[]; | ||
| 82 | |||
| 81 | /* Special one for strings we want to copy into */ | 83 | /* Special one for strings we want to copy into */ |
| 82 | struct kparam_string { | 84 | struct kparam_string { |
| 83 | unsigned int maxlen; | 85 | unsigned int maxlen; |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 1d2a6ab6b8bb..9b2022ab4d85 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
| @@ -24,6 +24,19 @@ static inline void touch_nmi_watchdog(void) | |||
| 24 | } | 24 | } |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #if defined(CONFIG_HARDLOCKUP_DETECTOR) | ||
| 28 | extern void watchdog_enable_hardlockup_detector(bool val); | ||
| 29 | extern bool watchdog_hardlockup_detector_is_enabled(void); | ||
| 30 | #else | ||
| 31 | static inline void watchdog_enable_hardlockup_detector(bool val) | ||
| 32 | { | ||
| 33 | } | ||
| 34 | static inline bool watchdog_hardlockup_detector_is_enabled(void) | ||
| 35 | { | ||
| 36 | return true; | ||
| 37 | } | ||
| 38 | #endif | ||
| 39 | |||
| 27 | /* | 40 | /* |
| 28 | * Create trigger_all_cpu_backtrace() out of the arch-provided | 41 | * Create trigger_all_cpu_backtrace() out of the arch-provided |
| 29 | * base function. Return whether such support was available, | 42 | * base function. Return whether such support was available, |
diff --git a/include/linux/prio_heap.h b/include/linux/prio_heap.h deleted file mode 100644 index 08094350f26a..000000000000 --- a/include/linux/prio_heap.h +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | #ifndef _LINUX_PRIO_HEAP_H | ||
| 2 | #define _LINUX_PRIO_HEAP_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Simple insertion-only static-sized priority heap containing | ||
| 6 | * pointers, based on CLR, chapter 7 | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/gfp.h> | ||
| 10 | |||
| 11 | /** | ||
| 12 | * struct ptr_heap - simple static-sized priority heap | ||
| 13 | * @ptrs - pointer to data area | ||
| 14 | * @max - max number of elements that can be stored in @ptrs | ||
| 15 | * @size - current number of valid elements in @ptrs (in the range 0..@size-1 | ||
| 16 | * @gt: comparison operator, which should implement "greater than" | ||
| 17 | */ | ||
| 18 | struct ptr_heap { | ||
| 19 | void **ptrs; | ||
| 20 | int max; | ||
| 21 | int size; | ||
| 22 | int (*gt)(void *, void *); | ||
| 23 | }; | ||
| 24 | |||
| 25 | /** | ||
| 26 | * heap_init - initialize an empty heap with a given memory size | ||
| 27 | * @heap: the heap structure to be initialized | ||
| 28 | * @size: amount of memory to use in bytes | ||
| 29 | * @gfp_mask: mask to pass to kmalloc() | ||
| 30 | * @gt: comparison operator, which should implement "greater than" | ||
| 31 | */ | ||
| 32 | extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask, | ||
| 33 | int (*gt)(void *, void *)); | ||
| 34 | |||
| 35 | /** | ||
| 36 | * heap_free - release a heap's storage | ||
| 37 | * @heap: the heap structure whose data should be released | ||
| 38 | */ | ||
| 39 | void heap_free(struct ptr_heap *heap); | ||
| 40 | |||
| 41 | /** | ||
| 42 | * heap_insert - insert a value into the heap and return any overflowed value | ||
| 43 | * @heap: the heap to be operated on | ||
| 44 | * @p: the pointer to be inserted | ||
| 45 | * | ||
| 46 | * Attempts to insert the given value into the priority heap. If the | ||
| 47 | * heap is full prior to the insertion, then the resulting heap will | ||
| 48 | * consist of the smallest @max elements of the original heap and the | ||
| 49 | * new element; the greatest element will be removed from the heap and | ||
| 50 | * returned. Note that the returned element will be the new element | ||
| 51 | * (i.e. no change to the heap) if the new element is greater than all | ||
| 52 | * elements currently in the heap. | ||
| 53 | */ | ||
| 54 | extern void *heap_insert(struct ptr_heap *heap, void *p); | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | #endif /* _LINUX_PRIO_HEAP_H */ | ||
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h index fea49b5da12a..378c5ee75f78 100644 --- a/include/linux/rbtree_augmented.h +++ b/include/linux/rbtree_augmented.h | |||
| @@ -43,6 +43,16 @@ struct rb_augment_callbacks { | |||
| 43 | 43 | ||
| 44 | extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, | 44 | extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, |
| 45 | void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); | 45 | void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); |
| 46 | /* | ||
| 47 | * Fixup the rbtree and update the augmented information when rebalancing. | ||
| 48 | * | ||
| 49 | * On insertion, the user must update the augmented information on the path | ||
| 50 | * leading to the inserted node, then call rb_link_node() as usual and | ||
| 51 | * rb_augment_inserted() instead of the usual rb_insert_color() call. | ||
| 52 | * If rb_augment_inserted() rebalances the rbtree, it will callback into | ||
| 53 | * a user provided function to update the augmented information on the | ||
| 54 | * affected subtrees. | ||
| 55 | */ | ||
| 46 | static inline void | 56 | static inline void |
| 47 | rb_insert_augmented(struct rb_node *node, struct rb_root *root, | 57 | rb_insert_augmented(struct rb_node *node, struct rb_root *root, |
| 48 | const struct rb_augment_callbacks *augment) | 58 | const struct rb_augment_callbacks *augment) |
diff --git a/include/linux/signal.h b/include/linux/signal.h index 750196fcc0a5..ab1e0392b5ac 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_SIGNAL_H | 2 | #define _LINUX_SIGNAL_H |
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <linux/bug.h> | ||
| 5 | #include <uapi/linux/signal.h> | 6 | #include <uapi/linux/signal.h> |
| 6 | 7 | ||
| 7 | struct task_struct; | 8 | struct task_struct; |
| @@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig) | |||
| 67 | 68 | ||
| 68 | static inline int sigisemptyset(sigset_t *set) | 69 | static inline int sigisemptyset(sigset_t *set) |
| 69 | { | 70 | { |
| 70 | extern void _NSIG_WORDS_is_unsupported_size(void); | ||
| 71 | switch (_NSIG_WORDS) { | 71 | switch (_NSIG_WORDS) { |
| 72 | case 4: | 72 | case 4: |
| 73 | return (set->sig[3] | set->sig[2] | | 73 | return (set->sig[3] | set->sig[2] | |
| @@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set) | |||
| 77 | case 1: | 77 | case 1: |
| 78 | return set->sig[0] == 0; | 78 | return set->sig[0] == 0; |
| 79 | default: | 79 | default: |
| 80 | _NSIG_WORDS_is_unsupported_size(); | 80 | BUILD_BUG(); |
| 81 | return 0; | 81 | return 0; |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| @@ -90,24 +90,23 @@ static inline int sigisemptyset(sigset_t *set) | |||
| 90 | #define _SIG_SET_BINOP(name, op) \ | 90 | #define _SIG_SET_BINOP(name, op) \ |
| 91 | static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ | 91 | static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ |
| 92 | { \ | 92 | { \ |
| 93 | extern void _NSIG_WORDS_is_unsupported_size(void); \ | ||
| 94 | unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ | 93 | unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ |
| 95 | \ | 94 | \ |
| 96 | switch (_NSIG_WORDS) { \ | 95 | switch (_NSIG_WORDS) { \ |
| 97 | case 4: \ | 96 | case 4: \ |
| 98 | a3 = a->sig[3]; a2 = a->sig[2]; \ | 97 | a3 = a->sig[3]; a2 = a->sig[2]; \ |
| 99 | b3 = b->sig[3]; b2 = b->sig[2]; \ | 98 | b3 = b->sig[3]; b2 = b->sig[2]; \ |
| 100 | r->sig[3] = op(a3, b3); \ | 99 | r->sig[3] = op(a3, b3); \ |
| 101 | r->sig[2] = op(a2, b2); \ | 100 | r->sig[2] = op(a2, b2); \ |
| 102 | case 2: \ | 101 | case 2: \ |
| 103 | a1 = a->sig[1]; b1 = b->sig[1]; \ | 102 | a1 = a->sig[1]; b1 = b->sig[1]; \ |
| 104 | r->sig[1] = op(a1, b1); \ | 103 | r->sig[1] = op(a1, b1); \ |
| 105 | case 1: \ | 104 | case 1: \ |
| 106 | a0 = a->sig[0]; b0 = b->sig[0]; \ | 105 | a0 = a->sig[0]; b0 = b->sig[0]; \ |
| 107 | r->sig[0] = op(a0, b0); \ | 106 | r->sig[0] = op(a0, b0); \ |
| 108 | break; \ | 107 | break; \ |
| 109 | default: \ | 108 | default: \ |
| 110 | _NSIG_WORDS_is_unsupported_size(); \ | 109 | BUILD_BUG(); \ |
| 111 | } \ | 110 | } \ |
| 112 | } | 111 | } |
| 113 | 112 | ||
| @@ -128,16 +127,14 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn) | |||
| 128 | #define _SIG_SET_OP(name, op) \ | 127 | #define _SIG_SET_OP(name, op) \ |
| 129 | static inline void name(sigset_t *set) \ | 128 | static inline void name(sigset_t *set) \ |
| 130 | { \ | 129 | { \ |
| 131 | extern void _NSIG_WORDS_is_unsupported_size(void); \ | ||
| 132 | \ | ||
| 133 | switch (_NSIG_WORDS) { \ | 130 | switch (_NSIG_WORDS) { \ |
| 134 | case 4: set->sig[3] = op(set->sig[3]); \ | 131 | case 4: set->sig[3] = op(set->sig[3]); \ |
| 135 | set->sig[2] = op(set->sig[2]); \ | 132 | set->sig[2] = op(set->sig[2]); \ |
| 136 | case 2: set->sig[1] = op(set->sig[1]); \ | 133 | case 2: set->sig[1] = op(set->sig[1]); \ |
| 137 | case 1: set->sig[0] = op(set->sig[0]); \ | 134 | case 1: set->sig[0] = op(set->sig[0]); \ |
| 138 | break; \ | 135 | break; \ |
| 139 | default: \ | 136 | default: \ |
| 140 | _NSIG_WORDS_is_unsupported_size(); \ | 137 | BUILD_BUG(); \ |
| 141 | } \ | 138 | } \ |
| 142 | } | 139 | } |
| 143 | 140 | ||
diff --git a/include/linux/string.h b/include/linux/string.h index d36977e029af..e6edfe51575a 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -41,7 +41,7 @@ extern int strcmp(const char *,const char *); | |||
| 41 | extern int strncmp(const char *,const char *,__kernel_size_t); | 41 | extern int strncmp(const char *,const char *,__kernel_size_t); |
| 42 | #endif | 42 | #endif |
| 43 | #ifndef __HAVE_ARCH_STRNICMP | 43 | #ifndef __HAVE_ARCH_STRNICMP |
| 44 | extern int strnicmp(const char *, const char *, __kernel_size_t); | 44 | #define strnicmp strncasecmp |
| 45 | #endif | 45 | #endif |
| 46 | #ifndef __HAVE_ARCH_STRCASECMP | 46 | #ifndef __HAVE_ARCH_STRCASECMP |
| 47 | extern int strcasecmp(const char *s1, const char *s2); | 47 | extern int strcasecmp(const char *s1, const char *s2); |
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index 3eeee9672a4a..6eb567ac56bc 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h | |||
| @@ -20,40 +20,6 @@ int string_get_size(u64 size, enum string_size_units units, | |||
| 20 | #define UNESCAPE_ANY \ | 20 | #define UNESCAPE_ANY \ |
| 21 | (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) | 21 | (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) |
| 22 | 22 | ||
| 23 | /** | ||
| 24 | * string_unescape - unquote characters in the given string | ||
| 25 | * @src: source buffer (escaped) | ||
| 26 | * @dst: destination buffer (unescaped) | ||
| 27 | * @size: size of the destination buffer (0 to unlimit) | ||
| 28 | * @flags: combination of the flags (bitwise OR): | ||
| 29 | * %UNESCAPE_SPACE: | ||
| 30 | * '\f' - form feed | ||
| 31 | * '\n' - new line | ||
| 32 | * '\r' - carriage return | ||
| 33 | * '\t' - horizontal tab | ||
| 34 | * '\v' - vertical tab | ||
| 35 | * %UNESCAPE_OCTAL: | ||
| 36 | * '\NNN' - byte with octal value NNN (1 to 3 digits) | ||
| 37 | * %UNESCAPE_HEX: | ||
| 38 | * '\xHH' - byte with hexadecimal value HH (1 to 2 digits) | ||
| 39 | * %UNESCAPE_SPECIAL: | ||
| 40 | * '\"' - double quote | ||
| 41 | * '\\' - backslash | ||
| 42 | * '\a' - alert (BEL) | ||
| 43 | * '\e' - escape | ||
| 44 | * %UNESCAPE_ANY: | ||
| 45 | * all previous together | ||
| 46 | * | ||
| 47 | * Returns amount of characters processed to the destination buffer excluding | ||
| 48 | * trailing '\0'. | ||
| 49 | * | ||
| 50 | * Because the size of the output will be the same as or less than the size of | ||
| 51 | * the input, the transformation may be performed in place. | ||
| 52 | * | ||
| 53 | * Caller must provide valid source and destination pointers. Be aware that | ||
| 54 | * destination buffer will always be NULL-terminated. Source string must be | ||
| 55 | * NULL-terminated as well. | ||
| 56 | */ | ||
| 57 | int string_unescape(char *src, char *dst, size_t size, unsigned int flags); | 23 | int string_unescape(char *src, char *dst, size_t size, unsigned int flags); |
| 58 | 24 | ||
| 59 | static inline int string_unescape_inplace(char *buf, unsigned int flags) | 25 | static inline int string_unescape_inplace(char *buf, unsigned int flags) |
| @@ -71,4 +37,35 @@ static inline int string_unescape_any_inplace(char *buf) | |||
| 71 | return string_unescape_any(buf, buf, 0); | 37 | return string_unescape_any(buf, buf, 0); |
| 72 | } | 38 | } |
| 73 | 39 | ||
| 40 | #define ESCAPE_SPACE 0x01 | ||
| 41 | #define ESCAPE_SPECIAL 0x02 | ||
| 42 | #define ESCAPE_NULL 0x04 | ||
| 43 | #define ESCAPE_OCTAL 0x08 | ||
| 44 | #define ESCAPE_ANY \ | ||
| 45 | (ESCAPE_SPACE | ESCAPE_OCTAL | ESCAPE_SPECIAL | ESCAPE_NULL) | ||
| 46 | #define ESCAPE_NP 0x10 | ||
| 47 | #define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP) | ||
| 48 | #define ESCAPE_HEX 0x20 | ||
| 49 | |||
| 50 | int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz, | ||
| 51 | unsigned int flags, const char *esc); | ||
| 52 | |||
| 53 | static inline int string_escape_mem_any_np(const char *src, size_t isz, | ||
| 54 | char **dst, size_t osz, const char *esc) | ||
| 55 | { | ||
| 56 | return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc); | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline int string_escape_str(const char *src, char **dst, size_t sz, | ||
| 60 | unsigned int flags, const char *esc) | ||
| 61 | { | ||
| 62 | return string_escape_mem(src, strlen(src), dst, sz, flags, esc); | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline int string_escape_str_any_np(const char *src, char **dst, | ||
| 66 | size_t sz, const char *esc) | ||
| 67 | { | ||
| 68 | return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc); | ||
| 69 | } | ||
| 70 | |||
| 74 | #endif | 71 | #endif |
