From: Josef Bacik Date: Wed, 11 Oct 2017 18:58:11 +0000 (-0400) Subject: convert FIO_OS_PATH_SEPARATOR to a character X-Git-Tag: fio-3.2~38 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=53a7af851836735f1ff59d2b9e1a743e7cc499e9 convert FIO_OS_PATH_SEPARATOR to a character 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 Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 0631a01f..a7bbcede 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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) { diff --git a/os/os-windows.h b/os/os-windows.h index 36b421ee..9e6f21ef 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -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 f62b4270..1a4437c9 100644 --- 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 diff --git a/verify.c b/verify.c index 1f177d75..db6e17e4 100644 --- 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");