From: Michael Jeanson Date: Tue, 6 Apr 2021 23:36:31 +0000 (-0400) Subject: Move error.h to 'src/common/' X-Git-Tag: v2.13.0-rc1~116 X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=9c4fe08d87975f3f79227b1b5e7629d52a16b4fc;p=lttng-ust.git Move error.h to 'src/common/' Also rename it to 'err-ptr.h' to mitigate the risk of confusion with the system header . Change-Id: Id86c8fda833c6358326708ccf54d5c35a69d5890 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/Makefile.am b/src/common/Makefile.am index ff2cfd71..209364d0 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -14,6 +14,7 @@ noinst_HEADERS = \ creds.h \ dynamic-type.h \ elf.h \ + err-ptr.h \ events.h \ jhash.h \ logging.h \ diff --git a/src/common/err-ptr.h b/src/common/err-ptr.h new file mode 100644 index 00000000..3e3f1da1 --- /dev/null +++ b/src/common/err-ptr.h @@ -0,0 +1,42 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (C) 2011 Mathieu Desnoyers + */ + +#ifndef _UST_COMMON_ERR_PTR_H +#define _UST_COMMON_ERR_PTR_H + +#include +#include + +#define MAX_ERRNO 4095 + +static inline +int IS_ERR_VALUE(long value) +{ + if (caa_unlikely((unsigned long) value >= (unsigned long) -MAX_ERRNO)) + return 1; + else + return 0; +} + +static inline +void *ERR_PTR(long error) +{ + return (void *) error; +} + +static inline +long PTR_ERR(const void *ptr) +{ + return (long) ptr; +} + +static inline +int IS_ERR(const void *ptr) +{ + return IS_ERR_VALUE((long) ptr); +} + +#endif /* _UST_COMMON_ERR_PTR_H */ diff --git a/src/lib/lttng-ust/Makefile.am b/src/lib/lttng-ust/Makefile.am index 1d0e85f1..aafcbd5f 100644 --- a/src/lib/lttng-ust/Makefile.am +++ b/src/lib/lttng-ust/Makefile.am @@ -22,8 +22,7 @@ liblttng_ust_tracepoint_la_SOURCES = \ tracepoint.c \ tracepoint-weak-test.c \ tracepoint-internal.h \ - lttng-tracer-core.h \ - error.h + lttng-tracer-core.h liblttng_ust_tracepoint_la_LIBADD = \ liblttng-ust-common.la \ @@ -80,7 +79,6 @@ liblttng_ust_runtime_la_SOURCES = \ events.h \ clock.h \ lttng-ust-uuid.h \ - error.h \ tracef.c \ lttng-ust-tracef-provider.h \ tracelog.c \ diff --git a/src/lib/lttng-ust/error.h b/src/lib/lttng-ust/error.h deleted file mode 100644 index 1c39d7db..00000000 --- a/src/lib/lttng-ust/error.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (C) 2011 Mathieu Desnoyers - */ - -#ifndef _LTTNG_ERROR_H -#define _LTTNG_ERROR_H - -#include -#include - -#define MAX_ERRNO 4095 - -static inline -int IS_ERR_VALUE(long value) -{ - if (caa_unlikely((unsigned long) value >= (unsigned long) -MAX_ERRNO)) - return 1; - else - return 0; -} - -static inline -void *ERR_PTR(long error) -{ - return (void *) error; -} - -static inline -long PTR_ERR(const void *ptr) -{ - return (long) ptr; -} - -static inline -int IS_ERR(const void *ptr) -{ - return IS_ERR_VALUE((long) ptr); -} - -#endif /* _LTTNG_ERROR_H */ diff --git a/src/lib/lttng-ust/getcpu.c b/src/lib/lttng-ust/getcpu.c index 1fb7b169..149491ce 100644 --- a/src/lib/lttng-ust/getcpu.c +++ b/src/lib/lttng-ust/getcpu.c @@ -5,7 +5,6 @@ */ #define _LGPL_SOURCE -#include #include #include #include "common/logging.h" diff --git a/src/lib/lttng-ust/lttng-clock.c b/src/lib/lttng-ust/lttng-clock.c index 61b8e55a..bc38850e 100644 --- a/src/lib/lttng-ust/lttng-clock.c +++ b/src/lib/lttng-ust/lttng-clock.c @@ -5,7 +5,6 @@ */ #define _LGPL_SOURCE -#include #include #include #include diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index 9ebd61dd..b33d6e1b 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -39,7 +39,6 @@ #include "common/ust-fd.h" #include "common/dynamic-type.h" #include "common/ust-context-provider.h" -#include "error.h" #include "lttng-ust-uuid.h" #include "tracepoint-internal.h" diff --git a/src/lib/lttng-ust/lttng-probes.c b/src/lib/lttng-ust/lttng-probes.c index b2e77e01..7781811b 100644 --- a/src/lib/lttng-ust/lttng-probes.c +++ b/src/lib/lttng-ust/lttng-probes.c @@ -20,7 +20,6 @@ #include "lttng-tracer-core.h" #include "common/jhash.h" -#include "error.h" #include "lib/lttng-ust/events.h" /* diff --git a/src/lib/lttng-ust/tracepoint.c b/src/lib/lttng-ust/tracepoint.c index e7f520ab..8d89d144 100644 --- a/src/lib/lttng-ust/tracepoint.c +++ b/src/lib/lttng-ust/tracepoint.c @@ -29,7 +29,7 @@ #include "tracepoint-internal.h" #include "lttng-tracer-core.h" #include "common/jhash.h" -#include "error.h" +#include "common/err-ptr.h" /* Test compiler support for weak symbols with hidden visibility. */ int __tracepoint_test_symbol1 __attribute__((weak, visibility("hidden")));