diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 21:08:07 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 21:08:07 -0400 |
| commit | d52bd54db8be8999df6df5a776f38c4f8b5e9cea (patch) | |
| tree | 0d8f436e959bb975c002ddf12ea1bdc9adadd04f /include/linux | |
| parent | 8cbdd85bda499d028b8f128191f392d701e8e41d (diff) | |
| parent | 3bd080e4d8f2351ee3e143f0ec9307cc95ae6639 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton:
- the rest of ocfs2
- various hotfixes, mainly MM
- quite a bit of misc stuff - drivers, fork, exec, signals, etc.
- printk updates
- firmware
- checkpatch
- nilfs2
- more kexec stuff than usual
- rapidio updates
- w1 things
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (111 commits)
ipc: delete "nr_ipc_ns"
kcov: allow more fine-grained coverage instrumentation
init/Kconfig: add clarification for out-of-tree modules
config: add android config fragments
init/Kconfig: ban CONFIG_LOCALVERSION_AUTO with allmodconfig
relay: add global mode support for buffer-only channels
init: allow blacklisting of module_init functions
w1:omap_hdq: fix regression
w1: add helper macro module_w1_family
w1: remove need for ida and use PLATFORM_DEVID_AUTO
rapidio/switches: add driver for IDT gen3 switches
powerpc/fsl_rio: apply changes for RIO spec rev 3
rapidio: modify for rev.3 specification changes
rapidio: change inbound window size type to u64
rapidio/idt_gen2: fix locking warning
rapidio: fix error handling in mbox request/release functions
rapidio/tsi721_dma: advance queue processing from transfer submit call
rapidio/tsi721: add messaging mbox selector parameter
rapidio/tsi721: add PCIe MRRS override parameter
rapidio/tsi721_dma: add channel mask and queue size parameters
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/capability.h | 1 | ||||
| -rw-r--r-- | include/linux/cpumask.h | 2 | ||||
| -rw-r--r-- | include/linux/firmware.h | 8 | ||||
| -rw-r--r-- | include/linux/fs.h | 1 | ||||
| -rw-r--r-- | include/linux/init.h | 6 | ||||
| -rw-r--r-- | include/linux/ipc_namespace.h | 2 | ||||
| -rw-r--r-- | include/linux/kasan.h | 3 | ||||
| -rw-r--r-- | include/linux/kernel.h | 1 | ||||
| -rw-r--r-- | include/linux/kexec.h | 46 | ||||
| -rw-r--r-- | include/linux/mman.h | 2 | ||||
| -rw-r--r-- | include/linux/nilfs2_fs.h | 934 | ||||
| -rw-r--r-- | include/linux/printk.h | 60 | ||||
| -rw-r--r-- | include/linux/radix-tree.h | 2 | ||||
| -rw-r--r-- | include/linux/ratelimit.h | 38 | ||||
| -rw-r--r-- | include/linux/rio.h | 13 | ||||
| -rw-r--r-- | include/linux/rio_ids.h | 2 | ||||
| -rw-r--r-- | include/linux/rio_regs.h | 167 | ||||
| -rw-r--r-- | include/linux/sched.h | 63 | ||||
| -rw-r--r-- | include/linux/sysctl.h | 1 | ||||
| -rw-r--r-- | include/linux/thread_info.h | 41 |
20 files changed, 340 insertions, 1053 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h index 5f3c63dde2d5..dbc21c719ce6 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
| @@ -38,6 +38,7 @@ struct cpu_vfs_cap_data { | |||
| 38 | struct file; | 38 | struct file; |
| 39 | struct inode; | 39 | struct inode; |
| 40 | struct dentry; | 40 | struct dentry; |
| 41 | struct task_struct; | ||
| 41 | struct user_namespace; | 42 | struct user_namespace; |
| 42 | 43 | ||
| 43 | extern const kernel_cap_t __cap_empty_set; | 44 | extern const kernel_cap_t __cap_empty_set; |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index e828cf65d7df..da7fbf1cdd56 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
| @@ -579,7 +579,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len, | |||
| 579 | } | 579 | } |
| 580 | 580 | ||
| 581 | /** | 581 | /** |
| 582 | * cpumask_parse - extract a cpumask from from a string | 582 | * cpumask_parse - extract a cpumask from a string |
| 583 | * @buf: the buffer to extract from | 583 | * @buf: the buffer to extract from |
| 584 | * @dstp: the cpumask to set. | 584 | * @dstp: the cpumask to set. |
| 585 | * | 585 | * |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 5c41c5e75b5c..b1f9f0ccb8ac 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
| @@ -47,6 +47,8 @@ int request_firmware_nowait( | |||
| 47 | void (*cont)(const struct firmware *fw, void *context)); | 47 | void (*cont)(const struct firmware *fw, void *context)); |
| 48 | int request_firmware_direct(const struct firmware **fw, const char *name, | 48 | int request_firmware_direct(const struct firmware **fw, const char *name, |
| 49 | struct device *device); | 49 | struct device *device); |
| 50 | int request_firmware_into_buf(const struct firmware **firmware_p, | ||
| 51 | const char *name, struct device *device, void *buf, size_t size); | ||
| 50 | 52 | ||
| 51 | void release_firmware(const struct firmware *fw); | 53 | void release_firmware(const struct firmware *fw); |
| 52 | #else | 54 | #else |
| @@ -75,5 +77,11 @@ static inline int request_firmware_direct(const struct firmware **fw, | |||
| 75 | return -EINVAL; | 77 | return -EINVAL; |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 80 | static inline int request_firmware_into_buf(const struct firmware **firmware_p, | ||
| 81 | const char *name, struct device *device, void *buf, size_t size) | ||
| 82 | { | ||
| 83 | return -EINVAL; | ||
| 84 | } | ||
| 85 | |||
| 78 | #endif | 86 | #endif |
| 79 | #endif | 87 | #endif |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 577365a77b47..f3f0b4c8e8ac 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2652,6 +2652,7 @@ extern int do_pipe_flags(int *, int); | |||
| 2652 | #define __kernel_read_file_id(id) \ | 2652 | #define __kernel_read_file_id(id) \ |
| 2653 | id(UNKNOWN, unknown) \ | 2653 | id(UNKNOWN, unknown) \ |
| 2654 | id(FIRMWARE, firmware) \ | 2654 | id(FIRMWARE, firmware) \ |
| 2655 | id(FIRMWARE_PREALLOC_BUFFER, firmware) \ | ||
| 2655 | id(MODULE, kernel-module) \ | 2656 | id(MODULE, kernel-module) \ |
| 2656 | id(KEXEC_IMAGE, kexec-image) \ | 2657 | id(KEXEC_IMAGE, kexec-image) \ |
| 2657 | id(KEXEC_INITRAMFS, kexec-initramfs) \ | 2658 | id(KEXEC_INITRAMFS, kexec-initramfs) \ |
diff --git a/include/linux/init.h b/include/linux/init.h index aedb254abc37..6935d02474aa 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
| @@ -77,12 +77,6 @@ | |||
| 77 | #define __refdata __section(.ref.data) | 77 | #define __refdata __section(.ref.data) |
| 78 | #define __refconst __constsection(.ref.rodata) | 78 | #define __refconst __constsection(.ref.rodata) |
| 79 | 79 | ||
| 80 | /* compatibility defines */ | ||
| 81 | #define __init_refok __ref | ||
| 82 | #define __initdata_refok __refdata | ||
| 83 | #define __exit_refok __ref | ||
| 84 | |||
| 85 | |||
| 86 | #ifdef MODULE | 80 | #ifdef MODULE |
| 87 | #define __exitused | 81 | #define __exitused |
| 88 | #else | 82 | #else |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index 1eee6bcfcf76..d10e54f03c09 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
| @@ -63,8 +63,6 @@ struct ipc_namespace { | |||
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | extern struct ipc_namespace init_ipc_ns; | 65 | extern struct ipc_namespace init_ipc_ns; |
| 66 | extern atomic_t nr_ipc_ns; | ||
| 67 | |||
| 68 | extern spinlock_t mq_lock; | 66 | extern spinlock_t mq_lock; |
| 69 | 67 | ||
| 70 | #ifdef CONFIG_SYSVIPC | 68 | #ifdef CONFIG_SYSVIPC |
diff --git a/include/linux/kasan.h b/include/linux/kasan.h index c9cf374445d8..d600303306eb 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h | |||
| @@ -56,6 +56,7 @@ void kasan_cache_destroy(struct kmem_cache *cache); | |||
| 56 | void kasan_poison_slab(struct page *page); | 56 | void kasan_poison_slab(struct page *page); |
| 57 | void kasan_unpoison_object_data(struct kmem_cache *cache, void *object); | 57 | void kasan_unpoison_object_data(struct kmem_cache *cache, void *object); |
| 58 | void kasan_poison_object_data(struct kmem_cache *cache, void *object); | 58 | void kasan_poison_object_data(struct kmem_cache *cache, void *object); |
| 59 | void kasan_init_slab_obj(struct kmem_cache *cache, const void *object); | ||
| 59 | 60 | ||
| 60 | void kasan_kmalloc_large(const void *ptr, size_t size, gfp_t flags); | 61 | void kasan_kmalloc_large(const void *ptr, size_t size, gfp_t flags); |
| 61 | void kasan_kfree_large(const void *ptr); | 62 | void kasan_kfree_large(const void *ptr); |
| @@ -102,6 +103,8 @@ static inline void kasan_unpoison_object_data(struct kmem_cache *cache, | |||
| 102 | void *object) {} | 103 | void *object) {} |
| 103 | static inline void kasan_poison_object_data(struct kmem_cache *cache, | 104 | static inline void kasan_poison_object_data(struct kmem_cache *cache, |
| 104 | void *object) {} | 105 | void *object) {} |
| 106 | static inline void kasan_init_slab_obj(struct kmem_cache *cache, | ||
| 107 | const void *object) {} | ||
| 105 | 108 | ||
| 106 | static inline void kasan_kmalloc_large(void *ptr, size_t size, gfp_t flags) {} | 109 | static inline void kasan_kmalloc_large(void *ptr, size_t size, gfp_t flags) {} |
| 107 | static inline void kasan_kfree_large(const void *ptr) {} | 110 | static inline void kasan_kfree_large(const void *ptr) {} |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index c42082112ec8..d96a6118d26a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include <linux/log2.h> | 11 | #include <linux/log2.h> |
| 12 | #include <linux/typecheck.h> | 12 | #include <linux/typecheck.h> |
| 13 | #include <linux/printk.h> | 13 | #include <linux/printk.h> |
| 14 | #include <linux/dynamic_debug.h> | ||
| 15 | #include <asm/byteorder.h> | 14 | #include <asm/byteorder.h> |
| 16 | #include <uapi/linux/kernel.h> | 15 | #include <uapi/linux/kernel.h> |
| 17 | 16 | ||
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index e8acb2b43dd9..d7437777baaa 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | #if !defined(__ASSEMBLY__) | 15 | #if !defined(__ASSEMBLY__) |
| 16 | 16 | ||
| 17 | #include <asm/io.h> | ||
| 18 | |||
| 17 | #include <uapi/linux/kexec.h> | 19 | #include <uapi/linux/kexec.h> |
| 18 | 20 | ||
| 19 | #ifdef CONFIG_KEXEC_CORE | 21 | #ifdef CONFIG_KEXEC_CORE |
| @@ -41,7 +43,7 @@ | |||
| 41 | #endif | 43 | #endif |
| 42 | 44 | ||
| 43 | #ifndef KEXEC_CONTROL_MEMORY_GFP | 45 | #ifndef KEXEC_CONTROL_MEMORY_GFP |
| 44 | #define KEXEC_CONTROL_MEMORY_GFP GFP_KERNEL | 46 | #define KEXEC_CONTROL_MEMORY_GFP (GFP_KERNEL | __GFP_NORETRY) |
| 45 | #endif | 47 | #endif |
| 46 | 48 | ||
| 47 | #ifndef KEXEC_CONTROL_PAGE_SIZE | 49 | #ifndef KEXEC_CONTROL_PAGE_SIZE |
| @@ -228,12 +230,13 @@ extern void *kexec_purgatory_get_symbol_addr(struct kimage *image, | |||
| 228 | extern void __crash_kexec(struct pt_regs *); | 230 | extern void __crash_kexec(struct pt_regs *); |
| 229 | extern void crash_kexec(struct pt_regs *); | 231 | extern void crash_kexec(struct pt_regs *); |
| 230 | int kexec_should_crash(struct task_struct *); | 232 | int kexec_should_crash(struct task_struct *); |
| 233 | int kexec_crash_loaded(void); | ||
| 231 | void crash_save_cpu(struct pt_regs *regs, int cpu); | 234 | void crash_save_cpu(struct pt_regs *regs, int cpu); |
| 232 | void crash_save_vmcoreinfo(void); | 235 | void crash_save_vmcoreinfo(void); |
| 233 | void arch_crash_save_vmcoreinfo(void); | 236 | void arch_crash_save_vmcoreinfo(void); |
| 234 | __printf(1, 2) | 237 | __printf(1, 2) |
| 235 | void vmcoreinfo_append_str(const char *fmt, ...); | 238 | void vmcoreinfo_append_str(const char *fmt, ...); |
| 236 | unsigned long paddr_vmcoreinfo_note(void); | 239 | phys_addr_t paddr_vmcoreinfo_note(void); |
| 237 | 240 | ||
| 238 | #define VMCOREINFO_OSRELEASE(value) \ | 241 | #define VMCOREINFO_OSRELEASE(value) \ |
| 239 | vmcoreinfo_append_str("OSRELEASE=%s\n", value) | 242 | vmcoreinfo_append_str("OSRELEASE=%s\n", value) |
| @@ -318,12 +321,51 @@ int __weak arch_kexec_apply_relocations(const Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, | |||
| 318 | void arch_kexec_protect_crashkres(void); | 321 | void arch_kexec_protect_crashkres(void); |
| 319 | void arch_kexec_unprotect_crashkres(void); | 322 | void arch_kexec_unprotect_crashkres(void); |
| 320 | 323 | ||
| 324 | #ifndef page_to_boot_pfn | ||
| 325 | static inline unsigned long page_to_boot_pfn(struct page *page) | ||
| 326 | { | ||
| 327 | return page_to_pfn(page); | ||
| 328 | } | ||
| 329 | #endif | ||
| 330 | |||
| 331 | #ifndef boot_pfn_to_page | ||
| 332 | static inline struct page *boot_pfn_to_page(unsigned long boot_pfn) | ||
| 333 | { | ||
| 334 | return pfn_to_page(boot_pfn); | ||
| 335 | } | ||
| 336 | #endif | ||
| 337 | |||
| 338 | #ifndef phys_to_boot_phys | ||
| 339 | static inline unsigned long phys_to_boot_phys(phys_addr_t phys) | ||
| 340 | { | ||
| 341 | return phys; | ||
| 342 | } | ||
| 343 | #endif | ||
| 344 | |||
| 345 | #ifndef boot_phys_to_phys | ||
| 346 | static inline phys_addr_t boot_phys_to_phys(unsigned long boot_phys) | ||
| 347 | { | ||
| 348 | return boot_phys; | ||
| 349 | } | ||
| 350 | #endif | ||
| 351 | |||
| 352 | static inline unsigned long virt_to_boot_phys(void *addr) | ||
| 353 | { | ||
| 354 | return phys_to_boot_phys(__pa((unsigned long)addr)); | ||
| 355 | } | ||
| 356 | |||
| 357 | static inline void *boot_phys_to_virt(unsigned long entry) | ||
| 358 | { | ||
| 359 | return phys_to_virt(boot_phys_to_phys(entry)); | ||
| 360 | } | ||
| 361 | |||
| 321 | #else /* !CONFIG_KEXEC_CORE */ | 362 | #else /* !CONFIG_KEXEC_CORE */ |
| 322 | struct pt_regs; | 363 | struct pt_regs; |
| 323 | struct task_struct; | 364 | struct task_struct; |
| 324 | static inline void __crash_kexec(struct pt_regs *regs) { } | 365 | static inline void __crash_kexec(struct pt_regs *regs) { } |
| 325 | static inline void crash_kexec(struct pt_regs *regs) { } | 366 | static inline void crash_kexec(struct pt_regs *regs) { } |
| 326 | static inline int kexec_should_crash(struct task_struct *p) { return 0; } | 367 | static inline int kexec_should_crash(struct task_struct *p) { return 0; } |
| 368 | static inline int kexec_crash_loaded(void) { return 0; } | ||
| 327 | #define kexec_in_progress false | 369 | #define kexec_in_progress false |
| 328 | #endif /* CONFIG_KEXEC_CORE */ | 370 | #endif /* CONFIG_KEXEC_CORE */ |
| 329 | 371 | ||
diff --git a/include/linux/mman.h b/include/linux/mman.h index 33e17f6a327a..634c4c51fe3a 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h | |||
| @@ -49,7 +49,7 @@ static inline void vm_unacct_memory(long pages) | |||
| 49 | * | 49 | * |
| 50 | * Returns true if the prot flags are valid | 50 | * Returns true if the prot flags are valid |
| 51 | */ | 51 | */ |
| 52 | static inline int arch_validate_prot(unsigned long prot) | 52 | static inline bool arch_validate_prot(unsigned long prot) |
| 53 | { | 53 | { |
| 54 | return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0; | 54 | return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0; |
| 55 | } | 55 | } |
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h deleted file mode 100644 index 5988dd57ba66..000000000000 --- a/include/linux/nilfs2_fs.h +++ /dev/null | |||
| @@ -1,934 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * nilfs2_fs.h - NILFS2 on-disk structures and common declarations. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU Lesser General Public License as published | ||
| 8 | * by the Free Software Foundation; either version 2.1 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * Written by Koji Sato and Ryusuke Konishi. | ||
| 17 | */ | ||
| 18 | /* | ||
| 19 | * linux/include/linux/ext2_fs.h | ||
| 20 | * | ||
| 21 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
| 22 | * Remy Card (card@masi.ibp.fr) | ||
| 23 | * Laboratoire MASI - Institut Blaise Pascal | ||
| 24 | * Universite Pierre et Marie Curie (Paris VI) | ||
| 25 | * | ||
| 26 | * from | ||
| 27 | * | ||
| 28 | * linux/include/linux/minix_fs.h | ||
| 29 | * | ||
| 30 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
| 31 | */ | ||
| 32 | |||
| 33 | #ifndef _LINUX_NILFS_FS_H | ||
| 34 | #define _LINUX_NILFS_FS_H | ||
| 35 | |||
| 36 | #include <linux/types.h> | ||
| 37 | #include <linux/ioctl.h> | ||
| 38 | #include <linux/magic.h> | ||
| 39 | #include <linux/bug.h> | ||
| 40 | |||
| 41 | |||
| 42 | #define NILFS_INODE_BMAP_SIZE 7 | ||
| 43 | /** | ||
| 44 | * struct nilfs_inode - structure of an inode on disk | ||
| 45 | * @i_blocks: blocks count | ||
| 46 | * @i_size: size in bytes | ||
| 47 | * @i_ctime: creation time (seconds) | ||
| 48 | * @i_mtime: modification time (seconds) | ||
| 49 | * @i_ctime_nsec: creation time (nano seconds) | ||
| 50 | * @i_mtime_nsec: modification time (nano seconds) | ||
| 51 | * @i_uid: user id | ||
| 52 | * @i_gid: group id | ||
| 53 | * @i_mode: file mode | ||
| 54 | * @i_links_count: links count | ||
| 55 | * @i_flags: file flags | ||
| 56 | * @i_bmap: block mapping | ||
| 57 | * @i_xattr: extended attributes | ||
| 58 | * @i_generation: file generation (for NFS) | ||
| 59 | * @i_pad: padding | ||
| 60 | */ | ||
| 61 | struct nilfs_inode { | ||
| 62 | __le64 i_blocks; | ||
| 63 | __le64 i_size; | ||
| 64 | __le64 i_ctime; | ||
| 65 | __le64 i_mtime; | ||
| 66 | __le32 i_ctime_nsec; | ||
| 67 | __le32 i_mtime_nsec; | ||
| 68 | __le32 i_uid; | ||
| 69 | __le32 i_gid; | ||
| 70 | __le16 i_mode; | ||
| 71 | __le16 i_links_count; | ||
| 72 | __le32 i_flags; | ||
| 73 | __le64 i_bmap[NILFS_INODE_BMAP_SIZE]; | ||
| 74 | #define i_device_code i_bmap[0] | ||
| 75 | __le64 i_xattr; | ||
| 76 | __le32 i_generation; | ||
| 77 | __le32 i_pad; | ||
| 78 | }; | ||
| 79 | |||
| 80 | #define NILFS_MIN_INODE_SIZE 128 | ||
| 81 | |||
| 82 | /** | ||
| 83 | * struct nilfs_super_root - structure of super root | ||
| 84 | * @sr_sum: check sum | ||
| 85 | * @sr_bytes: byte count of the structure | ||
| 86 | * @sr_flags: flags (reserved) | ||
| 87 | * @sr_nongc_ctime: write time of the last segment not for cleaner operation | ||
| 88 | * @sr_dat: DAT file inode | ||
| 89 | * @sr_cpfile: checkpoint file inode | ||
| 90 | * @sr_sufile: segment usage file inode | ||
| 91 | */ | ||
| 92 | struct nilfs_super_root { | ||
| 93 | __le32 sr_sum; | ||
| 94 | __le16 sr_bytes; | ||
| 95 | __le16 sr_flags; | ||
| 96 | __le64 sr_nongc_ctime; | ||
| 97 | struct nilfs_inode sr_dat; | ||
| 98 | struct nilfs_inode sr_cpfile; | ||
| 99 | struct nilfs_inode sr_sufile; | ||
| 100 | }; | ||
| 101 | |||
| 102 | #define NILFS_SR_MDT_OFFSET(inode_size, i) \ | ||
| 103 | ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \ | ||
| 104 | (inode_size) * (i)) | ||
| 105 | #define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0) | ||
| 106 | #define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1) | ||
| 107 | #define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2) | ||
| 108 | #define NILFS_SR_BYTES(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3) | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Maximal mount counts | ||
| 112 | */ | ||
| 113 | #define NILFS_DFL_MAX_MNT_COUNT 50 /* 50 mounts */ | ||
| 114 | |||
| 115 | /* | ||
| 116 | * File system states (sbp->s_state, nilfs->ns_mount_state) | ||
| 117 | */ | ||
| 118 | #define NILFS_VALID_FS 0x0001 /* Unmounted cleanly */ | ||
| 119 | #define NILFS_ERROR_FS 0x0002 /* Errors detected */ | ||
| 120 | #define NILFS_RESIZE_FS 0x0004 /* Resize required */ | ||
| 121 | |||
| 122 | /* | ||
| 123 | * Mount flags (sbi->s_mount_opt) | ||
| 124 | */ | ||
| 125 | #define NILFS_MOUNT_ERROR_MODE 0x0070 /* Error mode mask */ | ||
| 126 | #define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ | ||
| 127 | #define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ | ||
| 128 | #define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ | ||
| 129 | #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ | ||
| 130 | #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* | ||
| 131 | * Apply strict in-order | ||
| 132 | * semantics also for data | ||
| 133 | */ | ||
| 134 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* | ||
| 135 | * Disable write access during | ||
| 136 | * mount-time recovery | ||
| 137 | */ | ||
| 138 | #define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */ | ||
| 139 | |||
| 140 | |||
| 141 | /** | ||
| 142 | * struct nilfs_super_block - structure of super block on disk | ||
| 143 | */ | ||
| 144 | struct nilfs_super_block { | ||
| 145 | /*00*/ __le32 s_rev_level; /* Revision level */ | ||
| 146 | __le16 s_minor_rev_level; /* minor revision level */ | ||
| 147 | __le16 s_magic; /* Magic signature */ | ||
| 148 | |||
| 149 | __le16 s_bytes; /* | ||
| 150 | * Bytes count of CRC calculation | ||
| 151 | * for this structure. s_reserved | ||
| 152 | * is excluded. | ||
| 153 | */ | ||
| 154 | __le16 s_flags; /* flags */ | ||
| 155 | __le32 s_crc_seed; /* Seed value of CRC calculation */ | ||
| 156 | /*10*/ __le32 s_sum; /* Check sum of super block */ | ||
| 157 | |||
| 158 | __le32 s_log_block_size; /* | ||
| 159 | * Block size represented as follows | ||
| 160 | * blocksize = | ||
| 161 | * 1 << (s_log_block_size + 10) | ||
| 162 | */ | ||
| 163 | __le64 s_nsegments; /* Number of segments in filesystem */ | ||
| 164 | /*20*/ __le64 s_dev_size; /* block device size in bytes */ | ||
| 165 | __le64 s_first_data_block; /* 1st seg disk block number */ | ||
| 166 | /*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */ | ||
| 167 | __le32 s_r_segments_percentage; /* Reserved segments percentage */ | ||
| 168 | |||
| 169 | __le64 s_last_cno; /* Last checkpoint number */ | ||
| 170 | /*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */ | ||
| 171 | __le64 s_last_seq; /* seq. number of seg written last */ | ||
| 172 | /*50*/ __le64 s_free_blocks_count; /* Free blocks count */ | ||
| 173 | |||
| 174 | __le64 s_ctime; /* | ||
| 175 | * Creation time (execution time of | ||
| 176 | * newfs) | ||
| 177 | */ | ||
| 178 | /*60*/ __le64 s_mtime; /* Mount time */ | ||
| 179 | __le64 s_wtime; /* Write time */ | ||
| 180 | /*70*/ __le16 s_mnt_count; /* Mount count */ | ||
| 181 | __le16 s_max_mnt_count; /* Maximal mount count */ | ||
| 182 | __le16 s_state; /* File system state */ | ||
| 183 | __le16 s_errors; /* Behaviour when detecting errors */ | ||
| 184 | __le64 s_lastcheck; /* time of last check */ | ||
| 185 | |||
| 186 | /*80*/ __le32 s_checkinterval; /* max. time between checks */ | ||
| 187 | __le32 s_creator_os; /* OS */ | ||
| 188 | __le16 s_def_resuid; /* Default uid for reserved blocks */ | ||
| 189 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | ||
| 190 | __le32 s_first_ino; /* First non-reserved inode */ | ||
| 191 | |||
| 192 | /*90*/ __le16 s_inode_size; /* Size of an inode */ | ||
| 193 | __le16 s_dat_entry_size; /* Size of a dat entry */ | ||
| 194 | __le16 s_checkpoint_size; /* Size of a checkpoint */ | ||
| 195 | __le16 s_segment_usage_size; /* Size of a segment usage */ | ||
| 196 | |||
| 197 | /*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ | ||
| 198 | /*A8*/ char s_volume_name[80]; /* volume name */ | ||
| 199 | |||
| 200 | /*F8*/ __le32 s_c_interval; /* Commit interval of segment */ | ||
| 201 | __le32 s_c_block_max; /* | ||
| 202 | * Threshold of data amount for | ||
| 203 | * the segment construction | ||
| 204 | */ | ||
| 205 | /*100*/ __le64 s_feature_compat; /* Compatible feature set */ | ||
| 206 | __le64 s_feature_compat_ro; /* Read-only compatible feature set */ | ||
| 207 | __le64 s_feature_incompat; /* Incompatible feature set */ | ||
| 208 | __u32 s_reserved[186]; /* padding to the end of the block */ | ||
| 209 | }; | ||
| 210 | |||
| 211 | /* | ||
| 212 | * Codes for operating systems | ||
| 213 | */ | ||
| 214 | #define NILFS_OS_LINUX 0 | ||
| 215 | /* Codes from 1 to 4 are reserved to keep compatibility with ext2 creator-OS */ | ||
| 216 | |||
| 217 | /* | ||
| 218 | * Revision levels | ||
| 219 | */ | ||
| 220 | #define NILFS_CURRENT_REV 2 /* current major revision */ | ||
| 221 | #define NILFS_MINOR_REV 0 /* minor revision */ | ||
| 222 | #define NILFS_MIN_SUPP_REV 2 /* minimum supported revision */ | ||
| 223 | |||
| 224 | /* | ||
| 225 | * Feature set definitions | ||
| 226 | * | ||
| 227 | * If there is a bit set in the incompatible feature set that the kernel | ||
| 228 | * doesn't know about, it should refuse to mount the filesystem. | ||
| 229 | */ | ||
| 230 | #define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL | ||
| 231 | |||
| 232 | #define NILFS_FEATURE_COMPAT_SUPP 0ULL | ||
| 233 | #define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT | ||
| 234 | #define NILFS_FEATURE_INCOMPAT_SUPP 0ULL | ||
| 235 | |||
| 236 | /* | ||
| 237 | * Bytes count of super_block for CRC-calculation | ||
| 238 | */ | ||
| 239 | #define NILFS_SB_BYTES \ | ||
| 240 | ((long)&((struct nilfs_super_block *)0)->s_reserved) | ||
| 241 | |||
| 242 | /* | ||
| 243 | * Special inode number | ||
| 244 | */ | ||
| 245 | #define NILFS_ROOT_INO 2 /* Root file inode */ | ||
| 246 | #define NILFS_DAT_INO 3 /* DAT file */ | ||
| 247 | #define NILFS_CPFILE_INO 4 /* checkpoint file */ | ||
| 248 | #define NILFS_SUFILE_INO 5 /* segment usage file */ | ||
| 249 | #define NILFS_IFILE_INO 6 /* ifile */ | ||
| 250 | #define NILFS_ATIME_INO 7 /* Atime file (reserved) */ | ||
| 251 | #define NILFS_XATTR_INO 8 /* Xattribute file (reserved) */ | ||
| 252 | #define NILFS_SKETCH_INO 10 /* Sketch file */ | ||
| 253 | #define NILFS_USER_INO 11 /* Fisrt user's file inode number */ | ||
| 254 | |||
| 255 | #define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ | ||
| 256 | |||
| 257 | #define NILFS_SEG_MIN_BLOCKS 16 /* | ||
| 258 | * Minimum number of blocks in | ||
| 259 | * a full segment | ||
| 260 | */ | ||
| 261 | #define NILFS_PSEG_MIN_BLOCKS 2 /* | ||
| 262 | * Minimum number of blocks in | ||
| 263 | * a partial segment | ||
| 264 | */ | ||
| 265 | #define NILFS_MIN_NRSVSEGS 8 /* | ||
| 266 | * Minimum number of reserved | ||
| 267 | * segments | ||
| 268 | */ | ||
| 269 | |||
| 270 | /* | ||
| 271 | * We call DAT, cpfile, and sufile root metadata files. Inodes of | ||
| 272 | * these files are written in super root block instead of ifile, and | ||
| 273 | * garbage collector doesn't keep any past versions of these files. | ||
| 274 | */ | ||
| 275 | #define NILFS_ROOT_METADATA_FILE(ino) \ | ||
| 276 | ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO) | ||
| 277 | |||
| 278 | /* | ||
| 279 | * bytes offset of secondary super block | ||
| 280 | */ | ||
| 281 | #define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12) | ||
| 282 | |||
| 283 | /* | ||
| 284 | * Maximal count of links to a file | ||
| 285 | */ | ||
| 286 | #define NILFS_LINK_MAX 32000 | ||
| 287 | |||
| 288 | /* | ||
| 289 | * Structure of a directory entry | ||
| 290 | * (Same as ext2) | ||
| 291 | */ | ||
| 292 | |||
| 293 | #define NILFS_NAME_LEN 255 | ||
| 294 | |||
| 295 | /* | ||
| 296 | * Block size limitations | ||
| 297 | */ | ||
| 298 | #define NILFS_MIN_BLOCK_SIZE 1024 | ||
| 299 | #define NILFS_MAX_BLOCK_SIZE 65536 | ||
| 300 | |||
| 301 | /* | ||
| 302 | * The new version of the directory entry. Since V0 structures are | ||
| 303 | * stored in intel byte order, and the name_len field could never be | ||
| 304 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | ||
| 305 | * file_type field. | ||
| 306 | */ | ||
| 307 | struct nilfs_dir_entry { | ||
| 308 | __le64 inode; /* Inode number */ | ||
| 309 | __le16 rec_len; /* Directory entry length */ | ||
| 310 | __u8 name_len; /* Name length */ | ||
| 311 | __u8 file_type; /* Dir entry type (file, dir, etc) */ | ||
| 312 | char name[NILFS_NAME_LEN]; /* File name */ | ||
| 313 | char pad; | ||
| 314 | }; | ||
| 315 | |||
| 316 | /* | ||
| 317 | * NILFS directory file types. Only the low 3 bits are used. The | ||
| 318 | * other bits are reserved for now. | ||
| 319 | */ | ||
| 320 | enum { | ||
| 321 | NILFS_FT_UNKNOWN, | ||
| 322 | NILFS_FT_REG_FILE, | ||
| 323 | NILFS_FT_DIR, | ||
| 324 | NILFS_FT_CHRDEV, | ||
| 325 | NILFS_FT_BLKDEV, | ||
| 326 | NILFS_FT_FIFO, | ||
| 327 | NILFS_FT_SOCK, | ||
| 328 | NILFS_FT_SYMLINK, | ||
| 329 | NILFS_FT_MAX | ||
| 330 | }; | ||
| 331 | |||
| 332 | /* | ||
| 333 | * NILFS_DIR_PAD defines the directory entries boundaries | ||
| 334 | * | ||
| 335 | * NOTE: It must be a multiple of 8 | ||
| 336 | */ | ||
| 337 | #define NILFS_DIR_PAD 8 | ||
| 338 | #define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) | ||
| 339 | #define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ | ||
| 340 | ~NILFS_DIR_ROUND) | ||
| 341 | #define NILFS_MAX_REC_LEN ((1<<16)-1) | ||
| 342 | |||
| 343 | static inline unsigned int nilfs_rec_len_from_disk(__le16 dlen) | ||
| 344 | { | ||
| 345 | unsigned int len = le16_to_cpu(dlen); | ||
| 346 | |||
| 347 | #if !defined(__KERNEL__) || (PAGE_SIZE >= 65536) | ||
| 348 | if (len == NILFS_MAX_REC_LEN) | ||
| 349 | return 1 << 16; | ||
| 350 | #endif | ||
| 351 | return len; | ||
| 352 | } | ||
| 353 | |||
| 354 | static inline __le16 nilfs_rec_len_to_disk(unsigned int len) | ||
| 355 | { | ||
| 356 | #if !defined(__KERNEL__) || (PAGE_SIZE >= 65536) | ||
| 357 | if (len == (1 << 16)) | ||
| 358 | return cpu_to_le16(NILFS_MAX_REC_LEN); | ||
| 359 | else if (len > (1 << 16)) | ||
| 360 | BUG(); | ||
| 361 | #endif | ||
| 362 | return cpu_to_le16(len); | ||
| 363 | } | ||
| 364 | |||
| 365 | /** | ||
| 366 | * struct nilfs_finfo - file information | ||
| 367 | * @fi_ino: inode number | ||
| 368 | * @fi_cno: checkpoint number | ||
| 369 | * @fi_nblocks: number of blocks (including intermediate blocks) | ||
| 370 | * @fi_ndatablk: number of file data blocks | ||
| 371 | */ | ||
| 372 | struct nilfs_finfo { | ||
| 373 | __le64 fi_ino; | ||
| 374 | __le64 fi_cno; | ||
| 375 | __le32 fi_nblocks; | ||
| 376 | __le32 fi_ndatablk; | ||
| 377 | /* array of virtual block numbers */ | ||
| 378 | }; | ||
| 379 | |||
| 380 | /** | ||
| 381 | * struct nilfs_binfo_v - information for the block to which a virtual block number is assigned | ||
| 382 | * @bi_vblocknr: virtual block number | ||
| 383 | * @bi_blkoff: block offset | ||
| 384 | */ | ||
| 385 | struct nilfs_binfo_v { | ||
| 386 | __le64 bi_vblocknr; | ||
| 387 | __le64 bi_blkoff; | ||
| 388 | }; | ||
| 389 | |||
| 390 | /** | ||
| 391 | * struct nilfs_binfo_dat - information for the block which belongs to the DAT file | ||
| 392 | * @bi_blkoff: block offset | ||
| 393 | * @bi_level: level | ||
| 394 | * @bi_pad: padding | ||
| 395 | */ | ||
| 396 | struct nilfs_binfo_dat { | ||
| 397 | __le64 bi_blkoff; | ||
| 398 | __u8 bi_level; | ||
| 399 | __u8 bi_pad[7]; | ||
| 400 | }; | ||
| 401 | |||
| 402 | /** | ||
| 403 | * union nilfs_binfo: block information | ||
| 404 | * @bi_v: nilfs_binfo_v structure | ||
| 405 | * @bi_dat: nilfs_binfo_dat structure | ||
| 406 | */ | ||
| 407 | union nilfs_binfo { | ||
| 408 | struct nilfs_binfo_v bi_v; | ||
| 409 | struct nilfs_binfo_dat bi_dat; | ||
| 410 | }; | ||
| 411 | |||
| 412 | /** | ||
| 413 | * struct nilfs_segment_summary - segment summary header | ||
| 414 | * @ss_datasum: checksum of data | ||
| 415 | * @ss_sumsum: checksum of segment summary | ||
| 416 | * @ss_magic: magic number | ||
| 417 | * @ss_bytes: size of this structure in bytes | ||
| 418 | * @ss_flags: flags | ||
| 419 | * @ss_seq: sequence number | ||
| 420 | * @ss_create: creation timestamp | ||
| 421 | * @ss_next: next segment | ||
| 422 | * @ss_nblocks: number of blocks | ||
| 423 | * @ss_nfinfo: number of finfo structures | ||
| 424 | * @ss_sumbytes: total size of segment summary in bytes | ||
| 425 | * @ss_pad: padding | ||
| 426 | * @ss_cno: checkpoint number | ||
| 427 | */ | ||
| 428 | struct nilfs_segment_summary { | ||
| 429 | __le32 ss_datasum; | ||
| 430 | __le32 ss_sumsum; | ||
| 431 | __le32 ss_magic; | ||
| 432 | __le16 ss_bytes; | ||
| 433 | __le16 ss_flags; | ||
| 434 | __le64 ss_seq; | ||
| 435 | __le64 ss_create; | ||
| 436 | __le64 ss_next; | ||
| 437 | __le32 ss_nblocks; | ||
| 438 | __le32 ss_nfinfo; | ||
| 439 | __le32 ss_sumbytes; | ||
| 440 | __le32 ss_pad; | ||
| 441 | __le64 ss_cno; | ||
| 442 | /* array of finfo structures */ | ||
| 443 | }; | ||
| 444 | |||
| 445 | #define NILFS_SEGSUM_MAGIC 0x1eaffa11 /* segment summary magic number */ | ||
| 446 | |||
| 447 | /* | ||
| 448 | * Segment summary flags | ||
| 449 | */ | ||
| 450 | #define NILFS_SS_LOGBGN 0x0001 /* begins a logical segment */ | ||
| 451 | #define NILFS_SS_LOGEND 0x0002 /* ends a logical segment */ | ||
| 452 | #define NILFS_SS_SR 0x0004 /* has super root */ | ||
| 453 | #define NILFS_SS_SYNDT 0x0008 /* includes data only updates */ | ||
| 454 | #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ | ||
| 455 | |||
| 456 | /** | ||
| 457 | * struct nilfs_btree_node - B-tree node | ||
| 458 | * @bn_flags: flags | ||
| 459 | * @bn_level: level | ||
| 460 | * @bn_nchildren: number of children | ||
| 461 | * @bn_pad: padding | ||
| 462 | */ | ||
| 463 | struct nilfs_btree_node { | ||
| 464 | __u8 bn_flags; | ||
| 465 | __u8 bn_level; | ||
| 466 | __le16 bn_nchildren; | ||
| 467 | __le32 bn_pad; | ||
| 468 | }; | ||
| 469 | |||
| 470 | /* flags */ | ||
| 471 | #define NILFS_BTREE_NODE_ROOT 0x01 | ||
| 472 | |||
| 473 | /* level */ | ||
| 474 | #define NILFS_BTREE_LEVEL_DATA 0 | ||
| 475 | #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) | ||
| 476 | #define NILFS_BTREE_LEVEL_MAX 14 /* Max level (exclusive) */ | ||
| 477 | |||
| 478 | /** | ||
| 479 | * struct nilfs_palloc_group_desc - block group descriptor | ||
| 480 | * @pg_nfrees: number of free entries in block group | ||
| 481 | */ | ||
| 482 | struct nilfs_palloc_group_desc { | ||
| 483 | __le32 pg_nfrees; | ||
| 484 | }; | ||
| 485 | |||
| 486 | /** | ||
| 487 | * struct nilfs_dat_entry - disk address translation entry | ||
| 488 | * @de_blocknr: block number | ||
| 489 | * @de_start: start checkpoint number | ||
| 490 | * @de_end: end checkpoint number | ||
| 491 | * @de_rsv: reserved for future use | ||
| 492 | */ | ||
| 493 | struct nilfs_dat_entry { | ||
| 494 | __le64 de_blocknr; | ||
| 495 | __le64 de_start; | ||
| 496 | __le64 de_end; | ||
| 497 | __le64 de_rsv; | ||
| 498 | }; | ||
| 499 | |||
| 500 | #define NILFS_MIN_DAT_ENTRY_SIZE 32 | ||
| 501 | |||
| 502 | /** | ||
| 503 | * struct nilfs_snapshot_list - snapshot list | ||
| 504 | * @ssl_next: next checkpoint number on snapshot list | ||
| 505 | * @ssl_prev: previous checkpoint number on snapshot list | ||
| 506 | */ | ||
| 507 | struct nilfs_snapshot_list { | ||
| 508 | __le64 ssl_next; | ||
| 509 | __le64 ssl_prev; | ||
| 510 | }; | ||
| 511 | |||
| 512 | /** | ||
| 513 | * struct nilfs_checkpoint - checkpoint structure | ||
| 514 | * @cp_flags: flags | ||
| 515 | * @cp_checkpoints_count: checkpoints count in a block | ||
| 516 | * @cp_snapshot_list: snapshot list | ||
| 517 | * @cp_cno: checkpoint number | ||
| 518 | * @cp_create: creation timestamp | ||
| 519 | * @cp_nblk_inc: number of blocks incremented by this checkpoint | ||
| 520 | * @cp_inodes_count: inodes count | ||
| 521 | * @cp_blocks_count: blocks count | ||
| 522 | * @cp_ifile_inode: inode of ifile | ||
| 523 | */ | ||
| 524 | struct nilfs_checkpoint { | ||
| 525 | __le32 cp_flags; | ||
| 526 | __le32 cp_checkpoints_count; | ||
| 527 | struct nilfs_snapshot_list cp_snapshot_list; | ||
| 528 | __le64 cp_cno; | ||
| 529 | __le64 cp_create; | ||
| 530 | __le64 cp_nblk_inc; | ||
| 531 | __le64 cp_inodes_count; | ||
| 532 | __le64 cp_blocks_count; | ||
| 533 | |||
| 534 | /* | ||
| 535 | * Do not change the byte offset of ifile inode. | ||
| 536 | * To keep the compatibility of the disk format, | ||
| 537 | * additional fields should be added behind cp_ifile_inode. | ||
| 538 | */ | ||
| 539 | struct nilfs_inode cp_ifile_inode; | ||
| 540 | }; | ||
| 541 | |||
| 542 | #define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE) | ||
| 543 | |||
| 544 | /* checkpoint flags */ | ||
| 545 | enum { | ||
| 546 | NILFS_CHECKPOINT_SNAPSHOT, | ||
| 547 | NILFS_CHECKPOINT_INVALID, | ||
| 548 | NILFS_CHECKPOINT_SKETCH, | ||
| 549 | NILFS_CHECKPOINT_MINOR, | ||
| 550 | }; | ||
| 551 | |||
| 552 | #define NILFS_CHECKPOINT_FNS(flag, name) \ | ||
| 553 | static inline void \ | ||
| 554 | nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ | ||
| 555 | { \ | ||
| 556 | cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ | ||
| 557 | (1UL << NILFS_CHECKPOINT_##flag)); \ | ||
| 558 | } \ | ||
| 559 | static inline void \ | ||
| 560 | nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ | ||
| 561 | { \ | ||
| 562 | cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ | ||
| 563 | ~(1UL << NILFS_CHECKPOINT_##flag)); \ | ||
| 564 | } \ | ||
| 565 | static inline int \ | ||
| 566 | nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ | ||
| 567 | { \ | ||
| 568 | return !!(le32_to_cpu(cp->cp_flags) & \ | ||
| 569 | (1UL << NILFS_CHECKPOINT_##flag)); \ | ||
| 570 | } | ||
| 571 | |||
| 572 | NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot) | ||
| 573 | NILFS_CHECKPOINT_FNS(INVALID, invalid) | ||
| 574 | NILFS_CHECKPOINT_FNS(MINOR, minor) | ||
| 575 | |||
| 576 | /** | ||
| 577 | * struct nilfs_cpinfo - checkpoint information | ||
| 578 | * @ci_flags: flags | ||
| 579 | * @ci_pad: padding | ||
| 580 | * @ci_cno: checkpoint number | ||
| 581 | * @ci_create: creation timestamp | ||
| 582 | * @ci_nblk_inc: number of blocks incremented by this checkpoint | ||
| 583 | * @ci_inodes_count: inodes count | ||
| 584 | * @ci_blocks_count: blocks count | ||
| 585 | * @ci_next: next checkpoint number in snapshot list | ||
| 586 | */ | ||
| 587 | struct nilfs_cpinfo { | ||
| 588 | __u32 ci_flags; | ||
| 589 | __u32 ci_pad; | ||
| 590 | __u64 ci_cno; | ||
| 591 | __u64 ci_create; | ||
| 592 | __u64 ci_nblk_inc; | ||
| 593 | __u64 ci_inodes_count; | ||
| 594 | __u64 ci_blocks_count; | ||
| 595 | __u64 ci_next; | ||
| 596 | }; | ||
| 597 | |||
| 598 | #define NILFS_CPINFO_FNS(flag, name) \ | ||
| 599 | static inline int \ | ||
| 600 | nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \ | ||
| 601 | { \ | ||
| 602 | return !!(cpinfo->ci_flags & (1UL << NILFS_CHECKPOINT_##flag)); \ | ||
| 603 | } | ||
| 604 | |||
| 605 | NILFS_CPINFO_FNS(SNAPSHOT, snapshot) | ||
| 606 | NILFS_CPINFO_FNS(INVALID, invalid) | ||
| 607 | NILFS_CPINFO_FNS(MINOR, minor) | ||
| 608 | |||
| 609 | |||
| 610 | /** | ||
| 611 | * struct nilfs_cpfile_header - checkpoint file header | ||
| 612 | * @ch_ncheckpoints: number of checkpoints | ||
| 613 | * @ch_nsnapshots: number of snapshots | ||
| 614 | * @ch_snapshot_list: snapshot list | ||
| 615 | */ | ||
| 616 | struct nilfs_cpfile_header { | ||
| 617 | __le64 ch_ncheckpoints; | ||
| 618 | __le64 ch_nsnapshots; | ||
| 619 | struct nilfs_snapshot_list ch_snapshot_list; | ||
| 620 | }; | ||
| 621 | |||
| 622 | #define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET \ | ||
| 623 | ((sizeof(struct nilfs_cpfile_header) + \ | ||
| 624 | sizeof(struct nilfs_checkpoint) - 1) / \ | ||
| 625 | sizeof(struct nilfs_checkpoint)) | ||
| 626 | |||
| 627 | /** | ||
| 628 | * struct nilfs_segment_usage - segment usage | ||
| 629 | * @su_lastmod: last modified timestamp | ||
| 630 | * @su_nblocks: number of blocks in segment | ||
| 631 | * @su_flags: flags | ||
| 632 | */ | ||
| 633 | struct nilfs_segment_usage { | ||
| 634 | __le64 su_lastmod; | ||
| 635 | __le32 su_nblocks; | ||
| 636 | __le32 su_flags; | ||
| 637 | }; | ||
| 638 | |||
| 639 | #define NILFS_MIN_SEGMENT_USAGE_SIZE 16 | ||
| 640 | |||
| 641 | /* segment usage flag */ | ||
| 642 | enum { | ||
| 643 | NILFS_SEGMENT_USAGE_ACTIVE, | ||
| 644 | NILFS_SEGMENT_USAGE_DIRTY, | ||
| 645 | NILFS_SEGMENT_USAGE_ERROR, | ||
| 646 | |||
| 647 | /* ... */ | ||
| 648 | }; | ||
| 649 | |||
| 650 | #define NILFS_SEGMENT_USAGE_FNS(flag, name) \ | ||
| 651 | static inline void \ | ||
| 652 | nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ | ||
| 653 | { \ | ||
| 654 | su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ | ||
| 655 | (1UL << NILFS_SEGMENT_USAGE_##flag));\ | ||
| 656 | } \ | ||
| 657 | static inline void \ | ||
| 658 | nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ | ||
| 659 | { \ | ||
| 660 | su->su_flags = \ | ||
| 661 | cpu_to_le32(le32_to_cpu(su->su_flags) & \ | ||
| 662 | ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ | ||
| 663 | } \ | ||
| 664 | static inline int \ | ||
| 665 | nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ | ||
| 666 | { \ | ||
| 667 | return !!(le32_to_cpu(su->su_flags) & \ | ||
| 668 | (1UL << NILFS_SEGMENT_USAGE_##flag)); \ | ||
| 669 | } | ||
| 670 | |||
| 671 | NILFS_SEGMENT_USAGE_FNS(ACTIVE, active) | ||
| 672 | NILFS_SEGMENT_USAGE_FNS(DIRTY, dirty) | ||
| 673 | NILFS_SEGMENT_USAGE_FNS(ERROR, error) | ||
| 674 | |||
| 675 | static inline void | ||
| 676 | nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) | ||
| 677 | { | ||
| 678 | su->su_lastmod = cpu_to_le64(0); | ||
| 679 | su->su_nblocks = cpu_to_le32(0); | ||
| 680 | su->su_flags = cpu_to_le32(0); | ||
| 681 | } | ||
| 682 | |||
| 683 | static inline int | ||
| 684 | nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) | ||
| 685 | { | ||
| 686 | return !le32_to_cpu(su->su_flags); | ||
| 687 | } | ||
| 688 | |||
| 689 | /** | ||
| 690 | * struct nilfs_sufile_header - segment usage file header | ||
| 691 | * @sh_ncleansegs: number of clean segments | ||
| 692 | * @sh_ndirtysegs: number of dirty segments | ||
| 693 | * @sh_last_alloc: last allocated segment number | ||
| 694 | */ | ||
| 695 | struct nilfs_sufile_header { | ||
| 696 | __le64 sh_ncleansegs; | ||
| 697 | __le64 sh_ndirtysegs; | ||
| 698 | __le64 sh_last_alloc; | ||
| 699 | /* ... */ | ||
| 700 | }; | ||
| 701 | |||
| 702 | #define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET \ | ||
| 703 | ((sizeof(struct nilfs_sufile_header) + \ | ||
| 704 | sizeof(struct nilfs_segment_usage) - 1) / \ | ||
| 705 | sizeof(struct nilfs_segment_usage)) | ||
| 706 | |||
| 707 | /** | ||
| 708 | * nilfs_suinfo - segment usage information | ||
| 709 | * @sui_lastmod: timestamp of last modification | ||
| 710 | * @sui_nblocks: number of written blocks in segment | ||
| 711 | * @sui_flags: segment usage flags | ||
| 712 | */ | ||
| 713 | struct nilfs_suinfo { | ||
| 714 | __u64 sui_lastmod; | ||
| 715 | __u32 sui_nblocks; | ||
| 716 | __u32 sui_flags; | ||
| 717 | }; | ||
| 718 | |||
| 719 | #define NILFS_SUINFO_FNS(flag, name) \ | ||
| 720 | static inline int \ | ||
| 721 | nilfs_suinfo_##name(const struct nilfs_suinfo *si) \ | ||
| 722 | { \ | ||
| 723 | return si->sui_flags & (1UL << NILFS_SEGMENT_USAGE_##flag); \ | ||
| 724 | } | ||
| 725 | |||
| 726 | NILFS_SUINFO_FNS(ACTIVE, active) | ||
| 727 | NILFS_SUINFO_FNS(DIRTY, dirty) | ||
| 728 | NILFS_SUINFO_FNS(ERROR, error) | ||
| 729 | |||
| 730 | static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si) | ||
| 731 | { | ||
| 732 | return !si->sui_flags; | ||
| 733 | } | ||
| 734 | |||
| 735 | /* ioctl */ | ||
| 736 | /** | ||
| 737 | * nilfs_suinfo_update - segment usage information update | ||
| 738 | * @sup_segnum: segment number | ||
| 739 | * @sup_flags: flags for which fields are active in sup_sui | ||
| 740 | * @sup_reserved: reserved necessary for alignment | ||
| 741 | * @sup_sui: segment usage information | ||
| 742 | */ | ||
| 743 | struct nilfs_suinfo_update { | ||
| 744 | __u64 sup_segnum; | ||
| 745 | __u32 sup_flags; | ||
| 746 | __u32 sup_reserved; | ||
| 747 | struct nilfs_suinfo sup_sui; | ||
| 748 | }; | ||
| 749 | |||
| 750 | enum { | ||
| 751 | NILFS_SUINFO_UPDATE_LASTMOD, | ||
| 752 | NILFS_SUINFO_UPDATE_NBLOCKS, | ||
| 753 | NILFS_SUINFO_UPDATE_FLAGS, | ||
| 754 | __NR_NILFS_SUINFO_UPDATE_FIELDS, | ||
| 755 | }; | ||
| 756 | |||
| 757 | #define NILFS_SUINFO_UPDATE_FNS(flag, name) \ | ||
| 758 | static inline void \ | ||
| 759 | nilfs_suinfo_update_set_##name(struct nilfs_suinfo_update *sup) \ | ||
| 760 | { \ | ||
| 761 | sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_##flag; \ | ||
| 762 | } \ | ||
| 763 | static inline void \ | ||
| 764 | nilfs_suinfo_update_clear_##name(struct nilfs_suinfo_update *sup) \ | ||
| 765 | { \ | ||
| 766 | sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_##flag); \ | ||
| 767 | } \ | ||
| 768 | static inline int \ | ||
| 769 | nilfs_suinfo_update_##name(const struct nilfs_suinfo_update *sup) \ | ||
| 770 | { \ | ||
| 771 | return !!(sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_##flag));\ | ||
| 772 | } | ||
| 773 | |||
| 774 | NILFS_SUINFO_UPDATE_FNS(LASTMOD, lastmod) | ||
| 775 | NILFS_SUINFO_UPDATE_FNS(NBLOCKS, nblocks) | ||
| 776 | NILFS_SUINFO_UPDATE_FNS(FLAGS, flags) | ||
| 777 | |||
| 778 | enum { | ||
| 779 | NILFS_CHECKPOINT, | ||
| 780 | NILFS_SNAPSHOT, | ||
| 781 | }; | ||
| 782 | |||
| 783 | /** | ||
| 784 | * struct nilfs_cpmode - change checkpoint mode structure | ||
| 785 | * @cm_cno: checkpoint number | ||
| 786 | * @cm_mode: mode of checkpoint | ||
| 787 | * @cm_pad: padding | ||
| 788 | */ | ||
| 789 | struct nilfs_cpmode { | ||
| 790 | __u64 cm_cno; | ||
| 791 | __u32 cm_mode; | ||
| 792 | __u32 cm_pad; | ||
| 793 | }; | ||
| 794 | |||
| 795 | /** | ||
| 796 | * struct nilfs_argv - argument vector | ||
| 797 | * @v_base: pointer on data array from userspace | ||
| 798 | * @v_nmembs: number of members in data array | ||
| 799 | * @v_size: size of data array in bytes | ||
| 800 | * @v_flags: flags | ||
| 801 | * @v_index: start number of target data items | ||
| 802 | */ | ||
| 803 | struct nilfs_argv { | ||
| 804 | __u64 v_base; | ||
| 805 | __u32 v_nmembs; /* number of members */ | ||
| 806 | __u16 v_size; /* size of members */ | ||
| 807 | __u16 v_flags; | ||
| 808 | __u64 v_index; | ||
| 809 | }; | ||
| 810 | |||
| 811 | /** | ||
| 812 | * struct nilfs_period - period of checkpoint numbers | ||
| 813 | * @p_start: start checkpoint number (inclusive) | ||
| 814 | * @p_end: end checkpoint number (exclusive) | ||
| 815 | */ | ||
| 816 | struct nilfs_period { | ||
| 817 | __u64 p_start; | ||
| 818 | __u64 p_end; | ||
| 819 | }; | ||
| 820 | |||
| 821 | /** | ||
| 822 | * struct nilfs_cpstat - checkpoint statistics | ||
| 823 | * @cs_cno: checkpoint number | ||
| 824 | * @cs_ncps: number of checkpoints | ||
| 825 | * @cs_nsss: number of snapshots | ||
| 826 | */ | ||
| 827 | struct nilfs_cpstat { | ||
| 828 | __u64 cs_cno; | ||
| 829 | __u64 cs_ncps; | ||
| 830 | __u64 cs_nsss; | ||
| 831 | }; | ||
| 832 | |||
| 833 | /** | ||
| 834 | * struct nilfs_sustat - segment usage statistics | ||
| 835 | * @ss_nsegs: number of segments | ||
| 836 | * @ss_ncleansegs: number of clean segments | ||
| 837 | * @ss_ndirtysegs: number of dirty segments | ||
| 838 | * @ss_ctime: creation time of the last segment | ||
| 839 | * @ss_nongc_ctime: creation time of the last segment not for GC | ||
| 840 | * @ss_prot_seq: least sequence number of segments which must not be reclaimed | ||
| 841 | */ | ||
| 842 | struct nilfs_sustat { | ||
| 843 | __u64 ss_nsegs; | ||
| 844 | __u64 ss_ncleansegs; | ||
| 845 | __u64 ss_ndirtysegs; | ||
| 846 | __u64 ss_ctime; | ||
| 847 | __u64 ss_nongc_ctime; | ||
| 848 | __u64 ss_prot_seq; | ||
| 849 | }; | ||
| 850 | |||
| 851 | /** | ||
| 852 | * struct nilfs_vinfo - virtual block number information | ||
| 853 | * @vi_vblocknr: virtual block number | ||
| 854 | * @vi_start: start checkpoint number (inclusive) | ||
| 855 | * @vi_end: end checkpoint number (exclusive) | ||
| 856 | * @vi_blocknr: disk block number | ||
| 857 | */ | ||
| 858 | struct nilfs_vinfo { | ||
| 859 | __u64 vi_vblocknr; | ||
| 860 | __u64 vi_start; | ||
| 861 | __u64 vi_end; | ||
| 862 | __u64 vi_blocknr; | ||
| 863 | }; | ||
| 864 | |||
| 865 | /** | ||
| 866 | * struct nilfs_vdesc - descriptor of virtual block number | ||
| 867 | * @vd_ino: inode number | ||
| 868 | * @vd_cno: checkpoint number | ||
| 869 | * @vd_vblocknr: virtual block number | ||
| 870 | * @vd_period: period of checkpoint numbers | ||
| 871 | * @vd_blocknr: disk block number | ||
| 872 | * @vd_offset: logical block offset inside a file | ||
| 873 | * @vd_flags: flags (data or node block) | ||
| 874 | * @vd_pad: padding | ||
| 875 | */ | ||
| 876 | struct nilfs_vdesc { | ||
| 877 | __u64 vd_ino; | ||
| 878 | __u64 vd_cno; | ||
| 879 | __u64 vd_vblocknr; | ||
| 880 | struct nilfs_period vd_period; | ||
| 881 | __u64 vd_blocknr; | ||
| 882 | __u64 vd_offset; | ||
| 883 | __u32 vd_flags; | ||
| 884 | __u32 vd_pad; | ||
| 885 | }; | ||
| 886 | |||
| 887 | /** | ||
| 888 | * struct nilfs_bdesc - descriptor of disk block number | ||
| 889 | * @bd_ino: inode number | ||
| 890 | * @bd_oblocknr: disk block address (for skipping dead blocks) | ||
| 891 | * @bd_blocknr: disk block address | ||
| 892 | * @bd_offset: logical block offset inside a file | ||
| 893 | * @bd_level: level in the b-tree organization | ||
| 894 | * @bd_pad: padding | ||
| 895 | */ | ||
| 896 | struct nilfs_bdesc { | ||
| 897 | __u64 bd_ino; | ||
| 898 | __u64 bd_oblocknr; | ||
| 899 | __u64 bd_blocknr; | ||
| 900 | __u64 bd_offset; | ||
| 901 | __u32 bd_level; | ||
| 902 | __u32 bd_pad; | ||
| 903 | }; | ||
| 904 | |||
| 905 | #define NILFS_IOCTL_IDENT 'n' | ||
| 906 | |||
| 907 | #define NILFS_IOCTL_CHANGE_CPMODE \ | ||
| 908 | _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode) | ||
| 909 | #define NILFS_IOCTL_DELETE_CHECKPOINT \ | ||
| 910 | _IOW(NILFS_IOCTL_IDENT, 0x81, __u64) | ||
| 911 | #define NILFS_IOCTL_GET_CPINFO \ | ||
| 912 | _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv) | ||
| 913 | #define NILFS_IOCTL_GET_CPSTAT \ | ||
| 914 | _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat) | ||
| 915 | #define NILFS_IOCTL_GET_SUINFO \ | ||
| 916 | _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv) | ||
| 917 | #define NILFS_IOCTL_GET_SUSTAT \ | ||
| 918 | _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat) | ||
| 919 | #define NILFS_IOCTL_GET_VINFO \ | ||
| 920 | _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv) | ||
| 921 | #define NILFS_IOCTL_GET_BDESCS \ | ||
| 922 | _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv) | ||
| 923 | #define NILFS_IOCTL_CLEAN_SEGMENTS \ | ||
| 924 | _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5]) | ||
| 925 | #define NILFS_IOCTL_SYNC \ | ||
| 926 | _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64) | ||
| 927 | #define NILFS_IOCTL_RESIZE \ | ||
| 928 | _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) | ||
| 929 | #define NILFS_IOCTL_SET_ALLOC_RANGE \ | ||
| 930 | _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2]) | ||
| 931 | #define NILFS_IOCTL_SET_SUINFO \ | ||
| 932 | _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv) | ||
| 933 | |||
| 934 | #endif /* _LINUX_NILFS_FS_H */ | ||
diff --git a/include/linux/printk.h b/include/linux/printk.h index f136b22c7772..8dc155dab3ed 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
| @@ -61,6 +61,11 @@ static inline void console_verbose(void) | |||
| 61 | console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; | 61 | console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /* strlen("ratelimit") + 1 */ | ||
| 65 | #define DEVKMSG_STR_MAX_SIZE 10 | ||
| 66 | extern char devkmsg_log_str[]; | ||
| 67 | struct ctl_table; | ||
| 68 | |||
| 64 | struct va_format { | 69 | struct va_format { |
| 65 | const char *fmt; | 70 | const char *fmt; |
| 66 | va_list *va; | 71 | va_list *va; |
| @@ -175,6 +180,10 @@ extern int printk_delay_msec; | |||
| 175 | extern int dmesg_restrict; | 180 | extern int dmesg_restrict; |
| 176 | extern int kptr_restrict; | 181 | extern int kptr_restrict; |
| 177 | 182 | ||
| 183 | extern int | ||
| 184 | devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf, | ||
| 185 | size_t *lenp, loff_t *ppos); | ||
| 186 | |||
| 178 | extern void wake_up_klogd(void); | 187 | extern void wake_up_klogd(void); |
| 179 | 188 | ||
| 180 | char *log_buf_addr_get(void); | 189 | char *log_buf_addr_get(void); |
| @@ -257,21 +266,39 @@ extern asmlinkage void dump_stack(void) __cold; | |||
| 257 | * and other debug macros are compiled out unless either DEBUG is defined | 266 | * and other debug macros are compiled out unless either DEBUG is defined |
| 258 | * or CONFIG_DYNAMIC_DEBUG is set. | 267 | * or CONFIG_DYNAMIC_DEBUG is set. |
| 259 | */ | 268 | */ |
| 260 | #define pr_emerg(fmt, ...) \ | 269 | |
| 261 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) | 270 | #ifdef CONFIG_PRINTK |
| 262 | #define pr_alert(fmt, ...) \ | 271 | |
| 263 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) | 272 | asmlinkage __printf(1, 2) __cold void __pr_emerg(const char *fmt, ...); |
| 264 | #define pr_crit(fmt, ...) \ | 273 | asmlinkage __printf(1, 2) __cold void __pr_alert(const char *fmt, ...); |
| 265 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) | 274 | asmlinkage __printf(1, 2) __cold void __pr_crit(const char *fmt, ...); |
| 266 | #define pr_err(fmt, ...) \ | 275 | asmlinkage __printf(1, 2) __cold void __pr_err(const char *fmt, ...); |
| 267 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | 276 | asmlinkage __printf(1, 2) __cold void __pr_warn(const char *fmt, ...); |
| 268 | #define pr_warning(fmt, ...) \ | 277 | asmlinkage __printf(1, 2) __cold void __pr_notice(const char *fmt, ...); |
| 269 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | 278 | asmlinkage __printf(1, 2) __cold void __pr_info(const char *fmt, ...); |
| 270 | #define pr_warn pr_warning | 279 | |
| 271 | #define pr_notice(fmt, ...) \ | 280 | #define pr_emerg(fmt, ...) __pr_emerg(pr_fmt(fmt), ##__VA_ARGS__) |
| 272 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | 281 | #define pr_alert(fmt, ...) __pr_alert(pr_fmt(fmt), ##__VA_ARGS__) |
| 273 | #define pr_info(fmt, ...) \ | 282 | #define pr_crit(fmt, ...) __pr_crit(pr_fmt(fmt), ##__VA_ARGS__) |
| 274 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | 283 | #define pr_err(fmt, ...) __pr_err(pr_fmt(fmt), ##__VA_ARGS__) |
| 284 | #define pr_warn(fmt, ...) __pr_warn(pr_fmt(fmt), ##__VA_ARGS__) | ||
| 285 | #define pr_notice(fmt, ...) __pr_notice(pr_fmt(fmt), ##__VA_ARGS__) | ||
| 286 | #define pr_info(fmt, ...) __pr_info(pr_fmt(fmt), ##__VA_ARGS__) | ||
| 287 | |||
| 288 | #else | ||
| 289 | |||
| 290 | #define pr_emerg(fmt, ...) printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) | ||
| 291 | #define pr_alert(fmt, ...) printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) | ||
| 292 | #define pr_crit(fmt, ...) printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) | ||
| 293 | #define pr_err(fmt, ...) printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | ||
| 294 | #define pr_warn(fmt, ...) printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | ||
| 295 | #define pr_notice(fmt, ...) printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | ||
| 296 | #define pr_info(fmt, ...) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | ||
| 297 | |||
| 298 | #endif | ||
| 299 | |||
| 300 | #define pr_warning pr_warn | ||
| 301 | |||
| 275 | /* | 302 | /* |
| 276 | * Like KERN_CONT, pr_cont() should only be used when continuing | 303 | * Like KERN_CONT, pr_cont() should only be used when continuing |
| 277 | * a line with no newline ('\n') enclosed. Otherwise it defaults | 304 | * a line with no newline ('\n') enclosed. Otherwise it defaults |
| @@ -289,10 +316,11 @@ extern asmlinkage void dump_stack(void) __cold; | |||
| 289 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 316 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 290 | #endif | 317 | #endif |
| 291 | 318 | ||
| 292 | #include <linux/dynamic_debug.h> | ||
| 293 | 319 | ||
| 294 | /* If you are writing a driver, please use dev_dbg instead */ | 320 | /* If you are writing a driver, please use dev_dbg instead */ |
| 295 | #if defined(CONFIG_DYNAMIC_DEBUG) | 321 | #if defined(CONFIG_DYNAMIC_DEBUG) |
| 322 | #include <linux/dynamic_debug.h> | ||
| 323 | |||
| 296 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ | 324 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ |
| 297 | #define pr_debug(fmt, ...) \ | 325 | #define pr_debug(fmt, ...) \ |
| 298 | dynamic_pr_debug(fmt, ##__VA_ARGS__) | 326 | dynamic_pr_debug(fmt, ##__VA_ARGS__) |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index cbfee507c839..4c45105dece3 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | * 00 - data pointer | 35 | * 00 - data pointer |
| 36 | * 01 - internal entry | 36 | * 01 - internal entry |
| 37 | * 10 - exceptional entry | 37 | * 10 - exceptional entry |
| 38 | * 11 - locked exceptional entry | 38 | * 11 - this bit combination is currently unused/reserved |
| 39 | * | 39 | * |
| 40 | * The internal entry may be a pointer to the next level in the tree, a | 40 | * The internal entry may be a pointer to the next level in the tree, a |
| 41 | * sibling entry, or an indicator that the entry in this slot has been moved | 41 | * sibling entry, or an indicator that the entry in this slot has been moved |
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h index 18102529254e..57c9e0622a38 100644 --- a/include/linux/ratelimit.h +++ b/include/linux/ratelimit.h | |||
| @@ -2,11 +2,15 @@ | |||
| 2 | #define _LINUX_RATELIMIT_H | 2 | #define _LINUX_RATELIMIT_H |
| 3 | 3 | ||
| 4 | #include <linux/param.h> | 4 | #include <linux/param.h> |
| 5 | #include <linux/sched.h> | ||
| 5 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
| 6 | 7 | ||
| 7 | #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) | 8 | #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) |
| 8 | #define DEFAULT_RATELIMIT_BURST 10 | 9 | #define DEFAULT_RATELIMIT_BURST 10 |
| 9 | 10 | ||
| 11 | /* issue num suppressed message on exit */ | ||
| 12 | #define RATELIMIT_MSG_ON_RELEASE BIT(0) | ||
| 13 | |||
| 10 | struct ratelimit_state { | 14 | struct ratelimit_state { |
| 11 | raw_spinlock_t lock; /* protect the state */ | 15 | raw_spinlock_t lock; /* protect the state */ |
| 12 | 16 | ||
| @@ -15,6 +19,7 @@ struct ratelimit_state { | |||
| 15 | int printed; | 19 | int printed; |
| 16 | int missed; | 20 | int missed; |
| 17 | unsigned long begin; | 21 | unsigned long begin; |
| 22 | unsigned long flags; | ||
| 18 | }; | 23 | }; |
| 19 | 24 | ||
| 20 | #define RATELIMIT_STATE_INIT(name, interval_init, burst_init) { \ | 25 | #define RATELIMIT_STATE_INIT(name, interval_init, burst_init) { \ |
| @@ -34,12 +39,35 @@ struct ratelimit_state { | |||
| 34 | static inline void ratelimit_state_init(struct ratelimit_state *rs, | 39 | static inline void ratelimit_state_init(struct ratelimit_state *rs, |
| 35 | int interval, int burst) | 40 | int interval, int burst) |
| 36 | { | 41 | { |
| 42 | memset(rs, 0, sizeof(*rs)); | ||
| 43 | |||
| 37 | raw_spin_lock_init(&rs->lock); | 44 | raw_spin_lock_init(&rs->lock); |
| 38 | rs->interval = interval; | 45 | rs->interval = interval; |
| 39 | rs->burst = burst; | 46 | rs->burst = burst; |
| 40 | rs->printed = 0; | 47 | } |
| 41 | rs->missed = 0; | 48 | |
| 42 | rs->begin = 0; | 49 | static inline void ratelimit_default_init(struct ratelimit_state *rs) |
| 50 | { | ||
| 51 | return ratelimit_state_init(rs, DEFAULT_RATELIMIT_INTERVAL, | ||
| 52 | DEFAULT_RATELIMIT_BURST); | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline void ratelimit_state_exit(struct ratelimit_state *rs) | ||
| 56 | { | ||
| 57 | if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) | ||
| 58 | return; | ||
| 59 | |||
| 60 | if (rs->missed) { | ||
| 61 | pr_warn("%s: %d output lines suppressed due to ratelimiting\n", | ||
| 62 | current->comm, rs->missed); | ||
| 63 | rs->missed = 0; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | static inline void | ||
| 68 | ratelimit_set_flags(struct ratelimit_state *rs, unsigned long flags) | ||
| 69 | { | ||
| 70 | rs->flags = flags; | ||
| 43 | } | 71 | } |
| 44 | 72 | ||
| 45 | extern struct ratelimit_state printk_ratelimit_state; | 73 | extern struct ratelimit_state printk_ratelimit_state; |
diff --git a/include/linux/rio.h b/include/linux/rio.h index aa2323893e8d..37b95c4af99d 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
| @@ -163,6 +163,7 @@ enum rio_device_state { | |||
| 163 | * @dst_ops: Destination operation capabilities | 163 | * @dst_ops: Destination operation capabilities |
| 164 | * @comp_tag: RIO component tag | 164 | * @comp_tag: RIO component tag |
| 165 | * @phys_efptr: RIO device extended features pointer | 165 | * @phys_efptr: RIO device extended features pointer |
| 166 | * @phys_rmap: LP-Serial Register Map Type (1 or 2) | ||
| 166 | * @em_efptr: RIO Error Management features pointer | 167 | * @em_efptr: RIO Error Management features pointer |
| 167 | * @dma_mask: Mask of bits of RIO address this device implements | 168 | * @dma_mask: Mask of bits of RIO address this device implements |
| 168 | * @driver: Driver claiming this device | 169 | * @driver: Driver claiming this device |
| @@ -193,6 +194,7 @@ struct rio_dev { | |||
| 193 | u32 dst_ops; | 194 | u32 dst_ops; |
| 194 | u32 comp_tag; | 195 | u32 comp_tag; |
| 195 | u32 phys_efptr; | 196 | u32 phys_efptr; |
| 197 | u32 phys_rmap; | ||
| 196 | u32 em_efptr; | 198 | u32 em_efptr; |
| 197 | u64 dma_mask; | 199 | u64 dma_mask; |
| 198 | struct rio_driver *driver; /* RIO driver claiming this device */ | 200 | struct rio_driver *driver; /* RIO driver claiming this device */ |
| @@ -237,11 +239,6 @@ struct rio_dbell { | |||
| 237 | void *dev_id; | 239 | void *dev_id; |
| 238 | }; | 240 | }; |
| 239 | 241 | ||
| 240 | enum rio_phy_type { | ||
| 241 | RIO_PHY_PARALLEL, | ||
| 242 | RIO_PHY_SERIAL, | ||
| 243 | }; | ||
| 244 | |||
| 245 | /** | 242 | /** |
| 246 | * struct rio_mport - RIO master port info | 243 | * struct rio_mport - RIO master port info |
| 247 | * @dbells: List of doorbell events | 244 | * @dbells: List of doorbell events |
| @@ -259,8 +256,8 @@ enum rio_phy_type { | |||
| 259 | * @id: Port ID, unique among all ports | 256 | * @id: Port ID, unique among all ports |
| 260 | * @index: Port index, unique among all port interfaces of the same type | 257 | * @index: Port index, unique among all port interfaces of the same type |
| 261 | * @sys_size: RapidIO common transport system size | 258 | * @sys_size: RapidIO common transport system size |
| 262 | * @phy_type: RapidIO phy type | ||
| 263 | * @phys_efptr: RIO port extended features pointer | 259 | * @phys_efptr: RIO port extended features pointer |
| 260 | * @phys_rmap: LP-Serial EFB Register Mapping type (1 or 2). | ||
| 264 | * @name: Port name string | 261 | * @name: Port name string |
| 265 | * @dev: device structure associated with an mport | 262 | * @dev: device structure associated with an mport |
| 266 | * @priv: Master port private data | 263 | * @priv: Master port private data |
| @@ -289,8 +286,8 @@ struct rio_mport { | |||
| 289 | * 0 - Small size. 256 devices. | 286 | * 0 - Small size. 256 devices. |
| 290 | * 1 - Large size, 65536 devices. | 287 | * 1 - Large size, 65536 devices. |
| 291 | */ | 288 | */ |
| 292 | enum rio_phy_type phy_type; /* RapidIO phy type */ | ||
| 293 | u32 phys_efptr; | 289 | u32 phys_efptr; |
| 290 | u32 phys_rmap; | ||
| 294 | unsigned char name[RIO_MAX_MPORT_NAME]; | 291 | unsigned char name[RIO_MAX_MPORT_NAME]; |
| 295 | struct device dev; | 292 | struct device dev; |
| 296 | void *priv; /* Master port private data */ | 293 | void *priv; /* Master port private data */ |
| @@ -425,7 +422,7 @@ struct rio_ops { | |||
| 425 | int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf); | 422 | int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf); |
| 426 | void *(*get_inb_message)(struct rio_mport *mport, int mbox); | 423 | void *(*get_inb_message)(struct rio_mport *mport, int mbox); |
| 427 | int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart, | 424 | int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart, |
| 428 | u64 rstart, u32 size, u32 flags); | 425 | u64 rstart, u64 size, u32 flags); |
| 429 | void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart); | 426 | void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart); |
| 430 | int (*query_mport)(struct rio_mport *mport, | 427 | int (*query_mport)(struct rio_mport *mport, |
| 431 | struct rio_mport_attr *attr); | 428 | struct rio_mport_attr *attr); |
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h index 2543bc163d54..334c576c151c 100644 --- a/include/linux/rio_ids.h +++ b/include/linux/rio_ids.h | |||
| @@ -38,5 +38,7 @@ | |||
| 38 | #define RIO_DID_IDTVPS1616 0x0377 | 38 | #define RIO_DID_IDTVPS1616 0x0377 |
| 39 | #define RIO_DID_IDTSPS1616 0x0378 | 39 | #define RIO_DID_IDTSPS1616 0x0378 |
| 40 | #define RIO_DID_TSI721 0x80ab | 40 | #define RIO_DID_TSI721 0x80ab |
| 41 | #define RIO_DID_IDTRXS1632 0x80e5 | ||
| 42 | #define RIO_DID_IDTRXS2448 0x80e6 | ||
| 41 | 43 | ||
| 42 | #endif /* LINUX_RIO_IDS_H */ | 44 | #endif /* LINUX_RIO_IDS_H */ |
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index 1063ae382bc2..40c04efe7409 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
| @@ -42,9 +42,11 @@ | |||
| 42 | #define RIO_PEF_INB_MBOX2 0x00200000 /* [II, <= 1.2] Mailbox 2 */ | 42 | #define RIO_PEF_INB_MBOX2 0x00200000 /* [II, <= 1.2] Mailbox 2 */ |
| 43 | #define RIO_PEF_INB_MBOX3 0x00100000 /* [II, <= 1.2] Mailbox 3 */ | 43 | #define RIO_PEF_INB_MBOX3 0x00100000 /* [II, <= 1.2] Mailbox 3 */ |
| 44 | #define RIO_PEF_INB_DOORBELL 0x00080000 /* [II, <= 1.2] Doorbells */ | 44 | #define RIO_PEF_INB_DOORBELL 0x00080000 /* [II, <= 1.2] Doorbells */ |
| 45 | #define RIO_PEF_DEV32 0x00001000 /* [III] PE supports Common TRansport Dev32 */ | ||
| 45 | #define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */ | 46 | #define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */ |
| 46 | #define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */ | 47 | #define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */ |
| 47 | #define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ | 48 | #define RIO_PEF_CTLS 0x00000010 /* [III] Common Transport Large System (< rev.3) */ |
| 49 | #define RIO_PEF_DEV16 0x00000010 /* [III] PE Supports Common Transport Dev16 (rev.3) */ | ||
| 48 | #define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */ | 50 | #define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */ |
| 49 | #define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */ | 51 | #define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */ |
| 50 | #define RIO_PEF_ADDR_50 0x00000002 /* [I] 50 bits */ | 52 | #define RIO_PEF_ADDR_50 0x00000002 /* [I] 50 bits */ |
| @@ -194,70 +196,101 @@ | |||
| 194 | #define RIO_GET_BLOCK_ID(x) (x & RIO_EFB_ID_MASK) | 196 | #define RIO_GET_BLOCK_ID(x) (x & RIO_EFB_ID_MASK) |
| 195 | 197 | ||
| 196 | /* Extended Feature Block IDs */ | 198 | /* Extended Feature Block IDs */ |
| 197 | #define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */ | 199 | #define RIO_EFB_SER_EP_M1_ID 0x0001 /* [VI] LP-Serial EP Devices, Map I */ |
| 198 | #define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */ | 200 | #define RIO_EFB_SER_EP_SW_M1_ID 0x0002 /* [VI] LP-Serial EP w SW Recovery Devices, Map I */ |
| 199 | #define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */ | 201 | #define RIO_EFB_SER_EPF_M1_ID 0x0003 /* [VI] LP-Serial EP Free Devices, Map I */ |
| 200 | #define RIO_EFB_SER_EP_ID_V13P 0x0001 /* [VI] LP/Serial EP Devices, RapidIO Spec ver 1.3 and above */ | 202 | #define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP-Serial EP Devices, RIO 1.2 */ |
| 201 | #define RIO_EFB_SER_EP_REC_ID_V13P 0x0002 /* [VI] LP/Serial EP Recovery Devices, RapidIO Spec ver 1.3 and above */ | 203 | #define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP-Serial EP w SW Recovery Devices, RIO 1.2 */ |
| 202 | #define RIO_EFB_SER_EP_FREE_ID_V13P 0x0003 /* [VI] LP/Serial EP Free Devices, RapidIO Spec ver 1.3 and above */ | 204 | #define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP-Serial EP Free Devices, RIO 1.2 */ |
| 203 | #define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */ | ||
| 204 | #define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */ | ||
| 205 | #define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */ | ||
| 206 | #define RIO_EFB_SER_EP_FREC_ID 0x0009 /* [VI] LP/Serial EP Free Recovery Devices */ | ||
| 207 | #define RIO_EFB_ERR_MGMNT 0x0007 /* [VIII] Error Management Extensions */ | 205 | #define RIO_EFB_ERR_MGMNT 0x0007 /* [VIII] Error Management Extensions */ |
| 206 | #define RIO_EFB_SER_EPF_SW_M1_ID 0x0009 /* [VI] LP-Serial EP Free w SW Recovery Devices, Map I */ | ||
| 207 | #define RIO_EFB_SW_ROUTING_TBL 0x000E /* [III] Switch Routing Table Block */ | ||
| 208 | #define RIO_EFB_SER_EP_M2_ID 0x0011 /* [VI] LP-Serial EP Devices, Map II */ | ||
| 209 | #define RIO_EFB_SER_EP_SW_M2_ID 0x0012 /* [VI] LP-Serial EP w SW Recovery Devices, Map II */ | ||
| 210 | #define RIO_EFB_SER_EPF_M2_ID 0x0013 /* [VI] LP-Serial EP Free Devices, Map II */ | ||
| 211 | #define RIO_EFB_ERR_MGMNT_HS 0x0017 /* [VIII] Error Management Extensions, Hot-Swap only */ | ||
| 212 | #define RIO_EFB_SER_EPF_SW_M2_ID 0x0019 /* [VI] LP-Serial EP Free w SW Recovery Devices, Map II */ | ||
| 208 | 213 | ||
| 209 | /* | 214 | /* |
| 210 | * Physical 8/16 LP-LVDS | 215 | * Physical LP-Serial Registers Definitions |
| 211 | * ID=0x0001, Generic End Point Devices | 216 | * Parameters in register macros: |
| 212 | * ID=0x0002, Generic End Point Devices, software assisted recovery option | 217 | * n - port number, m - Register Map Type (1 or 2) |
| 213 | * ID=0x0003, Generic End Point Free Devices | ||
| 214 | * | ||
| 215 | * Physical LP-Serial | ||
| 216 | * ID=0x0004, Generic End Point Devices | ||
| 217 | * ID=0x0005, Generic End Point Devices, software assisted recovery option | ||
| 218 | * ID=0x0006, Generic End Point Free Devices | ||
| 219 | */ | 218 | */ |
| 220 | #define RIO_PORT_MNT_HEADER 0x0000 | 219 | #define RIO_PORT_MNT_HEADER 0x0000 |
| 221 | #define RIO_PORT_REQ_CTL_CSR 0x0020 | 220 | #define RIO_PORT_REQ_CTL_CSR 0x0020 |
| 222 | #define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */ | 221 | #define RIO_PORT_RSP_CTL_CSR 0x0024 |
| 223 | #define RIO_PORT_LINKTO_CTL_CSR 0x0020 /* Serial */ | 222 | #define RIO_PORT_LINKTO_CTL_CSR 0x0020 |
| 224 | #define RIO_PORT_RSPTO_CTL_CSR 0x0024 /* Serial */ | 223 | #define RIO_PORT_RSPTO_CTL_CSR 0x0024 |
| 225 | #define RIO_PORT_GEN_CTL_CSR 0x003c | 224 | #define RIO_PORT_GEN_CTL_CSR 0x003c |
| 226 | #define RIO_PORT_GEN_HOST 0x80000000 | 225 | #define RIO_PORT_GEN_HOST 0x80000000 |
| 227 | #define RIO_PORT_GEN_MASTER 0x40000000 | 226 | #define RIO_PORT_GEN_MASTER 0x40000000 |
| 228 | #define RIO_PORT_GEN_DISCOVERED 0x20000000 | 227 | #define RIO_PORT_GEN_DISCOVERED 0x20000000 |
| 229 | #define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */ | 228 | #define RIO_PORT_N_MNT_REQ_CSR(n, m) (0x40 + (n) * (0x20 * (m))) |
| 230 | #define RIO_MNT_REQ_CMD_RD 0x03 /* Reset-device command */ | 229 | #define RIO_MNT_REQ_CMD_RD 0x03 /* Reset-device command */ |
| 231 | #define RIO_MNT_REQ_CMD_IS 0x04 /* Input-status command */ | 230 | #define RIO_MNT_REQ_CMD_IS 0x04 /* Input-status command */ |
| 232 | #define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */ | 231 | #define RIO_PORT_N_MNT_RSP_CSR(n, m) (0x44 + (n) * (0x20 * (m))) |
| 233 | #define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */ | 232 | #define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */ |
| 234 | #define RIO_PORT_N_MNT_RSP_ASTAT 0x000007e0 /* ackID Status */ | 233 | #define RIO_PORT_N_MNT_RSP_ASTAT 0x000007e0 /* ackID Status */ |
| 235 | #define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */ | 234 | #define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */ |
| 236 | #define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */ | 235 | #define RIO_PORT_N_ACK_STS_CSR(n) (0x48 + (n) * 0x20) /* Only in RM-I */ |
| 237 | #define RIO_PORT_N_ACK_CLEAR 0x80000000 | 236 | #define RIO_PORT_N_ACK_CLEAR 0x80000000 |
| 238 | #define RIO_PORT_N_ACK_INBOUND 0x3f000000 | 237 | #define RIO_PORT_N_ACK_INBOUND 0x3f000000 |
| 239 | #define RIO_PORT_N_ACK_OUTSTAND 0x00003f00 | 238 | #define RIO_PORT_N_ACK_OUTSTAND 0x00003f00 |
| 240 | #define RIO_PORT_N_ACK_OUTBOUND 0x0000003f | 239 | #define RIO_PORT_N_ACK_OUTBOUND 0x0000003f |
| 241 | #define RIO_PORT_N_CTL2_CSR(x) (0x0054 + x*0x20) | 240 | #define RIO_PORT_N_CTL2_CSR(n, m) (0x54 + (n) * (0x20 * (m))) |
| 242 | #define RIO_PORT_N_CTL2_SEL_BAUD 0xf0000000 | 241 | #define RIO_PORT_N_CTL2_SEL_BAUD 0xf0000000 |
| 243 | #define RIO_PORT_N_ERR_STS_CSR(x) (0x0058 + x*0x20) | 242 | #define RIO_PORT_N_ERR_STS_CSR(n, m) (0x58 + (n) * (0x20 * (m))) |
| 244 | #define RIO_PORT_N_ERR_STS_PW_OUT_ES 0x00010000 /* Output Error-stopped */ | 243 | #define RIO_PORT_N_ERR_STS_OUT_ES 0x00010000 /* Output Error-stopped */ |
| 245 | #define RIO_PORT_N_ERR_STS_PW_INP_ES 0x00000100 /* Input Error-stopped */ | 244 | #define RIO_PORT_N_ERR_STS_INP_ES 0x00000100 /* Input Error-stopped */ |
| 246 | #define RIO_PORT_N_ERR_STS_PW_PEND 0x00000010 /* Port-Write Pending */ | 245 | #define RIO_PORT_N_ERR_STS_PW_PEND 0x00000010 /* Port-Write Pending */ |
| 246 | #define RIO_PORT_N_ERR_STS_PORT_UA 0x00000008 /* Port Unavailable */ | ||
| 247 | #define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004 | 247 | #define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004 |
| 248 | #define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002 | 248 | #define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002 |
| 249 | #define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001 | 249 | #define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001 |
| 250 | #define RIO_PORT_N_CTL_CSR(x) (0x005c + x*0x20) | 250 | #define RIO_PORT_N_CTL_CSR(n, m) (0x5c + (n) * (0x20 * (m))) |
| 251 | #define RIO_PORT_N_CTL_PWIDTH 0xc0000000 | 251 | #define RIO_PORT_N_CTL_PWIDTH 0xc0000000 |
| 252 | #define RIO_PORT_N_CTL_PWIDTH_1 0x00000000 | 252 | #define RIO_PORT_N_CTL_PWIDTH_1 0x00000000 |
| 253 | #define RIO_PORT_N_CTL_PWIDTH_4 0x40000000 | 253 | #define RIO_PORT_N_CTL_PWIDTH_4 0x40000000 |
| 254 | #define RIO_PORT_N_CTL_IPW 0x38000000 /* Initialized Port Width */ | 254 | #define RIO_PORT_N_CTL_IPW 0x38000000 /* Initialized Port Width */ |
| 255 | #define RIO_PORT_N_CTL_P_TYP_SER 0x00000001 | 255 | #define RIO_PORT_N_CTL_P_TYP_SER 0x00000001 |
| 256 | #define RIO_PORT_N_CTL_LOCKOUT 0x00000002 | 256 | #define RIO_PORT_N_CTL_LOCKOUT 0x00000002 |
| 257 | #define RIO_PORT_N_CTL_EN_RX_SER 0x00200000 | 257 | #define RIO_PORT_N_CTL_EN_RX 0x00200000 |
| 258 | #define RIO_PORT_N_CTL_EN_TX_SER 0x00400000 | 258 | #define RIO_PORT_N_CTL_EN_TX 0x00400000 |
| 259 | #define RIO_PORT_N_CTL_EN_RX_PAR 0x08000000 | 259 | #define RIO_PORT_N_OB_ACK_CSR(n) (0x60 + (n) * 0x40) /* Only in RM-II */ |
| 260 | #define RIO_PORT_N_CTL_EN_TX_PAR 0x40000000 | 260 | #define RIO_PORT_N_OB_ACK_CLEAR 0x80000000 |
| 261 | #define RIO_PORT_N_OB_ACK_OUTSTD 0x00fff000 | ||
| 262 | #define RIO_PORT_N_OB_ACK_OUTBND 0x00000fff | ||
| 263 | #define RIO_PORT_N_IB_ACK_CSR(n) (0x64 + (n) * 0x40) /* Only in RM-II */ | ||
| 264 | #define RIO_PORT_N_IB_ACK_INBND 0x00000fff | ||
| 265 | |||
| 266 | /* | ||
| 267 | * Device-based helper macros for serial port register access. | ||
| 268 | * d - pointer to rapidio device object, n - port number | ||
| 269 | */ | ||
| 270 | |||
| 271 | #define RIO_DEV_PORT_N_MNT_REQ_CSR(d, n) \ | ||
| 272 | (d->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(n, d->phys_rmap)) | ||
| 273 | |||
| 274 | #define RIO_DEV_PORT_N_MNT_RSP_CSR(d, n) \ | ||
| 275 | (d->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(n, d->phys_rmap)) | ||
| 276 | |||
| 277 | #define RIO_DEV_PORT_N_ACK_STS_CSR(d, n) \ | ||
| 278 | (d->phys_efptr + RIO_PORT_N_ACK_STS_CSR(n)) | ||
| 279 | |||
| 280 | #define RIO_DEV_PORT_N_CTL2_CSR(d, n) \ | ||
| 281 | (d->phys_efptr + RIO_PORT_N_CTL2_CSR(n, d->phys_rmap)) | ||
| 282 | |||
| 283 | #define RIO_DEV_PORT_N_ERR_STS_CSR(d, n) \ | ||
| 284 | (d->phys_efptr + RIO_PORT_N_ERR_STS_CSR(n, d->phys_rmap)) | ||
| 285 | |||
| 286 | #define RIO_DEV_PORT_N_CTL_CSR(d, n) \ | ||
| 287 | (d->phys_efptr + RIO_PORT_N_CTL_CSR(n, d->phys_rmap)) | ||
| 288 | |||
| 289 | #define RIO_DEV_PORT_N_OB_ACK_CSR(d, n) \ | ||
| 290 | (d->phys_efptr + RIO_PORT_N_OB_ACK_CSR(n)) | ||
| 291 | |||
| 292 | #define RIO_DEV_PORT_N_IB_ACK_CSR(d, n) \ | ||
| 293 | (d->phys_efptr + RIO_PORT_N_IB_ACK_CSR(n)) | ||
| 261 | 294 | ||
| 262 | /* | 295 | /* |
| 263 | * Error Management Extensions (RapidIO 1.3+, Part 8) | 296 | * Error Management Extensions (RapidIO 1.3+, Part 8) |
| @@ -268,6 +301,7 @@ | |||
| 268 | /* General EM Registers (Common for all Ports) */ | 301 | /* General EM Registers (Common for all Ports) */ |
| 269 | 302 | ||
| 270 | #define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */ | 303 | #define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */ |
| 304 | #define RIO_EM_EMHS_CAR 0x004 /* EM Functionality CAR */ | ||
| 271 | #define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */ | 305 | #define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */ |
| 272 | #define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */ | 306 | #define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */ |
| 273 | #define REM_LTL_ERR_ILLTRAN 0x08000000 /* Illegal Transaction decode */ | 307 | #define REM_LTL_ERR_ILLTRAN 0x08000000 /* Illegal Transaction decode */ |
| @@ -278,15 +312,33 @@ | |||
| 278 | #define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */ | 312 | #define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */ |
| 279 | #define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */ | 313 | #define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */ |
| 280 | #define RIO_EM_LTL_CTRL_CAP 0x01c /* Logical/Transport Layer Control Capture CSR */ | 314 | #define RIO_EM_LTL_CTRL_CAP 0x01c /* Logical/Transport Layer Control Capture CSR */ |
| 315 | #define RIO_EM_LTL_DID32_CAP 0x020 /* Logical/Transport Layer Dev32 DestID Capture CSR */ | ||
| 316 | #define RIO_EM_LTL_SID32_CAP 0x024 /* Logical/Transport Layer Dev32 source ID Capture CSR */ | ||
| 281 | #define RIO_EM_PW_TGT_DEVID 0x028 /* Port-write Target deviceID CSR */ | 317 | #define RIO_EM_PW_TGT_DEVID 0x028 /* Port-write Target deviceID CSR */ |
| 318 | #define RIO_EM_PW_TGT_DEVID_D16M 0xff000000 /* Port-write Target DID16 MSB */ | ||
| 319 | #define RIO_EM_PW_TGT_DEVID_D8 0x00ff0000 /* Port-write Target DID16 LSB or DID8 */ | ||
| 320 | #define RIO_EM_PW_TGT_DEVID_DEV16 0x00008000 /* Port-write Target DID16 LSB or DID8 */ | ||
| 321 | #define RIO_EM_PW_TGT_DEVID_DEV32 0x00004000 /* Port-write Target DID16 LSB or DID8 */ | ||
| 282 | #define RIO_EM_PKT_TTL 0x02c /* Packet Time-to-live CSR */ | 322 | #define RIO_EM_PKT_TTL 0x02c /* Packet Time-to-live CSR */ |
| 323 | #define RIO_EM_PKT_TTL_VAL 0xffff0000 /* Packet Time-to-live value */ | ||
| 324 | #define RIO_EM_PW_TGT32_DEVID 0x030 /* Port-write Dev32 Target deviceID CSR */ | ||
| 325 | #define RIO_EM_PW_TX_CTRL 0x034 /* Port-write Transmission Control CSR */ | ||
| 326 | #define RIO_EM_PW_TX_CTRL_PW_DIS 0x00000001 /* Port-write Transmission Disable bit */ | ||
| 283 | 327 | ||
| 284 | /* Per-Port EM Registers */ | 328 | /* Per-Port EM Registers */ |
| 285 | 329 | ||
| 286 | #define RIO_EM_PN_ERR_DETECT(x) (0x040 + x*0x40) /* Port N Error Detect CSR */ | 330 | #define RIO_EM_PN_ERR_DETECT(x) (0x040 + x*0x40) /* Port N Error Detect CSR */ |
| 287 | #define REM_PED_IMPL_SPEC 0x80000000 | 331 | #define REM_PED_IMPL_SPEC 0x80000000 |
| 332 | #define REM_PED_LINK_OK2U 0x40000000 /* Link OK to Uninit transition */ | ||
| 333 | #define REM_PED_LINK_UPDA 0x20000000 /* Link Uninit Packet Discard Active */ | ||
| 334 | #define REM_PED_LINK_U2OK 0x10000000 /* Link Uninit to OK transition */ | ||
| 288 | #define REM_PED_LINK_TO 0x00000001 | 335 | #define REM_PED_LINK_TO 0x00000001 |
| 336 | |||
| 289 | #define RIO_EM_PN_ERRRATE_EN(x) (0x044 + x*0x40) /* Port N Error Rate Enable CSR */ | 337 | #define RIO_EM_PN_ERRRATE_EN(x) (0x044 + x*0x40) /* Port N Error Rate Enable CSR */ |
| 338 | #define RIO_EM_PN_ERRRATE_EN_OK2U 0x40000000 /* Enable notification for OK2U */ | ||
| 339 | #define RIO_EM_PN_ERRRATE_EN_UPDA 0x20000000 /* Enable notification for UPDA */ | ||
| 340 | #define RIO_EM_PN_ERRRATE_EN_U2OK 0x10000000 /* Enable notification for U2OK */ | ||
| 341 | |||
| 290 | #define RIO_EM_PN_ATTRIB_CAP(x) (0x048 + x*0x40) /* Port N Attributes Capture CSR */ | 342 | #define RIO_EM_PN_ATTRIB_CAP(x) (0x048 + x*0x40) /* Port N Attributes Capture CSR */ |
| 291 | #define RIO_EM_PN_PKT_CAP_0(x) (0x04c + x*0x40) /* Port N Packet/Control Symbol Capture 0 CSR */ | 343 | #define RIO_EM_PN_PKT_CAP_0(x) (0x04c + x*0x40) /* Port N Packet/Control Symbol Capture 0 CSR */ |
| 292 | #define RIO_EM_PN_PKT_CAP_1(x) (0x050 + x*0x40) /* Port N Packet Capture 1 CSR */ | 344 | #define RIO_EM_PN_PKT_CAP_1(x) (0x050 + x*0x40) /* Port N Packet Capture 1 CSR */ |
| @@ -294,5 +346,50 @@ | |||
| 294 | #define RIO_EM_PN_PKT_CAP_3(x) (0x058 + x*0x40) /* Port N Packet Capture 3 CSR */ | 346 | #define RIO_EM_PN_PKT_CAP_3(x) (0x058 + x*0x40) /* Port N Packet Capture 3 CSR */ |
| 295 | #define RIO_EM_PN_ERRRATE(x) (0x068 + x*0x40) /* Port N Error Rate CSR */ | 347 | #define RIO_EM_PN_ERRRATE(x) (0x068 + x*0x40) /* Port N Error Rate CSR */ |
| 296 | #define RIO_EM_PN_ERRRATE_TR(x) (0x06c + x*0x40) /* Port N Error Rate Threshold CSR */ | 348 | #define RIO_EM_PN_ERRRATE_TR(x) (0x06c + x*0x40) /* Port N Error Rate Threshold CSR */ |
| 349 | #define RIO_EM_PN_LINK_UDT(x) (0x070 + x*0x40) /* Port N Link Uninit Discard Timer CSR */ | ||
| 350 | #define RIO_EM_PN_LINK_UDT_TO 0xffffff00 /* Link Uninit Timeout value */ | ||
| 351 | |||
| 352 | /* | ||
| 353 | * Switch Routing Table Register Block ID=0x000E (RapidIO 3.0+, part 3) | ||
| 354 | * Register offsets are defined from beginning of the block. | ||
| 355 | */ | ||
| 356 | |||
| 357 | /* Broadcast Routing Table Control CSR */ | ||
| 358 | #define RIO_BC_RT_CTL_CSR 0x020 | ||
| 359 | #define RIO_RT_CTL_THREE_LVL 0x80000000 | ||
| 360 | #define RIO_RT_CTL_DEV32_RT_CTRL 0x40000000 | ||
| 361 | #define RIO_RT_CTL_MC_MASK_SZ 0x03000000 /* 3.0+ Part 11: Multicast */ | ||
| 362 | |||
| 363 | /* Broadcast Level 0 Info CSR */ | ||
| 364 | #define RIO_BC_RT_LVL0_INFO_CSR 0x030 | ||
| 365 | #define RIO_RT_L0I_NUM_GR 0xff000000 | ||
| 366 | #define RIO_RT_L0I_GR_PTR 0x00fffc00 | ||
| 367 | |||
| 368 | /* Broadcast Level 1 Info CSR */ | ||
| 369 | #define RIO_BC_RT_LVL1_INFO_CSR 0x034 | ||
| 370 | #define RIO_RT_L1I_NUM_GR 0xff000000 | ||
| 371 | #define RIO_RT_L1I_GR_PTR 0x00fffc00 | ||
| 372 | |||
| 373 | /* Broadcast Level 2 Info CSR */ | ||
| 374 | #define RIO_BC_RT_LVL2_INFO_CSR 0x038 | ||
| 375 | #define RIO_RT_L2I_NUM_GR 0xff000000 | ||
| 376 | #define RIO_RT_L2I_GR_PTR 0x00fffc00 | ||
| 377 | |||
| 378 | /* Per-Port Routing Table registers. | ||
| 379 | * Register fields defined in the broadcast section above are | ||
| 380 | * applicable to the corresponding registers below. | ||
| 381 | */ | ||
| 382 | #define RIO_SPx_RT_CTL_CSR(x) (0x040 + (0x20 * x)) | ||
| 383 | #define RIO_SPx_RT_LVL0_INFO_CSR(x) (0x50 + (0x20 * x)) | ||
| 384 | #define RIO_SPx_RT_LVL1_INFO_CSR(x) (0x54 + (0x20 * x)) | ||
| 385 | #define RIO_SPx_RT_LVL2_INFO_CSR(x) (0x58 + (0x20 * x)) | ||
| 386 | |||
| 387 | /* Register Formats for Routing Table Group entry. | ||
| 388 | * Register offsets are calculated using GR_PTR field in the corresponding | ||
| 389 | * table Level_N and group/entry numbers (see RapidIO 3.0+ Part 3). | ||
| 390 | */ | ||
| 391 | #define RIO_RT_Ln_ENTRY_IMPL_DEF 0xf0000000 | ||
| 392 | #define RIO_RT_Ln_ENTRY_RTE_VAL 0x000003ff | ||
| 393 | #define RIO_RT_ENTRY_DROP_PKT 0x300 | ||
| 297 | 394 | ||
| 298 | #endif /* LINUX_RIO_REGS_H */ | 395 | #endif /* LINUX_RIO_REGS_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 553af2923824..62c68e513e39 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -1547,6 +1547,9 @@ struct task_struct { | |||
| 1547 | /* unserialized, strictly 'current' */ | 1547 | /* unserialized, strictly 'current' */ |
| 1548 | unsigned in_execve:1; /* bit to tell LSMs we're in execve */ | 1548 | unsigned in_execve:1; /* bit to tell LSMs we're in execve */ |
| 1549 | unsigned in_iowait:1; | 1549 | unsigned in_iowait:1; |
| 1550 | #if !defined(TIF_RESTORE_SIGMASK) | ||
| 1551 | unsigned restore_sigmask:1; | ||
| 1552 | #endif | ||
| 1550 | #ifdef CONFIG_MEMCG | 1553 | #ifdef CONFIG_MEMCG |
| 1551 | unsigned memcg_may_oom:1; | 1554 | unsigned memcg_may_oom:1; |
| 1552 | #ifndef CONFIG_SLOB | 1555 | #ifndef CONFIG_SLOB |
| @@ -2680,6 +2683,66 @@ extern void sigqueue_free(struct sigqueue *); | |||
| 2680 | extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); | 2683 | extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); |
| 2681 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); | 2684 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); |
| 2682 | 2685 | ||
| 2686 | #ifdef TIF_RESTORE_SIGMASK | ||
| 2687 | /* | ||
| 2688 | * Legacy restore_sigmask accessors. These are inefficient on | ||
| 2689 | * SMP architectures because they require atomic operations. | ||
| 2690 | */ | ||
| 2691 | |||
| 2692 | /** | ||
| 2693 | * set_restore_sigmask() - make sure saved_sigmask processing gets done | ||
| 2694 | * | ||
| 2695 | * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code | ||
| 2696 | * will run before returning to user mode, to process the flag. For | ||
| 2697 | * all callers, TIF_SIGPENDING is already set or it's no harm to set | ||
| 2698 | * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the | ||
| 2699 | * arch code will notice on return to user mode, in case those bits | ||
| 2700 | * are scarce. We set TIF_SIGPENDING here to ensure that the arch | ||
| 2701 | * signal code always gets run when TIF_RESTORE_SIGMASK is set. | ||
| 2702 | */ | ||
| 2703 | static inline void set_restore_sigmask(void) | ||
| 2704 | { | ||
| 2705 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 2706 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); | ||
| 2707 | } | ||
| 2708 | static inline void clear_restore_sigmask(void) | ||
| 2709 | { | ||
| 2710 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 2711 | } | ||
| 2712 | static inline bool test_restore_sigmask(void) | ||
| 2713 | { | ||
| 2714 | return test_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 2715 | } | ||
| 2716 | static inline bool test_and_clear_restore_sigmask(void) | ||
| 2717 | { | ||
| 2718 | return test_and_clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 2719 | } | ||
| 2720 | |||
| 2721 | #else /* TIF_RESTORE_SIGMASK */ | ||
| 2722 | |||
| 2723 | /* Higher-quality implementation, used if TIF_RESTORE_SIGMASK doesn't exist. */ | ||
| 2724 | static inline void set_restore_sigmask(void) | ||
| 2725 | { | ||
| 2726 | current->restore_sigmask = true; | ||
| 2727 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); | ||
| 2728 | } | ||
| 2729 | static inline void clear_restore_sigmask(void) | ||
| 2730 | { | ||
| 2731 | current->restore_sigmask = false; | ||
| 2732 | } | ||
| 2733 | static inline bool test_restore_sigmask(void) | ||
| 2734 | { | ||
| 2735 | return current->restore_sigmask; | ||
| 2736 | } | ||
| 2737 | static inline bool test_and_clear_restore_sigmask(void) | ||
| 2738 | { | ||
| 2739 | if (!current->restore_sigmask) | ||
| 2740 | return false; | ||
| 2741 | current->restore_sigmask = false; | ||
| 2742 | return true; | ||
| 2743 | } | ||
| 2744 | #endif | ||
| 2745 | |||
| 2683 | static inline void restore_saved_sigmask(void) | 2746 | static inline void restore_saved_sigmask(void) |
| 2684 | { | 2747 | { |
| 2685 | if (test_and_clear_restore_sigmask()) | 2748 | if (test_and_clear_restore_sigmask()) |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index fa7bc29925c9..697e160c78d0 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <uapi/linux/sysctl.h> | 28 | #include <uapi/linux/sysctl.h> |
| 29 | 29 | ||
| 30 | /* For the /proc/sys support */ | 30 | /* For the /proc/sys support */ |
| 31 | struct completion; | ||
| 31 | struct ctl_table; | 32 | struct ctl_table; |
| 32 | struct nsproxy; | 33 | struct nsproxy; |
| 33 | struct ctl_table_root; | 34 | struct ctl_table_root; |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index b4c2a485b28a..352b1542f5cc 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
| @@ -105,47 +105,6 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) | |||
| 105 | 105 | ||
| 106 | #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) | 106 | #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) |
| 107 | 107 | ||
| 108 | #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK | ||
| 109 | /* | ||
| 110 | * An arch can define its own version of set_restore_sigmask() to get the | ||
| 111 | * job done however works, with or without TIF_RESTORE_SIGMASK. | ||
| 112 | */ | ||
| 113 | #define HAVE_SET_RESTORE_SIGMASK 1 | ||
| 114 | |||
| 115 | /** | ||
| 116 | * set_restore_sigmask() - make sure saved_sigmask processing gets done | ||
| 117 | * | ||
| 118 | * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code | ||
| 119 | * will run before returning to user mode, to process the flag. For | ||
| 120 | * all callers, TIF_SIGPENDING is already set or it's no harm to set | ||
| 121 | * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the | ||
| 122 | * arch code will notice on return to user mode, in case those bits | ||
| 123 | * are scarce. We set TIF_SIGPENDING here to ensure that the arch | ||
| 124 | * signal code always gets run when TIF_RESTORE_SIGMASK is set. | ||
| 125 | */ | ||
| 126 | static inline void set_restore_sigmask(void) | ||
| 127 | { | ||
| 128 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 129 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); | ||
| 130 | } | ||
| 131 | static inline void clear_restore_sigmask(void) | ||
| 132 | { | ||
| 133 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 134 | } | ||
| 135 | static inline bool test_restore_sigmask(void) | ||
| 136 | { | ||
| 137 | return test_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 138 | } | ||
| 139 | static inline bool test_and_clear_restore_sigmask(void) | ||
| 140 | { | ||
| 141 | return test_and_clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 142 | } | ||
| 143 | #endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */ | ||
| 144 | |||
| 145 | #ifndef HAVE_SET_RESTORE_SIGMASK | ||
| 146 | #error "no set_restore_sigmask() provided and default one won't work" | ||
| 147 | #endif | ||
| 148 | |||
| 149 | #endif /* __KERNEL__ */ | 108 | #endif /* __KERNEL__ */ |
| 150 | 109 | ||
| 151 | #endif /* _LINUX_THREAD_INFO_H */ | 110 | #endif /* _LINUX_THREAD_INFO_H */ |
