From patchwork Sun Jun 11 18:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 13275341 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 9C6C0C7EE2E for ; Sun, 11 Jun 2023 19:08:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232964AbjFKTID (ORCPT ); Sun, 11 Jun 2023 15:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjFKTIC (ORCPT ); Sun, 11 Jun 2023 15:08:02 -0400 X-Greylist: delayed 123 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 11 Jun 2023 12:08:00 PDT Received: from out203-205-221-155.mail.qq.com (out203-205-221-155.mail.qq.com [203.205.221.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A139F; Sun, 11 Jun 2023 12:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1686510478; bh=WTlI9lDwIb26jxouPAzEjCQdYursinj8cqf+Aqs40+4=; h=From:To:Cc:Subject:Date; b=kVX8U0GdPhqaNU0HkiirFx/P+O6zQ++nYf2RqIUi10Q5ipbA/Mr7KB1+E4i3Ocisi svCim1ww1RrPtnfEdDxFuZhppmuuy7lJ255+DaJfwSox+0zZMo0TSHRVkFcVAVTJyO ZefVPdG/ounYyG7VApn2zcWCKIKlV1WDosCv6Bac= Received: from wen-VirtualBox.. ([240e:331:cb9:1200:2421:564d:c6df:cf15]) by newxmesmtplogicsvrszb1-0.qq.com (NewEsmtp) with SMTP id ED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r6+n1PrpGySSLYgOO61VBMM3m2+EvG8The5aTonX2KiIRrVgrs3LTfJJav UQ8KsqjUGIdbYViNlt 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] eventfd: add a uapi header for eventfd userspace APIs Date: Mon, 12 Jun 2023 02:59:20 +0800 X-OQ-MSGID: <20230611185920.2191-1-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.37.2 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. 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 --- include/linux/eventfd.h | 16 +--------------- include/uapi/linux/eventfd.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 include/uapi/linux/eventfd.h diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 98d31cdaca40..c8be8fa6795d 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -9,26 +9,12 @@ #ifndef _LINUX_EVENTFD_H #define _LINUX_EVENTFD_H -#include #include #include #include #include #include - -/* - * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining - * new flags, since they might collide with O_* ones. We want - * to re-use O_* flags that couldn't possibly have a meaning - * 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) +#include struct eventfd_ctx; struct file; diff --git a/include/uapi/linux/eventfd.h b/include/uapi/linux/eventfd.h new file mode 100644 index 000000000000..02e9dcdb8d29 --- /dev/null +++ b/include/uapi/linux/eventfd.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_EVENTFD_H +#define _UAPI_LINUX_EVENTFD_H + +#include + +/* For O_CLOEXEC and O_NONBLOCK */ +#include + +/* For _IO helpers */ +#include + +/* + * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining + * new flags, since they might collide with O_* ones. We want + * to re-use O_* flags that couldn't possibly have a meaning + * 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) + +#endif /* _UAPI_LINUX_EVENTFD_H */