From: Anna Schumaker <anna.schumaker@xxxxxxxxxx> This was recently added to the Linux kernel, so running rpcctl on kernels that don't have this attribute will print out "unknown" in its place instead. Signed-off-by: Anna Schumaker <anna.schumaker@xxxxxxxxxx> --- tools/rpcctl/rpcctl.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index 654b2f60a894..20f90d6ca796 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -36,6 +36,15 @@ def write_sysfs_file(path, input): return read_sysfs_file(path) +def read_xprtsec_file(path): + """Read an xprtsec file.""" + try: + with open(path, 'r') as f: + return f.readline().strip() + except FileNotFoundError: + return "(unknown)" + + def read_info_file(path): """Read an xprt or xprt switch information file.""" res = collections.defaultdict(int) @@ -58,6 +67,7 @@ class Xprt: self.info = read_info_file(path / "xprt_info") self.dstaddr = read_sysfs_file(path / "dstaddr") self.srcaddr = read_sysfs_file(path / "srcaddr") + self.xprtsec = read_xprtsec_file(path / "xprtsec") self.read_state() def __lt__(self, rhs): @@ -67,7 +77,8 @@ class Xprt: def _xprt(self): main = ", main" if self.info.get("main_xprt") else "" return f"{self.name}: {self.type}, {self.dstaddr}, " \ - f"port {self.info['dst_port']}, state <{self.state}>{main}" + f"port {self.info['dst_port']}, sec {self.xprtsec}, " \ + f"state <{self.state}>{main}" def _src_reqs(self): return f" Source: {self.srcaddr}, port {self.info['src_port']}, " \ -- 2.47.1