Message ID | 20240219223833.95710-12-zfigura@codeweavers.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-72089-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp78366dyc; Mon, 19 Feb 2024 14:51:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVM3yrPlR+3GtzY+WFqrA/5vYkYgppmBmeXpw6BliDCFsO5su5jfMaKZiJCr2iPS5GNdW6w5mXlEDJ6Cy1hXYugmjllEQ== X-Google-Smtp-Source: AGHT+IE7rdVil0TaHVXpHTGMlxJzJu+EAbasC94M6Kd+0QOZunAnAkpR4bfwUEBC5mz41jvpzry9 X-Received: by 2002:a17:903:58d:b0:1db:a7bb:492d with SMTP id jv13-20020a170903058d00b001dba7bb492dmr12100741plb.5.1708383089065; Mon, 19 Feb 2024 14:51:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708383089; cv=pass; d=google.com; s=arc-20160816; b=S50P+mqT3K87IcqO33Gg1v4eKoekf4qm7G6zppY3dpIv+KYvKg/U5oMppXyRI+6/J3 RmbbUmVq1AtKowDVhW3KTXcrhd+FYebjWHWiH738drEmOfWbaJ+O/NpeFAiGsnxOW68L zUjtmBZYEO45Mf71KUynuzip0i9/2jr+W64BeP1YANjg+rg/hRaEI6qmqiV1bB7vRDDH EK1CAVNmMFqNkiGK7R6tRMB3D0eXwk0ckELaIeB1YAqGCbcUAkRjOpRKt6sHQeISF/8k /OuZlbHqUWwhlWJ2coMd9zM85FcsuiKCWVloDAqCex5vy6haMC4hX/LNxYbW0BAdAGl4 8TIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=glfLDRv/3XY37fbznHkzZJx66tLy2zaGV1ONv1JLlIM=; fh=hR3Xqo6s6FufP5gEw1XgbtLHrluZu7hd5XGp+hLIfiM=; b=C2TZz54wukqKeZUOHCP1CoTENGQptb7ixAvwDBcvTtuajBHOUkbdXivEyESv3Ahxwy zaQMIrqhLYbbGXmPFIYBHc7+Lk9g+mtCfXHfDGKTK2WESpAl6+5dThLU0aVVDCy7S0gG a6UaUril2+X7Dd9fjO6HTXZfKyJjxy+psvlWS7gSO9efuOG4l/mAUvRLW+jcsRXu+QIG BNkEzpAsRdrL0srEdQTgrZx8qDMYy1p+5C/vjvxqya8jDPFBinNHwJlSRrAP5o4Q6ofY oA5CeH3ab4xentwBtbPixB01SjdgYHD9wZ/47pzeNnjT1G77uPDJwbOFbgSPnq8Fxi7u KlEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=hzGcbG7d; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-72089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lk4-20020a17090308c400b001dbcc3280f3si4405928plb.232.2024.02.19.14.51.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 14:51:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=hzGcbG7d; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-72089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C8363B26310 for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 22:43:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B452F60DE6; Mon, 19 Feb 2024 22:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b="hzGcbG7d" Received: from mail.codeweavers.com (mail.codeweavers.com [4.36.192.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4D6E55E60; Mon, 19 Feb 2024 22:39:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=4.36.192.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708382381; cv=none; b=ZsX4SUC1FUXKmURhjNJZkiEDFaY+xCdB1tkU7eODs1OgqWYuIGgmO4Q8l7j/xhNUbqci1lyABCwCq0k9wY75HazkpRgEhLxxYf5Jgt3GbePqtM3Cd+8K2ok9295iDBdCmSsLBszRUay7E2CAF1dQyCJ6C/eWVmEYHPVLlvw9AbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708382381; c=relaxed/simple; bh=I8ziftNmVebQ4+7/x6/7j/jlpEI+Ceu8QdugfllIwJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VJHF5k2i+EBX07XtrdCj9pPuhO7j8HHe6F6zMNtsf813JI5wFZ0v9m2STvvLIdi5sJSdZy/+tk9AZEHPz/5pxqz6v9BqG+k5dRov6hpaUBaDBrBqBKwUcSnXKiFbsie5MBPbuHfWJrkqK+fjNhlyyJmYbTRW5RYf64Lka6Y31z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com; spf=pass smtp.mailfrom=codeweavers.com; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b=hzGcbG7d; arc=none smtp.client-ip=4.36.192.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codeweavers.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=s1; h=Message-ID:Date:Subject:Cc:To:From:Sender; bh=glfLDRv/3XY37fbznHkzZJx66tLy2zaGV1ONv1JLlIM=; b=hzGcbG7d3pobkx+DNgudLBeoMK ZvG20YoYVQZTQlBAWpuB4T63xM6di+SPMeejeRv0X5La8BhpYvY1LGYkIYED+fSorRE4pwYPXld5f Io9BhWav2eEtZsxMPG2cJVoJAHRP/l9ZNv7BpSs4pZyyUs7PcZUZBtaqZwQ/0CHg9rVZQ0rxAgtJP k7d9cgJeRez3opDpjJ00vpMZxitnTVRwTRUmpP7gSbLwitgb9WD6PHeDK30W0Bip2SSISUvwFoq8K qP/4oveBwbvlM+c2G81RRN9w0HB3Na1FzRQBZ9yvVmE95IqIpXRtbJX2zOs/3w5JNPTZqe0avRMox itdK6jWQ==; Received: from cw137ip160.mn.codeweavers.com ([10.69.137.160] helo=camazotz.mn.codeweavers.com) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <zfigura@codeweavers.com>) id 1rcCIM-0037Oz-2B; Mon, 19 Feb 2024 16:39:30 -0600 From: Elizabeth Figura <zfigura@codeweavers.com> To: Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, wine-devel@winehq.org, =?utf-8?q?Andr=C3=A9_Almeida?= <andrealmeid@igalia.com>, Wolfram Sang <wsa@kernel.org>, Arkadiusz Hiler <ahiler@codeweavers.com>, Peter Zijlstra <peterz@infradead.org>, Andy Lutomirski <luto@kernel.org>, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>, Elizabeth Figura <zfigura@codeweavers.com> Subject: [PATCH v2 11/31] ntsync: Introduce NTSYNC_IOC_EVENT_RESET. Date: Mon, 19 Feb 2024 16:38:13 -0600 Message-ID: <20240219223833.95710-12-zfigura@codeweavers.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240219223833.95710-1-zfigura@codeweavers.com> References: <20240219223833.95710-1-zfigura@codeweavers.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791369505843223400 X-GMAIL-MSGID: 1791369505843223400 |
Series |
NT synchronization primitive driver
|
|
Commit Message
Elizabeth Figura
Feb. 19, 2024, 10:38 p.m. UTC
This corresponds to the NT syscall NtResetEvent().
This sets the event to the unsignaled state, and returns its previous state.
Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
---
drivers/misc/ntsync.c | 22 ++++++++++++++++++++++
include/uapi/linux/ntsync.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c index edfbf11cafe0..fa4c3fa1e496 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -504,6 +504,26 @@ static int ntsync_event_set(struct ntsync_obj *event, void __user *argp) return 0; } +static int ntsync_event_reset(struct ntsync_obj *event, void __user *argp) +{ + __u32 prev_state; + + if (event->type != NTSYNC_TYPE_EVENT) + return -EINVAL; + + spin_lock(&event->lock); + + prev_state = event->u.event.signaled; + event->u.event.signaled = false; + + spin_unlock(&event->lock); + + if (put_user(prev_state, (__u32 __user *)argp)) + return -EFAULT; + + return 0; +} + static int ntsync_obj_release(struct inode *inode, struct file *file) { struct ntsync_obj *obj = file->private_data; @@ -529,6 +549,8 @@ static long ntsync_obj_ioctl(struct file *file, unsigned int cmd, return ntsync_mutex_kill(obj, argp); case NTSYNC_IOC_EVENT_SET: return ntsync_event_set(obj, argp); + case NTSYNC_IOC_EVENT_RESET: + return ntsync_event_reset(obj, argp); default: return -ENOIOCTLCMD; } diff --git a/include/uapi/linux/ntsync.h b/include/uapi/linux/ntsync.h index af518530bffd..6963356ee3f7 100644 --- a/include/uapi/linux/ntsync.h +++ b/include/uapi/linux/ntsync.h @@ -49,5 +49,6 @@ struct ntsync_wait_args { #define NTSYNC_IOC_MUTEX_UNLOCK _IOWR('N', 0x85, struct ntsync_mutex_args) #define NTSYNC_IOC_MUTEX_KILL _IOW ('N', 0x86, __u32) #define NTSYNC_IOC_EVENT_SET _IOR ('N', 0x88, __u32) +#define NTSYNC_IOC_EVENT_RESET _IOR ('N', 0x89, __u32) #endif