Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
fork
Configure Feed
Select the types of activity you want to include in your feed.
1# SPDX-License-Identifier: GPL-2.0
2
3import sys
4from pathlib import Path
5from .consts import KSRC, KSFT_DIR
6from .ksft import ksft_pr, ktap_result
7
8# Resolve paths
9try:
10 if (KSFT_DIR / "kselftest-list.txt").exists():
11 # Running in "installed" selftests
12 tools_full_path = KSFT_DIR
13 SPEC_PATH = KSFT_DIR / "net/lib/specs"
14
15 sys.path.append(tools_full_path.as_posix())
16 from net.lib.ynl.lib import YnlFamily, NlError
17 else:
18 # Running in tree
19 tools_full_path = KSRC / "tools"
20 SPEC_PATH = KSRC / "Documentation/netlink/specs"
21
22 sys.path.append(tools_full_path.as_posix())
23 from net.ynl.lib import YnlFamily, NlError
24except ModuleNotFoundError as e:
25 ksft_pr("Failed importing `ynl` library from kernel sources")
26 ksft_pr(str(e))
27 ktap_result(True, comment="SKIP")
28 sys.exit(4)
29
30#
31# Wrapper classes, loading the right specs
32# Set schema='' to avoid jsonschema validation, it's slow
33#
34class EthtoolFamily(YnlFamily):
35 def __init__(self):
36 super().__init__((SPEC_PATH / Path('ethtool.yaml')).as_posix(),
37 schema='')
38
39
40class RtnlFamily(YnlFamily):
41 def __init__(self):
42 super().__init__((SPEC_PATH / Path('rt_link.yaml')).as_posix(),
43 schema='')
44
45
46class NetdevFamily(YnlFamily):
47 def __init__(self):
48 super().__init__((SPEC_PATH / Path('netdev.yaml')).as_posix(),
49 schema='')