relayd: implement file and session rotation on top of trace chunks
[lttng-tools.git] / src / common / utils.c
index 732a30bf114fb89551bf322451dca89afbef10cf..664ba3e8e82abbdcf3a0c15614ba9b5858fbea93 100644 (file)
@@ -833,74 +833,6 @@ error:
        return ret;
 }
 
-/*
- * Change the output tracefile according to the given size and count The
- * new_count pointer is set during this operation.
- *
- * From the consumer, the stream lock MUST be held before calling this function
- * because we are modifying the stream status.
- *
- * Return 0 on success or else a negative value.
- */
-LTTNG_HIDDEN
-int utils_rotate_stream_file(char *path_name, char *file_name, uint64_t size,
-               uint64_t count, int uid, int gid, int out_fd, uint64_t *new_count,
-               int *stream_fd)
-{
-       int ret;
-
-       assert(stream_fd);
-
-       ret = close(out_fd);
-       if (ret < 0) {
-               PERROR("Closing tracefile");
-               goto error;
-       }
-       *stream_fd = -1;
-
-       if (count > 0) {
-               /*
-                * In tracefile rotation, for the relay daemon we need
-                * to unlink the old file if present, because it may
-                * still be open in reading by the live thread, and we
-                * need to ensure that we do not overwrite the content
-                * between get_index and get_packet. Since we have no
-                * way to verify integrity of the data content compared
-                * to the associated index, we need to ensure the reader
-                * has exclusive access to the file content, and that
-                * the open of the data file is performed in get_index.
-                * Unlinking the old file rather than overwriting it
-                * achieves this.
-                */
-               if (new_count) {
-                       *new_count = (*new_count + 1) % count;
-               }
-               ret = utils_unlink_stream_file(path_name, file_name, size,
-                               new_count ? *new_count : 0, uid, gid, 0);
-               if (ret < 0 && errno != ENOENT) {
-                       goto error;
-               }
-       } else {
-               if (new_count) {
-                       (*new_count)++;
-               }
-       }
-
-       ret = utils_create_stream_file(path_name, file_name, size,
-                       new_count ? *new_count : 0, uid, gid, 0);
-       if (ret < 0) {
-               goto error;
-       }
-       *stream_fd = ret;
-
-       /* Success. */
-       ret = 0;
-
-error:
-       return ret;
-}
-
-
 /**
  * Parse a string that represents a size in human readable format. It
  * supports decimal integers suffixed by 'k', 'K', 'M' or 'G'.
This page took 0.025551 seconds and 5 git commands to generate.