Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-5504

Missing "const" qualifier in changelog record accessors

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • Lustre 2.8.0
    • 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.

      Attachments

        Activity

          People

            jamesanunez James Nunez (Inactive)
            leibovici-cea Thomas LEIBOVICI - CEA (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: