Whamcloud - gitweb
LU-5504 utils: add const qualifier to changelog accessors. 17/11517/2
authorThomas Leibovici <thomas.leibovici@cea.fr>
Tue, 19 Aug 2014 11:51:05 +0000 (13:51 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 6 Sep 2014 02:51:25 +0000 (02:51 +0000)
The following accessors don't need to modify their argument:
changelog_rec_size(), changelog_rec_name(), changelog_rec_snamelen(),
changelog_rec_sname().
Make their prototype more rigorous by adding a "const" qualifier.

Signed-off-by: Thomas Leibovici <thomas.leibovici@cea.fr>
Change-Id: I7915a2487b2b772482c777c4c19ec947b7015b74
Reviewed-on: http://review.whamcloud.com/11517
Tested-by: Jenkins
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustre_user.h

index e016d59..f4d1f8b 100644 (file)
@@ -852,24 +852,25 @@ struct changelog_ext_rec {
 #define CHANGELOG_REC_EXTENDED(rec) \
        (((rec)->cr_flags & CLF_VERMASK) == CLF_EXT_VERSION)
 
-static inline int changelog_rec_size(struct changelog_rec *rec)
+static inline int changelog_rec_size(const struct changelog_rec *rec)
 {
        return CHANGELOG_REC_EXTENDED(rec) ? sizeof(struct changelog_ext_rec):
                                             sizeof(*rec);
 }
 
-static inline char *changelog_rec_name(struct changelog_rec *rec)
+static inline const char *changelog_rec_name(const struct changelog_rec *rec)
 {
        return CHANGELOG_REC_EXTENDED(rec) ?
                ((struct changelog_ext_rec *)rec)->cr_name: rec->cr_name;
 }
 
-static inline int changelog_rec_snamelen(struct changelog_ext_rec *rec)
+static inline int changelog_rec_snamelen(const struct changelog_ext_rec *rec)
 {
        return rec->cr_namelen - strlen(rec->cr_name) - 1;
 }
 
-static inline char *changelog_rec_sname(struct changelog_ext_rec *rec)
+static inline const char *changelog_rec_sname(const struct changelog_ext_rec
+                                             *rec)
 {
        return rec->cr_name + strlen(rec->cr_name) + 1;
 }