[CRIU] [PATCH 1/2] userns: Wrap call with a macro fore readability
Cyrill Gorcunov
gorcunov at openvz.org
Thu Oct 29 02:28:59 PDT 2015
Pass function name into a helper instead of pointer
wich doesn't provide much useful info.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
include/namespaces.h | 9 +++++++--
namespaces.c | 6 +++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/include/namespaces.h b/include/namespaces.h
index 8809acbed529..f511290fbc8e 100644
--- a/include/namespaces.h
+++ b/include/namespaces.h
@@ -1,6 +1,7 @@
#ifndef __CR_NS_H__
#define __CR_NS_H__
+#include "compiler.h"
#include "files.h"
struct ns_desc {
@@ -114,7 +115,11 @@ typedef int (*uns_call_t)(void *arg, int fd, pid_t pid);
* In case we're not in userns, just call the callback immediatelly
* in the context of calling task.
*/
-int userns_call(uns_call_t call, int flags,
- void *arg, size_t arg_size, int fd);
+extern int __userns_call(const char *func_name, uns_call_t call, int flags,
+ void *arg, size_t arg_size, int fd);
+
+#define userns_call(__call, __flags, __arg, __arg_size, __fd) \
+ __userns_call(__stringify(__call), __call, __flags, \
+ __arg, __arg_size, __fd)
#endif /* __CR_NS_H__ */
diff --git a/namespaces.c b/namespaces.c
index d4abd97840bc..68a3f36523ff 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -1015,8 +1015,8 @@ static int usernsd(int sk)
}
}
-int userns_call(uns_call_t call, int flags,
- void *arg, size_t arg_size, int fd)
+int __userns_call(const char *func_name, uns_call_t call, int flags,
+ void *arg, size_t arg_size, int fd)
{
int ret, res, sk;
bool async = flags & UNS_ASYNC;
@@ -1031,7 +1031,7 @@ int userns_call(uns_call_t call, int flags,
return call(arg, fd, getpid());
sk = get_service_fd(USERNSD_SK);
- pr_debug("UNS: calling %p (%d, %x)\n", call, fd, flags);
+ pr_debug("UNS: calling %s (%d, %x)\n", func_name, fd, flags);
if (!async)
/*
--
2.4.3
More information about the CRIU
mailing list