linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linaro-mm-sig@lists.linaro.org
Cc: "Laura Abbott" <labbott@redhat.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"John Stultz" <john.stultz@linaro.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	devel@driverdev.osuosl.org, "Jon Medhurst" <tixy@linaro.org>,
	"Android Kernel Team" <kernel-team@android.com>,
	"Liviu Dudau" <Liviu.Dudau@arm.com>,
	linux-kernel@vger.kernel.org,
	"Jeremy Gebben" <jgebben@codeaurora.org>,
	"Eun Taik Lee" <eun.taik.lee@samsung.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Brian Starkey" <brian.starkey@arm.com>,
	"Chen Feng" <puck.chen@hisilicon.com>
Subject: Re: [Linaro-mm-sig] [PATCHv2 3/4] staging: android: ion: Add an ioctl for ABI checking
Date: Fri, 02 Sep 2016 11:02:13 +0200	[thread overview]
Message-ID: <7145471.hhkX02hEGi@wuerfel> (raw)
In-Reply-To: <1472769644-11039-4-git-send-email-labbott@redhat.com>

On Thursday, September 1, 2016 3:40:43 PM CEST Laura Abbott wrote:

> --- a/drivers/staging/android/ion/ion-ioctl.c
> +++ b/drivers/staging/android/ion/ion-ioctl.c
> @@ -22,6 +22,29 @@
>  #include "ion_priv.h"
>  #include "compat_ion.h"
>  
> +union ion_ioctl_arg {
> +	struct ion_fd_data fd;
> +	struct ion_allocation_data allocation;
> +	struct ion_handle_data handle;
> +	struct ion_custom_data custom;
> +	struct ion_abi_version abi_version;
> +};

Are you introducing this, or just clarifying the defintion of the
existing interface. For new interfaces, we should not have a union
as an ioctl argument. Instead each ioctl command should have one
specific structure (or better a scalar argument).

> +static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
> +{
> +	int ret = 0;
> +
> +	switch (cmd) {
> +	case ION_IOC_ABI_VERSION:
> +		ret = arg->abi_version.reserved != 0;
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return ret ? -EINVAL : 0;
> +}

I agree with Greg, ioctl interfaces should normally not be versioned,
the usual way is to try a command and see if it fails or not.

> +/**
> + * struct ion_abi_version
> + *
> + *  @version - current ABI version
> + */
> +
> +#define ION_ABI_VERSION                KERNEL_VERSION(0, 1, 0)
> +
> +struct ion_abi_version {
> +	__u32 abi_version;
> +	__u32 reserved;
> +};
> +

This interface doesn't really need a "reserved" field, you could
as well use a __u32 by itself. If you ever need a second field,
just add a new command number.

	Arnd

  parent reply	other threads:[~2016-09-02  9:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 22:40 [PATCHv2 0/4] New Ion ioctls Laura Abbott
2016-09-01 22:40 ` [PATCHv2 1/4] staging: android: ion: Drop heap type masks Laura Abbott
2016-09-02 13:41   ` Brian Starkey
2016-09-02 19:36     ` Laura Abbott
2016-09-05 11:20       ` Brian Starkey
2016-09-06 22:16         ` Laura Abbott
2016-09-07  8:50           ` Brian Starkey
2016-09-01 22:40 ` [PATCHv2 2/4] staging: android: ion: Pull out ion ioctls to a separate file Laura Abbott
2016-09-02 12:44   ` Greg Kroah-Hartman
2016-09-02 19:53     ` Laura Abbott
2016-09-01 22:40 ` [PATCHv2 3/4] staging: android: ion: Add an ioctl for ABI checking Laura Abbott
2016-09-02  6:10   ` Greg Kroah-Hartman
2016-09-02 20:26     ` Laura Abbott
2016-09-02  9:02   ` Arnd Bergmann [this message]
2016-09-02 20:33     ` [Linaro-mm-sig] " Laura Abbott
2016-09-02 21:33       ` Arnd Bergmann
2016-09-02 22:14         ` Laura Abbott
2016-09-01 22:40 ` [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps Laura Abbott
2016-09-01 23:44   ` kbuild test robot
2016-09-02 21:27     ` Laura Abbott
2016-09-02 21:37       ` [Linaro-mm-sig] " Arnd Bergmann
2016-09-02 21:53         ` Laura Abbott
2016-09-02  6:14   ` Greg Kroah-Hartman
2016-09-02 20:41     ` Laura Abbott
2016-09-03 12:55       ` Greg Kroah-Hartman

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=7145471.hhkX02hEGi@wuerfel \
    --to=arnd@arndb.de \
    --cc=Liviu.Dudau@arm.com \
    --cc=arve@android.com \
    --cc=brian.starkey@arm.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=eun.taik.lee@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgebben@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=labbott@redhat.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puck.chen@hisilicon.com \
    --cc=riandrews@android.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tixy@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).