Ejemplo n.º 1
0
def spl_aligned_slab_size(cache: drgn.Object) -> int:
    assert sdb.type_canonical_name(cache.type_) == 'struct spl_kmem_cache *'
    cache_obj_align = cache.skc_obj_align.value_()
    spl_slab_type_size = sdb.type_canonicalize_size('spl_kmem_slab_t')
    return p2.p2roundup(spl_slab_type_size, cache_obj_align)
Ejemplo n.º 2
0
def sko_from_obj(cache: drgn.Object, obj: drgn.Object) -> drgn.Object:
    assert sdb.type_canonical_name(cache.type_) == 'struct spl_kmem_cache *'
    cache_obj_align = cache.skc_obj_align.value_()
    return sdb.create_object(
        'spl_kmem_obj_t *',
        obj.value_() + p2.p2roundup(object_size(cache), cache_obj_align))