Re: [PATCH v10 1/2] fs: New zonefs file system
From: Damien Le Moal
Date: Tue Feb 04 2020 - 20:36:12 EST
On Tue, 2020-02-04 at 10:46 +0100, Markus Elfring wrote:
> â
> > +++ b/fs/zonefs/super.c
> â
> > +static const char *zgroups_name[ZONEFS_ZTYPE_MAX] = { "cnv", "seq" };
>
> Can this array be treated as immutable?
> How do you think about to use the following code variant?
>
> +static const char const *zgroups_name[ZONEFS_ZTYPE_MAX] = { "cnv", "seq" };
That does not compile: duplicated const.
In any case, I am not sure what this would achieve since string
literals are constants by default and the pointer to the array is
declared as a constant too. This ends up completely with read-only text
section.
Declaring it as
static const char * const zgroups_name[] = { "cnv", "seq" };
is probably what you are suggesting, but since the string literals are
already constants by default, I do not think there is any difference.
>
> Regards,
> Markus
--
Damien Le Moal
Western Digital Research