From patchwork Wed Jun 14 18:40:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 13280373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8037EB64D8 for ; Wed, 14 Jun 2023 18:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231464AbjFNSlS (ORCPT ); Wed, 14 Jun 2023 14:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233734AbjFNSkt (ORCPT ); Wed, 14 Jun 2023 14:40:49 -0400 Received: from out162-62-57-137.mail.qq.com (out162-62-57-137.mail.qq.com [162.62.57.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E5B1BF9; Wed, 14 Jun 2023 11:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1686768038; bh=4CJx16EcnxgGxbCniEZqiBh3CmXAUAC3svoc61S+bmQ=; h=From:To:Cc:Subject:Date; b=RR6eWYlZAbKfJ1rlTG8DUddW6d3+4amJJ6vtJgYOYXxFNZrJlDIV90a7dp4ZrbB8v BfKvRduvUi+gUI6D8UMKOGtuwVB1Opf7xRV0Vm0Gjl5Q0+4o5f4dvnkSkLDx8xpsHF J2N0W2FY7+/0Ys6PpJDqbJAcpIdkLcbanBTLLxNU= Received: from localhost.localdomain ([240e:331:cd5:3100:8cae:648b:2ef1:ffd3]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id A2183CA7; Thu, 15 Jun 2023 02:40:33 +0800 X-QQ-mid: xmsmtpt1686768033tx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wDT3tbSpbOU+ Fe8BkLzKLwEcGWIHOZmZyC4p3OxYU= X-QQ-XMAILREADINFO: Nho4V/E0OEdrqQ11svVYjpA= From: wenyang.linux@foxmail.com To: Alexander Viro , Jens Axboe , Christian Brauner Cc: Wen Yang , Christoph Hellwig , Dylan Yudaken , David Woodhouse , Matthew Wilcox , Eric Biggers , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] eventfd: add a uapi header for eventfd userspace APIs Date: Thu, 15 Jun 2023 02:40:28 +0800 X-OQ-MSGID: <20230614184028.207757-1-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Wen Yang Create a uapi header include/uapi/linux/eventfd.h, move the associated flags to the uapi header, and include it from linux/eventfd.h. Suggested-by: Christian Brauner Signed-off-by: Wen Yang Cc: Alexander Viro Cc: Jens Axboe Cc: Christian Brauner Cc: Christoph Hellwig Cc: Dylan Yudaken Cc: David Woodhouse Cc: Matthew Wilcox Cc: Eric Biggers Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Matthew Wilcox (Oracle) --- v3: remove types.h that is not needed now v2: improve the code based on Christian's suggestions include/linux/eventfd.h | 6 +----- include/uapi/linux/eventfd.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 include/uapi/linux/eventfd.h diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 98d31cdaca40..b9d83652c097 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -9,12 +9,12 @@ #ifndef _LINUX_EVENTFD_H #define _LINUX_EVENTFD_H -#include #include #include #include #include #include +#include /* * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining @@ -23,10 +23,6 @@ * from eventfd, in order to leave a free define-space for * shared O_* flags. */ -#define EFD_SEMAPHORE (1 << 0) -#define EFD_CLOEXEC O_CLOEXEC -#define EFD_NONBLOCK O_NONBLOCK - #define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) #define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE) diff --git a/include/uapi/linux/eventfd.h b/include/uapi/linux/eventfd.h new file mode 100644 index 000000000000..2eb9ab6c32f3 --- /dev/null +++ b/include/uapi/linux/eventfd.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_EVENTFD_H +#define _UAPI_LINUX_EVENTFD_H + +#include + +#define EFD_SEMAPHORE (1 << 0) +#define EFD_CLOEXEC O_CLOEXEC +#define EFD_NONBLOCK O_NONBLOCK + +#endif /* _UAPI_LINUX_EVENTFD_H */