[LU-5504] Missing "const" qualifier in changelog record accessors Created: 19/Aug/14  Updated: 25/Mar/15  Resolved: 25/Mar/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.6.0, Lustre 2.5.2, Lustre 2.4.3
Fix Version/s: Lustre 2.8.0

Type: Improvement Priority: Minor
Reporter: Thomas LEIBOVICI - CEA (Inactive) Assignee: James Nunez (Inactive)
Resolution: Fixed Votes: 0
Labels: patch

Rank (Obsolete): 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.



 Comments   
Comment by Thomas LEIBOVICI - CEA (Inactive) [ 19/Aug/14 ]

Change submitted as: http://review.whamcloud.com/#/c/11517/

Comment by Peter Jones [ 19/Aug/14 ]

James

Can you please take care of this patch?

Thanks

Peter

Comment by James Nunez (Inactive) [ 15/Sep/14 ]

Landed to master

Comment by Frank Zago (Inactive) [ 17/Feb/15 ]

This was accidentally reverted in 0f22e4.

Can this bug be re-opened?

Comment by Gerrit Updater [ 17/Feb/15 ]

frank zago (fzago@cray.com) uploaded a new patch: http://review.whamcloud.com/13787
Subject: LU-5504 utils: add const qualifier to changelog accessors.
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 4456a3e7815594337b4f6996bf1cfcc0e7f24572

Comment by Gerrit Updater [ 25/Mar/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/13787/
Subject: LU-5504 utils: add const qualifier to changelog accessors.
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 7505b4e4f99af589ce09ef97d21f0abc00ae79a8

Comment by Peter Jones [ 25/Mar/15 ]

Landed for 2.8

Generated at Sat Feb 10 01:52:03 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.