Esempio n. 1
0
def idr_find(idr, id):
    """
    .. c:function:: void *idr_find(struct idr *idr, unsigned long id)

    Look up the entry with the given id in an IDR. If it is not found, this
    returns a ``NULL`` object.
    """
    # idr_base was added in v4.16.
    try:
        id -= idr.idr_base
    except AttributeError:
        pass
    return radix_tree_lookup(idr.idr_rt, id)
Esempio n. 2
0
    def walk(self, blkcg, q_id, parent_path):
        if not self.include_dying and \
           not (blkcg.css.flags.value_() & prog['CSS_ONLINE'].value_()):
            return

        name = BlkgIterator.blkcg_name(blkcg)
        path = parent_path + '/' + name if parent_path else name
        blkg = drgn.Object(prog, 'struct blkcg_gq',
                           address=radix_tree_lookup(blkcg.blkg_tree, q_id))
        if not blkg.address_:
            return

        self.blkgs.append((path if path else '/', blkg))

        for c in list_for_each_entry('struct blkcg',
                                     blkcg.css.children.address_of_(), 'css.sibling'):
            self.walk(c, q_id, path)