Re: [PATCH] orangefs: move s_kmod_keyword_mask_map[] into debugfs.c
From: Arnd Bergmann
Date: Tue Feb 25 2025 - 15:41:41 EST
On Tue, Feb 25, 2025, at 21:24, Christophe JAILLET wrote:
> Le 25/02/2025 à 21:08, Arnd Bergmann a écrit :
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>> + * . . .
>> + */
>> +static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
>
> Unrelated to your patch, but I think that this could be made const.
>
Right, but not trivially, probably something like the change below.
There are obviously countless variables that should be const.
Arnd
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -73,7 +73,7 @@ struct __keyword_mask_s {
* qux 8 3
* . . .
*/
-static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
+static const struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
{"super", GOSSIP_SUPER_DEBUG},
{"inode", GOSSIP_INODE_DEBUG},
{"file", GOSSIP_FILE_DEBUG},
@@ -131,7 +131,7 @@ static int orangefs_prepare_cdm_array(char *);
static void debug_mask_to_string(void *, int);
static void do_k_string(void *, int);
static void do_c_string(void *, int);
-static int keyword_is_amalgam(char *);
+static int keyword_is_amalgam(const char *);
static int check_amalgam_keyword(void *, int);
static void debug_string_to_mask(char *, void *, int);
static void do_c_mask(int, char *, struct client_debug_mask **);
@@ -764,7 +764,7 @@ static void do_k_string(void *k_mask, int index)
{
__u64 *mask = (__u64 *) k_mask;
- if (keyword_is_amalgam((char *) s_kmod_keyword_mask_map[index].keyword))
+ if (keyword_is_amalgam((const char *) s_kmod_keyword_mask_map[index].keyword))
goto out;
if (*mask & s_kmod_keyword_mask_map[index].mask_val) {
@@ -811,7 +811,7 @@ static void do_c_string(void *c_mask, int index)
return;
}
-static int keyword_is_amalgam(char *keyword)
+static int keyword_is_amalgam(const char *keyword)
{
int rc = 0;