Use in-place path separator "/" for Linux specific code
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fri, 29 Jul 2016 15:05:57 +0000 (00:05 +0900)
committerJens Axboe <axboe@fb.com>
Fri, 29 Jul 2016 15:01:18 +0000 (09:01 -0600)
diskutil,cgroup,blktrace related code fully depend on Linux kernel,
so sprintf variants can use in-place path separator "/" instead of
FIO_OS_PATH_SEPARATOR.

In fact these Linux specific files are mix of two types within the
same file depending on who wrote them, where they were originally
using "/".

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
cgroup.c
diskutil.c
oslib/linux-dev-lookup.c

index 34b61ded08d0fa5e22527012c979e31163b1b8ec..a297e2ac82e82f5145edfcb9cc509b23134a360b 100644 (file)
--- a/cgroup.c
+++ b/cgroup.c
@@ -102,9 +102,9 @@ static char *get_cgroup_root(struct thread_data *td, char *mnt)
        char *str = malloc(64);
 
        if (td->o.cgroup)
-               sprintf(str, "%s%s%s", mnt, FIO_OS_PATH_SEPARATOR, td->o.cgroup);
+               sprintf(str, "%s/%s", mnt, td->o.cgroup);
        else
-               sprintf(str, "%s%s%s", mnt, FIO_OS_PATH_SEPARATOR, td->o.name);
+               sprintf(str, "%s/%s", mnt, td->o.name);
 
        return str;
 }
@@ -116,7 +116,7 @@ static int write_int_to_file(struct thread_data *td, const char *path,
        char tmp[256];
        FILE *f;
 
-       sprintf(tmp, "%s%s%s", path, FIO_OS_PATH_SEPARATOR, filename);
+       sprintf(tmp, "%s/%s", path, filename);
        f = fopen(tmp, "w");
        if (!f) {
                td_verror(td, errno, onerr);
index 8031d5d9ce7e6130977c1034a5c82c8106882ea6..294d2d3d084a371fb3b1b47a4fb2087046d9f262 100644 (file)
@@ -239,7 +239,7 @@ static void find_add_disk_slaves(struct thread_data *td, char *path,
                    !strcmp(dirent->d_name, ".."))
                        continue;
 
-               sprintf(temppath, "%s%s%s", slavesdir, FIO_OS_PATH_SEPARATOR, dirent->d_name);
+               sprintf(temppath, "%s/%s", slavesdir, dirent->d_name);
                /* Can we always assume that the slaves device entries
                 * are links to the real directories for the slave
                 * devices?
@@ -266,7 +266,7 @@ static void find_add_disk_slaves(struct thread_data *td, char *path,
                if (slavedu)
                        continue;
 
-               sprintf(temppath, "%s%s%s", slavesdir, FIO_OS_PATH_SEPARATOR, slavepath);
+               sprintf(temppath, "%s/%s", slavesdir, slavepath);
                __init_per_file_disk_util(td, majdev, mindev, temppath);
                slavedu = disk_util_exists(majdev, mindev);
 
@@ -370,7 +370,7 @@ static int find_block_dir(int majdev, int mindev, char *path, int link_ok)
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
 
-               sprintf(full_path, "%s%s%s", path, FIO_OS_PATH_SEPARATOR, dir->d_name);
+               sprintf(full_path, "%s/%s", path, dir->d_name);
 
                if (!strcmp(dir->d_name, "dev")) {
                        if (!check_dev_match(majdev, mindev, full_path)) {
index 4d5f356c1774565e2e13a841377e7763e453448d..3a415dde00ea55a73467a691c2bdfb7a325ac1f8 100644 (file)
@@ -25,7 +25,7 @@ int blktrace_lookup_device(const char *redirect, char *path, unsigned int maj,
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
 
-               sprintf(full_path, "%s%s%s", path, FIO_OS_PATH_SEPARATOR, dir->d_name);
+               sprintf(full_path, "%s/%s", path, dir->d_name);
                if (lstat(full_path, &st) == -1) {
                        perror("lstat");
                        break;