linux/tools/testing/selftests/bpf/progs/btf_dump_test_case_ordering.c
<<
>>
Prefs
   1// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
   2
   3/*
   4 * BTF-to-C dumper test for topological sorting of dependent structs.
   5 *
   6 * Copyright (c) 2019 Facebook
   7 */
   8/* ----- START-EXPECTED-OUTPUT ----- */
   9struct s1 {};
  10
  11struct s3;
  12
  13struct s4;
  14
  15struct s2 {
  16        struct s2 *s2;
  17        struct s3 *s3;
  18        struct s4 *s4;
  19};
  20
  21struct s3 {
  22        struct s1 s1;
  23        struct s2 s2;
  24};
  25
  26struct s4 {
  27        struct s1 s1;
  28        struct s3 s3;
  29};
  30
  31struct list_head {
  32        struct list_head *next;
  33        struct list_head *prev;
  34};
  35
  36struct hlist_node {
  37        struct hlist_node *next;
  38        struct hlist_node **pprev;
  39};
  40
  41struct hlist_head {
  42        struct hlist_node *first;
  43};
  44
  45struct callback_head {
  46        struct callback_head *next;
  47        void (*func)(struct callback_head *);
  48};
  49
  50struct root_struct {
  51        struct s4 s4;
  52        struct list_head l;
  53        struct hlist_node n;
  54        struct hlist_head h;
  55        struct callback_head cb;
  56};
  57
  58/*------ END-EXPECTED-OUTPUT ------ */
  59
  60int f(struct root_struct *root)
  61{
  62        return 0;
  63}
  64