Re: [PATCH v10 1/2] fs: New zonefs file system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux