Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

From: Christoph Hellwig
Date: Thu Mar 26 2020 - 05:23:33 EST


On Wed, Mar 25, 2020 at 04:17:05PM -0700, Jacob Pan wrote:
> Having a single UAPI version to govern the user-kernel data structures
> makes compatibility check straightforward. On the contrary, supporting
> combinations of multiple versions of the data can be a nightmare to
> maintain.
>
> This patch defines a unified UAPI version to be used for compatibility
> checks between user and kernel.

This is bullshit. Version numbers don't scale and we've avoided them
everywhere. You need need flags specifying specific behavior.

> +#define IOMMU_UAPI_VERSION 1
> +static inline int iommu_get_uapi_version(void)
> +{
> + return IOMMU_UAPI_VERSION;
> +}

Also inline functions like this in UAPI headers that actually get
included by userspace programs simply don't work.