From: Michael Jeanson Date: Tue, 6 Apr 2021 23:57:21 +0000 (-0400) Subject: Move ns.h to 'src/common/' X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=c5e8ef85e4c09e2f91a226195dc59f8b0bd6fd60;p=deliverable%2Flttng-ust.git Move ns.h to 'src/common/' Change-Id: Ibddbf741bdc7a4b1bcc1602cf636b71ac12683df Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 15aba9b5..f89dd1c3 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -20,6 +20,7 @@ noinst_HEADERS = \ jhash.h \ logging.h \ macros.h \ + ns.h \ patient.h \ procname.h \ safe-snprintf.h \ diff --git a/src/common/ns.h b/src/common/ns.h new file mode 100644 index 00000000..6f28a825 --- /dev/null +++ b/src/common/ns.h @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (C) 2019 Michael Jeanson + */ + +#ifndef _LTTNG_NS_H +#define _LTTNG_NS_H + +/* + * The lowest valid inode number that can be allocated in the proc filesystem + * is 0xF0000000. Any number below can be used internally as an error code. + * + * Zero is used in the kernel as an error code, it's the value we will return + * when we fail to read the proper inode number. + * + * One is used internally to identify an uninitialized cache entry, it should + * never be returned. + */ + +enum ns_ino_state { + NS_INO_UNAVAILABLE = 0x0, + NS_INO_UNINITIALIZED = 0x1, + NS_INO_MIN = 0xF0000000, +}; + +/* + * The longest possible namespace proc path is with the cgroup ns + * and the maximum theoretical linux pid of 536870912 : + * + * /proc/self/task/536870912/ns/cgroup + */ +#define LTTNG_PROC_NS_PATH_MAX 40 + +#endif /* _LTTNG_NS_H */ diff --git a/src/lib/lttng-ust/Makefile.am b/src/lib/lttng-ust/Makefile.am index 7537bb7d..4bd39a3c 100644 --- a/src/lib/lttng-ust/Makefile.am +++ b/src/lib/lttng-ust/Makefile.am @@ -85,7 +85,6 @@ liblttng_ust_runtime_la_SOURCES = \ string-utils.c \ string-utils.h \ event-notifier-notification.c \ - ns.h \ rculfhash.c \ rculfhash.h \ rculfhash-internal.h \ diff --git a/src/lib/lttng-ust/lttng-context-cgroup-ns.c b/src/lib/lttng-ust/lttng-context-cgroup-ns.c index 305ed8cd..0a688db1 100644 --- a/src/lib/lttng-ust/lttng-context-cgroup-ns.c +++ b/src/lib/lttng-ust/lttng-context-cgroup-ns.c @@ -21,7 +21,7 @@ #include "context-internal.h" #include "lttng-tracer-core.h" -#include "ns.h" +#include "common/ns.h" /* diff --git a/src/lib/lttng-ust/lttng-context-ipc-ns.c b/src/lib/lttng-ust/lttng-context-ipc-ns.c index c5867fb4..a122d423 100644 --- a/src/lib/lttng-ust/lttng-context-ipc-ns.c +++ b/src/lib/lttng-ust/lttng-context-ipc-ns.c @@ -21,7 +21,7 @@ #include "context-internal.h" #include "lttng-tracer-core.h" -#include "ns.h" +#include "common/ns.h" /* * We cache the result to ensure we don't stat(2) the proc filesystem on diff --git a/src/lib/lttng-ust/lttng-context-mnt-ns.c b/src/lib/lttng-ust/lttng-context-mnt-ns.c index 61812625..3642b023 100644 --- a/src/lib/lttng-ust/lttng-context-mnt-ns.c +++ b/src/lib/lttng-ust/lttng-context-mnt-ns.c @@ -18,7 +18,7 @@ #include #include "context-internal.h" -#include "ns.h" +#include "common/ns.h" /* * We cache the result to ensure we don't stat(2) the proc filesystem on diff --git a/src/lib/lttng-ust/lttng-context-net-ns.c b/src/lib/lttng-ust/lttng-context-net-ns.c index e7c8f9f9..242b2e80 100644 --- a/src/lib/lttng-ust/lttng-context-net-ns.c +++ b/src/lib/lttng-ust/lttng-context-net-ns.c @@ -21,7 +21,7 @@ #include "context-internal.h" #include "lttng-tracer-core.h" -#include "ns.h" +#include "common/ns.h" /* * We cache the result to ensure we don't stat(2) the proc filesystem on diff --git a/src/lib/lttng-ust/lttng-context-pid-ns.c b/src/lib/lttng-ust/lttng-context-pid-ns.c index 4e42e6b5..05b309b8 100644 --- a/src/lib/lttng-ust/lttng-context-pid-ns.c +++ b/src/lib/lttng-ust/lttng-context-pid-ns.c @@ -18,7 +18,7 @@ #include #include "context-internal.h" -#include "ns.h" +#include "common/ns.h" /* * We cache the result to ensure we don't stat(2) the proc filesystem on diff --git a/src/lib/lttng-ust/lttng-context-time-ns.c b/src/lib/lttng-ust/lttng-context-time-ns.c index 75e3e365..e8a9e01a 100644 --- a/src/lib/lttng-ust/lttng-context-time-ns.c +++ b/src/lib/lttng-ust/lttng-context-time-ns.c @@ -19,7 +19,7 @@ #include "common/compat/tid.h" #include #include "lttng-tracer-core.h" -#include "ns.h" +#include "common/ns.h" #include "context-internal.h" diff --git a/src/lib/lttng-ust/lttng-context-user-ns.c b/src/lib/lttng-ust/lttng-context-user-ns.c index 9d31da5e..ead9f14c 100644 --- a/src/lib/lttng-ust/lttng-context-user-ns.c +++ b/src/lib/lttng-ust/lttng-context-user-ns.c @@ -18,7 +18,7 @@ #include #include "context-internal.h" -#include "ns.h" +#include "common/ns.h" /* * We cache the result to ensure we don't stat(2) the proc filesystem on diff --git a/src/lib/lttng-ust/lttng-context-uts-ns.c b/src/lib/lttng-ust/lttng-context-uts-ns.c index b28fe874..5e37ae8f 100644 --- a/src/lib/lttng-ust/lttng-context-uts-ns.c +++ b/src/lib/lttng-ust/lttng-context-uts-ns.c @@ -21,7 +21,7 @@ #include "context-internal.h" #include "lttng-tracer-core.h" -#include "ns.h" +#include "common/ns.h" /* diff --git a/src/lib/lttng-ust/lttng-tracer-core.h b/src/lib/lttng-ust/lttng-tracer-core.h index 04ba642e..096ed28f 100644 --- a/src/lib/lttng-ust/lttng-tracer-core.h +++ b/src/lib/lttng-ust/lttng-tracer-core.h @@ -16,14 +16,6 @@ #include #include "common/logging.h" -/* - * The longuest possible namespace proc path is with the cgroup ns - * and the maximum theoretical linux pid of 536870912 : - * - * /proc/self/task/536870912/ns/cgroup - */ -#define LTTNG_PROC_NS_PATH_MAX 40 - struct lttng_ust_session; struct lttng_ust_channel_buffer; struct lttng_ust_ctx_field; diff --git a/src/lib/lttng-ust/ns.h b/src/lib/lttng-ust/ns.h deleted file mode 100644 index 1a848ccc..00000000 --- a/src/lib/lttng-ust/ns.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (C) 2019 Michael Jeanson - */ - -#ifndef _LTTNG_NS_H -#define _LTTNG_NS_H - -/* - * The lowest valid inode number that can be allocated in the proc filesystem - * is 0xF0000000. Any number below can be used internally as an error code. - * - * Zero is used in the kernel as an error code, it's the value we will return - * when we fail to read the proper inode number. - * - * One is used internally to identify an uninitialized cache entry, it should - * never be returned. - */ - -enum ns_ino_state { - NS_INO_UNAVAILABLE = 0x0, - NS_INO_UNINITIALIZED = 0x1, - NS_INO_MIN = 0xF0000000, -}; - -#endif /* _LTTNG_NS_H */