Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp635122pxy; Fri, 30 Apr 2021 12:53:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxLAa/1k+Rjg/hC6qFB4Fy+cNi8T3u4YJ6A+yIn98zULuMF11T1fZ3ko53ti8UfJJXgimi X-Received: by 2002:a17:902:c211:b029:ed:7a6b:d4bf with SMTP id 17-20020a170902c211b02900ed7a6bd4bfmr6796396pll.63.1619812419763; Fri, 30 Apr 2021 12:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619812419; cv=none; d=google.com; s=arc-20160816; b=s2LEL/OQJXIu0eaXAU2SxJCrK4kyz+fBlY2XdtLKS74RREJ+f4oHhVpJXNUa3z5jNv 5yr3Kk0XXtVNrkGob3g4EnmsKVm+Q1+cbtB+etq4zSZUozxlAXKeavcqO6zHZpm9btsU fvaI2UPoN6YmsKPoUmaTqU0avY6hOXuys31NVpl0LsKmMjbsQpzmujjsU9gI4Y0hPn0W NFwpllpKoL7F8M2UVqmhPzJd1wjP8OYop+Pd1GKf43IWYabi7bkItqLQ+bFD1tItGzT5 IE293BtE5YskshDSv4RgALRh3UU1QvT+Igz5sCPKaSUQe62bE+1wSDYrR+9hVoNyr3mO hrjQ== 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=U3NRDWUS3k2S7zTRCnL5Tab/JpanPdjkC6JRyYJveY7aWdLa9ClRBtAVJXbc+sutTx Vl2O4QHi1jNJumdiwLKtshJ20t+mytnOkBeipcRiSK6RPfZOw1n0USpHGfpjlii/MQ7h VHIC0ADogHOapyMRU722flPioSt0WhUBZXu00fnsIzBQNxRtcu55oPmK9G85aOR54tLb TINyjQHWKg/RwA7QQ+UgGUNna40Uavtkp8Vk6xpWTRWKZNr6ApghVXOkhiUpL09/qfL0 mNjOJqpfbHmAWaBg7KzRcFm6Gxrl0/Obecuv1lnostG4KyeKt52D5IpTj+mGvuDgZwdj 6c8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.b=pu4gEEk8; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b="OJ/qR0VZ"; 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 m10si4932302plx.380.2021.04.30.12.53.27; Fri, 30 Apr 2021 12:53:39 -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=pu4gEEk8; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b="OJ/qR0VZ"; 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 S233362AbhD3Txi (ORCPT + 99 others); Fri, 30 Apr 2021 15:53:38 -0400 Received: from server.lespinasse.org ([63.205.204.226]:54429 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232291AbhD3TxW (ORCPT ); Fri, 30 Apr 2021 15:53:22 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-14-ed; t=1619812353; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=sRgr3eTHMkYG0a033c5wSjP6+Yvrcvk4eJe6GnX/cXk=; b=pu4gEEk8gaS/ZROdf2FE6TRCwKA3WG48lPgW+lbTvRhfaZiXKDPKC9Ab/r9nTYZxiRuSc oCeVJTcBB8K0IfVAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-14-rsa; t=1619812353; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=sRgr3eTHMkYG0a033c5wSjP6+Yvrcvk4eJe6GnX/cXk=; b=OJ/qR0VZF0/gCuHmcQvd9wL3u8ggpTpELa5K5Ixo9ImrXlgyebYkv+gh7VbA4Oqt247Jh 8Dbgd9DQXJjIO6xeGUV6CvAdM8lohz6e/MyQl9EnmjOSIGedHtdE5y21J/h2RzDYBxt/9O4 2BgjQihL+CXBHVw4WBP8WKugN0Zmgd7TthmDaEWPZJPdtSNW5Y4lVplSE8/LT2d7KprQmBb EvaxTSSuJXKuLgr8BEvcU8nFcvs51kLDtBc0yi7/v6HVis2w5RGQH3MrvycJhtJ/lyzvTFt wbL+fbDoTZeH4ZTYaqxXhiw7/u9ZMFL++Qe2UuCz6X7igqi/n60uPIaF4qrQ== Received: from zeus.lespinasse.org (zeus.lespinasse.org [10.0.0.150]) by server.lespinasse.org (Postfix) with ESMTPS id 244BA16030D; Fri, 30 Apr 2021 12:52:33 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 0D7FE19F524; Fri, 30 Apr 2021 12:52:33 -0700 (PDT) From: Michel Lespinasse To: Linux-MM , Linux-Kernel Cc: Laurent Dufour , Peter Zijlstra , Michal Hocko , Matthew Wilcox , Rik van Riel , Paul McKenney , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Andy Lutomirski , Michel Lespinasse Subject: [PATCH 03/29] mmap locking API: name the return values Date: Fri, 30 Apr 2021 12:52:04 -0700 Message-Id: <20210430195232.30491-4-michel@lespinasse.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210430195232.30491-1-michel@lespinasse.org> References: <20210430195232.30491-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