Messages in this thread |  | | From | Damien Le Moal <> | Subject | Re: [PATCH v10 1/2] fs: New zonefs file system | Date | Wed, 5 Feb 2020 01:35:58 +0000 |
| |
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
|  |