Message ID | 20240214235307.10494-2-zfigura@codeweavers.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-66142-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp61271dyb; Wed, 14 Feb 2024 15:56:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUqwV/EQQY5+5tD8LNcmmDKkCWy3GLdnibxVlSXuhCSXWi1KZiKs97bY376XwOpjOYlie/E5v7vq9IA7C53gXu8zp43sA== X-Google-Smtp-Source: AGHT+IEuVwqMII8jztlVb3ThDegqtPZ31NVtKWVy9g3CAuv5JHElEI0r+0XOOr4p1Q4crYAU0U42 X-Received: by 2002:ac8:5c43:0:b0:42c:6416:b4f4 with SMTP id j3-20020ac85c43000000b0042c6416b4f4mr372478qtj.27.1707954968396; Wed, 14 Feb 2024 15:56:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707954968; cv=pass; d=google.com; s=arc-20160816; b=J27jqgLY9xtpCAUBzqwVNeeBJN3R9JQFRz3IEM3L4kMqleIoJbhngZJJvEKqXc7ByU yWynieCicXXhFu6miyrltJRIA4JhwPomw9bTl1B2LasGjxW1lQOzqLXrip8lcgv/wocL G4bo+cpZxhhMyAd86jGJx/gsbfpjaRRudNpF6lUy+MgM1jw0Cs/pPkOllWRzGaveb63M rclybd4vSCPMHC49vO1OrTNdZLfygPxDCpqhuVpauDVTbmDz4CXbMTxzwLS+mjLR2g3n 24lcjrMezEkCdQFBQiDt6lLBJ54URobaFGi57GlmGfg+FyjRiqBVzbHcSaJhqRazGGbd JgMg== 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=ysylq2RMZIH24LbG0jmFl4YpEtJVTp+RFmS8r+eXNAU=; fh=sOAzP1IXJnllEbSCBRlwdfT0MN3UiaRLwzx1Tpw7GJA=; b=jelLT9sr2S/zC4ApCGI5XjfzP3yd1JnNrhguY+eIVWjOtUPViPLmqXPYyQKepORmFp aGN63CWRSIJwdBsYgwOr8bA1TBuTKygbClrqFfYtRMCXaik8x6BPZoLqOwxOdGaVEV6z dxgCvoNk1nQRf8iNQvSHYks6MT+yvcP814gayUOXUcX/GO6z4AvL+pQ8hbEsGYKS0dRi 9SUR/1XvHMfyq4BS+lJeLl7R0bHW/Zsd5HdNyprKjt3MHz+BREC6Tzkr/yi02fLgZUAP ndsbgCTE+hMiCgdDFKHkyurMxn0O4BPr8QFTea95S4qfcwt6BzAB323RQpVbye8fw7ik v4jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b="Wip/RTMI"; 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-66142-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66142-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 3-20020ac85743000000b0042db439fc96si117947qtx.514.2024.02.14.15.56.08 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 15:56:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66142-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b="Wip/RTMI"; 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-66142-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66142-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8A6531C26BE4 for <ouuuleilei@gmail.com>; Wed, 14 Feb 2024 23:55:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF2641474BB; Wed, 14 Feb 2024 23:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b="Wip/RTMI" 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 BA585146011; Wed, 14 Feb 2024 23:53:29 +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=1707954811; cv=none; b=uZPcYtwCRFEXSCWvvLCZDgLVZhcAgToXJOMCFUMqVvu+1NZLkYmVHPBq9Y7SroHoE0DR2ZvoRkb5lY3FARfSAp5K+VLCd+57Kqt3qygK3bWMPVTct2VEIcl5RxjZH9SINrG280Mvn2egcp8eqM+s2+ROZJl/t/t0hKSUeLDJxRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707954811; c=relaxed/simple; bh=iNoJnS47rRHG70TRY/f6nIJyk4KHDH1hiPc+CQPBb8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l599iRbnfszWVd3phbdummvC3SpW2pz29dGe6QPV65kTgxnSS0iG4m6y+yv2yytvFACn68neTqTnkMPP8UJfwfJw/Jxm6t0fbAy1i9AgKea9qgVNi8WmiJswm6FPaylcMZlpF4CZINQI5up/hj3Tler6dCBNWdiyNvdtPoGGAUs= 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=Wip/RTMI; 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=ysylq2RMZIH24LbG0jmFl4YpEtJVTp+RFmS8r+eXNAU=; b=Wip/RTMI5/kTkwfD+ng/5Q49mi JEWcMzTNSykQPwp3F4yRheF7LDNVqT2t6kCPa7BnQYfrz+aV/Vz8TD4cIa5BQv/LDxcLtOpN2FVnw 0091iXLF8LiN8TBBHqTJlHILupureelN8827AagDZshNTWLnJGfXYOP/+XvXLVQTTmip4k7yxablt J2nNW/PMfqYGHdAb0vz0gTkf8N255mOxkPMJnqRtvhjiw3huOoyc+JYvzkRM03E1ZiNgf/MNsHcpb E7hZQIVlKB6QR+NCSv6to58oRC67XG1trwQneqBSpS88Cdatsqw62H4463nub2UxW7GBClw+LZo8N tdtWeS8Q==; 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 1raP45-00GcSK-12; Wed, 14 Feb 2024 17:53:21 -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, Elizabeth Figura <zfigura@codeweavers.com> Subject: [PATCH 11/31] ntsync: Introduce NTSYNC_IOC_EVENT_RESET. Date: Wed, 14 Feb 2024 17:52:46 -0600 Message-ID: <20240214235307.10494-2-zfigura@codeweavers.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214235307.10494-1-zfigura@codeweavers.com> References: <20240214233645.9273-1-zfigura@codeweavers.com> <20240214235307.10494-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: 1790920588773734997 X-GMAIL-MSGID: 1790920588773734997 |
Series |
NT synchronization primitive driver
|
|
Commit Message
Elizabeth Figura
Feb. 14, 2024, 11:52 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 bc24de02fd1c..57d78b086241 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -491,6 +491,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; @@ -516,6 +536,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 782057552483..f2d7507d8438 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