summaryrefslogtreecommitdiffstats
path: root/testsuite/parseko/functiondecl06.stp
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-08-31 15:22:33 -0700
committerJosh Stone <jistone@redhat.com>2009-08-31 15:27:07 -0700
commit0ceb1f7bca62225444f6c8a92f7b69c9c55d6582 (patch)
treedec9eb2b43ea7891942d31f56a08b3b95c998a6d /testsuite/parseko/functiondecl06.stp
parent0dc23d1d3435d0a1b8721618e6c898b9216a27e2 (diff)
downloadsystemtap-steved-0ceb1f7bca62225444f6c8a92f7b69c9c55d6582.tar.gz
systemtap-steved-0ceb1f7bca62225444f6c8a92f7b69c9c55d6582.tar.xz
systemtap-steved-0ceb1f7bca62225444f6c8a92f7b69c9c55d6582.zip
Use a header-cast in nd_syscall.sigaltstack
The nd_syscalls tapset is meant to run with no debuginfo, so using a @cast into a module type defeats the purpose. We should use a @cast with a header name instead, so debuginfo is generated. * tapset/i386/nd_syscalls.stp (nd_syscall.sigaltstack): Get the pt_regs type definition from "kernel<asm/ptrace.h>".
Diffstat (limited to 'testsuite/parseko/functiondecl06.stp')
0 files changed, 0 insertions, 0 deletions
a> 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
#!/usr/bin/python2
#
# Copyright (C) 2014  FreeIPA Contributors see COPYING for license
#

import logging
from lxml import etree
import dns.name
import subprocess

from ipapython import ipa_log_manager, ipautil

# hack: zone object UUID is stored as path to imaginary zone file
ENTRYUUID_PREFIX = "/var/lib/ipa/dns/zone/entryUUID/"
ENTRYUUID_PREFIX_LEN = len(ENTRYUUID_PREFIX)


class ZoneListReader(object):
    def __init__(self):
        self.names = set()  # dns.name
        self.uuids = set()  # UUID strings
        self.mapping = dict()      # {UUID: dns.name}
        self.log = ipa_log_manager.log_mgr.get_logger(self)

    def _add_zone(self, name, zid):
        """Add zone & UUID to internal structures.

        Zone with given name and UUID must not exist."""
        # detect duplicate zone names
        name = dns.name.from_text(name)
        assert name not in self.names, \
            'duplicate name (%s, %s) vs. %s' % (name, zid, self.mapping)
        # duplicate non-None zid is not allowed
        assert not zid or zid not in self.uuids, \
            'duplicate UUID (%s, %s) vs. %s' % (name, zid, self.mapping)

        self.names.add(name)
        self.uuids.add(zid)
        self.mapping[zid] = name

    def _del_zone(self, name, zid):
        """Remove zone & UUID from internal structures.

        Zone with given name and UUID must exist.
        """
        name = dns.name.from_text(name)
        assert zid is not None
        assert name in self.names, \
            'name (%s, %s) does not exist in %s' % (name, zid, self.mapping)
        assert zid in self.uuids, \
            'UUID (%s, %s) does not exist in %s' % (name, zid, self.mapping)
        assert zid in self.mapping and name == self.mapping[zid], \
            'pair {%s: %s} does not exist in %s' % (zid, name, self.mapping)

        self.names.remove(name)
        self.uuids.remove(zid)
        del self.mapping[zid]


class ODSZoneListReader(ZoneListReader):
    """One-shot parser for ODS zonelist.xml."""
    def __init__(self, zonelist_text):
        super(ODSZoneListReader, self).__init__()
        xml = etree.fromstring(zonelist_text)
        self._parse_zonelist(xml)

    def _parse_zonelist(self, xml):
        """iterate over Zone elements with attribute 'name' and
        add IPA zones to self.zones"""
        for zone_xml in xml.xpath('/ZoneList/Zone[@name]'):
            name, zid = self._parse_ipa_zone(zone_xml)
            self._add_zone(name, zid)

    def _parse_ipa_zone(self, zone_xml):
        """Extract zone name, input adapter and detect IPA zones.