Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp58053lqj; Thu, 11 Apr 2024 09:44:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWothYghbBhxnfnrMVhCU9z6u/T87Cl8YUFl1NMmW+MX73g/1FW61n/Hq8TRIN9U1O4aa/sitH/UbKxjT/bsXj0mcKCd/ifr6J0adbM4g== X-Google-Smtp-Source: AGHT+IHhfRqfNmIKUvTBeEiIF8k4Z575HwXQUAoP2MkuLLNLdVszFIFY4S0uBg0aw2dPWs2YyRkv X-Received: by 2002:a17:903:2450:b0:1e5:5df7:3cf6 with SMTP id l16-20020a170903245000b001e55df73cf6mr2687240pls.0.1712853883630; Thu, 11 Apr 2024 09:44:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712853883; cv=pass; d=google.com; s=arc-20160816; b=V0IRy7OYq2h4FcVOvF0RujPo9n2NPB+9OBCdTd0f3l5Kv9DDElyQCwP6ZgVNfAlc9c nmFadNnjRBCcEAEhN82+VV+BO+1vobZONtmMn18JsKk5mEAbkURaRM24NXNquJFPfuOU qN4l+Ycz8J3aTmU+OAtCuiR2D+U20oz3K+Cn7K2O5IKN1k9+MpHsYkVAQrREd/WKbnRr I3El8vVNERVIrrtx1tmcLOT6q0Ogh/Pszbu8rqpr3aFqpSBmdssOlSDzxpDnrTuXtee/ WiZgU4nr1LOu/lMhj17rX+j1+QPw4yphq+vNKFeIZe3LyCQVaMY8Gx3K4KjQJ9hcxVHC H//w== 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=wyiv3PYk9uivp8uRbPKfheMtxKLuVXL7eV2fO7HBsks=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=PPamy8cm62HYfcj4vMxSp4QXis/KBytHG811tCfezZn47U62zI0YK3quhbpirKHb8O WjCHpKMTkxdFhCm0/YgFuOAgVbxETtqoX5TpbkRvBC54/b2u1dqaNLxKXnu65L/a+a+x V5C1jRUv31b9oY0vNOj90WGXoYgFh3jRZGMjd1SpaAuH+aJOdb+cLxFruVtsGQZHSqS0 bSpQ+JKa4xiww49TuxolwR2PIFLDia00b6JpaeCqYfJTfgEE90CqfagCG+De9DHD20+s p9vb7OwldmcKWgC5mS/CA7bVzvMUlb//QVdD5lBpGv0MXDQ9XBKlmE0EZXb0BDhAKkwe GXag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=jmfoVQB2; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-141057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141057-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b17-20020a170902e95100b001e20290828fsi1485118pll.637.2024.04.11.09.44.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:44:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=jmfoVQB2; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-141057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141057-linux.lists.archive=gmail.com@vger.kernel.org" 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 4D901283A58 for ; Thu, 11 Apr 2024 16:44:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7C751D2148; Thu, 11 Apr 2024 15:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="jmfoVQB2" Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46B4A15535B for ; Thu, 11 Apr 2024 15:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849973; cv=none; b=NcJmRg6frFjD+Sy+daNZVZsn4Pcon4fFhn4Dsa9O0GipDRWrTfV5mThNVtoaVQi+hLpcSAAAWcEiM3pF0CYRRZVft+b0RvTahQabYaDWfia1ahEkkOrvkzbqlxwwSAdN6rJ6lxqciOB29JZ+gU4kAbuN+XTSw2UkLjwlQhLkNFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849973; c=relaxed/simple; bh=kBOG6gh9L+YlXUEO5PvC5HwNjQ+tJN1HQ2raep5WTkw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d0e3t/ge5CZW2AS39c/fOUOSNoYc9+atSUwOQleQAvvem7/Fy7NM+QHyNscw3qOEHaaTGXlRDGygGitgerJxM+IatTffSWebOGSSnrQuPHagGRpN1FTUHoryMOGpSsNjDJ2ZbwAxVO0zOSSonXXJ/FZKWbkoPGrKxGyUlrd4L1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=jmfoVQB2; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7c8e4c0412dso69635839f.1 for ; Thu, 11 Apr 2024 08:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712849969; x=1713454769; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wyiv3PYk9uivp8uRbPKfheMtxKLuVXL7eV2fO7HBsks=; b=jmfoVQB2l7npa+vChySWBlEM7k9h/jRMrg3OL++SemkaaPhXopomw2KYADHoOuE688 yBjtb8szD28w05ikvOzt2v2720i+kMJWKXhFxF2dqo6LygiHIbyP9a/s1U4C/AXF0wQc JPWh75ul5gWCi3ApwZD/YEyripLBCTJAJSdkYFKVK7uKJXZQ11zGxYnm/lL78z3csCsE FxDawscqYeSX0/E9TGztT7jjec5Cr9HklhTCFpfxkNcUjoUofdbIAO6NoLD1l2HSDsZ3 bjIHevRakpBMW4XhMDW0Bl4mb8LtI4U49O753G5eCOzMWRQeYXiDXo3PmbXfmZpQusW8 LdRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712849969; x=1713454769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wyiv3PYk9uivp8uRbPKfheMtxKLuVXL7eV2fO7HBsks=; b=akGMd67fkZgXjGIrEO8vI4fKiVK37z1JYxA3V4akQzviKOR6sSDMcuiT82fwz8s4rq Xqif3BXKjtEmYowPWHe1vAudNoNk8WJtoLSXfxHA+QE//oY/RDrGaET5OTjHWOBkbfH4 CoapP51ct8gAQNHQ41NDkHID/6fjwmRAmWMieeTwqn7kr8KvzFvrRw2AW84d9uYTYV9M 2aGMfZIVnoqyYbLbvyUMPVS/xyM03sGBNRVL/M7xvkWzSOLsxKA9X8KjRwZNc10k3nQI o0VtVcITd8Ztq+G9zdNT8MVNLuI6xsFg/jFi68vrsQn5uYDLWf1Ti9yj6BnyO1c1k9Ky kWEg== X-Gm-Message-State: AOJu0YxBEBX9vYd8Vw7gA1nUyJaoevGNue9T46ouZqwhjIWRngIf2KG9 KvAQxj5quEQVvXlHta4ePcxnwiAKUHwhb+UZnrkfRxMJI30ctDUTe7eik94tHCOCd8L9oRPUCog h X-Received: by 2002:a6b:c34e:0:b0:7d6:7b7c:8257 with SMTP id t75-20020a6bc34e000000b007d67b7c8257mr227452iof.0.1712849969399; Thu, 11 Apr 2024 08:39:29 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:39:28 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 283/437] fs/binfmt_misc: convert to read/write iterators Date: Thu, 11 Apr 2024 09:17:03 -0600 Message-ID: <20240411153126.16201-284-axboe@kernel.dk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411153126.16201-1-axboe@kernel.dk> References: <20240411153126.16201-1-axboe@kernel.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Jens Axboe --- fs/binfmt_misc.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 68fa225f89e5..f44b626c4df7 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -734,10 +734,9 @@ static void remove_binfmt_handler(struct binfmt_misc *misc, Node *e) /* / */ -static ssize_t -bm_entry_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) +static ssize_t bm_entry_read(struct kiocb *iocb, struct iov_iter *to) { - Node *e = file_inode(file)->i_private; + Node *e = file_inode(iocb->ki_filp)->i_private; ssize_t res; char *page; @@ -747,7 +746,7 @@ bm_entry_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) entry_status(e, page); - res = simple_read_from_buffer(buf, nbytes, ppos, page, strlen(page)); + res = simple_copy_to_iter(page, &iocb->ki_pos, strlen(page), to); free_page((unsigned long) page); return res; @@ -794,10 +793,11 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer, return count; } +FOPS_WRITE_ITER_HELPER(bm_entry_write); static const struct file_operations bm_entry_operations = { - .read = bm_entry_read, - .write = bm_entry_write, + .read_iter = bm_entry_read, + .write_iter = bm_entry_write_iter, .llseek = default_llseek, }; @@ -882,23 +882,23 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, } return count; } +FOPS_WRITE_ITER_HELPER(bm_register_write); static const struct file_operations bm_register_operations = { - .write = bm_register_write, + .write_iter = bm_register_write_iter, .llseek = noop_llseek, }; /* /status */ -static ssize_t -bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) +static ssize_t bm_status_read(struct kiocb *iocb, struct iov_iter *to) { struct binfmt_misc *misc; char *s; - misc = i_binfmt_misc(file_inode(file)); + misc = i_binfmt_misc(file_inode(iocb->ki_filp)); s = misc->enabled ? "enabled\n" : "disabled\n"; - return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s)); + return simple_copy_to_iter(s, &iocb->ki_pos, strlen(s), to); } static ssize_t bm_status_write(struct file *file, const char __user *buffer, @@ -944,10 +944,11 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer, return count; } +FOPS_WRITE_ITER_HELPER(bm_status_write); static const struct file_operations bm_status_operations = { - .read = bm_status_read, - .write = bm_status_write, + .read_iter = bm_status_read, + .write_iter = bm_status_write_iter, .llseek = default_llseek, }; -- 2.43.0