Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
Lustre 2.6.0, Lustre 2.5.2, Lustre 2.4.3
-
15354
Description
The following function prototypes in "lustre_user.h" require read/write access to their "rec" argument but they don't need to modify it:
static inline int changelog_rec_size(struct changelog_rec *rec);
static inline char *changelog_rec_name(struct changelog_rec *rec);
static inline int changelog_rec_snamelen(struct changelog_ext_rec *rec);
static inline char *changelog_rec_sname(struct changelog_ext_rec *rec);
Qualifying the "rec" argument as "const" would be more rigourous, and would avoid such messages when using them:
warning: passing argument 1 of 'changelog_rec_snamelen' discards qualifiers from pointer target type
/usr/include/lustre/lustre_user.h:844: note: expected 'struct changelog_ext_rec *' but argument is of type 'const struct changelog_ext_rec *'
warning: passing argument 1 of 'changelog_rec_sname' discards qualifiers from pointer target type
/usr/include/lustre/lustre_user.h:849: note: expected 'struct changelog_ext_rec *' but argument is of type 'const struct changelog_ext_rec *'
I will submit a patch to make these prototypes more strict.