@@ -887,7 +887,7 @@ def get_subdirs(self) -> interfaces.objects.ObjectInterface:
887887 if self .has_member ("d_sib" ) and self .has_member ("d_children" ):
888888 # kernels >= 6.8
889889 walk_member = "d_sib"
890- list_head_member = self .d_children . first
890+ list_head_member = self .d_children
891891 elif self .has_member ("d_child" ) and self .has_member ("d_subdirs" ):
892892 # 2.5.0 <= kernels < 6.8
893893 walk_member = "d_child"
@@ -1004,6 +1004,40 @@ def __iter__(self) -> Iterator[interfaces.objects.ObjectInterface]:
10041004 return self .to_list (self .vol .parent .vol .type_name , self .vol .member_name )
10051005
10061006
1007+ class hlist_head (objects .StructType , collections .abc .Iterable ):
1008+ def to_list (
1009+ self ,
1010+ symbol_type : str ,
1011+ member : str ,
1012+ ) -> Iterator [interfaces .objects .ObjectInterface ]:
1013+ """Returns an iterator of the entries in the list.
1014+
1015+ This is a doubly linked list; however, it is not circular, so the 'forward' field
1016+ doesn't make sense. Also, the sentinel concept doesn't make sense here either;
1017+ unlike list_head, the head and nodes each have their own distinct types. A list_head
1018+ cannot be a node by itself.
1019+ - The 'pprev' of the first 'hlist_node' points to the 'hlist_head', not to the last node.
1020+ - The last element 'next' member is NULL
1021+
1022+ Args:
1023+ symbol_type: Type of the list elements
1024+ member: Name of the list_head member in the list elements
1025+
1026+ Yields:
1027+ Objects of the type specified via the "symbol_type" argument.
1028+
1029+ """
1030+ vmlinux = linux .LinuxUtilities .get_module_from_volobj_type (self ._context , self )
1031+
1032+ current = self .first
1033+ while current and current .is_readable ():
1034+ yield linux .LinuxUtilities .container_of (
1035+ current , symbol_type , member , vmlinux
1036+ )
1037+
1038+ current = current .next
1039+
1040+
10071041class files_struct (objects .StructType ):
10081042 def get_fds (self ) -> interfaces .objects .ObjectInterface :
10091043 if self .has_member ("fdt" ):
0 commit comments