convert FIO_OS_PATH_SEPARATOR to a character
authorJosef Bacik <jbacik@fb.com>
Wed, 11 Oct 2017 18:58:11 +0000 (14:58 -0400)
committerJens Axboe <axboe@kernel.dk>
Wed, 11 Oct 2017 19:02:39 +0000 (13:02 -0600)
Instead of a string let's use this as a character so we can search for
it in path names.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c
os/os-windows.h
os/os.h
verify.c

index 0631a01f96a635789f925e6f54f7abf9a23ce92f..a7bbcede08d199cb7660a2771f4b715600ca8af3 100644 (file)
@@ -1725,7 +1725,7 @@ static int recurse_dir(struct thread_data *td, const char *dirname)
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
 
-               sprintf(full_path, "%s%s%s", dirname, FIO_OS_PATH_SEPARATOR, dir->d_name);
+               sprintf(full_path, "%s%c%s", dirname, FIO_OS_PATH_SEPARATOR, dir->d_name);
 
                if (lstat(full_path, &sb) == -1) {
                        if (errno != ENOENT) {
index 36b421ee45ad52049dabafa625acda25d79c1c00..9e6f21ef5a5d8c16129145b5c906ae329edb227c 100644 (file)
@@ -37,7 +37,7 @@ int rand_r(unsigned *);
 
 #define FIO_PREFERRED_ENGINE           "windowsaio"
 #define FIO_PREFERRED_CLOCK_SOURCE     CS_CGETTIME
-#define FIO_OS_PATH_SEPARATOR          "\\"
+#define FIO_OS_PATH_SEPARATOR          '\'
 
 #define FIO_MAX_CPUS   MAXIMUM_PROCESSORS
 
diff --git a/os/os.h b/os/os.h
index f62b4270f8383851dede8402dc925066770623f5..1a4437c940ad1b3f9c7f9266be1f2d021963d797 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -155,7 +155,7 @@ extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
 #endif
 
 #ifndef FIO_OS_PATH_SEPARATOR
-#define FIO_OS_PATH_SEPARATOR  "/"
+#define FIO_OS_PATH_SEPARATOR  '/'
 #endif
 
 #ifndef FIO_PREFERRED_CLOCK_SOURCE
index 1f177d756d24a6e6059f46bb5337870a4dc65214..db6e17e4def8f60f556b5fca4c1082f107f46d3f 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -252,7 +252,7 @@ static void dump_buf(char *buf, unsigned int len, unsigned long long offset,
 
        memset(fname, 0, sizeof(fname));
        if (aux_path)
-               sprintf(fname, "%s%s", aux_path, FIO_OS_PATH_SEPARATOR);
+               sprintf(fname, "%s%c", aux_path, FIO_OS_PATH_SEPARATOR);
 
        strncpy(fname + strlen(fname), basename(ptr), buf_left - 1);
 
@@ -1726,7 +1726,7 @@ void verify_save_state(int mask)
                char prefix[PATH_MAX];
 
                if (aux_path)
-                       sprintf(prefix, "%s%slocal", aux_path, FIO_OS_PATH_SEPARATOR);
+                       sprintf(prefix, "%s%clocal", aux_path, FIO_OS_PATH_SEPARATOR);
                else
                        strcpy(prefix, "local");