-/*
- * Allocate and initialize a ust metadata.
- *
- * Return pointer to structure or NULL.
- */
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
-{
- int ret;
- struct ltt_ust_metadata *lum;
-
- lum = zmalloc(sizeof(struct ltt_ust_metadata));
- if (lum == NULL) {
- PERROR("ust metadata zmalloc");
- goto error;
- }
-
- /* Set default attributes */
- lum->attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
- lum->attr.subbuf_size = default_get_metadata_subbuf_size();
- lum->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
- lum->attr.switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
- lum->attr.read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
- lum->attr.output = LTTNG_UST_MMAP;
-
- lum->handle = -1;
- /* Set metadata trace path */
- ret = snprintf(lum->pathname, PATH_MAX, "%s/metadata", path);
- if (ret < 0) {
- PERROR("asprintf ust metadata");
- goto error_free_metadata;
- }
-
- return lum;
-
-error_free_metadata:
- free(lum);
-error:
- return NULL;
-}
-