All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h
Date: Fri, 25 Aug 2017 11:24:22 +0800	[thread overview]
Message-ID: <20170825032423.21004-1-fenggw-fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1d294342-1504-e66f-5fdc-f9cd7806afef@cn.fujitsu.com>

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
 include/lapi/keyctl.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index ed3b7bd..e761be8 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -23,6 +23,55 @@
 # include <linux/keyctl.h>
 #endif /* HAVE_LINUX_KEYCTL_H */
 
+#ifdef HAVE_KEYUTILS_H
+# include <keyutils.h>
+#else
+# include <stdarg.h>
+# include <stdint.h>
+# include "lapi/syscalls.h"
+# ifdef __TEST_H__
+#  define TST_SYSCALL_WRAPPER ltp_syscall
+# else
+#  define TST_SYSCALL_WRAPPER tst_syscall
+# endif /* __TEST_H__ */
+typedef int32_t key_serial_t;
+
+static inline key_serial_t add_key(const char *type,
+				   const char *description,
+				   const void *payload,
+				   size_t plen,
+				   key_serial_t ringid)
+{
+	return TST_SYSCALL_WRAPPER(__NR_add_key,
+		type, description, payload, plen, ringid);
+}
+
+static inline key_serial_t request_key(const char *type,
+				       const char *description,
+				       const char *callout_info,
+				       key_serial_t destringid)
+{
+	return TST_SYSCALL_WRAPPER(__NR_request_key,
+		type, description, callout_info, destringid);
+}
+
+static inline long keyctl(int cmd, ...)
+{
+	va_list va;
+	unsigned long arg2, arg3, arg4, arg5;
+
+	va_start(va, cmd);
+	arg2 = va_arg(va, unsigned long);
+	arg3 = va_arg(va, unsigned long);
+	arg4 = va_arg(va, unsigned long);
+	arg5 = va_arg(va, unsigned long);
+	va_end(va);
+
+	return TST_SYSCALL_WRAPPER(__NR_keyctl,
+		cmd, arg2, arg3, arg4, arg5);
+}
+#endif /* HAVE_KEYUTILS_H */
+
 #ifndef KEYCTL_GET_KEYRING_ID
 # define KEYCTL_GET_KEYRING_ID 0
 #endif
-- 
2.9.4




  reply	other threads:[~2017-08-25  3:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 11:00 [LTP] [PATCH 1/2] syscalls/keyctl01: Convert to the new library && Cleanup Guangwen Feng
2017-08-23 11:00 ` [LTP] [PATCH 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve Guangwen Feng
2017-08-23 14:18   ` Cyril Hrubis
2017-08-24 13:25     ` Guangwen Feng
2017-08-24 13:28       ` [LTP] [PATCH v2 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h Guangwen Feng
2017-08-24 13:28         ` [LTP] [PATCH v2 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve Guangwen Feng
2017-08-25  3:14           ` Guangwen Feng
2017-08-25  3:24             ` Guangwen Feng [this message]
2017-08-25  3:24               ` [LTP] [PATCH v3 " Guangwen Feng
2017-08-28 11:04                 ` Cyril Hrubis
2017-08-28 11:02               ` [LTP] [PATCH v3 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h Cyril Hrubis
2017-08-29  3:37                 ` [LTP] [PATCH v4 1/3] " Guangwen Feng
2017-08-29  3:37                   ` [LTP] [PATCH v4 2/3] syscalls/keyctl: Make use of lapi/keyctl.h Guangwen Feng
2017-08-29  3:37                   ` [LTP] [PATCH v4 3/3] CVE: Add some existing tests to runtest/cve Guangwen Feng
2017-08-29 11:47                   ` [LTP] [PATCH v4 1/3] lapi/keyctl.h: Add fallback definition of keyutil.h Cyril Hrubis
2017-08-23 14:13 ` [LTP] [PATCH 1/2] syscalls/keyctl01: Convert to the new library && Cleanup Cyril Hrubis

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=20170825032423.21004-1-fenggw-fnst@cn.fujitsu.com \
    --to=fenggw-fnst@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.