+ struct definition_float *float_definition =
+ container_of(definition, struct definition_float, p);
+ const struct declaration_float *float_declaration =
+ float_definition->declaration;
+ struct ctf_stream_pos *pos = ctf_pos(ppos);
+ union doubleIEEE754 u;
+ struct bt_definition *tmpdef;
+ struct definition_float *tmpfloat;
+ struct ctf_stream_pos destp;
+ struct mmap_align mma;
+ int ret;
+
+ float_lock();
+ switch (float_declaration->mantissa->len + 1) {
+ case FLT_MANT_DIG:
+ tmpdef = static_float_declaration->p.definition_new(
+ &static_float_declaration->p,
+ NULL, 0, 0, "__tmpfloat");
+ break;
+ case DBL_MANT_DIG:
+ tmpdef = static_double_declaration->p.definition_new(
+ &static_double_declaration->p,
+ NULL, 0, 0, "__tmpfloat");
+ break;
+ default:
+ ret = -EINVAL;
+ goto end;
+ }
+ tmpfloat = container_of(tmpdef, struct definition_float, p);
+ memset(&destp, 0, sizeof(destp));
+ ctf_init_pos(&destp, NULL, -1, O_RDWR);
+ mmap_align_set_addr(&mma, (char *) u.bits);
+ destp.base_mma = &mma;
+ destp.content_size = destp.packet_size = sizeof(u) * CHAR_BIT;
+ if (!ctf_align_pos(pos, float_declaration->p.alignment)) {
+ ret = -EFAULT;
+ goto end_unref;
+ }
+ ret = _ctf_float_copy(&destp.parent, tmpfloat, ppos, float_definition);
+ switch (float_declaration->mantissa->len + 1) {
+ case FLT_MANT_DIG:
+ float_definition->value = u.vf;
+ break;
+ case DBL_MANT_DIG:
+ float_definition->value = u.vd;
+ break;
+ default:
+ ret = -EINVAL;
+ goto end_unref;
+ }
+
+end_unref:
+ bt_definition_unref(tmpdef);
+end:
+ float_unlock();
+ return ret;