public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h
Date: Mon, 28 Aug 2017 13:02:06 +0200	[thread overview]
Message-ID: <20170828110206.GA21355@rei.lan> (raw)
In-Reply-To: <20170825032423.21004-1-fenggw-fnst@cn.fujitsu.com>

Hi!
> +#ifdef HAVE_KEYUTILS_H
> +# include <keyutils.h>

We should also make sure we do not include both linux/keyctl.h and
keyutils.h they both define KEY_* and KEYCTL_* constants.

So the <linux/keyctl.h> include should be in the else branch of the
HAVE_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__ */

What do we need these ifdefs for?

I've checked all the keyctl tests and they are all converted to new
library and so we can call tst_syscall() directly.

> +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
> 
> 
> 

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2017-08-28 11:02 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             ` [LTP] [PATCH v3 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h Guangwen Feng
2017-08-25  3:24               ` [LTP] [PATCH v3 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve Guangwen Feng
2017-08-28 11:04                 ` Cyril Hrubis
2017-08-28 11:02               ` Cyril Hrubis [this message]
2017-08-29  3:37                 ` [LTP] [PATCH v4 1/3] lapi/keyctl.h: Add fallback definition of keyutil.h 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=20170828110206.GA21355@rei.lan \
    --to=chrubis@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox