* [PATCH] Declare debug_levels[] const
@ 2018-03-10 0:46 Bart Van Assche
2018-03-10 4:33 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2018-03-10 0:46 UTC (permalink / raw)
To: Jens Axboe; +Cc: fio, Bart Van Assche
Since debug_levels[] is not modified by any code, declare it const.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
debug.h | 2 +-
init.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/debug.h b/debug.h
index ac5f2ccdd551..b8718ddc225f 100644
--- a/debug.h
+++ b/debug.h
@@ -53,7 +53,7 @@ struct debug_level {
unsigned long shift;
unsigned int jobno;
};
-extern struct debug_level debug_levels[];
+extern const struct debug_level debug_levels[];
extern unsigned long fio_debug;
diff --git a/init.c b/init.c
index 28061db8ea8f..bb0627b208a6 100644
--- a/init.c
+++ b/init.c
@@ -2094,7 +2094,7 @@ static int fill_def_thread(void)
static void show_debug_categories(void)
{
#ifdef FIO_INC_DEBUG
- struct debug_level *dl = &debug_levels[0];
+ const struct debug_level *dl = &debug_levels[0];
int curlen, first = 1;
curlen = 0;
@@ -2184,7 +2184,7 @@ static void usage(const char *name)
}
#ifdef FIO_INC_DEBUG
-struct debug_level debug_levels[] = {
+const struct debug_level debug_levels[] = {
{ .name = "process",
.help = "Process creation/exit logging",
.shift = FD_PROCESS,
@@ -2262,7 +2262,7 @@ struct debug_level debug_levels[] = {
static int set_debug(const char *string)
{
- struct debug_level *dl;
+ const struct debug_level *dl;
char *p = (char *) string;
char *opt;
int i;
--
2.16.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Declare debug_levels[] const
2018-03-10 0:46 [PATCH] Declare debug_levels[] const Bart Van Assche
@ 2018-03-10 4:33 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-03-10 4:33 UTC (permalink / raw)
To: Bart Van Assche; +Cc: fio
On 3/9/18 5:46 PM, Bart Van Assche wrote:
> Since debug_levels[] is not modified by any code, declare it const.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-10 4:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-10 0:46 [PATCH] Declare debug_levels[] const Bart Van Assche
2018-03-10 4:33 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.