From patchwork Wed Jan 24 07:41:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 765614 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989563wrx; Tue, 23 Jan 2024 23:42:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGQIx8nr0AI+OgkwU301nNNB5VKIU5q/k0d7SAlUTjPDu8fom8CtFV20JL//Y5IAWJk5MZ X-Received: by 2002:a05:6902:38b:b0:dc2:3853:c79b with SMTP id f11-20020a056902038b00b00dc23853c79bmr294055ybs.102.1706082165734; Tue, 23 Jan 2024 23:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082165; cv=none; d=google.com; s=arc-20160816; b=c0rnNDQRiD5ehgZ3gZwptOG+XzZhzrLYs1qsyn5W6wSaBddlbIbyVuLhXU9qDnWRk5 PKSbugrMse+amcUgUYW6tKLXINy1q4GHH2EcmjLKQ4CCKCjuN3eoFcdREx1zgu3n4OR0 eMdBfbnNs05PpJBeWaq0FN0Lv9NqdMGXiCNKGslUuXcBgfb0aW7gAkXj3kVc/J57m28v TRwufX1+ZxZd62RuXmX6CBCTtL+8c4qEGQtC0yiX5vnvkbRScVPf963eISKfXnFHloBV CE7m2jg1IbPoTRbKLJzo/9ndP0IL0G2MiA8wQA7AYwv9ZpiAfHaCKpIVUjTaeU2IDhoL rQ7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iAI6SzwuMj1fhJkYbViGKDOa9P8dnzcSn0icKU6xRVc=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=qJnVFrVWdQbqTorPY3JodOjWqqUZcvd36WbDTtYaOyx+R8tRjJlVSgB+yFvdn6yccG QZtV8HBgXjoAkSlDXIOS5nhLqDLxKvyimmAf0NiSjIbGn51yhU7NWxVw/+Bf5yjf10BU n0soAs87SUT+pfR8IDgNF9DDaJ5+P0JN7ZaadrMCdYQ0yIi0X/wR41TjT6rTZY5WN0wd fuEJSSPkptgaZW3ZLmpaTnm/wN7zAgxFoy2XMD3+W/EdS47nB8DHRXgX9//Hz5MCyYj3 1YbWbYqG39KvK6CkOIRbsLVxeimKj2Z/ULIANGktatyZayOu90JS0vPtEfT51DDY49zW 2Ntw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TdjHpQl6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h21-20020a0cab15000000b0067f89610cdcsi10174514qvb.180.2024.01.23.23.42.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:42:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TdjHpQl6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSXtw-00036J-MY; Wed, 24 Jan 2024 02:42:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSXtt-00036B-Sq for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:21 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSXts-00034L-E0 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:21 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3394b892691so320453f8f.1 for ; Tue, 23 Jan 2024 23:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082138; x=1706686938; darn=nongnu.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=iAI6SzwuMj1fhJkYbViGKDOa9P8dnzcSn0icKU6xRVc=; b=TdjHpQl6HeC5xhmOjRLRiK3M/4SUV3D6v9A2heARnxXi6BojDyESpya/dh30LKE6/K IkRzzry7eAvZ7/5mVLYUih1c7qXDwAUORLH3qZT3hO5UhE8LnEUetHhNkNH6tkjmgiy+ vCAESeXtJLnbpbP5utI6a9nzVo+iylPF9y0f2nZsRMjm04v2FwTlDwsz4DNIpJAku2rd gQiICxS5t/XKd6xZany99UJYRrZrEFP2Hd6je5oT0BDf0vTW1Ye2LdJbf4MXBaxrPjUN 8maaRiDD6+GOvi3fGmZD4HjSOIOQXSMXvqS/rugSuiuKb6dUsak0HaugT81s5HF0k6MI Pkpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082138; x=1706686938; 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=iAI6SzwuMj1fhJkYbViGKDOa9P8dnzcSn0icKU6xRVc=; b=CWCOif9FKnrdhU2ZuNsP+XgG0jXIu2gPD3/Lvl1T4nasuTJQh6XDcQ5uvA7Ssclt+3 mazNlEDgyg7UQgGF7SRsYZi9kTkv175x+3if3qEPJkQSAn3rT1aWS8mUAKlF49ZYTQG2 GvYwwCZnuqXYBjQYmkTGte6sRhUJns4HUnaDDU5MLrJ5pC49TBuJ/TUgX54E2WTV+5Qu 1PWatduNPXE7dSCoEPjN/tEqGKenll/N+e54JX4q4tOni/ZT/Y7m3zVLsovVOL6728i2 JlxM81yeajk/q6blkN3ORfC0/zC7sduiGRSoheS3DIDDVQ5yfTJ47M4LlZcrMMc7RH5D Il6A== X-Gm-Message-State: AOJu0YwsNbkKFa6V7gfvEHIjuaxhJi+0MwqO8sJkPoxe4DZv7jmq//8H 5/Hvm4j83jQvHrTv7n5AvwNJwuemq6jSb67NoLLriR63cP5nCvVbzyH3bAyHRbcK2PpUQqQ1OMj Z X-Received: by 2002:a05:6000:144a:b0:339:47d7:6527 with SMTP id v10-20020a056000144a00b0033947d76527mr281803wrx.0.1706082138385; Tue, 23 Jan 2024 23:42:18 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id l11-20020a5d674b000000b003392c727cadsm9218653wrw.27.2024.01.23.23.42.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Christian Schoenebeck , Fam Zheng , Greg Kurz , Richard Henderson , "Michael S. Tsirkin" , Gerd Hoffmann , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goat?= =?utf-8?q?er?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/6] hw/9pfs/9p-synth: Use RCU_READ macro Date: Wed, 24 Jan 2024 08:41:57 +0100 Message-ID: <20240124074201.8239-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124074201.8239-1-philmd@linaro.org> References: <20240124074201.8239-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace the manual rcu_read_(un)lock calls by the WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba "docs/style: call out the use of GUARD macros"). Signed-off-by: Philippe Mathieu-Daudé Acked-by: Greg Kurz Acked-by: Christian Schoenebeck --- hw/9pfs/9p-synth.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 0ac79a500b..419ea69e3a 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -241,15 +241,15 @@ static struct dirent *synth_get_dentry(V9fsSynthNode *dir, int i = 0; V9fsSynthNode *node; - rcu_read_lock(); - QLIST_FOREACH(node, &dir->child, sibling) { - /* This is the off child of the directory */ - if (i == off) { - break; + WITH_RCU_READ_LOCK_GUARD() { + QLIST_FOREACH(node, &dir->child, sibling) { + /* This is the off child of the directory */ + if (i == off) { + break; + } + i++; } - i++; } - rcu_read_unlock(); if (!node) { /* end of directory */ return NULL; @@ -494,13 +494,13 @@ static int synth_name_to_path(FsContext *ctx, V9fsPath *dir_path, goto out; } /* search for the name in the children */ - rcu_read_lock(); - QLIST_FOREACH(node, &dir_node->child, sibling) { - if (!strcmp(node->name, name)) { - break; + WITH_RCU_READ_LOCK_GUARD() { + QLIST_FOREACH(node, &dir_node->child, sibling) { + if (!strcmp(node->name, name)) { + break; + } } } - rcu_read_unlock(); if (!node) { errno = ENOENT;