Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1405265rdb; Mon, 19 Feb 2024 14:50:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV/F0h3ehhpImnF1CWpoBOmFU3pCY8SQNhxLdRZ2ZeuigaSLpOkvGn0rma++M8wHSLcZd5W5B4S6U6yQ6NLJSnyae6VfsYqBQLh6p6eRg== X-Google-Smtp-Source: AGHT+IEF+uB0rrsuOsc5u/mFkaVUZpK0LTs85rGAaU625A0GD+H269qbu/LK3KTJHpYNQvnCW+u7 X-Received: by 2002:a17:902:ce81:b0:1db:e244:78 with SMTP id f1-20020a170902ce8100b001dbe2440078mr7359375plg.20.1708383024579; Mon, 19 Feb 2024 14:50:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708383024; cv=pass; d=google.com; s=arc-20160816; b=NlsHB0jBhm9FyF2sRbwH/UkYr5CdbzYOUyOONgtg72hd3GgHUscY7w+U8XEKN7PKgm ZekviXNJdHVZqqRhkxd7E6EqQdD2+JNuqJepxmstn73Nvnh7Mub9o27rW0nCVmFsyJex tPUJNTFd5LgumQq0l9fJeQWxGowfRxNyJtuAZKjjFjSTsFPTL9tIBI1FSkbRFyWGBE3h tnL5qa4FpL1/edrtSpBzQT3ttCpQoVjkuFN909qXYZ1reiRQ54oattz13rCSvUnA0/Um LE3GZknairE8Y+E63QpLMNhSc8wVZVWlv2XM1Q50Kjn3KeiCMhTFnWjFazPyIzX5tn7m z+Yg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e8-20020a170902784800b001d8eaf6626esi5000833pln.440.2024.02.19.14.50.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 14:50:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72089-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72089-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 98214287997 for ; Mon, 19 Feb 2024 22:42:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF1245F48D; Mon, 19 Feb 2024 22:39:45 +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 ) id 1rcCIM-0037Oz-2B; Mon, 19 Feb 2024 16:39:30 -0600 From: Elizabeth Figura To: Arnd Bergmann , Greg Kroah-Hartman , Jonathan Corbet , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, wine-devel@winehq.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= , Wolfram Sang , Arkadiusz Hiler , Peter Zijlstra , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Randy Dunlap , Elizabeth Figura 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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 -- 2.43.0