Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/common/ctf/ctf_open.c
Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | for (tp = tbuf; tp < tend; fp->ctf_typemax++) { | ||||
case CTF_K_POINTER: | case CTF_K_POINTER: | ||||
case CTF_K_TYPEDEF: | case CTF_K_TYPEDEF: | ||||
case CTF_K_VOLATILE: | case CTF_K_VOLATILE: | ||||
case CTF_K_CONST: | case CTF_K_CONST: | ||||
case CTF_K_RESTRICT: | case CTF_K_RESTRICT: | ||||
child |= CTF_TYPE_ISCHILD(tp->ctt_type); | child |= CTF_TYPE_ISCHILD(tp->ctt_type); | ||||
vbytes = 0; | vbytes = 0; | ||||
break; | break; | ||||
case CTF_K_CONSTVAL: | |||||
child |= CTF_TYPE_ISCHILD(tp->ctt_type); | |||||
vbytes = vlen; | |||||
break; | |||||
default: | default: | ||||
ctf_dprintf("detected invalid CTF kind -- %u\n", kind); | ctf_dprintf("detected invalid CTF kind -- %u\n", kind); | ||||
return (ECTF_CORRUPT); | return (ECTF_CORRUPT); | ||||
} | } | ||||
tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes); | tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes); | ||||
pop[kind]++; | pop[kind]++; | ||||
} | } | ||||
Show All 18 Lines | if ((err = ctf_hash_create(&fp->ctf_unions, pop[CTF_K_UNION])) != 0) | ||||
return (err); | return (err); | ||||
if ((err = ctf_hash_create(&fp->ctf_enums, pop[CTF_K_ENUM])) != 0) | if ((err = ctf_hash_create(&fp->ctf_enums, pop[CTF_K_ENUM])) != 0) | ||||
return (err); | return (err); | ||||
if ((err = ctf_hash_create(&fp->ctf_names, | if ((err = ctf_hash_create(&fp->ctf_names, | ||||
pop[CTF_K_INTEGER] + pop[CTF_K_FLOAT] + pop[CTF_K_FUNCTION] + | pop[CTF_K_INTEGER] + pop[CTF_K_FLOAT] + pop[CTF_K_FUNCTION] + | ||||
pop[CTF_K_TYPEDEF] + pop[CTF_K_POINTER] + pop[CTF_K_VOLATILE] + | pop[CTF_K_TYPEDEF] + pop[CTF_K_POINTER] + pop[CTF_K_VOLATILE] + | ||||
pop[CTF_K_CONST] + pop[CTF_K_RESTRICT])) != 0) | pop[CTF_K_CONST] + pop[CTF_K_RESTRICT] + pop[CTF_K_CONSTVAL])) != 0) | ||||
return (err); | return (err); | ||||
fp->ctf_txlate = ctf_alloc(sizeof (uint_t) * (fp->ctf_typemax + 1)); | fp->ctf_txlate = ctf_alloc(sizeof (uint_t) * (fp->ctf_typemax + 1)); | ||||
fp->ctf_ptrtab = ctf_alloc(sizeof (ushort_t) * (fp->ctf_typemax + 1)); | fp->ctf_ptrtab = ctf_alloc(sizeof (ushort_t) * (fp->ctf_typemax + 1)); | ||||
if (fp->ctf_txlate == NULL || fp->ctf_ptrtab == NULL) | if (fp->ctf_txlate == NULL || fp->ctf_ptrtab == NULL) | ||||
return (EAGAIN); /* memory allocation failed */ | return (EAGAIN); /* memory allocation failed */ | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | case CTF_K_RESTRICT: | ||||
err = ctf_hash_insert(&fp->ctf_names, fp, | err = ctf_hash_insert(&fp->ctf_names, fp, | ||||
CTF_INDEX_TO_TYPE(id, child), tp->ctt_name); | CTF_INDEX_TO_TYPE(id, child), tp->ctt_name); | ||||
if (err != 0 && err != ECTF_STRTAB) | if (err != 0 && err != ECTF_STRTAB) | ||||
return (err); | return (err); | ||||
/*FALLTHRU*/ | /*FALLTHRU*/ | ||||
default: | default: | ||||
vbytes = 0; | vbytes = 0; | ||||
break; | |||||
case CTF_K_CONSTVAL: | |||||
vbytes = vlen; | |||||
break; | break; | ||||
} | } | ||||
*xp = (uint_t)((uintptr_t)tp - (uintptr_t)fp->ctf_buf); | *xp = (uint_t)((uintptr_t)tp - (uintptr_t)fp->ctf_buf); | ||||
tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes); | tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes); | ||||
} | } | ||||
ctf_dprintf("%lu total types processed\n", fp->ctf_typemax); | ctf_dprintf("%lu total types processed\n", fp->ctf_typemax); | ||||
▲ Show 20 Lines • Show All 539 Lines • Show Last 20 Lines |