Ejemplo n.º 1
0
tnf_datum_t
tnf_get_tag_arg(tnf_datum_t datum)
{
	TNF		*tnf;
	tnf_ref32_t	*arg;

	CHECK_RECORD(datum);

	tnf = DATUM_TNF(datum);

	/* Should not give an error if not found */
	/* LINTED pointer cast may result in improper alignment */
	arg = _tnf_get_tag_arg(tnf, DATUM_RECORD(datum));

	if (arg == TNF_NULL)
		return (TNF_DATUM_NULL);
	else			/* repackage the tag arg with its taginfo */
		return (RECORD_DATUM(tnf, arg));
}
Ejemplo n.º 2
0
static tnf_datum_t
get_slot(tnf_datum_t datum, struct slot *slot)
{
	if (slot == NULL) {
		_tnf_error(DATUM_TNF(datum), TNF_ERR_BADSLOT); /* XXX */
		return (TNF_DATUM_NULL);

	} else if (INFO_TAGGED(slot->slot_type)) {
		TNF		*tnf;
		tnf_ref32_t	*rec;

		tnf = DATUM_TNF(datum);
		/* LINTED pointer cast may result in improper alignment */
		rec = _GET_REF32(tnf, (tnf_ref32_t *)
			(DATUM_VAL(datum) + slot->slot_offset));
		/* NULL slots are allowed */
		return ((rec == TNF_NULL)? TNF_DATUM_NULL :
			RECORD_DATUM(tnf, rec));

	} else			/* inline */
		return DATUM(slot->slot_type,
			DATUM_VAL(datum) + slot->slot_offset);
}