diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/console_struct.h | 5 | ||||
-rw-r--r-- | include/linux/kernel.h | 12 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 30 | ||||
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | include/linux/slub_def.h | 25 |
5 files changed, 46 insertions, 27 deletions
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index a461f76fb004..dc77fed7b285 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h @@ -9,6 +9,9 @@ * to achieve effects such as fast scrolling by changing the origin. */ +#ifndef _LINUX_CONSOLE_STRUCT_H +#define _LINUX_CONSOLE_STRUCT_H + #include <linux/wait.h> #include <linux/vt.h> #include <linux/workqueue.h> @@ -130,3 +133,5 @@ extern void vc_SAK(struct work_struct *work); #define CUR_DEFAULT CUR_UNDERLINE #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp) + +#endif /* _LINUX_CONSOLE_STRUCT_H */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 45353d757cd0..7a4852505914 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -218,10 +218,14 @@ enum { DUMP_PREFIX_ADDRESS, DUMP_PREFIX_OFFSET }; -extern void hex_dump_to_buffer(const void *buf, size_t len, char *linebuf, - size_t linebuflen); -extern void print_hex_dump(const char *level, int prefix_type, - void *buf, size_t len); +extern void hex_dump_to_buffer(const void *buf, size_t len, + int rowsize, int groupsize, + char *linebuf, size_t linebuflen, bool ascii); +extern void print_hex_dump(const char *level, const char *prefix_str, + int prefix_type, int rowsize, int groupsize, + void *buf, size_t len, bool ascii); +extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, + void *buf, size_t len); #define hex_asc(x) "0123456789abcdef"[x] #ifdef DEBUG diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 8bcbc54e1b48..c8884f971228 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -16,6 +16,21 @@ struct pipe_buffer { unsigned int flags; }; +struct pipe_inode_info { + wait_queue_head_t wait; + unsigned int nrbufs, curbuf; + struct page *tmp_page; + unsigned int readers; + unsigned int writers; + unsigned int waiting_writers; + unsigned int r_counter; + unsigned int w_counter; + struct fasync_struct *fasync_readers; + struct fasync_struct *fasync_writers; + struct inode *inode; + struct pipe_buffer bufs[PIPE_BUFFERS]; +}; + /* * Note on the nesting of these functions: * @@ -38,21 +53,6 @@ struct pipe_buf_operations { void (*get)(struct pipe_inode_info *, struct pipe_buffer *); }; -struct pipe_inode_info { - wait_queue_head_t wait; - unsigned int nrbufs, curbuf; - struct page *tmp_page; - unsigned int readers; - unsigned int writers; - unsigned int waiting_writers; - unsigned int r_counter; - unsigned int w_counter; - struct fasync_struct *fasync_readers; - struct fasync_struct *fasync_writers; - struct inode *inode; - struct pipe_buffer bufs[PIPE_BUFFERS]; -}; - /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ #define PIPE_SIZE PAGE_SIZE diff --git a/include/linux/sched.h b/include/linux/sched.h index d58e74b98367..693f0e6c54d4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1162,6 +1162,7 @@ static inline void put_task_struct(struct task_struct *t) /* Not implemented yet, only for 486*/ #define PF_STARTING 0x00000002 /* being created */ #define PF_EXITING 0x00000004 /* getting shut down */ +#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ #define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ #define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ #define PF_DUMPCORE 0x00000200 /* dumped core */ diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 0764c829d967..a0ad37463d62 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -70,11 +70,8 @@ extern struct kmem_cache kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; */ static inline int kmalloc_index(size_t size) { - /* - * We should return 0 if size == 0 but we use the smallest object - * here for SLAB legacy reasons. - */ - WARN_ON_ONCE(size == 0); + if (!size) + return 0; if (size > KMALLOC_MAX_SIZE) return -1; @@ -153,13 +150,25 @@ static inline struct kmem_cache *kmalloc_slab(size_t size) #define SLUB_DMA 0 #endif + +/* + * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. + * + * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault. + * + * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can. + * Both make kfree a no-op. + */ +#define ZERO_SIZE_PTR ((void *)16) + + static inline void *kmalloc(size_t size, gfp_t flags) { if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) { struct kmem_cache *s = kmalloc_slab(size); if (!s) - return NULL; + return ZERO_SIZE_PTR; return kmem_cache_alloc(s, flags); } else @@ -172,7 +181,7 @@ static inline void *kzalloc(size_t size, gfp_t flags) struct kmem_cache *s = kmalloc_slab(size); if (!s) - return NULL; + return ZERO_SIZE_PTR; return kmem_cache_zalloc(s, flags); } else @@ -188,7 +197,7 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node) struct kmem_cache *s = kmalloc_slab(size); if (!s) - return NULL; + return ZERO_SIZE_PTR; return kmem_cache_alloc_node(s, flags, node); } else |