Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp722631pxf; Wed, 7 Apr 2021 09:57:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8rGG1eUEXqWkJevbZOz+pfFoWdCDox3S/SzfUXuza5pwCVA1FCEuxm4FiSAJYuSyohD4E X-Received: by 2002:a05:6402:4415:: with SMTP id y21mr5532085eda.70.1617814672813; Wed, 07 Apr 2021 09:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617814672; cv=none; d=google.com; s=arc-20160816; b=xi7ToX8o6KlV27hjQ0i1m0pm7j38P/IolCmPTpTTV80tonUUM1NfPTFaoIS/pfBty9 Z5RUiSaSGfEXExAN9nx3cvku1YAGwp3n7O1SCN8s7y4LbhTPGfOjVW5k6ksYgQTFT/LZ M+Y1oDd8sKoWiAuhktZ1udVfXOreVFJ5ka55fV9+N6sTK7HL06gEkUvq2L8s2YjiD7Vs vozqfHLvbR6n8I5G2vUTTV/dwnFO6A7BlkLvPB9Au+K+z/VF9lhdaGMKMh1iGrmqt26N S8Ff7mEn9oNbkbRPerp68WZmz4xIcxSGENuZV8x3nFTrLrTBUYIRdB7/senjgddNt8ak pGRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=sRgr3eTHMkYG0a033c5wSjP6+Yvrcvk4eJe6GnX/cXk=; b=DNoxnftKWujThRbgBnoXxJTCxdM78MyP0SIUvi9NTwdts+pOOtpIBrajkUtjNg7nAT dkhexTMibFETBkzYi/yzh0nxhGHam+72UaBHJ1fRTaHsJ73csPZN5E3QaxeW5BA58OAO ecndDFrbNyH/NTWzd391wLPuAoGPP1ktIu/yX45zD1Z5E5YBkIs1LBhYda6SiA3Wqbqm GZp5BVhtTFccvHrLy7JQyTjrBoQ4GRG/7Beahg6pVmBMWic7rY1a9hgTAD5AsqQnlBJ2 HTNYaZfuorHos1ETsdzv3D/Czs4DSKJeoT65L52ZUQp6C1HRyGBtdYTd/jmtwf9z35Xn IiLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.b=5EhncmT4; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b="l9qp+/x/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lespinasse.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si18654552edd.185.2021.04.07.09.57.29; Wed, 07 Apr 2021 09:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.b=5EhncmT4; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b="l9qp+/x/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lespinasse.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347870AbhDGBv5 (ORCPT + 99 others); Tue, 6 Apr 2021 21:51:57 -0400 Received: from server.lespinasse.org ([63.205.204.226]:34719 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343631AbhDGBvt (ORCPT ); Tue, 6 Apr 2021 21:51:49 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-ed; t=1617759902; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=sRgr3eTHMkYG0a033c5wSjP6+Yvrcvk4eJe6GnX/cXk=; b=5EhncmT4Gv438y6/5NG8ncKXAEzImmCZNTdJ3BxGL42bGoEFICVQKsc5B2hxAx8fr7H4e xJ/4tdl7nubFCxJCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-rsa; t=1617759902; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=sRgr3eTHMkYG0a033c5wSjP6+Yvrcvk4eJe6GnX/cXk=; b=l9qp+/x/nFDxeFdkHEoF5i+V2o64nYkMphTKPV+I1CsWjxM3TxYvrT3odZdhMkHUWNk7P mJP519TzYNxVsZRJ5bWfMQ4XA/VwL5/m+55+duBR7nt6WMjCdzRqzAIT9uNSt+hForKTjF1 vYafd0yyNFnhcNrFcuASUOHtJ4PL9q9UdQ2S9QSDDo6ObI65oDsQE7NLqJvFpg/nCTfZkXQ 6RjIKhSCrcNJS43RcFFrQIOYKiT4ISh2jSANhns1iZaXnAGFiXYs4iv3jNfy2jsXh1x6Vaf LBpGuioVpY/32Plv1fYa63ymJhJ9ve3uUAyf8tv7eYHnQoypIIbXGU9nNNGQ== Received: from zeus.lespinasse.org (zeus.lespinasse.org [IPv6:fd00::150:0]) by server.lespinasse.org (Postfix) with ESMTPS id 757ED160224; Tue, 6 Apr 2021 18:45:02 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 6242919F31F; Tue, 6 Apr 2021 18:45:02 -0700 (PDT) From: Michel Lespinasse To: Linux-MM Cc: Laurent Dufour , Peter Zijlstra , Michal Hocko , Matthew Wilcox , Rik van Riel , Paul McKenney , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Rom Lemarchand , Linux-Kernel , Michel Lespinasse Subject: [RFC PATCH 02/37] mmap locking API: name the return values Date: Tue, 6 Apr 2021 18:44:27 -0700 Message-Id: <20210407014502.24091-3-michel@lespinasse.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210407014502.24091-1-michel@lespinasse.org> References: <20210407014502.24091-1-michel@lespinasse.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the mmap locking API, the *_killable() functions return an error (or 0 on success), and the *_trylock() functions return a boolean (true on success). Rename the return values "int error" and "bool ok", respectively, rather than using "ret" for both cases which I find less readable. Signed-off-by: Michel Lespinasse --- include/linux/mmap_lock.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h index 4e27f755766b..8ff276a7560e 100644 --- a/include/linux/mmap_lock.h +++ b/include/linux/mmap_lock.h @@ -81,22 +81,22 @@ static inline void mmap_write_lock_nested(struct mm_struct *mm, int subclass) static inline int mmap_write_lock_killable(struct mm_struct *mm) { - int ret; + int error; __mmap_lock_trace_start_locking(mm, true); - ret = down_write_killable(&mm->mmap_lock); - __mmap_lock_trace_acquire_returned(mm, true, ret == 0); - return ret; + error = down_write_killable(&mm->mmap_lock); + __mmap_lock_trace_acquire_returned(mm, true, !error); + return error; } static inline bool mmap_write_trylock(struct mm_struct *mm) { - bool ret; + bool ok; __mmap_lock_trace_start_locking(mm, true); - ret = down_write_trylock(&mm->mmap_lock) != 0; - __mmap_lock_trace_acquire_returned(mm, true, ret); - return ret; + ok = down_write_trylock(&mm->mmap_lock) != 0; + __mmap_lock_trace_acquire_returned(mm, true, ok); + return ok; } static inline void mmap_write_unlock(struct mm_struct *mm) @@ -120,22 +120,22 @@ static inline void mmap_read_lock(struct mm_struct *mm) static inline int mmap_read_lock_killable(struct mm_struct *mm) { - int ret; + int error; __mmap_lock_trace_start_locking(mm, false); - ret = down_read_killable(&mm->mmap_lock); - __mmap_lock_trace_acquire_returned(mm, false, ret == 0); - return ret; + error = down_read_killable(&mm->mmap_lock); + __mmap_lock_trace_acquire_returned(mm, false, !error); + return error; } static inline bool mmap_read_trylock(struct mm_struct *mm) { - bool ret; + bool ok; __mmap_lock_trace_start_locking(mm, false); - ret = down_read_trylock(&mm->mmap_lock) != 0; - __mmap_lock_trace_acquire_returned(mm, false, ret); - return ret; + ok = down_read_trylock(&mm->mmap_lock) != 0; + __mmap_lock_trace_acquire_returned(mm, false, ok); + return ok; } static inline void mmap_read_unlock(struct mm_struct *mm) -- 2.20.1