From patchwork Wed Jan 15 20:20:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940880 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5E54A1D89FA for ; Wed, 15 Jan 2025 20:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972437; cv=none; b=L5b0N3wlb6umsCC973XUi0w4YMmNA4QE2j9LTSf3M6X2y0mJUyF4qaIT1HjxsU8nVMAwf3In6FxecHG7glqJ0HAogOKAG47VeSsv/iw0Tu9u0AYbk+Gw8dUZr4wEvrYrE8vUoKV4+bpU+FjY/tpwthPORemPYIUh8M+5wGqMEJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972437; c=relaxed/simple; bh=ons201zd7zgdZGm6nNGtUON1uSf9urm/nC22I0yxNmc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LK7WmpPNalgvHy4o25+jIyNvxLM6hzwz+eDg54jC1WYZebA4nf5JrYVw/D2MQk/PwBvjxpOTP+ZksmdEFhyAhOMP66hYOTeZ8EumWc8CIGBB7lyjofsNE4ow1mXgattUltp5ABHDcM2AsQGV/i/SJP7u7ojwYOIgfUTwQUqdtR0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tr3xGQCa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tr3xGQCa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCA9BC4CEE1; Wed, 15 Jan 2025 20:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972437; bh=ons201zd7zgdZGm6nNGtUON1uSf9urm/nC22I0yxNmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tr3xGQCa+8vugoq9rvBFa0u7K81gNPLAz+TDVvqZK0aWYztbiqjBdR6Xx4oaMv+M2 HJmdV2KGEok29NPVPTYWoiLUi+ReWRiXOqsmz/OvRt6MnhHmWX/VdHmdp64zW3RQC9 +3JbtcqGY3APPS1woyz34M3HEUzc8FDDgH/BY3k7HV/Yx5HPtfbPjwuJO5UK3RIWFn ekfxhKGVkpF5cQssuiJjKxm8ZB7p07bOMf6koRzyOd2V1TOJFW7VMt1zhsXaHwQHoZ oBiN6HudEdJdUTr4HiN4hNCy7guE1qW+aT9oazyLQbZMIo7ZQI7amcMubXSuTZjs0w LRJxbNu87E1lQ== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 1/8] Patch for broken libnfsimapd static and regex plugins. Date: Wed, 15 Jan 2025 15:20:28 -0500 Message-ID: <20250115202035.112122-2-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Joshua Kaldon It appears that the makefile does not add nfsidmap_common.c in the sources. nfs-utils (1:2.8.2-1.1~0.1) UNRELEASED; urgency=medium . Non-maintainer upload. Fix issue with static and regex plugins missing symbol get_grnam_buflen. Signed-off-by: Steve Dickson --- support/nfsidmap/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/support/nfsidmap/Makefile.am b/support/nfsidmap/Makefile.am index f5b9de0e1e91..b2db18f1b970 100644 --- a/support/nfsidmap/Makefile.am +++ b/support/nfsidmap/Makefile.am @@ -40,15 +40,15 @@ nsswitch_la_SOURCES = nss.c nfsidmap_common.c nsswitch_la_LDFLAGS = -module -avoid-version nsswitch_la_LIBADD = ../../support/nfs/libnfsconf.la -static_la_SOURCES = static.c +static_la_SOURCES = static.c nfsidmap_common.c static_la_LDFLAGS = -module -avoid-version static_la_LIBADD = ../../support/nfs/libnfsconf.la -regex_la_SOURCES = regex.c +regex_la_SOURCES = regex.c nfsidmap_common.c regex_la_LDFLAGS = -module -avoid-version regex_la_LIBADD = ../../support/nfs/libnfsconf.la -umich_ldap_la_SOURCES = umich_ldap.c +umich_ldap_la_SOURCES = umich_ldap.c nfsidmap_common.c umich_ldap_la_LDFLAGS = -module -avoid-version umich_ldap_la_LIBADD = -lldap $(KRB5_GSS_LIB) ../../support/nfs/libnfsconf.la From patchwork Wed Jan 15 20:20:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940881 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3DD351D89FA for ; Wed, 15 Jan 2025 20:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972438; cv=none; b=Tn+zgbR0agnDtIxFlAdMSs9tgHeQQLCHauqq7bP9RTBr3IpHaC1QMamspKC3qwT9w/7AVWjSuVF0PbfxiGqM+f0/ZHOnfRuxty/JZXFcNPG1LRYreZM5Q91vJ0eae9wcKdWdUqpDoSRCO+iePVy0ziudG4SI+y7RTXGDZiW3B8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972438; c=relaxed/simple; bh=lPEmA6ck3pSMyWC7cY1+5R4MNAM+1KDdJol1heDUFFo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lJBT6uJ5LHELOqBV7TxrQXFC1q3jJTUvl0JBYeeX5/cDvBR8fz6Szqo2Upa1+qQOzG4j4LDgzwFUkaEoF1oxsboA3jv4w18RQYDF+io1bPNLkxRuUJy2VoSSur7lF2pgLLG1vITw91O8Phen0Q9JRAr6W6EBedrzHJrNo5UcZTg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MR/aVPo2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MR/aVPo2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76352C4CEE2; Wed, 15 Jan 2025 20:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972437; bh=lPEmA6ck3pSMyWC7cY1+5R4MNAM+1KDdJol1heDUFFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MR/aVPo2DyKcxQL/wMgTQI66x5Ajo6gUZsVeKe9jY7IluNBIVA21cntlaYNthhrOV Qn8JDng3TlttPqmPjAcZR/Oam4FaYEQ4pTIq+p6MPznoIfxiPqWhJAAomtwCdCWHD9 lJwMrINaEAIcK3JPOZIFjYHdsViKhs1YuHj+IaXZFHp1QJje+9YSp9nUvnLSh3sF97 PlmdQbQdhI3u5eJ6kxDNRC6rrFDNIpbZe7OfazEyLVTgI/wWkeu70f7JwGY1m83FFQ yY2Q75IOEZv9rgelKVGwSxExzgD10mdCQ12SpeBPt8PpW/p/mSB9Sbftg7nY5T5lZo bKao7v/goyhYg== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 2/8] rpcctl: Fix flake8 whitespace errors Date: Wed, 15 Jan 2025 15:20:29 -0500 Message-ID: <20250115202035.112122-3-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index d2110ad6de93..92a851c2278b 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -8,7 +8,7 @@ import socket import sys with open("/proc/mounts", 'r') as f: - mount = [ line.split()[1] for line in f if "sysfs" in line ] + mount = [line.split()[1] for line in f if "sysfs" in line] if len(mount) == 0: print("ERROR: sysfs is not mounted") sys.exit(1) @@ -18,6 +18,7 @@ if not sunrpc.is_dir(): print("ERROR: sysfs does not have sunrpc directory") sys.exit(1) + def read_addr_file(path): try: with open(path, 'r') as f: @@ -25,17 +26,19 @@ def read_addr_file(path): except: return "(enoent)" + def write_addr_file(path, newaddr): with open(path, 'w') as f: f.write(newaddr) return read_addr_file(path) + def read_info_file(path): res = collections.defaultdict(int) try: with open(path) as info: - lines = [ l.split("=", 1) for l in info if "=" in l ] - res.update({ key:int(val.strip()) for (key, val) in lines }) + lines = [l.split("=", 1) for l in info if "=" in l] + res.update({key: int(val.strip()) for (key, val) in lines}) finally: return res @@ -75,7 +78,7 @@ class Xprt: if not self.path.exists(): return f"{self.name}: has been removed" return "\n".join([self._xprt(), self._src_reqs(), - self._cong_slots(), self._queues() ]) + self._cong_slots(), self._queues()]) def read_state(self): if self.path.exists(): @@ -132,7 +135,7 @@ class Xprt: def get_by_name(name): glob = f"**/{name}-*" if name else "**/xprt-*" - res = [ Xprt(x) for x in (sunrpc / "xprt-switches").glob(glob) ] + res = [Xprt(x) for x in (sunrpc / "xprt-switches").glob(glob)] if name and len(res) == 0: raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), f"{sunrpc / 'xprt-switches' / glob}") @@ -158,19 +161,19 @@ class XprtSwitch: self.path = path self.name = path.stem self.info = read_info_file(path / "xprt_switch_info") - self.xprts = sorted([ Xprt(p) for p in self.path.iterdir() if p.is_dir() ]) + self.xprts = sorted([Xprt(p) for p in self.path.iterdir() if p.is_dir()]) self.sep = sep def __lt__(self, rhs): return self.name < rhs.name def __str__(self): - switch = f"{self.name}{self.sep} " \ - f"xprts {self.info['num_xprts']}, " \ - f"active {self.info['num_active']}, " \ - f"queue {self.info['queue_len']}" - xprts = [ f" {x.small_str()}" for x in self.xprts ] - return "\n".join([ switch ] + xprts) + switch = f"{self.name}{self.sep} " \ + f"xprts {self.info['num_xprts']}, " \ + f"active {self.info['num_active']}, " \ + f"queue {self.info['queue_len']}" + xprts = [f" {x.small_str()}" for x in self.xprts] + return "\n".join([switch] + xprts) def add_command(subparser): parser = subparser.add_parser("switch", help="Commands for xprt switches") @@ -194,8 +197,8 @@ class XprtSwitch: def get_by_name(name): xprt_switches = sunrpc / "xprt-switches" if name: - return [ XprtSwitch(xprt_switches / name) ] - return [ XprtSwitch(f) for f in sorted(xprt_switches.iterdir()) ] + return [XprtSwitch(xprt_switches / name)] + return [XprtSwitch(f) for f in sorted(xprt_switches.iterdir())] def show(args): for switch in XprtSwitch.get_by_name(args.switch): @@ -234,8 +237,8 @@ class RpcClient: def get_by_name(name): rpc_clients = sunrpc / "rpc-clients" if name: - return [ RpcClient(rpc_clients / name) ] - return [ RpcClient(f) for f in sorted(rpc_clients.iterdir()) ] + return [RpcClient(rpc_clients / name)] + return [RpcClient(f) for f in sorted(rpc_clients.iterdir())] def show(args): for client in RpcClient.get_by_name(args.client): @@ -244,9 +247,12 @@ class RpcClient: parser = argparse.ArgumentParser() + def show_small_help(args): parser.print_usage() print("sunrpc dir:", sunrpc) + + parser.set_defaults(func=show_small_help) subparser = parser.add_subparsers(title="commands") From patchwork Wed Jan 15 20:20:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940882 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CD9C81D90AD for ; Wed, 15 Jan 2025 20:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972438; cv=none; b=KgiLvtjoIY7COCAqocwciC+XtzR/jh9C/pE54ZHZThIL+cYaU14J7vngZBMDtvdTdu9Ol/f8WEgI0EpqLHdZ+WyMYk8hpU68M31ja7mVo1ckeK/8zt14mR+G30lo2YHYsmzvalmNhfLF2Cbd5kq8t7BCtx7RUjavhS82ugisRxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972438; c=relaxed/simple; bh=xW70Aucnop/TXo6NJMtzRw2LYQdaei3qhN+R3YKWe9E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZcQ8ObMdC6hV/MXAGs43MCABzt7qd++e02+iBqpjrav66lFssNcQyfgWhBESHyXHw4zpowYdU91xDUZmm5YKgaIJT/NiaNQqN14vx41dQmo3/RfaRQCvnLcx8yVJ+shqUfF/zFS3kxFj7cpjR5mYkUi3a1+QDlk7Yxy44XNI1Ug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JFRAW4N0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JFRAW4N0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E7FDC4CEE1; Wed, 15 Jan 2025 20:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972438; bh=xW70Aucnop/TXo6NJMtzRw2LYQdaei3qhN+R3YKWe9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JFRAW4N01gjQg6D19bwsCVJafjT+O6XQyCp9elTR9GLfIIBU96rmwGQa6AnjPDCsk r6RXcylehtYDXmvvxF+pZ000rexIZi0uqIQ+YIEB7tyvM0/XwQ29BKFxYY8EVElAG2 bKq8a/9C3mF9y8Otx2VVZsFXZPrrhOrkfORz/O049IS9Jc3WQLCESwrPUVNoltshz6 RzG1R7RYxp1IhTYOCrpa0wQX4unI5RINBRCmR4jzlC6GfnTNCPenbXU3hdOyzI+Chp b7I3KwnQQAiqUrq0rM63GZYfy/0onVq6GiwmrIU7zDh8rrw+2HGG+bhkYGk9P5lBnA RqSDzY7wDpGAA== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 3/8] rpcctl: Fix flake8 line-too-long errors Date: Wed, 15 Jan 2025 15:20:30 -0500 Message-ID: <20250115202035.112122-4-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index 92a851c2278b..ec43d12afc41 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -66,13 +66,17 @@ class Xprt: f"Requests: {self.info['num_reqs']}" def _cong_slots(self): - return f" Congestion: cur {self.info['cur_cong']}, win {self.info['cong_win']}, " \ - f"Slots: min {self.info['min_num_slots']}, max {self.info['max_num_slots']}" + return f" Congestion: cur {self.info['cur_cong']}, " \ + f"win {self.info['cong_win']}, " \ + f"Slots: min {self.info['min_num_slots']}, " \ + f"max {self.info['max_num_slots']}" def _queues(self): return f" Queues: binding {self.info['binding_q_len']}, " \ - f"sending {self.info['sending_q_len']}, pending {self.info['pending_q_len']}, " \ - f"backlog {self.info['backlog_q_len']}, tasks {self.info['tasks_queuelen']}" + f"sending {self.info['sending_q_len']}, " \ + f"pending {self.info['pending_q_len']}, " \ + f"backlog {self.info['backlog_q_len']}, " \ + f"tasks {self.info['tasks_queuelen']}" def __str__(self): if not self.path.exists(): @@ -106,7 +110,8 @@ class Xprt: self.set_state("remove") def add_command(subparser): - parser = subparser.add_parser("xprt", help="Commands for individual xprts") + parser = subparser.add_parser("xprt", + help="Commands for individual xprts") parser.set_defaults(func=Xprt.show, xprt=None) subparser = parser.add_subparsers() @@ -128,7 +133,8 @@ class Xprt: online.set_defaults(func=Xprt.set_property, property="online") offline = subparser.add_parser("offline", help="Set an xprt offline") offline.set_defaults(func=Xprt.set_property, property="offline") - dstaddr = subparser.add_parser("dstaddr", help="Change an xprt's dstaddr") + dstaddr = subparser.add_parser("dstaddr", + help="Change an xprt's dstaddr") dstaddr.add_argument("newaddr", metavar="NEWADDR", nargs=1, help="The new address for the xprt") dstaddr.set_defaults(func=Xprt.set_property, property="dstaddr") @@ -161,7 +167,8 @@ class XprtSwitch: self.path = path self.name = path.stem self.info = read_info_file(path / "xprt_switch_info") - self.xprts = sorted([Xprt(p) for p in self.path.iterdir() if p.is_dir()]) + self.xprts = sorted([Xprt(p) for p in self.path.iterdir() + if p.is_dir()]) self.sep = sep def __lt__(self, rhs): @@ -176,7 +183,8 @@ class XprtSwitch: return "\n".join([switch] + xprts) def add_command(subparser): - parser = subparser.add_parser("switch", help="Commands for xprt switches") + parser = subparser.add_parser("switch", + help="Commands for xprt switches") parser.set_defaults(func=XprtSwitch.show, switch=None) subparser = parser.add_subparsers() @@ -185,11 +193,13 @@ class XprtSwitch: help="Name of a specific switch to show") show.set_defaults(func=XprtSwitch.show) - set = subparser.add_parser("set", help="Change an xprt switch property") + set = subparser.add_parser("set", + help="Change an xprt switch property") set.add_argument("switch", metavar="SWITCH", nargs=1, help="Name of a specific xprt switch to modify") subparser = set.add_subparsers(required=True) - dstaddr = subparser.add_parser("dstaddr", help="Change an xprt switch's dstaddr") + dstaddr = subparser.add_parser("dstaddr", + help="Change an xprt switch's dstaddr") dstaddr.add_argument("newaddr", metavar="NEWADDR", nargs=1, help="The new address for the xprt switch") dstaddr.set_defaults(func=XprtSwitch.set_property, property="dstaddr") @@ -225,7 +235,8 @@ class RpcClient: return f"{self.name}: {self.switch}" def add_command(subparser): - parser = subparser.add_parser("client", help="Commands for rpc clients") + parser = subparser.add_parser("client", + help="Commands for rpc clients") parser.set_defaults(func=RpcClient.show, client=None) subparser = parser.add_subparsers() From patchwork Wed Jan 15 20:20:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940883 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 80EA71D90AD for ; Wed, 15 Jan 2025 20:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972439; cv=none; b=facFHWnqwVy3l399Vm0RBMcTS6rRgbjg2nQP5Eu2n78Dn6WLQZ2QRgX6dOGaD77PlidjERDiqRVRgH2u6l+bgLw/Ynp0iazqRiI0RwtazaUc440T5kg2pRLXXszRBVXMxsEjHTkN4exTynJHdYwImWxqdM7bVBAbU+0vGMQVrhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972439; c=relaxed/simple; bh=1SY9npNDZCPDJOJxh0hepcXTRZ+x2s7mjFFm8rpmhwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RrmcyCqcWLSrR1RWZhfJ5ADszQ9AzszpN/T4wW9JQFXK2Erfz0+3sytk3lCj+VGwIhSsssPeHAEFDHJNLEBot27+QsCpJk9Xe2j2nk3hBd8ohMfJrm5NKtgvT+IqaxM4pdqjsf5x66crRLRVYrbFCS7Evq8uEwLB40H6QfLWdz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BA7Yu4N8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BA7Yu4N8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AAB0C4CED1; Wed, 15 Jan 2025 20:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972439; bh=1SY9npNDZCPDJOJxh0hepcXTRZ+x2s7mjFFm8rpmhwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BA7Yu4N8LeqGRHGadK79tRyEEyiJ8WIKESZ2n9nXcw1tjLV9ABXJXtE5Wk0kTAxTN fp4kirlHMn7YI8DkjmeUgFDwc6SflfWSBB2bCh5Ym/grC73FDCd7exX8wJylGIwh8X Y6marGXRaaWcXIOf+6dCIRDK75uHWfsf4Q25PnvcZjGmyhpKVR0D5dnHWMPJgyZRqB p13/374E9R3tlrGgDVdJwQ7tU1J/FfstNheWalLg4i/K3RjMw97h0IFzaBtzUnk2gx C7ujyr9Cg2PiXIQ1eLUnVMlEgr2G97BUKbQlbzaBaiY8qqVRgOtBXS3llaAD6Zzadz k1QsiggdQq58w== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 4/8] rpcctl: Fix flake8 bare exception error Date: Wed, 15 Jan 2025 15:20:31 -0500 Message-ID: <20250115202035.112122-5-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index ec43d12afc41..c6e73aad8bb9 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -23,7 +23,7 @@ def read_addr_file(path): try: with open(path, 'r') as f: return f.readline().strip() - except: + except FileNotFoundError: return "(enoent)" From patchwork Wed Jan 15 20:20:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940884 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 173B41D9320 for ; Wed, 15 Jan 2025 20:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972440; cv=none; b=YwzaYdQ+Ony/JBhW9qukdni7qBP2piBMMYY1DjRcM7qN6R/kOAjqkQO0YfzK1y8DYQYGSVcaQ5uDu4KAYisZ8u7lZtLLaOE/UhfIUsfuHHICdbRKtNuEeCIBss6lkLEfPZ5B2F0OPN94cR9elSkjSc87LjRJDmeOoTPANaHBzbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972440; c=relaxed/simple; bh=aKlE/uab/3R8C3BPeGxr8V73nq7hA/zceATf6X2HUSI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZwqWDdcCbhlLqH+tVjgvyrWT7O/sT6GB5tf9KIpOSSFtpmyJ9ka0AXIbcV12Ukw6Cmu2azSrP0wWT0BTjyf+sVKQFYMa0PX3ITKFOJU/i2rLY/4384sPRsCAFMPqTekovoTprg/JZ2wSTVREB3clsgHES1isYiJKhd5YuvuqpcI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZsFw2J6t; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZsFw2J6t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BACFC4CEE2; Wed, 15 Jan 2025 20:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972439; bh=aKlE/uab/3R8C3BPeGxr8V73nq7hA/zceATf6X2HUSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsFw2J6t88eK4ZvLMukHkIh/MTaDUn8HTJboH5HZcySCW4sxLS8psS8yZOw0hmjbm RqoHUyhmON/t7Q1RsR4F8bQXtuf5XJF7pBsVM2VBSohg+V/UV/GqZw0W3TjFA8DWtp wNK2EQ77fZGz70Cu1eS1RajqaleecdBSKRedCNrCl45ISshgCAcM98bY/IhKcMbnHy d8ipAdWSaX7LnK9ojMkKOb/eReQyxpXiPnUZWJmL7j/kKhw0BccJSPnkn1+rSpvISD LQVJ7sWzMynIncwuHlBlhUU9HO+QPLs4SR0lbYcjtN0R07f7RQBmxpw8ryFc/VPzlS BZkTSUNvBW5/w== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 5/8] rpcctl: Fix flake8 ambiguous-variable-name error Date: Wed, 15 Jan 2025 15:20:32 -0500 Message-ID: <20250115202035.112122-6-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index c6e73aad8bb9..435f4be6623a 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -37,7 +37,7 @@ def read_info_file(path): res = collections.defaultdict(int) try: with open(path) as info: - lines = [l.split("=", 1) for l in info if "=" in l] + lines = [line.split("=", 1) for line in info if "=" in line] res.update({key: int(val.strip()) for (key, val) in lines}) finally: return res From patchwork Wed Jan 15 20:20:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940885 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9D5A51D9337 for ; Wed, 15 Jan 2025 20:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972440; cv=none; b=FgCkCmtWiNrjA2ARXR3r6KTkO/nAeCtMIVSmvy9g1rr1rktNIb4acW4/sQ34M+gC3Z11z5BK4dw4+8LK280lCDQgg2QwAmKTy6NDqa28L85nLPm5YWjmpuLld2YidVpWVnC84U6/jk53yFkywtGeT0SMuSdpoiB2sF1MDHM+8ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972440; c=relaxed/simple; bh=yjkDiLX5hhYPH6CbLSaMhXE49j7uLj8uXTgK9uVGAMk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B4QdV69JA/e2xPzNZZx4D9xFKRedmahMSgiELt2+ET8Esxm+KI+gF6foVE9l0wBo2W/9nbLVOq3H8hzAtiOvrYP5tlO9yOBV82pJjydZqhgHtcIJvfsXQmyyRxCyK53HsWZ1C++z7f/NnKnLvtyM0RZYjCoCHkMEiYbwGjDvbpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kYhdkrkk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kYhdkrkk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0B1BC4CED1; Wed, 15 Jan 2025 20:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972440; bh=yjkDiLX5hhYPH6CbLSaMhXE49j7uLj8uXTgK9uVGAMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYhdkrkkPtWXB9HtwawS60eTgjPntioy/0y4JtY3PAyk0uhnQFJE1HuCh2yHRwVcg xyNEAYmGDlCQpFhdL/marjgc9ji2uQFpvVHBHkDVvyg3yNgsvZoG/wAe8Icfg0+O5n CmVvVtYN43KXSd6qIXeWVpEA28mZsVI5cIGk6ly7I7QkPxQBff+ym3QGqyz790Gwbz 7OwNIcvm65ixqP6vPij/D1RiioykAfdLyg1F4Nab/rR5DSvHfNqebe3TWHUTl/+4Lz kFpp28wYlJIunnoR1lFwne+vtldqFcGtvbOxDCOPhKCpKHLFKX35YWjXncZIwm4VHj jc2v2kbIp4Jbg== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 6/8] rpcctl: Add missing docstrings to the Xprt class Date: Wed, 15 Jan 2025 15:20:33 -0500 Message-ID: <20250115202035.112122-7-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index 435f4be6623a..b8808787b51d 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -44,7 +44,10 @@ def read_info_file(path): class Xprt: + """Represents a single sunrpc connection.""" + def __init__(self, path): + """Read in xprt information from sysfs.""" self.path = path self.name = path.stem.rsplit("-", 1)[0] self.type = path.stem.split("-")[2] @@ -54,6 +57,7 @@ class Xprt: self.read_state() def __lt__(self, rhs): + """Compare the names of two xprt instances.""" return self.name < rhs.name def _xprt(self): @@ -79,24 +83,29 @@ class Xprt: f"tasks {self.info['tasks_queuelen']}" def __str__(self): + """Return a string representation of an xprt.""" if not self.path.exists(): return f"{self.name}: has been removed" return "\n".join([self._xprt(), self._src_reqs(), self._cong_slots(), self._queues()]) def read_state(self): + """Read in the xprt_state file.""" if self.path.exists(): with open(self.path / "xprt_state") as f: self.state = ','.join(f.readline().split()[1:]) def small_str(self): + """Return a short string summary of an xprt.""" main = " [main]" if self.info.get("main_xprt") else "" return f"{self.name}: {self.type}, {self.dstaddr}{main}" def set_dstaddr(self, newaddr): + """Change the dstaddr of an xprt.""" self.dstaddr = write_addr_file(self.path / "dstaddr", newaddr) def set_state(self, state): + """Change the state of an xprt.""" if self.info.get("main_xprt"): raise Exception(f"Main xprts cannot be set {state}") with open(self.path / "xprt_state", 'w') as f: @@ -104,12 +113,14 @@ class Xprt: self.read_state() def remove(self): + """Remove an xprt.""" if self.info.get("main_xprt"): raise Exception("Main xprts cannot be removed") self.set_state("offline") self.set_state("remove") def add_command(subparser): + """Add parser options for the `rpcctl xprt` command.""" parser = subparser.add_parser("xprt", help="Commands for individual xprts") parser.set_defaults(func=Xprt.show, xprt=None) @@ -140,6 +151,7 @@ class Xprt: dstaddr.set_defaults(func=Xprt.set_property, property="dstaddr") def get_by_name(name): + """Find a (sorted) list of Xprts matching the given name.""" glob = f"**/{name}-*" if name else "**/xprt-*" res = [Xprt(x) for x in (sunrpc / "xprt-switches").glob(glob)] if name and len(res) == 0: @@ -148,10 +160,12 @@ class Xprt: return sorted(res) def show(args): + """Handle the `rpcctl xprt show` command.""" for xprt in Xprt.get_by_name(args.xprt): print(xprt) def set_property(args): + """Handle the `rpcctl xprt set` command.""" for xprt in Xprt.get_by_name(args.xprt[0]): if args.property == "dstaddr": xprt.set_dstaddr(socket.gethostbyname(args.newaddr[0])) From patchwork Wed Jan 15 20:20:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940886 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DA17D1D934C for ; Wed, 15 Jan 2025 20:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972440; cv=none; b=G08lPtV+5v6oc1/udyEg3diZ04nVxXQbugmPSRk6lmWxiS0p8shy8//sPEWgU9WW5wI6Dd+gowQFk3w8UlT/0FLJ7SP+uHK5MgyiZz3sV23D+IzglWIdZPNWgLgbai6lEiw/Ldg5yEQHeLrKZ7uXI9JNwSGR6D6ZDMxydUKzNkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972440; c=relaxed/simple; bh=W6qK0Ba520y4HCa8GGP6e6N7kAmdoqUl7Q5Czvi8mmk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SN777gNglJYL7VvO8Veq2bx3eWEPsIh7MfpcxW/Wnh4u6lFGtIa2h46HGj5R6KrkAj1YEqLNL0viYXPWgTnIJxBOsZmPMEpZC2tEvQs8YYrhjT9U7296XR5L1HbFwVZB8Rk8zmAs1arKFuoP2dXvUZT4LoEe6UVqQeMaK/lkUfM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p+u6aXJL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p+u6aXJL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6775AC4CEE2; Wed, 15 Jan 2025 20:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972440; bh=W6qK0Ba520y4HCa8GGP6e6N7kAmdoqUl7Q5Czvi8mmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+u6aXJLlvfbyMWesKQTinVBtU0FXzqgSxEPQDZkmXfyDaWjVHGj480sTM5rhHegX WpOKnozaoQDudW5GeqQhOepSsqjYNVKJF0/BtsvRGvO7N0dx+/1bdbc0NNMgSA/RDk rNuREvUhyfeBLS2KgzXZwxd+fGgNP9plIktXXqoNStWrm7z2neXrVM1UOzBP7/abYb JSgv3HbR2H7eoabfBPYAzQCETLHFREgeELDu0iLh9E557V1o266mZ9ghc4A8YlVWKd +tspX7QER1pXgwZx1ZYR8mcbxilIoP/NH6j7xPQjvc6xEKbaUHpm0ZJlO21T2CYpS5 ZUMqqgOE1Gxkg== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 7/8] rpcctl: Add missing docstrings to the XprtSwitch class Date: Wed, 15 Jan 2025 15:20:34 -0500 Message-ID: <20250115202035.112122-8-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index b8808787b51d..adeb26d51f0e 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -177,7 +177,10 @@ class Xprt: class XprtSwitch: + """Represents a group of xprt connections.""" + def __init__(self, path, sep=":"): + """Read in xprt switch information from sysfs.""" self.path = path self.name = path.stem self.info = read_info_file(path / "xprt_switch_info") @@ -186,9 +189,11 @@ class XprtSwitch: self.sep = sep def __lt__(self, rhs): + """Compare the name of two xprt switch instances.""" return self.name < rhs.name def __str__(self): + """Return a string representation of an xprt switch.""" switch = f"{self.name}{self.sep} " \ f"xprts {self.info['num_xprts']}, " \ f"active {self.info['num_active']}, " \ @@ -197,6 +202,7 @@ class XprtSwitch: return "\n".join([switch] + xprts) def add_command(subparser): + """Add parser options for the `rpcctl switch` command.""" parser = subparser.add_parser("switch", help="Commands for xprt switches") parser.set_defaults(func=XprtSwitch.show, switch=None) @@ -219,16 +225,19 @@ class XprtSwitch: dstaddr.set_defaults(func=XprtSwitch.set_property, property="dstaddr") def get_by_name(name): + """Find a (sorted) list of XprtSwitches matching the given name.""" xprt_switches = sunrpc / "xprt-switches" if name: return [XprtSwitch(xprt_switches / name)] return [XprtSwitch(f) for f in sorted(xprt_switches.iterdir())] def show(args): + """Handle the `rpcctl switch show` command.""" for switch in XprtSwitch.get_by_name(args.switch): print(switch) def set_property(args): + """Handle the `rpcctl switch set` command.""" for switch in XprtSwitch.get_by_name(args.switch[0]): resolved = socket.gethostbyname(args.newaddr[0]) for xprt in switch.xprts: From patchwork Wed Jan 15 20:20:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13940887 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C393B1D86CB for ; Wed, 15 Jan 2025 20:20:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972441; cv=none; b=fVJdCeN3P2aMRfeQ9h5900sn7w9DWm5HeosKbh011a/YVEwhQ7oqoJzsH5w92PljsAdthE4wpjyBVRHJDo7WM1TYvKFpXdalsbMjpSnQs4kC8NWuW4JlzXW65E+TT/pKUrcMH6qDZh+XbZ7MnZHuUG4BLF7FJr4df78nBxFM8/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736972441; c=relaxed/simple; bh=5OsjFvU0tnvh9ALhRSGUnAbO4RpCWKUTxxN5Y9WxHjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M3saqtYM/ulRxyRtsdRF3S3cVP3H1ANvYGrbcbSNp/C1X7lCu4etOLySCOs48Ue8t/J8Tsvhe7TaGinQ+Lo+D0jTgPNQzbdIPBfGkXg78NCcao6HeXzNnefg9JIJ8roffAHDjrkiB9uzuTDT8nHM7Mn5qxrrI75r/LD8wxgbjBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZS1mKebs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZS1mKebs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0045CC4CED1; Wed, 15 Jan 2025 20:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736972441; bh=5OsjFvU0tnvh9ALhRSGUnAbO4RpCWKUTxxN5Y9WxHjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZS1mKebs07csQBy3Tjtu1bKV4Q1rkmkivdQFGIMppaNd+6sLFHE4vZH/C5K7KgLMG /87XrVyvZHOlrFhj0XIKpnoamz4YLJ6G1V0ciy98yUAjz7zEQwEarmFsBC9GN/1T2d FHCsvXcOBvEcSRWNyQ+LdKoleeGL4Xk+svOLOpHqHv5PzN5ZCNrrqZfcH1gqM3pxlT J/aBrfjxkXATHjkJIAvsG+4a98p+vg5QYLSY0mLLhODzfFvZScN8tNH60pNXQmA2KK 3ciiD6u6c4gThB+ZfWddGEqXwjnOgXyGGe0g5vMdIk/A1YGw15UKwY2p7qTUBJ5d2k l7R8K3llFuvSw== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 8/8] rpcctl: Add remaining missing docstrings Date: Wed, 15 Jan 2025 15:20:35 -0500 Message-ID: <20250115202035.112122-9-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250115202035.112122-1-anna@kernel.org> References: <20250115202035.112122-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index adeb26d51f0e..0221fbb68be1 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 +"""Utility for working with the sunrpc sysfs files.""" import argparse import collections import errno @@ -20,6 +21,7 @@ if not sunrpc.is_dir(): def read_addr_file(path): + """Read an xprt address file.""" try: with open(path, 'r') as f: return f.readline().strip() @@ -28,12 +30,14 @@ def read_addr_file(path): def write_addr_file(path, newaddr): + """Write a new address to an xprt address file.""" with open(path, 'w') as f: f.write(newaddr) return read_addr_file(path) def read_info_file(path): + """Read an xprt or xprt switch information file.""" res = collections.defaultdict(int) try: with open(path) as info: @@ -246,18 +250,24 @@ class XprtSwitch: class RpcClient: + """Represents an rpc client instance.""" + def __init__(self, path): + """Read in rpc client information from sysfs.""" self.path = path self.name = path.stem self.switch = XprtSwitch(path / (path / "switch").readlink(), sep=",") def __lt__(self, rhs): + """Compare the name of two rpc client instances.""" return self.name < rhs.name def __str__(self): + """Return a string representation of an rpc client.""" return f"{self.name}: {self.switch}" def add_command(subparser): + """Add parser options for the `rpcctl client` command.""" parser = subparser.add_parser("client", help="Commands for rpc clients") parser.set_defaults(func=RpcClient.show, client=None) @@ -269,12 +279,14 @@ class RpcClient: parser.set_defaults(func=RpcClient.show) def get_by_name(name): + """Find a (sorted) list of RpcClients matching the given name.""" rpc_clients = sunrpc / "rpc-clients" if name: return [RpcClient(rpc_clients / name)] return [RpcClient(f) for f in sorted(rpc_clients.iterdir())] def show(args): + """Handle the `rpcctl client show` command.""" for client in RpcClient.get_by_name(args.client): print(client) @@ -283,6 +295,7 @@ parser = argparse.ArgumentParser() def show_small_help(args): + """Show a one-line usage summary if no subcommand is given.""" parser.print_usage() print("sunrpc dir:", sunrpc)