struct ustcomm_ust_reply {
uint32_t handle;
uint32_t cmd;
- uint32_t ret_code; /* enum ustcomm_return_code */
+ int32_t ret_code; /* enum ustcomm_return_code */
uint32_t ret_val; /* return value */
char padding[USTCOMM_REPLY_PADDING1];
union {
return 0;
}
+static
+int serialize_string_encoding(enum ustctl_string_encodings *ue,
+ enum lttng_string_encodings le)
+{
+ switch (le) {
+ case lttng_encode_none:
+ *ue = ustctl_encode_none;
+ break;
+ case lttng_encode_UTF8:
+ *ue = ustctl_encode_UTF8;
+ break;
+ case lttng_encode_ASCII:
+ *ue = ustctl_encode_ASCII;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
static
int serialize_basic_type(enum ustctl_abstract_types *uatype,
enum lttng_abstract_types atype,
uit->signedness = lit->signedness;
uit->reverse_byte_order = lit->reverse_byte_order;
uit->base = lit->base;
- uit->encoding = lit->encoding;
+ if (serialize_string_encoding(&uit->encoding, lit->encoding))
+ return -EINVAL;
uit->alignment = lit->alignment;
*uatype = ustctl_atype_integer;
break;
}
case atype_string:
{
- ubt->string.encoding = lbt->string.encoding;
+ if (serialize_string_encoding(&ubt->string.encoding,
+ lbt->string.encoding))
+ return -EINVAL;
*uatype = ustctl_atype_string;
break;
}
return ret;
ret = ustcomm_recv_app_reply(sock, &lur, lum.handle, lum.cmd);
if (!ret) {
- if (lur.ret_val >= 0) {
- channel_data->handle = lur.ret_val;
- }
+ channel_data->handle = lur.ret_val;
}
return ret;
}