[PATCH] Warn on writable strings
authorJens Axboe <jens.axboe@oracle.com>
Tue, 7 Nov 2006 07:36:14 +0000 (08:36 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 7 Nov 2006 07:36:14 +0000 (08:36 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Makefile
fio.c
fio.h
init.c
parse.h
stat.c

index 2746ce7236691c0a5f5b0bc44fd7b2d46416e17a..ad9aa3bd3f94586366213f99af4f514819cb464d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC     = gcc
-CFLAGS = -W -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS = -W -Wwrite-strings -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 PROGS  = fio
 SCRIPTS = fio_generate_plots
 OBJS = fio.o ioengines.o init.o stat.o log.o time.o md5.o crc32.o \
diff --git a/fio.c b/fio.c
index 011c13a31a6e2cabea1ea4254d69b9a16604726d..8c059df627294f3607e2e1bae00a6f2c571451fb 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -45,7 +45,7 @@ int groupid = 0;
 int thread_number = 0;
 int shm_id = 0;
 int temp_stall_ts;
-char *fio_inst_prefix = _INST_PREFIX;
+const char *fio_inst_prefix = _INST_PREFIX;
 
 static volatile int startup_sem;
 
diff --git a/fio.h b/fio.h
index b94bf4313081bfed79fbed4ff8b67274a134ad83..434c34b237ed718cb1c8312fc77629281d35c39f 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -356,7 +356,7 @@ extern int groupid;
 extern int terse_output;
 extern FILE *f_out;
 extern FILE *f_err;
-extern char *fio_inst_prefix;
+extern const char *fio_inst_prefix;
 extern int temp_stall_ts;
 
 extern struct thread_data *threads;
diff --git a/init.c b/init.c
index 0352c555c8a9b191e8adff4fb4514ae976afbc69..54e2ecae28202622d6954308d192439bb55dca2c 100644 (file)
--- a/init.c
+++ b/init.c
@@ -539,8 +539,8 @@ static char *to_kmg(unsigned int val)
  */
 static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
 {
-       char *ddir_str[] = { "read", "write", "randread", "randwrite",
-                            "rw", NULL, "randrw" };
+       const char *ddir_str[] = { "read", "write", "randread", "randwrite",
+                                  "rw", NULL, "randrw" };
        struct stat sb;
        int numjobs, ddir, i;
        struct fio_file *f;
diff --git a/parse.h b/parse.h
index 9b34de9aad60b178a5257e78f7e96d2d158db015..adbb3208e644c7bcac22ed96c58206553f9e1d42 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -19,7 +19,7 @@ enum fio_opt_type {
  * Option define
  */
 struct fio_option {
-       char *name;
+       const char *name;
        enum fio_opt_type type;
        unsigned int off1;
        unsigned int off2;
diff --git a/stat.c b/stat.c
index 0ae19b282026782e09a8298f1363d4c448a24bf1..0ccf37e7bc481e3db70b915b1ad8d06e4aa10fb8 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -333,7 +333,7 @@ static void show_disk_util(void)
 static void show_ddir_status(struct thread_data *td, struct group_run_stats *rs,
                             int ddir)
 {
-       char *ddir_str[] = { "read ", "write" };
+       const char *ddir_str[] = { "read ", "write" };
        unsigned long min, max;
        unsigned long long bw;
        double mean, dev;