Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp580036ybt; Fri, 10 Jul 2020 07:21:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAKPhgOjucWB2k9PnclBloP11cizrd6mL78C1fahCJdsk0orXsre8LPL74EkmSrrfFZJcW X-Received: by 2002:a17:906:194b:: with SMTP id b11mr55290563eje.28.1594390860879; Fri, 10 Jul 2020 07:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594390860; cv=none; d=google.com; s=arc-20160816; b=jn1RmnJihlyICHvsdnZCYvvp8Q1nDFxA4bOfE1UnhqV43WVepXLfB3reB9Q51b0lPo SJlPfHRlbxvfYGrB5XIPf8cxO21qRokx3uTX3eMiO56487B1u30mj9K1kbT2RNEwdCFW 0CH4r3ltpNMCWB8nl3ZarLrL9llWOWERUnrBNA0pNsBOMRnF2pqZSoxxwHP5TLvBHwfI uIyWOJN32W5/XWW1b5DsBucPMvnTTMozTmVA75uDmvkxiIAT0HnrKy2fQpRGvxsqfiWv bFpgxwVEcAmWKCtAJ15S3iu68A3K6QnLoDX4t8UeLVhp1+lq4amGXafIq7iI/BKmVHjX wvTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iINrqTduzdzlg8cDRyIDlpEwPnwdLZ0XaojMAYpWNSc=; b=Z4N7OqeyV7376aFluMWswoMIbx35Hx1Z0fHpheLZfbKQL22NWTYfeHMnMf/cIvFEN9 ilM2WmVppDO7vUv0BPFp/ppJTcd1BF8GnfAqkM4MUKb+zoZVnLHgvaE+qovNzjVjOHlF bbfAq27N0N722ZptbOCIkMd7NIA2uGSk8mx3ZlnYNnwtp5ZVE//HCHtpDBdD4hfVwZlq HJDJS0EnGR1wDp5xCEcbNZye1XBHVuwpg+9CBR1yhyUIDDvbOk9sWW9Hf2ODEHRq6/Yw ELwpjljHp5gebpmXf/agGJNidyAzRhvQdtrCqUkGpYHpyhIOC3U5+/aN7pPlFDHYnqqr QQIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UPC8oScV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si4387227eds.544.2020.07.10.07.20.36; Fri, 10 Jul 2020 07:21:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UPC8oScV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728225AbgGJOUL (ORCPT + 99 others); Fri, 10 Jul 2020 10:20:11 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56972 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728182AbgGJOUH (ORCPT ); Fri, 10 Jul 2020 10:20:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594390806; 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=iINrqTduzdzlg8cDRyIDlpEwPnwdLZ0XaojMAYpWNSc=; b=UPC8oScVqHBaSk/KZqX3sH8wje2UhDrbYfetI/2Zhr+fIt6XgcqxgOtGpUMb8Z2RYrAOPg I8qnqLtu+b+PAGQAh0lmMWjQZLd+vk+YUUu6yQntSAP7wjrO85s3t2B6nA4BUMxR/g6ECO ZEGXfNyQvw5l+ZXZrR55ARGeBPjopYg= 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-219-h_9ogIOyOk-t4fP_p4hujw-1; Fri, 10 Jul 2020 10:20:00 -0400 X-MC-Unique: h_9ogIOyOk-t4fP_p4hujw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 435AF1B18BC7; Fri, 10 Jul 2020 14:19:59 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-112-4.ams2.redhat.com [10.36.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 787C55C5B7; Fri, 10 Jul 2020 14:19:55 +0000 (UTC) From: Stefano Garzarella To: Jens Axboe Cc: Sargun Dhillon , Kees Cook , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kernel Hardening , Jann Horn , Aleksa Sarai , Christian Brauner , Stefan Hajnoczi , io-uring@vger.kernel.org, Alexander Viro , Jeff Moyer Subject: [PATCH RFC 1/3] io_uring: use an enumeration for io_uring_register(2) opcodes Date: Fri, 10 Jul 2020 16:19:43 +0200 Message-Id: <20200710141945.129329-2-sgarzare@redhat.com> In-Reply-To: <20200710141945.129329-1-sgarzare@redhat.com> References: <20200710141945.129329-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Signed-off-by: Stefano Garzarella --- 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 92c22699a5a7..2d18f1d0b5df 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -252,17 +252,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, + IORING_UNREGISTER_BUFFERS, + IORING_REGISTER_FILES, + IORING_UNREGISTER_FILES, + IORING_REGISTER_EVENTFD, + IORING_UNREGISTER_EVENTFD, + IORING_REGISTER_FILES_UPDATE, + IORING_REGISTER_EVENTFD_ASYNC, + IORING_REGISTER_PROBE, + IORING_REGISTER_PERSONALITY, + IORING_UNREGISTER_PERSONALITY, + + /* this goes last */ + IORING_REGISTER_LAST +}; struct io_uring_files_update { __u32 offset; -- 2.26.2