glusterfs: update for new API
[fio.git] / diskutil.c
index dd8fc6a20b3aec09875823f416369743a897af3e..7be4c022431e1a0b823332f233d0159f07876ba4 100644 (file)
@@ -1,13 +1,10 @@
 #include <stdio.h>
 #include <string.h>
-#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
 #include <dirent.h>
 #include <libgen.h>
-#include <math.h>
-#include <assert.h>
 #ifdef CONFIG_VALGRIND_DEV
 #include <valgrind/drd.h>
 #else
@@ -245,7 +242,8 @@ static void find_add_disk_slaves(struct thread_data *td, char *path,
                    !strcmp(dirent->d_name, ".."))
                        continue;
 
-               sprintf(temppath, "%s/%s", slavesdir, dirent->d_name);
+               nowarn_snprintf(temppath, sizeof(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?
@@ -258,9 +256,12 @@ static void find_add_disk_slaves(struct thread_data *td, char *path,
                }
                slavepath[linklen] = '\0';
 
-               sprintf(temppath, "%s/%s/dev", slavesdir, slavepath);
+               nowarn_snprintf(temppath, sizeof(temppath), "%s/%s/dev",
+                               slavesdir, slavepath);
                if (access(temppath, F_OK) != 0)
-                       sprintf(temppath, "%s/%s/device/dev", slavesdir, slavepath);
+                       nowarn_snprintf(temppath, sizeof(temppath),
+                                       "%s/%s/device/dev", slavesdir,
+                                       slavepath);
                if (read_block_dev_entry(temppath, &majdev, &mindev)) {
                        perror("Error getting slave device numbers");
                        closedir(dirhandle);
@@ -274,7 +275,8 @@ static void find_add_disk_slaves(struct thread_data *td, char *path,
                if (slavedu)
                        continue;
 
-               sprintf(temppath, "%s/%s", slavesdir, slavepath);
+               nowarn_snprintf(temppath, sizeof(temppath), "%s/%s", slavesdir,
+                               slavepath);
                __init_per_file_disk_util(td, majdev, mindev, temppath);
                slavedu = disk_util_exists(majdev, mindev);
 
@@ -699,7 +701,7 @@ void show_disk_util(int terse, struct json_object *parent,
        struct disk_util *du;
        bool do_json;
 
-       if (!disk_util_sem)
+       if (!is_running_backend())
                return;
 
        fio_sem_down(disk_util_sem);