Whamcloud - gitweb
LU-6142 misc: declare static chars as const where possible. 21/38421/3
authorMr NeilBrown <neilb@suse.de>
Wed, 29 Apr 2020 23:39:04 +0000 (09:39 +1000)
committerOleg Drokin <green@whamcloud.com>
Thu, 14 May 2020 05:39:21 +0000 (05:39 +0000)
commit257c0debc71ed7c496d55547ad2ee88cd9d546a1
treec22a53663b3f074bb6b8b1749ae8168a6aa38852
parentc5a311781fc60c9a91483b737d3f59096949439e
LU-6142 misc: declare static chars as const where possible.

When a char * is statically initialized to a literal string, it is
best if the char is declared 'const' to ensure that literal string can
never be changed, and to allow it to be stored in read-only memory.

Unfortunately this is not possible for strings used as module
parameters.  Similarly osd_0copy_tag in osd-zfs cannot be made const,
so that is change to a simple array (no pointer).

But in many other places it is possible, and it requires all ultimate
users of the string to declare that they are working with const chars.

This patch changes a collection of static char*s to const, and in many
cases arrays of char * to "const char * const", and then propagates
the 'const' annotion as needed.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I3185a6cd0d1b8a7dbd83698f456f65f47b4f2954
Reviewed-on: https://review.whamcloud.com/38421
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/lib-lnet.h
lnet/lnet/api-ni.c
lnet/lnet/config.c
lnet/utils/lnetconfig/cyaml.c
lustre/include/lustre_import.h
lustre/mdt/mdt_lproc.c
lustre/obdclass/lprocfs_status.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-zfs/osd_io.c
lustre/target/tgt_main.c
lustre/utils/mount_utils.h