0x00
     ³ˆÞÝƒ�oÜ¾ß û    ³/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_CONTAINER_OF_H
#define _LINUX_CONTAINER_OF_H

#include <linux/build_bug.h>
#include <linux/err.h>

#define typeof_member(T, m)	typeof(((T*)0)->m)

/**
 * container_of - cast a member of a structure out to the containing structure
 * @ptr:	the pointer to the member.
 * @type:	the type of the container struct this is embedded in.
 * @member:	the name of the member within the struct.
 *
 */
#define container_of(ptr, type, member) ({				\
	void *__mptr = (void *)(ptr);					\
	static_assert(__same_type(*(ptr), ((type *)0)->member) ||	\
		      __same_type(*(ptr), void),			\
		      "pointer type mismatch in container_of()");	\
	((type *)(__mptr - offsetof(type, member))); })

/**
 * container_of_const - cast a member of a structure out to the containing
 *			structure and preserve the const-ness of the pointer
 * @ptr:		the pointer to the member
 * @type:		the type of the container struct this is embedded in.
 * @member:		the name of the member within the struct.
 */
#define container_of_const(ptr, type, member)				\
	_Generic(ptr,							\
		const typeof(*(ptr)) *: ((const type *)container_of(ptr, type, member)),\
		default: ((type *)container_of(ptr, type, member))	\
	)

#endif	/* _LINUX_CONTAINER_OF_H */
  #   µˆl–Ü4ý(”†»â‚Æ…q�©‹FÿÞ„®¾ç¿à ?÷     µ#!/usr/bin/python3
# vim: et sta sts=4 sw=4 ts=8

# This handles the systemtap equivalent of
# $(DTRACE) $(DTRACEFLAGS) -G -s $^ -o $@
# $(DTRACE) $(DTRACEFLAGS) -h -s $^ -o $@
# which is a step that builds DTrace provider and probe definitions

# Copyright (C) 2009-2018 Red Hat Inc.
#
# This file is part of systemtap, and is free software.  You can
# redistribute it and/or modify it under the terms of the GNU General
# Public License (GPL); either version 2, or (at your option) any
# later version.

# ignore line too long, missing docstring, method could be a function,
#        too many public methods
# pylint: disable=C0301
# pylint: disable=C0111
# pylint: disable=R0201
# pylint: disable=R0904

import hashlib
import os
import sys
import time
import atexit
from shlex import split
from subprocess import call
try:
    from pyparsing import alphas, cStyleComment, delimitedList, Group, \
        Keyword, lineno, Literal, nestedExpr, nums, oneOf, OneOrMore, \
        Optional, ParseException, ParserElement, restOfLine, restOfLine, \
        Suppress, SkipTo, Word, ZeroOrMore
    HAVE_PYP = True
except ImportError:
    HAVE_PYP = False


# Common file creation methods for pyparsing and string pattern matching

class _HeaderCreator(object):
    def init_semaphores(self, fdesc):
        # dummy declaration just to make the object file non-empty
        fdesc.write("/* Generated by the Systemtap dtrace wrapper */\n\n")
        fdesc.write("static void __dtrace (void) __attribute__((unused));\n")
        fdesc.write("static void __dtrace (void) {}\n")
        fdesc.write("\n#include <sys/sdt.h>\n\n")

    def init_probes(self, fdesc):
        fdesc.write("/* Generated by the Systemtap dtrace wrapper */\n\n")
        fdesc.write("\n#define _SDT_HAS_SEMAPHORES 1\n\n")
        fdesc.write("\n#define STAP_HAS_SEMAPHORES 1 /* deprecated */\n\n")
        fdesc.write("\n#include <sys/sdt.h>\n\n")

    def add_semaphore(self, this_provider, this_probe):
        # NB: unsigned short is fixed in ABI
        semaphores_def = '\n#if defined STAP_SDT_V1\n'
        semaphores_def += '#define %s_%s_semaphore %s_semaphore\n' % \
                          (this_provider, this_probe, this_probe)
        semaphores_def += '#endif\n'
        semaphores_def += '#if defined STAP_SDT_V1 || defined STAP_SDT_V2 \n'
        semaphores_def += "__extension__ unsigned short %s_%s_semaphore __attribute__ ((unused)) __attribute__ ((section (\".probes\")));\n" % \
            (this_provider, this_probe)
        semaphores_def += '#else\n'
        semaphores_def += "__extension__ unsigned short %s_%s_semaphore __attribute__ ((unused)) __attribute__ ((section (\".probes\"))) __attribute__ ((visibility (\"hidden\")));\n" % \
 