From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752855AbcFFSYE (ORCPT ); Mon, 6 Jun 2016 14:24:04 -0400 Received: from mail-qg0-f52.google.com ([209.85.192.52]:36296 "EHLO mail-qg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752415AbcFFSX5 (ORCPT ); Mon, 6 Jun 2016 14:23:57 -0400 From: Laura Abbott To: Sumit Semwal , John Stultz , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Riley Andrews Cc: Laura Abbott , Daniel Vetter , linaro-mm-sig@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Eun Taik Lee , Liviu Dudau , Jon Medhurst , Mitchel Humpherys , Jeremy Gebben , Bryan Huntsman , Greg Kroah-Hartman , Android Kernel Team Subject: [RFC][PATCH 5/6] staging: android: ion: Add an ioctl for ABI checking Date: Mon, 6 Jun 2016 11:23:32 -0700 Message-Id: <1465237413-10549-6-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465237413-10549-1-git-send-email-labbott@redhat.com> References: <1465237413-10549-1-git-send-email-labbott@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current Ion ioctls lack a good way to tell what ioctls are available. Introduce an ioctl to give an ABI version. This way when the ABI inevitably gets screwed up userspace will have a way to tell what version of the screw up is available. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion-ioctl.c | 6 ++++++ drivers/staging/android/uapi/ion.h | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c index 341ba7d..45b89e8 100644 --- a/drivers/staging/android/ion/ion-ioctl.c +++ b/drivers/staging/android/ion/ion-ioctl.c @@ -48,6 +48,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) struct ion_allocation_data allocation; struct ion_handle_data handle; struct ion_custom_data custom; + struct ion_abi_version abi_version; } data; dir = ion_ioctl_dir(cmd); @@ -129,6 +130,11 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data.custom.arg); break; } + case ION_IOC_ABI_VERSION: + { + data.abi_version.abi_version = ION_ABI_VERSION; + break; + } default: return -ENOTTY; } diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h index a9c4e8b..145005f 100644 --- a/drivers/staging/android/uapi/ion.h +++ b/drivers/staging/android/uapi/ion.h @@ -19,6 +19,7 @@ #include #include +#include typedef int ion_user_handle_t; @@ -128,6 +129,19 @@ struct ion_custom_data { unsigned long arg; }; +/** + * 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; +}; + #define ION_IOC_MAGIC 'I' /** @@ -194,4 +208,13 @@ struct ion_custom_data { */ #define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data) +/** + * DOC: ION_IOC_ABI_VERSION - return ABI version + * + * Returns the ABI version of this driver. + */ +#define ION_IOC_ABI_VERSION _IOR(ION_IOC_MAGIC, 8, \ + struct ion_abi_version) + + #endif /* _UAPI_LINUX_ION_H */ -- 2.5.5