Whamcloud - gitweb
LU-5504 utils: add const qualifier to changelog accessors. 87/13787/3
authorFrank Zago <fzago@cray.com>
Tue, 17 Feb 2015 21:11:40 +0000 (15:11 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 25 Mar 2015 13:06:52 +0000 (13:06 +0000)
Commit 6e1365 changed 4 functions, and commit 0f22e4 accidentally
reverted them.

This patch put them back, as well as adding new ones to
changelog_rec_size(), changelog_rec_varsize(), changelog_rec_rename()
and changelog_rec_jobid().

6e1365 also changed changelog_rec_name() and changelog_rec_sname() to
return a const, but that is not possible anymore.

Signed-off-by: frank zago <fzago@cray.com>
Change-Id: I19e389c422795c2ece4d7af369099cb733d3cb1a
Reviewed-on: http://review.whamcloud.com/13787
Tested-by: Jenkins
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/include/lustre/lustre_user.h

index 9b65dba..060ff29 100644 (file)
@@ -897,18 +897,18 @@ static inline size_t changelog_rec_offset(enum changelog_rec_flags crf)
        return size;
 }
 
-static inline size_t changelog_rec_size(struct changelog_rec *rec)
+static inline size_t changelog_rec_size(const struct changelog_rec *rec)
 {
        return changelog_rec_offset(rec->cr_flags);
 }
 
-static inline size_t changelog_rec_varsize(struct changelog_rec *rec)
+static inline size_t changelog_rec_varsize(const struct changelog_rec *rec)
 {
        return changelog_rec_size(rec) - sizeof(*rec) + rec->cr_namelen;
 }
 
 static inline
-struct changelog_ext_rename *changelog_rec_rename(struct changelog_rec *rec)
+struct changelog_ext_rename *changelog_rec_rename(const struct changelog_rec *rec)
 {
        enum changelog_rec_flags crf = rec->cr_flags & CLF_VERSION;
 
@@ -918,7 +918,7 @@ struct changelog_ext_rename *changelog_rec_rename(struct changelog_rec *rec)
 
 /* The jobid follows the rename extension, if present */
 static inline
-struct changelog_ext_jobid *changelog_rec_jobid(struct changelog_rec *rec)
+struct changelog_ext_jobid *changelog_rec_jobid(const struct changelog_rec *rec)
 {
        enum changelog_rec_flags crf = rec->cr_flags &
                                        (CLF_VERSION | CLF_RENAME);
@@ -928,18 +928,18 @@ struct changelog_ext_jobid *changelog_rec_jobid(struct changelog_rec *rec)
 }
 
 /* The name follows the rename and jobid extensions, if present */
-static inline char *changelog_rec_name(struct changelog_rec *rec)
+static inline char *changelog_rec_name(const struct changelog_rec *rec)
 {
        return (char *)rec + changelog_rec_offset(rec->cr_flags &
                                                  CLF_SUPPORTED);
 }
 
-static inline size_t changelog_rec_snamelen(struct changelog_rec *rec)
+static inline size_t changelog_rec_snamelen(const struct changelog_rec *rec)
 {
        return rec->cr_namelen - strlen(changelog_rec_name(rec)) - 1;
 }
 
-static inline char *changelog_rec_sname(struct changelog_rec *rec)
+static inline char *changelog_rec_sname(const struct changelog_rec *rec)
 {
        char *cr_name = changelog_rec_name(rec);