[LTP] [PATCH v2 1/2] keyctl: Vendor struct keyctl_dh_params

Cyril Hrubis chrubis@suse.cz
Tue Sep 22 16:03:02 CEST 2026


Hi!
> I think that we should simplify this by including only
> include/linux/keyctl.h and do not ever include the include/keyutils.h
> from keyutils package.
> 
> This should do the trick:
> 
> diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
> index fdb68d172..90ebf88c1 100644
> --- a/include/lapi/keyctl.h
> +++ b/include/lapi/keyctl.h
> @@ -10,15 +10,13 @@
> 
>  #include <stdint.h>
> 
> -#if defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS)
> -# include <keyutils.h>
> -#else
> -# ifdef HAVE_LINUX_KEYCTL_H
> -#  include <linux/keyctl.h>
> -# endif /* HAVE_LINUX_KEYCTL_H */
> -
> -# include <stdarg.h>
> -# include "lapi/syscalls.h"
> +#ifdef HAVE_LINUX_KEYCTL_H
> +# include <linux/keyctl.h>
> +#endif /* HAVE_LINUX_KEYCTL_H */
> +
> +#include <stdarg.h>
> +#include "lapi/syscalls.h"
> +
>  typedef int32_t key_serial_t;
> 
>  static inline key_serial_t add_key(const char *type,
> @@ -59,11 +57,12 @@ static inline key_serial_t keyctl_join_session_keyring(const char *name) {
>         return keyctl(KEYCTL_JOIN_SESSION_KEYRING, name);
>  }
> 
> -#endif /* defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) */
> -
>  #ifndef HAVE_STRUCT_KEYCTL_DH_PARAMS
>  struct keyctl_dh_params {
> -       int32_t priv;
> +       union {
> +               int32_t priv;
> +               int32_t private;
> +       };
>         int32_t prime;
>         int32_t base;
>  };

And of course we have to change the ->priv to ->private to get the
tests compiled on older distributions as well.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list