From: Joe Perches <joe@perches.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 13/14] kernel.h: Kernel address utility aggregation and other neatening
Date: Wed, 16 Dec 2009 00:09:12 -0800 [thread overview]
Message-ID: <944beaa0ec67ae4eed36fb70b1f0b9cef3859ede.1260949674.git.joe@perches.com> (raw)
In-Reply-To: <cover.1260949674.git.joe@perches.com>
Group the address utilities
Move upper_32_bits and lower_32_bits to math and limits group
Add a few new group headers
panic and oops
shutdown
string parsing
sysinfo
Signed-off-by: Joe Perches <joe@perches.com>
---
include/linux/kernel.h | 69 +++++++++++++++++++++++++++++++----------------
1 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7d7f7e2..0fd5949 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -32,8 +32,6 @@
#define LLONG_MIN (-LLONG_MAX - 1)
#define ULLONG_MAX (~0ULL)
-#define STACK_MAGIC 0xdeadbeef
-
#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1)
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
@@ -51,9 +49,6 @@
(((x) + ((__divisor) / 2)) / (__divisor)); \
})
-#define _RET_IP_ (unsigned long)__builtin_return_address(0)
-#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
-
#ifdef CONFIG_LBDAF
# include <asm/div64.h>
# define sector_div(a, b) do_div(a, b)
@@ -67,22 +62,6 @@
})
#endif
-/**
- * upper_32_bits - return bits 32-63 of a number
- * @n: the number we're accessing
- *
- * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress
- * the "right shift count >= width of type" warning when that quantity is
- * 32-bits.
- */
-#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
-
-/**
- * lower_32_bits - return bits 0-31 of a number
- * @n: the number we're accessing
- */
-#define lower_32_bits(n) ((u32)(n))
-
struct completion;
struct pt_regs;
struct user;
@@ -124,6 +103,9 @@ static inline void might_fault(void)
}
#endif
+/*
+ * panic and oops support
+ */
extern struct atomic_notifier_head panic_notifier_list;
extern long (*panic_blink)(long time);
extern void panic(const char *fmt, ...)
@@ -131,6 +113,10 @@ extern void panic(const char *fmt, ...)
extern void oops_enter(void);
extern void oops_exit(void);
extern int oops_may_print(void);
+
+/*
+ * shutdown support
+ */
extern void do_exit(long code)
__attribute__ ((noreturn));
extern void complete_and_exit(struct completion *comp, long code)
@@ -176,15 +162,28 @@ extern int sscanf(const char *buf, const char *fmt, ...)
extern int vsscanf(const char *buf, const char *fmt, va_list)
__attribute__ ((format (scanf, 2, 0)));
+/*
+ * String parsing
+ */
extern int get_option(char **str, int *pint);
extern char *get_options(const char *str, int nints, int *ints);
extern unsigned long long memparse(const char *ptr, char **retptr);
+ /*parse a string with mem suffixes into a number */
+/*
+ * Kernel address utils
+ */
extern int core_kernel_text(unsigned long addr);
extern int __kernel_text_address(unsigned long addr);
extern int kernel_text_address(unsigned long addr);
extern int func_ptr_is_kernel_text(void *ptr);
+#define _RET_IP_ (unsigned long)__builtin_return_address(0)
+#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
+#define STACK_MAGIC 0xdeadbeef
+/*
+ * Process ID and process group
+ */
struct pid;
extern struct pid *session_of_pgrp(struct pid *pgrp);
@@ -221,6 +220,9 @@ extern int panic_on_unrecovered_nmi;
extern int panic_on_io_nmi;
extern int root_mountflags;
+/*
+ * Hex to ascii helpers
+ */
extern const char hex_asc[];
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -244,6 +246,22 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
unsigned long int_sqrt(unsigned long);
+/**
+ * upper_32_bits - return bits 32-63 of a number
+ * @n: the number we're accessing
+ *
+ * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress
+ * the "right shift count >= width of type" warning when that quantity is
+ * 32-bits.
+ */
+#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
+
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n) ((u32)(n))
+
/*
* min()/max()/clamp() macros that also do
* strict type-checking.. See the
@@ -362,9 +380,6 @@ unsigned long int_sqrt(unsigned long);
(type *)((char *)__mptr - offsetof(type, member)); \
})
-struct sysinfo;
-extern int do_sysinfo(struct sysinfo *info);
-
/*
* Console and logging support
*/
@@ -776,6 +791,12 @@ ftrace_vprintk(const char *fmt, va_list ap)
static inline void ftrace_dump(void) { }
#endif /* CONFIG_TRACING */
+/*
+ * sysinfo support
+ */
+struct sysinfo;
+extern int do_sysinfo(struct sysinfo *info);
+
#endif /* __KERNEL__ */
#ifndef __EXPORTED_HEADERS__
--
1.6.6.rc0.57.gad7a
next prev parent reply other threads:[~2009-12-16 8:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-16 8:08 [PATCH 00/14] kernel.h cleanups Joe Perches
2009-12-16 8:09 ` [PATCH 01/14] kernel.h: Consolidate console and logging functions and defines Joe Perches
2009-12-16 8:09 ` [PATCH 02/14] kernel.h: Checkpatch cleaning Joe Perches
2009-12-16 8:09 ` [PATCH 03/14] kernel.h: ARRAY_SIZE neatening Joe Perches
2009-12-16 8:09 ` [PATCH 04/14] kernel.h: Add argument names to strtoXX, Xscanf prototypes Joe Perches
2009-12-16 8:09 ` [PATCH 05/14] kernel.h: printk neatening Joe Perches
2009-12-16 8:09 ` [PATCH 06/14] drivers/firmware/iscsi_ibft.c: Use %pI4 to print netmask Joe Perches
2009-12-16 8:09 ` [PATCH 07/14] kernel.h: Move NIPQUAD and NIPQUAD_FMT to in.h Joe Perches
2009-12-16 8:09 ` [PATCH 08/14] kernel.h: Group math and limits functions, indent function args Joe Perches
2009-12-16 8:09 ` [PATCH 09/14] kernel.h: Don't use NORET_AND just use noreturn, instead Joe Perches
2009-12-16 8:09 ` [PATCH 10/14] kernel.h: Remove ATTRIB_NORET, use __attribute__((noreturn)) Joe Perches
2009-12-16 8:09 ` [PATCH 11/14] kernel.h: Remove uses of NORET_TYPE Joe Perches
2009-12-16 8:09 ` [PATCH 12/14] kernel.h: Add pr_<level>_once Joe Perches
2009-12-16 8:09 ` Joe Perches [this message]
2009-12-16 8:09 ` [PATCH 14/14] kernel/exit.c and kernel/panic.c: Remove unused NORET_TYPE Joe Perches
2009-12-16 18:51 ` Peter Zijlstra
2009-12-16 18:53 ` Peter Zijlstra
2009-12-17 20:52 ` [PATCH 00/14] kernel.h cleanups Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=944beaa0ec67ae4eed36fb70b1f0b9cef3859ede.1260949674.git.joe@perches.com \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®