From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C13F6C433E1 for ; Thu, 27 Aug 2020 14:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D3D22054F for ; Thu, 27 Aug 2020 14:50:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i3M/qal6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728052AbgH0Our (ORCPT ); Thu, 27 Aug 2020 10:50:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22559 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728040AbgH0NlP (ORCPT ); Thu, 27 Aug 2020 09:41:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598535666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E6x4893U1XZUaKie9nG5yKGJyij3esKFZmrFVgshH0M=; b=i3M/qal63h1K7ARUAe6gNucbVv9RAihf2Dx78Z+y0SKHYqjP2XR9jjVofln7+K5kHe3jnX +Jq9ag5+W4qAuyASQ7fZ2TBZ3kHL/llvFT5nc10z0Qcsn5XzjerwBULXOxqxSIHlV0NhD9 FTOi62CVC/FWIxmM6p/evFM0Lz2VmLM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-1uL7r7AxPuWd6lzDfgbeMg-1; Thu, 27 Aug 2020 09:41:04 -0400 X-MC-Unique: 1uL7r7AxPuWd6lzDfgbeMg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED5DD18A2240; Thu, 27 Aug 2020 13:40:58 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-96.ams2.redhat.com [10.36.113.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD72C7C55A; Thu, 27 Aug 2020 13:40:53 +0000 (UTC) From: Stefano Garzarella To: Jens Axboe Cc: Aleksa Sarai , Kernel Hardening , Jann Horn , io-uring@vger.kernel.org, Christian Brauner , linux-fsdevel@vger.kernel.org, Alexander Viro , Stefan Hajnoczi , linux-kernel@vger.kernel.org, Sargun Dhillon , Kees Cook , Jeff Moyer Subject: [PATCH v5 1/3] io_uring: use an enumeration for io_uring_register(2) opcodes Date: Thu, 27 Aug 2020 15:40:42 +0200 Message-Id: <20200827134044.82821-2-sgarzare@redhat.com> In-Reply-To: <20200827134044.82821-1-sgarzare@redhat.com> References: <20200827134044.82821-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org The enumeration allows us to keep track of the last io_uring_register(2) opcode available. Behaviour and opcodes names don't change. Reviewed-by: Kees Cook Signed-off-by: Stefano Garzarella --- v5: - explicitly assign enum values since this is UAPI [Kees] --- include/uapi/linux/io_uring.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index d65fde732518..5f12ae6a415c 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -255,17 +255,22 @@ struct io_uring_params { /* * io_uring_register(2) opcodes and arguments */ -#define IORING_REGISTER_BUFFERS 0 -#define IORING_UNREGISTER_BUFFERS 1 -#define IORING_REGISTER_FILES 2 -#define IORING_UNREGISTER_FILES 3 -#define IORING_REGISTER_EVENTFD 4 -#define IORING_UNREGISTER_EVENTFD 5 -#define IORING_REGISTER_FILES_UPDATE 6 -#define IORING_REGISTER_EVENTFD_ASYNC 7 -#define IORING_REGISTER_PROBE 8 -#define IORING_REGISTER_PERSONALITY 9 -#define IORING_UNREGISTER_PERSONALITY 10 +enum { + IORING_REGISTER_BUFFERS = 0, + IORING_UNREGISTER_BUFFERS = 1, + IORING_REGISTER_FILES = 2, + IORING_UNREGISTER_FILES = 3, + IORING_REGISTER_EVENTFD = 4, + IORING_UNREGISTER_EVENTFD = 5, + IORING_REGISTER_FILES_UPDATE = 6, + IORING_REGISTER_EVENTFD_ASYNC = 7, + IORING_REGISTER_PROBE = 8, + IORING_REGISTER_PERSONALITY = 9, + IORING_UNREGISTER_PERSONALITY = 10, + + /* this goes last */ + IORING_REGISTER_LAST +}; struct io_uring_files_update { __u32 offset; -- 2.26.2