X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Findex%2Findex.c;h=07d2cf3c01ed9bd9c2798fd16be595e9a14f1675;hb=7a5e50b18fbe1093870efaf0dc3bee6e900af13c;hp=9bfb56fa0b7a6a3c9c475e028473c297a9e5779a;hpb=9f1053713656f28d01552540067b8887546a574c;p=deliverable%2Flttng-tools.git diff --git a/src/common/index/index.c b/src/common/index/index.c index 9bfb56fa0..07d2cf3c0 100644 --- a/src/common/index/index.c +++ b/src/common/index/index.c @@ -78,11 +78,15 @@ struct lttng_index_file *lttng_index_file_create(char *path_name, */ ret = utils_unlink_stream_file(fullpath, stream_name, size, count, uid, gid, DEFAULT_INDEX_FILE_SUFFIX); + DBG("utils_unlink_stream_file %s %s ret %d errno %d", + fullpath, stream_name, ret, errno); if (ret < 0 && errno != ENOENT) { goto error; } ret = utils_create_stream_file(fullpath, stream_name, size, count, uid, gid, DEFAULT_INDEX_FILE_SUFFIX); + DBG("utils_create_stream_file %s %s ret %d errno %d", + fullpath, stream_name, ret, errno); if (ret < 0) { goto error; } @@ -119,6 +123,34 @@ error: return NULL; } +int lttng_index_file_unlink(char *path_name, + char *stream_name, int uid, int gid, + uint64_t tracefile_size, + uint64_t tracefile_count_current) +{ + int ret; + char fullpath[PATH_MAX]; + + ret = snprintf(fullpath, sizeof(fullpath), "%s/" DEFAULT_INDEX_DIR, + path_name); + if (ret < 0) { + PERROR("snprintf index path"); + goto error; + } + + ret = utils_unlink_stream_file(fullpath, stream_name, + tracefile_size, tracefile_count_current, uid, + gid, DEFAULT_INDEX_FILE_SUFFIX); + if (ret < 0 && errno != ENOENT) { + goto error; + } + + return 0; + +error: + return -1; +} + /* * Write index values to the given index file. *