Clean-up: remove unused stream file creation and unlink functions
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 9 Sep 2019 16:39:02 +0000 (12:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 10 Sep 2019 16:15:44 +0000 (12:15 -0400)
No code should be creating or unlinking stream files without going
through the trace chunk interface. These functions are removed since
there are no more users and no legitimate future users.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/utils.c
src/common/utils.h

index fda43152d30905fc278515277f79a11eb0104282..b0e5b63e34400c3f0e2e2df57b58fcdf0f875f32 100644 (file)
@@ -765,74 +765,6 @@ int utils_stream_file_path(const char *path_name, const char *file_name,
        return ret;
 }
 
        return ret;
 }
 
-/*
- * Create the stream file on disk.
- *
- * Return 0 on success or else a negative value.
- */
-LTTNG_HIDDEN
-int utils_create_stream_file(const char *path_name, char *file_name, uint64_t size,
-               uint64_t count, int uid, int gid, char *suffix)
-{
-       int ret, flags, mode;
-       char path[LTTNG_PATH_MAX];
-
-       ret = utils_stream_file_path(path_name, file_name,
-                       size, count, suffix, path, sizeof(path));
-       if (ret < 0) {
-               goto error;
-       }
-
-       /*
-        * With the session rotation feature on the relay, we might need to seek
-        * and truncate a tracefile, so we need read and write access.
-        */
-       flags = O_RDWR | O_CREAT | O_TRUNC;
-       /* Open with 660 mode */
-       mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
-
-       if (uid < 0 || gid < 0) {
-               ret = open(path, flags, mode);
-       } else {
-               ret = run_as_open(path, flags, mode, uid, gid);
-       }
-       if (ret < 0) {
-               PERROR("open stream path %s", path);
-       }
-error:
-       return ret;
-}
-
-/*
- * Unlink the stream tracefile from disk.
- *
- * Return 0 on success or else a negative value.
- */
-LTTNG_HIDDEN
-int utils_unlink_stream_file(const char *path_name, char *file_name, uint64_t size,
-               uint64_t count, int uid, int gid, char *suffix)
-{
-       int ret;
-       char path[LTTNG_PATH_MAX];
-
-       ret = utils_stream_file_path(path_name, file_name, size, count, suffix,
-                       path, sizeof(path));
-       if (ret < 0) {
-               goto error;
-       }
-       if (uid < 0 || gid < 0) {
-               ret = unlink(path);
-       } else {
-               ret = run_as_unlink(path, uid, gid);
-       }
-       if (ret < 0) {
-               goto error;
-       }
-error:
-       DBG("utils_unlink_stream_file %s returns %d", path, ret);
-       return ret;
-}
-
 /**
  * Parse a string that represents a size in human readable format. It
  * supports decimal integers suffixed by 'k', 'K', 'M' or 'G'.
 /**
  * Parse a string that represents a size in human readable format. It
  * supports decimal integers suffixed by 'k', 'K', 'M' or 'G'.
index 00b65939d163dedbf143d8eedbcc28dc08a8ed10..11388c9031bfdaabffd9b1dad596410af43e5e9f 100644 (file)
@@ -44,10 +44,6 @@ int utils_set_fd_cloexec(int fd);
 int utils_create_pid_file(pid_t pid, const char *filepath);
 int utils_mkdir(const char *path, mode_t mode, int uid, int gid);
 int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid);
 int utils_create_pid_file(pid_t pid, const char *filepath);
 int utils_mkdir(const char *path, mode_t mode, int uid, int gid);
 int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid);
-int utils_create_stream_file(const char *path_name, char *file_name, uint64_t size,
-               uint64_t count, int uid, int gid, char *suffix);
-int utils_unlink_stream_file(const char *path_name, char *file_name, uint64_t size,
-               uint64_t count, int uid, int gid, char *suffix);
 int utils_stream_file_path(const char *path_name, const char *file_name,
                uint64_t size, uint64_t count, const char *suffix,
                char *out_stream_path, size_t stream_path_len);
 int utils_stream_file_path(const char *path_name, const char *file_name,
                uint64_t size, uint64_t count, const char *suffix,
                char *out_stream_path, size_t stream_path_len);
This page took 0.027615 seconds and 4 git commands to generate.