Add ustcomm_trace_info struct and support functions to ustcomm
[ust.git] / libustcomm / ustcomm.c
index fe8fea2d66c2c46b8fd30252c3357fba443cb95e..7d0fe000155525669e28afaff4931d2597c2ecc8 100644 (file)
@@ -621,6 +621,38 @@ char * ustcomm_restore_ptr(char *ptr, char *data_field, int data_field_size)
        return data_field + (long)ptr;
 }
 
+int ustcomm_pack_trace_info(struct ustcomm_header *header,
+                           struct ustcomm_trace_info *trace_inf,
+                           const char *trace)
+{
+       int offset = 0;
+
+       trace_inf->trace = ustcomm_print_data(trace_inf->data,
+                                             sizeof(trace_inf->data),
+                                             &offset,
+                                             trace);
+
+       if (trace_inf->trace == USTCOMM_POISON_PTR) {
+               return -ENOMEM;
+       }
+
+       header->size = COMPUTE_MSG_SIZE(trace_inf, offset);
+
+       return 0;
+}
+
+
+int ustcomm_unpack_trace_info(struct ustcomm_trace_info *trace_inf)
+{
+       trace_inf->trace = ustcomm_restore_ptr(trace_inf->trace,
+                                              trace_inf->data,
+                                              sizeof(trace_inf->data));
+       if (!trace_inf->trace) {
+               return -EINVAL;
+       }
+
+       return 0;
+}
 
 int ustcomm_pack_channel_info(struct ustcomm_header *header,
                              struct ustcomm_channel_info *ch_inf,
This page took 0.022328 seconds and 4 git commands to generate.