Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1464126
| From | James Simmons <jsimmons@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 25/80] staging: lustre: const correct FID/OSTID/... helpers |
| Date | 2016-08-16 22:40 +0200 |
| Message-ID | <s6Tjs-7Qi-27@gated-at.bofh.it> (permalink) |
| References | <s6T05-7HZ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: John L. Hammond <john.hammond@intel.com>
Add a const qualifier wherever possible to the pointer parameters of
the inline helper functions in lustre_idl.h and lustre_fid.h.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/8641
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
.../lustre/lustre/include/lustre/lustre_idl.h | 28 ++++++++++----------
drivers/staging/lustre/lustre/include/lustre_fid.h | 9 +++---
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 87e79b9..c932e20 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -1033,7 +1033,7 @@ static inline int lu_dirent_calc_size(int namelen, __u16 attr)
return (size + 7) & ~7;
}
-static inline int lu_dirent_size(struct lu_dirent *ent)
+static inline int lu_dirent_size(const struct lu_dirent *ent)
{
if (le16_to_cpu(ent->lde_reclen) == 0) {
return lu_dirent_calc_size(le16_to_cpu(ent->lde_namelen),
@@ -1067,7 +1067,7 @@ struct lustre_handle {
#define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL
-static inline int lustre_handle_is_used(struct lustre_handle *lh)
+static inline int lustre_handle_is_used(const struct lustre_handle *lh)
{
return lh->cookie != 0ull;
}
@@ -1079,7 +1079,7 @@ static inline int lustre_handle_equal(const struct lustre_handle *lh1,
}
static inline void lustre_handle_copy(struct lustre_handle *tgt,
- struct lustre_handle *src)
+ const struct lustre_handle *src)
{
tgt->cookie = src->cookie;
}
@@ -1570,25 +1570,25 @@ static inline void lmm_oi_set_id(struct ost_id *oi, __u64 oid)
oi->oi.oi_id = oid;
}
-static inline __u64 lmm_oi_id(struct ost_id *oi)
+static inline __u64 lmm_oi_id(const struct ost_id *oi)
{
return oi->oi.oi_id;
}
-static inline __u64 lmm_oi_seq(struct ost_id *oi)
+static inline __u64 lmm_oi_seq(const struct ost_id *oi)
{
return oi->oi.oi_seq;
}
static inline void lmm_oi_le_to_cpu(struct ost_id *dst_oi,
- struct ost_id *src_oi)
+ const struct ost_id *src_oi)
{
dst_oi->oi.oi_id = le64_to_cpu(src_oi->oi.oi_id);
dst_oi->oi.oi_seq = le64_to_cpu(src_oi->oi.oi_seq);
}
static inline void lmm_oi_cpu_to_le(struct ost_id *dst_oi,
- struct ost_id *src_oi)
+ const struct ost_id *src_oi)
{
dst_oi->oi.oi_id = cpu_to_le64(src_oi->oi.oi_id);
dst_oi->oi.oi_seq = cpu_to_le64(src_oi->oi.oi_seq);
@@ -2724,15 +2724,15 @@ struct ldlm_extent {
#define LDLM_GID_ANY ((__u64)-1)
-static inline int ldlm_extent_overlap(struct ldlm_extent *ex1,
- struct ldlm_extent *ex2)
+static inline int ldlm_extent_overlap(const struct ldlm_extent *ex1,
+ const struct ldlm_extent *ex2)
{
return (ex1->start <= ex2->end) && (ex2->start <= ex1->end);
}
/* check if @ex1 contains @ex2 */
-static inline int ldlm_extent_contain(struct ldlm_extent *ex1,
- struct ldlm_extent *ex2)
+static inline int ldlm_extent_contain(const struct ldlm_extent *ex1,
+ const struct ldlm_extent *ex2)
{
return (ex1->start <= ex2->start) && (ex1->end >= ex2->end);
}
@@ -3092,7 +3092,7 @@ enum agent_req_status {
ARS_SUCCEED,
};
-static inline char *agent_req_status2name(enum agent_req_status ars)
+static inline const char *agent_req_status2name(const enum agent_req_status ars)
{
switch (ars) {
case ARS_WAITING:
@@ -3268,7 +3268,7 @@ struct obdo {
#define o_cksum o_nlink
#define o_grant_used o_data_version
-static inline void lustre_set_wire_obdo(struct obd_connect_data *ocd,
+static inline void lustre_set_wire_obdo(const struct obd_connect_data *ocd,
struct obdo *wobdo,
const struct obdo *lobdo)
{
@@ -3287,7 +3287,7 @@ static inline void lustre_set_wire_obdo(struct obd_connect_data *ocd,
}
}
-static inline void lustre_get_wire_obdo(struct obd_connect_data *ocd,
+static inline void lustre_get_wire_obdo(const struct obd_connect_data *ocd,
struct obdo *lobdo,
const struct obdo *wobdo)
{
diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h
index 61f3930..a85183b 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -483,7 +483,7 @@ fid_build_pdo_res_name(const struct lu_fid *fid, unsigned int hash,
* res will be built from normal FID directly, i.e. res[0] = f_seq,
* res[1] = f_oid + f_ver.
*/
-static inline void ostid_build_res_name(struct ost_id *oi,
+static inline void ostid_build_res_name(const struct ost_id *oi,
struct ldlm_res_id *name)
{
memset(name, 0, sizeof(*name));
@@ -498,8 +498,8 @@ static inline void ostid_build_res_name(struct ost_id *oi,
/**
* Return true if the resource is for the object identified by this id & group.
*/
-static inline int ostid_res_name_eq(struct ost_id *oi,
- struct ldlm_res_id *name)
+static inline int ostid_res_name_eq(const struct ost_id *oi,
+ const struct ldlm_res_id *name)
{
/* Note: it is just a trick here to save some effort, probably the
* correct way would be turn them into the FID and compare
@@ -610,7 +610,8 @@ static inline __u32 fid_flatten32(const struct lu_fid *fid)
return ino ? ino : fid_oid(fid);
}
-static inline int lu_fid_diff(struct lu_fid *fid1, struct lu_fid *fid2)
+static inline int lu_fid_diff(const struct lu_fid *fid1,
+ const struct lu_fid *fid2)
{
LASSERTF(fid_seq(fid1) == fid_seq(fid2), "fid1:"DFID", fid2:"DFID"\n",
PFID(fid1), PFID(fid2));
--
1.7.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/80] staging: lustre: majority of missing fixes for 2.6 release James Simmons <jsimmons@infradead.org> - 2016-08-16 22:20 +0200 [PATCH 01/80] staging: lustre: llite: add md_op_data parameter to ll_get_dir_page James Simmons <jsimmons@infradead.org> - 2016-08-16 22:20 +0200 [PATCH 72/80] staging: lustre: obd: validate open handle cookies James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 14/80] staging: lustre: delete striped directory James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 42/80] staging: lustre: llite: validate names James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 64/80] staging: lustre: ptlrpc: add OBD_CONNECT_UNLINK_CLOSE flag James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 75/80] staging: lustre: llite: set op_max_pages James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 54/80] staging: lustre: llite: set dir LOV xattr length variable James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 45/80] staging: lustre: llite: Fix the deadlock in balance_dirty_pages() James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 60/80] staging: lustre: ldlm: improve ldlm_lock_create() return value James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 80/80] staging: lustre: lnet: Stop Infinite CON RACE Condition James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 73/80] staging: lustre: lmv: build error with gcc 4.7.0 20110509 James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 49/80] staging: lustre: lmv: validate lock with correct stripe FID James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 53/80] staging: lustre: obd: rename lsr_padding to lsr_valid James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 56/80] staging: lustre: clio: Reduce memory overhead of per-page allocation James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 74/80] staging: lustre: obd: implement md_read_page James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 26/80] staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 13/80] staging: lustre: llite: fix "getdirstripe" to show stripe info James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 58/80] staging: lustre: mdc: always use D_INFO for debug info when mdc_put_rpc_lock fails James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 68/80] staging: lustre: lmv: build master LMV EA dynamically build via readdir James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 19/80] staging: lustre: libcfs: Only dump log once per sec. to avoid EEXIST James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 57/80] staging: lustre: osc: revise unstable pages accounting James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 66/80] staging: lustre: lmv: try all stripes for unknown hash functions James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 52/80] staging: lustre: llite: use the correct mode for striped directory James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 59/80] staging: lustre: fld: add fld description documentation James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 34/80] staging: lustre: lmv: rename request to preq in lmv_getattr_name() James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 15/80] staging: lustre: obdclass: fix lmd_parse() to handle comma-separated NIDs James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 51/80] staging: lustre: lmv: Match MDT where the FID locates first James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 61/80] staging: lustre: obdclass: compile issues with variable not being initialized James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 76/80] staging: lustre: lnet: Do not drop message when shutting down LNet James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 46/80] staging: lustre: llite: Change readdir BRW metrics James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 71/80] staging: lustre: llite: remove assert for acl refcount James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 70/80] staging: lustre: include: fix one off errors in lustre_id.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 47/80] staging: lustre: uapi: reduce scope of lustre_idl.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 77/80] staging: lustre: lnet: Correct position of lnet_ni_decref() James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 62/80] staging: lustre: obd: limit lu_object cache James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 63/80] staging: lustre: fid: do open-by-fid by default James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 07/80] staging: lustre: lmv: remove unused lmv_get_mea function James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 67/80] staging: lustre: ptlrpc: request gets stuck in UNREGISTERING phase James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 50/80] staging: lustre: lov: new pattern flag for partially repaired file James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 79/80] staging: lustre: lnet: lock improvement for ko2iblnd James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 04/80] staging: lustre: llite: pass inode to ll_release_page James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 28/80] staging: lustre: lmv: access lum_stripe_offset as little endian James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 32/80] staging: lustre: lov: handle the case of stripe size is not power 2 James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 65/80] staging: lustre: llog: keep llog ctxt indices constant James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 17/80] staging: lustre: add ability to migrate inodes. James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 48/80] staging: lustre: llite: a few fixes about readdir of striped dir. James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 69/80] staging: lustre: osc: Automatically increase the max_dirty_mb James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 78/80] staging: lustre: lnet: make connection more stable with packet loss James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 43/80] staging: lustre: llite: fix inconsistencies of root squash feature James Simmons <jsimmons@infradead.org> - 2016-08-16 22:30 +0200 [PATCH 30/80] staging: lustre: lmv: Ensure lmv_intent_lookup cleans up reqp James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 40/80] staging: lustre: ptlrpc: Early replies need to honor at_max James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 37/80] staging: lustre: ldlm: flock completion fixes. James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 11/80] staging: lustre: lmv: replace obd_free_memmd with lmv_free_memmd James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 39/80] staging: lustre: llite: add error handler in inode prepare phase James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 21/80] staging: lustre: osc: allow to call brw_commit() multiple times James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 27/80] staging: lustre: simplify inline functions in lustre_fid.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 02/80] staging: lustre: llite: remove comment from ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 29/80] staging: lustre: lmv: lookup remote migrating object in LMV James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 20/80] staging: lustre: llite: enable clients to inject error for lfsck James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 18/80] staging: lustre: lmv: fix issue found by Klocwork Insight tool James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 25/80] staging: lustre: const correct FID/OSTID/... helpers James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 10/80] staging: lustre: lmv: remove lmv_get_easize James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 08/80] staging: lustre: lmv: remove duplicate MAX_HASH_* James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 22/80] staging: lustre: llite: a few fixes for migration. James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 33/80] staging: lustre: lmv: cleanup req in lmv_getattr_name() James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 06/80] staging: lustre: mdc: don't take rpc lock for readdir case James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 03/80] staging: lustre: llite: style cleanup for llite_internal.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 16/80] staging: lustre: obdclass: bug fixes for lu_device_type handling James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 24/80] staging: lustre: don't need to const __u64 parameters for lustre_idl.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 36/80] staging: lustre: reorder LOV_MAGIC_* definition James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 38/80] staging: lustre: move ioctls to lustre_ioctl.h James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 35/80] staging: lustre: obdclass: unified flow control interfaces James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 09/80] staging: lustre: lmv: change handling of lmv striping information James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 23/80] staging: lustre: mdc: fixup MDS_SWAP_LAYOUTS ELC handling James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 31/80] staging: lustre: llite: avoid a deadlock in page write James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200 [PATCH 44/80] staging: lustre: Remove static declaration in anonymous union James Simmons <jsimmons@infradead.org> - 2016-08-16 22:40 +0200
csiph-web