mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 00:28:52 +02:00 
			
		
		
		
	 0d5fd96880
			
		
	
	
		0d5fd96880
		
	
	
	
	
		
			
			The undefined logic is complex and has lots of magic on it. Implement it, using the same algorithm we have at get_abi.pl. Yet, some tweaks to optimize performance and to make the code simpler were added here: - at the perl version, the tree graph had loops, so we had to use BFS to traverse it. On this version, the graph is a tree, so, it simplifies the what group for sysfs aliases; - the logic which splits regular expressions into subgroups was re-written to make it faster; - it may optionally use multiple processes to search for symbol matches; - it has some additional debug levels. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/1529c255845d117696d5af57d8dc05554663afdf.1739182025.git.mchehab+huawei@kernel.org
		
			
				
	
	
		
			38 lines
		
	
	
	
		
			907 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
	
		
			907 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| #!/usr/bin/env python3
 | |
| # Copyright(c) 2025: Mauro Carvalho Chehab <mchehab@kernel.org>.
 | |
| # pylint: disable=R0903
 | |
| # SPDX-License-Identifier: GPL-2.0
 | |
| 
 | |
| """
 | |
| Helper classes for ABI parser
 | |
| """
 | |
| 
 | |
| ABI_DIR = "Documentation/ABI/"
 | |
| 
 | |
| 
 | |
| class AbiDebug:
 | |
|     """Debug levels"""
 | |
| 
 | |
|     WHAT_PARSING = 1
 | |
|     WHAT_OPEN = 2
 | |
|     DUMP_ABI_STRUCTS = 4
 | |
|     UNDEFINED = 8
 | |
|     REGEX = 16
 | |
|     SUBGROUP_MAP = 32
 | |
|     SUBGROUP_DICT = 64
 | |
|     SUBGROUP_SIZE = 128
 | |
|     GRAPH = 256
 | |
| 
 | |
| 
 | |
| DEBUG_HELP = """
 | |
| 1  - enable debug parsing logic
 | |
| 2  - enable debug messages on file open
 | |
| 4  - enable debug for ABI parse data
 | |
| 8  - enable extra debug information to identify troubles
 | |
|      with ABI symbols found at the local machine that
 | |
|      weren't found on ABI documentation (used only for
 | |
|      undefined subcommand)
 | |
| 16 - enable debug for what to regex conversion
 | |
| 32 - enable debug for symbol regex subgroups
 | |
| 64 - enable debug for sysfs graph tree variable
 | |
| """
 |