(root)/
strace-6.5/
tests/
init_delete_module.h
       1  /*
       2   * Helper header containing common code for finit_module, init_module,
       3   * and delete_module tests.
       4   *
       5   * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
       6   * Copyright (c) 2016-2021 The strace developers.
       7   * All rights reserved.
       8   *
       9   * SPDX-License-Identifier: GPL-2.0-or-later
      10   */
      11  
      12  #ifndef STRACE_TESTS_INIT_DELETE_MODULE_H
      13  # define STRACE_TESTS_INIT_DELETE_MODULE_H
      14  
      15  # include <stdbool.h>
      16  # include <stdio.h>
      17  
      18  enum {
      19  	PARAM1_LEN = 33,
      20  	PARAM2_LEN = 8,
      21  	PARAM1_BASE = 0x30,
      22  	PARAM2_BASE = 0x80,
      23  	MAX_STRLEN = 32,
      24  };
      25  
      26  static void
      27  print_str(unsigned int base, unsigned int len, bool escape)
      28  {
      29  	if (!escape) {
      30  		for (unsigned int i = base; i < (base + len); ++i)
      31  			putc(i, stdout);
      32  	} else {
      33  		for (unsigned int i = base; i < (base + len); ++i)
      34  			printf("\\%u%u%u",
      35  			       (i >> 6) & 0x3, (i >> 3) & 0x7, i & 0x7);
      36  	}
      37  }
      38  
      39  #endif /* !STRACE_TESTS_INIT_DELETE_MODULE_H */