From: Jovi Zhangwei <jovi.zhangwei@gmail.com>
To: Ingo Molnar <mingo@redhat.com>, Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Andi Kleen <andi@firstfloor.org>,
Jovi Zhangwei <jovi.zhangwei@gmail.com>
Subject: [PATCH v2 06/29] ktap: add ktap_arch.h and error header file(include/uapi/ktap/)
Date: Fri, 28 Mar 2014 10:45:01 -0400 [thread overview]
Message-ID: <1396017924-7754-7-git-send-email-jovi.zhangwei@gmail.com> (raw)
In-Reply-To: <1396017924-7754-1-git-send-email-jovi.zhangwei@gmail.com>
Simple arch related definition and error msg definition.
Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
---
include/uapi/ktap/ktap_arch.h | 33 ++++++++++
include/uapi/ktap/ktap_err.h | 11 ++++
include/uapi/ktap/ktap_errmsg.h | 135 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 179 insertions(+)
create mode 100644 include/uapi/ktap/ktap_arch.h
create mode 100644 include/uapi/ktap/ktap_err.h
create mode 100644 include/uapi/ktap/ktap_errmsg.h
diff --git a/include/uapi/ktap/ktap_arch.h b/include/uapi/ktap/ktap_arch.h
new file mode 100644
index 0000000..aeb7036
--- /dev/null
+++ b/include/uapi/ktap/ktap_arch.h
@@ -0,0 +1,33 @@
+#ifndef __KTAP_ARCH__
+#define __KTAP_ARCH__
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+#if defined(__LITTLE_ENDIAN)
+#define KP_LE 1
+#define KP_BE 0
+#define KP_ENDIAN_SELECT(le, be) le
+#elif defined(__BIG_ENDIAN)
+#define KP_LE 0
+#define KP_BE 1
+#define KP_ENDIAN_SELECT(le, be) be
+#endif
+
+#else /* __KERNEL__ */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define KP_LE 1
+#define KP_BE 0
+#define KP_ENDIAN_SELECT(le, be) le
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define KP_LE 0
+#define KP_BE 1
+#define KP_ENDIAN_SELECT(le, be) be
+#else
+#error "could not determine byte order"
+#endif
+
+#endif
+#endif
diff --git a/include/uapi/ktap/ktap_err.h b/include/uapi/ktap/ktap_err.h
new file mode 100644
index 0000000..b7e1a31
--- /dev/null
+++ b/include/uapi/ktap/ktap_err.h
@@ -0,0 +1,11 @@
+#ifndef __KTAP_ERR_H__
+#define __KTAP_ERR_H__
+
+typedef enum {
+#define ERRDEF(name, msg) \
+ KP_ERR_##name, KP_ERR_##name##_ = KP_ERR_##name + sizeof(msg)-1,
+#include "ktap_errmsg.h"
+ KP_ERR__MAX
+} ErrMsg;
+
+#endif
diff --git a/include/uapi/ktap/ktap_errmsg.h b/include/uapi/ktap/ktap_errmsg.h
new file mode 100644
index 0000000..fd7a081
--- /dev/null
+++ b/include/uapi/ktap/ktap_errmsg.h
@@ -0,0 +1,135 @@
+/*
+ * VM error messages.
+ * Copyright (C) 2012-2014 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
+ * Copyright (C) 2005-2014 Mike Pall.
+ */
+
+/* Basic error handling. */
+ERRDEF(ERRMEM, "not enough memory")
+ERRDEF(ERRERR, "error in error handling")
+
+/* Allocations. */
+ERRDEF(STROV, "string length overflow")
+ERRDEF(UDATAOV, "userdata length overflow")
+ERRDEF(STKOV, "stack overflow")
+ERRDEF(STKOVM, "stack overflow (%s)")
+ERRDEF(TABOV, "table overflow")
+
+/* Table indexing. */
+ERRDEF(NANIDX, "table index is NaN")
+ERRDEF(NILIDX, "table index is nil")
+ERRDEF(NEXTIDX, "invalid key to " KTAP_QL("next"))
+
+/* Metamethod resolving. */
+ERRDEF(BADCALL, "attempt to call a %s value")
+ERRDEF(BADOPRT, "attempt to %s %s " KTAP_QS " (a %s value)")
+ERRDEF(BADOPRV, "attempt to %s a %s value")
+ERRDEF(BADCMPT, "attempt to compare %s with %s")
+ERRDEF(BADCMPV, "attempt to compare two %s values")
+ERRDEF(GETLOOP, "loop in gettable")
+ERRDEF(SETLOOP, "loop in settable")
+ERRDEF(OPCALL, "call")
+ERRDEF(OPINDEX, "index")
+ERRDEF(OPARITH, "perform arithmetic on")
+ERRDEF(OPCAT, "concatenate")
+ERRDEF(OPLEN, "get length of")
+
+/* Type checks. */
+ERRDEF(BADSELF, "calling " KTAP_QS " on bad self (%s)")
+ERRDEF(BADARG, "bad argument #%d to " KTAP_QS " (%s)")
+ERRDEF(BADTYPE, "%s expected, got %s")
+ERRDEF(BADVAL, "invalid value")
+ERRDEF(NOVAL, "value expected")
+ERRDEF(NOCORO, "coroutine expected")
+ERRDEF(NOTABN, "nil or table expected")
+ERRDEF(NOLFUNC, "ktap function expected")
+ERRDEF(NOFUNCL, "function or level expected")
+ERRDEF(NOSFT, "string/function/table expected")
+ERRDEF(NOPROXY, "boolean or proxy expected")
+ERRDEF(FORINIT, KTAP_QL("for") " initial value must be a number")
+ERRDEF(FORLIM, KTAP_QL("for") " limit must be a number")
+ERRDEF(FORSTEP, KTAP_QL("for") " step must be a number")
+
+/* C API checks. */
+ERRDEF(NOENV, "no calling environment")
+ERRDEF(CYIELD, "attempt to yield across C-call boundary")
+ERRDEF(BADLU, "bad light userdata pointer")
+
+/* Standard library function errors. */
+ERRDEF(ASSERT, "assertion failed!")
+ERRDEF(PROTMT, "cannot change a protected metatable")
+ERRDEF(UNPACK, "too many results to unpack")
+ERRDEF(RDRSTR, "reader function must return a string")
+ERRDEF(PRTOSTR, KTAP_QL("tostring") " must return a string to " KTAP_QL("print"))
+ERRDEF(IDXRNG, "index out of range")
+ERRDEF(BASERNG, "base out of range")
+ERRDEF(LVLRNG, "level out of range")
+ERRDEF(INVLVL, "invalid level")
+ERRDEF(INVOPT, "invalid option")
+ERRDEF(INVOPTM, "invalid option " KTAP_QS)
+ERRDEF(INVFMT, "invalid format")
+ERRDEF(SETFENV, KTAP_QL("setfenv") " cannot change environment of given object")
+ERRDEF(CORUN, "cannot resume running coroutine")
+ERRDEF(CODEAD, "cannot resume dead coroutine")
+ERRDEF(COSUSP, "cannot resume non-suspended coroutine")
+ERRDEF(TABINS, "wrong number of arguments to " KTAP_QL("insert"))
+ERRDEF(TABCAT, "invalid value (%s) at index %d in table for " KTAP_QL("concat"))
+ERRDEF(TABSORT, "invalid order function for sorting")
+ERRDEF(IOCLFL, "attempt to use a closed file")
+ERRDEF(IOSTDCL, "standard file is closed")
+ERRDEF(OSUNIQF, "unable to generate a unique filename")
+ERRDEF(OSDATEF, "field " KTAP_QS " missing in date table")
+ERRDEF(STRDUMP, "unable to dump given function")
+ERRDEF(STRSLC, "string slice too long")
+ERRDEF(STRPATB, "missing " KTAP_QL("[") " after " KTAP_QL("%f") " in pattern")
+ERRDEF(STRPATC, "invalid pattern capture")
+ERRDEF(STRPATE, "malformed pattern (ends with " KTAP_QL("%") ")")
+ERRDEF(STRPATM, "malformed pattern (missing " KTAP_QL("]") ")")
+ERRDEF(STRPATU, "unbalanced pattern")
+ERRDEF(STRPATX, "pattern too complex")
+ERRDEF(STRCAPI, "invalid capture index")
+ERRDEF(STRCAPN, "too many captures")
+ERRDEF(STRCAPU, "unfinished capture")
+ERRDEF(STRFMT, "invalid option " KTAP_QS " to " KTAP_QL("format"))
+ERRDEF(STRGSRV, "invalid replacement value (a %s)")
+ERRDEF(BADMODN, "name conflict for module " KTAP_QS)
+ERRDEF(JITOPT, "unknown or malformed optimization flag " KTAP_QS)
+
+/* Lexer/parser errors. */
+ERRDEF(XMODE, "attempt to load chunk with wrong mode")
+ERRDEF(XNEAR, "%s near " KTAP_QS)
+ERRDEF(XLINES, "chunk has too many lines")
+ERRDEF(XLEVELS, "chunk has too many syntax levels")
+ERRDEF(XNUMBER, "malformed number")
+ERRDEF(XLSTR, "unfinished long string")
+ERRDEF(XLCOM, "unfinished long comment")
+ERRDEF(XSTR, "unfinished string")
+ERRDEF(XESC, "invalid escape sequence")
+ERRDEF(XLDELIM, "invalid long string delimiter")
+ERRDEF(XTOKEN, KTAP_QS " expected")
+ERRDEF(XJUMP, "control structure too long")
+ERRDEF(XSLOTS, "function or expression too complex")
+ERRDEF(XLIMC, "chunk has more than %d local variables")
+ERRDEF(XLIMM, "main function has more than %d %s")
+ERRDEF(XLIMF, "function at line %d has more than %d %s")
+ERRDEF(XMATCH, KTAP_QS " expected (to close " KTAP_QS " at line %d)")
+ERRDEF(XFIXUP, "function too long for return fixup")
+ERRDEF(XPARAM, "<name> or " KTAP_QL("...") " expected")
+ERRDEF(XAMBIG, "ambiguous syntax (function call x new statement)")
+ERRDEF(XFUNARG, "function arguments expected")
+ERRDEF(XSYMBOL, "unexpected symbol")
+ERRDEF(XDOTS, "cannot use " KTAP_QL("...") " outside a vararg function")
+ERRDEF(XSYNTAX, "syntax error")
+ERRDEF(XFOR, KTAP_QL("=") " or " KTAP_QL("in") " expected")
+ERRDEF(XBREAK, "no loop to break")
+ERRDEF(XLUNDEF, "undefined label " KTAP_QS)
+ERRDEF(XLDUP, "duplicate label " KTAP_QS)
+ERRDEF(XGSCOPE, "<goto %s> jumps into the scope of local " KTAP_QS)
+ERRDEF(XEVENTDEF,"cannot parse eventdef " KTAP_QS)
+
+/* Bytecode reader errors. */
+ERRDEF(BCFMT, "cannot load incompatible bytecode")
+ERRDEF(BCBAD, "cannot load malformed bytecode")
+
+#undef ERRDEF
+
--
1.8.1.4
next prev parent reply other threads:[~2014-03-29 15:34 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 14:44 [RFC PATCH v2 00/29] ktap: A lightweight dynamic tracing tool for Linux Jovi Zhangwei
2014-03-28 14:44 ` [PATCH v2 01/29] ktap: add tools/ktap/README.md file Jovi Zhangwei
2014-03-28 14:44 ` [PATCH v2 02/29] ktap: add ktap tutorial(tools/ktap/doc/tutorial.md) Jovi Zhangwei
2014-03-28 14:44 ` [PATCH v2 03/29] ktap: add sample scripts(tools/ktap/samples/*) Jovi Zhangwei
2014-03-28 14:44 ` [PATCH v2 04/29] ktap: add basic ktap types definition(include/uapi/ktap/ktap_types.h) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 05/29] ktap: add bytecode definition(include/uapi/ktap/ktap_bc.h) Jovi Zhangwei
2014-03-28 14:45 ` Jovi Zhangwei [this message]
2014-03-28 14:45 ` [PATCH v2 07/29] ktap: add kernel module main entry(kernel/trace/ktap/ktap.[c|h]) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 08/29] ktap: add bytecode reader(kernel/trace/ktap/kp_bcread.[c|h]) Jovi Zhangwei
2014-03-30 2:47 ` Andi Kleen
2014-03-30 8:02 ` Jovi Zhangwei
2014-03-30 17:17 ` Andi Kleen
2014-03-31 2:05 ` Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 09/29] ktap: add bytecode execution engine(kernel/trace/ktap/kp_vm.[c|h]) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 10/29] ktap: add string handling code(kernel/trace/ktap/kp_[str|mempool].[c|h]) Jovi Zhangwei
2014-03-30 3:50 ` Andi Kleen
2014-03-30 9:12 ` Jovi Zhangwei
2014-03-30 17:19 ` Andi Kleen
2014-03-31 2:35 ` Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 11/29] ktap: add table handling code(kernel/trace/ktap/kp_tab.[c|h]) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 12/29] ktap: add generic object handling code(kernel/trace/ktap/kp_obj.[c|h]) Jovi Zhangwei
2014-03-30 3:56 ` Andi Kleen
2014-03-30 8:14 ` Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 13/29] ktap: add ring buffer handling code(kernel/trace/ktap/kp_transport.[c|h]) Jovi Zhangwei
2014-03-30 3:58 ` Andi Kleen
2014-03-30 7:40 ` Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 14/29] ktap: add events management(kernel/trace/ktap/kp_events.[c|h]) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 15/29] ktap: add built-in functions and library(kernel/trace/ktap/lib_*.c) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 16/29] ktap: add amalgamation build(kernel/trace/ktap/amalg.c) Jovi Zhangwei
2014-03-31 2:17 ` Li Zefan
2014-03-31 3:22 ` Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 17/29] ktap: add Makefile for kernel module(kernel/trace/ktap/Makefile) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 18/29] ktap: add Kconfig(kernel/trace/ktap/Kconfig) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 19/29] ktap: add main file for ktap binary(tools/ktap/kp_main.c) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 20/29] ktap: add compiler(tools/ktap/kp_[lex|parse].[c|h]) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 21/29] ktap: add symbol handling code(tools/ktap/symbol.[c|h]) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 22/29] ktap: add events parse code(tools/ktap/kp_parse_events.c) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 23/29] ktap: add ring buffer reader(tools/ktap/kp_reader.c) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 24/29] ktap: add bytecode writer(tools/ktap/kp_bcwrite.c) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 25/29] ktap: add userspace util(tools/ktap/kp_util.c) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 26/29] ktap: add userspace binary Makefile(tools/ktap/Makefile) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 27/29] ktap: add testsuite and benchmark(tools/ktap/test/*) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 28/29] ktap: add vim syntax file(tools/ktap/vim/*) Jovi Zhangwei
2014-03-28 14:45 ` [PATCH v2 29/29] ktap: add COPYRIGHT file(tools/ktap/COPYRIGHT) Jovi Zhangwei
2014-03-30 1:00 ` [RFC PATCH v2 00/29] ktap: A lightweight dynamic tracing tool for Linux Andi Kleen
2014-03-30 9:18 ` Jovi Zhangwei
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=1396017924-7754-7-git-send-email-jovi.zhangwei@gmail.com \
--to=jovi.zhangwei@gmail.com \
--cc=andi@firstfloor.org \
--cc=fweisbec@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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®