Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1448371

[PATCH 44/58] staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 44/58] staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h
Date 2016-07-22 06:00 +0200
Message-ID <rXzMZ-ne-13@gated-at.bofh.it> (permalink)
References <rXyQV-88M-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: John L. Hammond <john.hammond@intel.com>

Change the return type of several predicate functions from int to bool.

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      |   72 ++++++++++----------
 drivers/staging/lustre/lustre/include/lustre_fid.h |    4 +-
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index c932e20..d3a9db9 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -196,12 +196,12 @@ static inline unsigned fld_range_type(const struct lu_seq_range *range)
 	return range->lsr_flags & LU_SEQ_RANGE_MASK;
 }
 
-static inline int fld_range_is_ost(const struct lu_seq_range *range)
+static inline bool fld_range_is_ost(const struct lu_seq_range *range)
 {
 	return fld_range_type(range) == LU_SEQ_RANGE_OST;
 }
 
-static inline int fld_range_is_mdt(const struct lu_seq_range *range)
+static inline bool fld_range_is_mdt(const struct lu_seq_range *range)
 {
 	return fld_range_type(range) == LU_SEQ_RANGE_MDT;
 }
@@ -260,23 +260,23 @@ static inline void range_init(struct lu_seq_range *range)
  * check if given seq id \a s is within given range \a r
  */
 
-static inline int range_within(const struct lu_seq_range *range,
-			       __u64 s)
+static inline bool range_within(const struct lu_seq_range *range,
+				__u64 s)
 {
 	return s >= range->lsr_start && s < range->lsr_end;
 }
 
-static inline int range_is_sane(const struct lu_seq_range *range)
+static inline bool range_is_sane(const struct lu_seq_range *range)
 {
 	return (range->lsr_end >= range->lsr_start);
 }
 
-static inline int range_is_zero(const struct lu_seq_range *range)
+static inline bool range_is_zero(const struct lu_seq_range *range)
 {
 	return (range->lsr_start == 0 && range->lsr_end == 0);
 }
 
-static inline int range_is_exhausted(const struct lu_seq_range *range)
+static inline bool range_is_exhausted(const struct lu_seq_range *range)
 
 {
 	return range_space(range) == 0;
@@ -437,69 +437,69 @@ enum dot_lustre_oid {
 	FID_OID_DOT_LUSTRE_OBF = 2UL,
 };
 
-static inline int fid_seq_is_mdt0(__u64 seq)
+static inline bool fid_seq_is_mdt0(__u64 seq)
 {
 	return (seq == FID_SEQ_OST_MDT0);
 }
 
-static inline int fid_seq_is_mdt(__u64 seq)
+static inline bool fid_seq_is_mdt(__u64 seq)
 {
 	return seq == FID_SEQ_OST_MDT0 || seq >= FID_SEQ_NORMAL;
 };
 
-static inline int fid_seq_is_echo(__u64 seq)
+static inline bool fid_seq_is_echo(__u64 seq)
 {
 	return (seq == FID_SEQ_ECHO);
 }
 
-static inline int fid_is_echo(const struct lu_fid *fid)
+static inline bool fid_is_echo(const struct lu_fid *fid)
 {
 	return fid_seq_is_echo(fid_seq(fid));
 }
 
-static inline int fid_seq_is_llog(__u64 seq)
+static inline bool fid_seq_is_llog(__u64 seq)
 {
 	return (seq == FID_SEQ_LLOG);
 }
 
-static inline int fid_is_llog(const struct lu_fid *fid)
+static inline bool fid_is_llog(const struct lu_fid *fid)
 {
 	/* file with OID == 0 is not llog but contains last oid */
 	return fid_seq_is_llog(fid_seq(fid)) && fid_oid(fid) > 0;
 }
 
-static inline int fid_seq_is_rsvd(__u64 seq)
+static inline bool fid_seq_is_rsvd(__u64 seq)
 {
 	return (seq > FID_SEQ_OST_MDT0 && seq <= FID_SEQ_RSVD);
 };
 
-static inline int fid_seq_is_special(__u64 seq)
+static inline bool fid_seq_is_special(__u64 seq)
 {
 	return seq == FID_SEQ_SPECIAL;
 };
 
-static inline int fid_seq_is_local_file(__u64 seq)
+static inline bool fid_seq_is_local_file(__u64 seq)
 {
 	return seq == FID_SEQ_LOCAL_FILE ||
 	       seq == FID_SEQ_LOCAL_NAME;
 };
 
-static inline int fid_seq_is_root(__u64 seq)
+static inline bool fid_seq_is_root(__u64 seq)
 {
 	return seq == FID_SEQ_ROOT;
 }
 
-static inline int fid_seq_is_dot(__u64 seq)
+static inline bool fid_seq_is_dot(__u64 seq)
 {
 	return seq == FID_SEQ_DOT_LUSTRE;
 }
 
-static inline int fid_seq_is_default(__u64 seq)
+static inline bool fid_seq_is_default(__u64 seq)
 {
 	return seq == FID_SEQ_LOV_DEFAULT;
 }
 
-static inline int fid_is_mdt0(const struct lu_fid *fid)
+static inline bool fid_is_mdt0(const struct lu_fid *fid)
 {
 	return fid_seq_is_mdt0(fid_seq(fid));
 }
@@ -516,12 +516,12 @@ static inline void lu_root_fid(struct lu_fid *fid)
  * \param fid the fid to be tested.
  * \return true if the fid is a igif; otherwise false.
  */
-static inline int fid_seq_is_igif(__u64 seq)
+static inline bool fid_seq_is_igif(__u64 seq)
 {
 	return seq >= FID_SEQ_IGIF && seq <= FID_SEQ_IGIF_MAX;
 }
 
-static inline int fid_is_igif(const struct lu_fid *fid)
+static inline bool fid_is_igif(const struct lu_fid *fid)
 {
 	return fid_seq_is_igif(fid_seq(fid));
 }
@@ -531,27 +531,27 @@ static inline int fid_is_igif(const struct lu_fid *fid)
  * \param fid the fid to be tested.
  * \return true if the fid is a idif; otherwise false.
  */
-static inline int fid_seq_is_idif(__u64 seq)
+static inline bool fid_seq_is_idif(__u64 seq)
 {
 	return seq >= FID_SEQ_IDIF && seq <= FID_SEQ_IDIF_MAX;
 }
 
-static inline int fid_is_idif(const struct lu_fid *fid)
+static inline bool fid_is_idif(const struct lu_fid *fid)
 {
 	return fid_seq_is_idif(fid_seq(fid));
 }
 
-static inline int fid_is_local_file(const struct lu_fid *fid)
+static inline bool fid_is_local_file(const struct lu_fid *fid)
 {
 	return fid_seq_is_local_file(fid_seq(fid));
 }
 
-static inline int fid_seq_is_norm(__u64 seq)
+static inline bool fid_seq_is_norm(__u64 seq)
 {
 	return (seq >= FID_SEQ_NORMAL);
 }
 
-static inline int fid_is_norm(const struct lu_fid *fid)
+static inline bool fid_is_norm(const struct lu_fid *fid)
 {
 	return fid_seq_is_norm(fid_seq(fid));
 }
@@ -769,7 +769,7 @@ static inline int fid_to_ostid(const struct lu_fid *fid, struct ost_id *ostid)
 }
 
 /* Check whether the fid is for LAST_ID */
-static inline int fid_is_last_id(const struct lu_fid *fid)
+static inline bool fid_is_last_id(const struct lu_fid *fid)
 {
 	return (fid_oid(fid) == 0);
 }
@@ -838,7 +838,7 @@ static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 	dst->f_ver = be32_to_cpu(fid_ver(src));
 }
 
-static inline int fid_is_sane(const struct lu_fid *fid)
+static inline bool fid_is_sane(const struct lu_fid *fid)
 {
 	return fid &&
 	       ((fid_seq(fid) >= FID_SEQ_START && fid_ver(fid) == 0) ||
@@ -846,7 +846,7 @@ static inline int fid_is_sane(const struct lu_fid *fid)
 		fid_seq_is_rsvd(fid_seq(fid)));
 }
 
-static inline int fid_is_zero(const struct lu_fid *fid)
+static inline bool fid_is_zero(const struct lu_fid *fid)
 {
 	return fid_seq(fid) == 0 && fid_oid(fid) == 0;
 }
@@ -854,7 +854,7 @@ static inline int fid_is_zero(const struct lu_fid *fid)
 void lustre_swab_lu_fid(struct lu_fid *fid);
 void lustre_swab_lu_seq_range(struct lu_seq_range *range);
 
-static inline int lu_fid_eq(const struct lu_fid *f0, const struct lu_fid *f1)
+static inline bool lu_fid_eq(const struct lu_fid *f0, const struct lu_fid *f1)
 {
 	return memcmp(f0, f1, sizeof(*f0)) == 0;
 }
@@ -1067,13 +1067,13 @@ struct lustre_handle {
 
 #define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL
 
-static inline int lustre_handle_is_used(const struct lustre_handle *lh)
+static inline bool lustre_handle_is_used(const struct lustre_handle *lh)
 {
 	return lh->cookie != 0ull;
 }
 
-static inline int lustre_handle_equal(const struct lustre_handle *lh1,
-				      const struct lustre_handle *lh2)
+static inline bool lustre_handle_equal(const struct lustre_handle *lh1,
+				       const struct lustre_handle *lh2)
 {
 	return lh1->cookie == lh2->cookie;
 }
@@ -2684,8 +2684,8 @@ struct ldlm_res_id {
 #define PLDLMRES(res)	(res)->lr_name.name[0], (res)->lr_name.name[1], \
 			(res)->lr_name.name[2], (res)->lr_name.name[3]
 
-static inline int ldlm_res_eq(const struct ldlm_res_id *res0,
-			      const struct ldlm_res_id *res1)
+static inline bool ldlm_res_eq(const struct ldlm_res_id *res0,
+			       const struct ldlm_res_id *res1)
 {
 	return !memcmp(res0, res1, sizeof(*res0));
 }
diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h
index a85183b..6f7dc15 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -406,8 +406,8 @@ fid_build_reg_res_name(const struct lu_fid *fid, struct ldlm_res_id *res)
 /*
  * Return true if resource is for object identified by FID.
  */
-static inline int fid_res_name_eq(const struct lu_fid *fid,
-				  const struct ldlm_res_id *res)
+static inline bool fid_res_name_eq(const struct lu_fid *fid,
+				   const struct ldlm_res_id *res)
 {
 	return res->name[LUSTRE_RES_ID_SEQ_OFF] == fid_seq(fid) &&
 	       res->name[LUSTRE_RES_ID_VER_OID_OFF] == fid_ver_oid(fid);
-- 
1.7.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/58] staging: lustre: bug fixes from lustre 2.5.[56-58] James Simmons <jsimmons@infradead.org> - 2016-07-22 05:00 +0200
  [PATCH 07/58] staging: lustre: llite: label the debug info James Simmons <jsimmons@infradead.org> - 2016-07-22 05:00 +0200
  [PATCH 02/58] staging: lustre: obd: rename struct lmv_stripe_md field mea to lmv James Simmons <jsimmons@infradead.org> - 2016-07-22 05:00 +0200
  [PATCH 05/58] staging: lustre: lmv: add new lmv structures James Simmons <jsimmons@infradead.org> - 2016-07-22 05:00 +0200
  [PATCH 10/58] staging: lustre: llite: reduce indent in ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 06/58] staging: lustre: mdc: handle IT_READDIR operations James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 08/58] staging: lustre: llite: pass struct md_op_data to ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 03/58] staging: lustre: ptlrpc: remove wirecheck for struct lmv_stripe_md James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 15/58] staging: lustre: llite: clarify some debug messages for statahead James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 04/58] staging: lustre: llite: cache directory striping information James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 14/58] staging: lustre: llite: rename some variables for ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:10 +0200
  [PATCH 16/58] staging: lustre: llite: remove code never called James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 23/58] staging: lustre: llite: change remove parameter to bool James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 24/58] staging: lustre: mdc: don't take rpc lock for readdir case James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 17/58] staging: lustre: llite: pass in __u64 pos for ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 21/58] staging: lustre: llite: style cleanup for llite_internal.h James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 11/58] staging: lustre: llite: set next only when needed in ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 13/58] staging: lustre: llite: change done flag in ll_dir_read to bool James Simmons <jsimmons@infradead.org> - 2016-07-22 05:20 +0200
  [PATCH 25/58] staging: lustre: lmv: remove unused lmv_get_mea function James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 20/58] staging: lustre: llite: remove comment from ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 19/58] staging: lustre: llite: add md_op_data parameter to ll_get_dir_page James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 26/58] staging: lustre: lmv: remove duplicate MAX_HASH_* James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 22/58] staging: lustre: llite: pass inode to ll_release_page James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 12/58] staging: lustre: llite: handle done flags differently in ll_dir_read James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 28/58] staging: lustre: lmv: remove lmv_get_easize James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 27/58] staging: lustre: lmv: change handling of lmv striping information James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 18/58] staging: lustre: llite: do post work for statahead in readdir case James Simmons <jsimmons@infradead.org> - 2016-07-22 05:30 +0200
  [PATCH 36/58] staging: lustre: lmv: fix issue found by Klocwork Insight tool James Simmons <jsimmons@infradead.org> - 2016-07-22 05:40 +0200
  [PATCH 29/58] staging: lustre: lmv: replace obd_free_memmd with lmv_free_memmd James Simmons <jsimmons@infradead.org> - 2016-07-22 05:40 +0200
  [PATCH 34/58] staging: lustre: obdclass: bug fixes for lu_device_type handling James Simmons <jsimmons@infradead.org> - 2016-07-22 05:40 +0200
  [PATCH 31/58] staging: lustre: llite: fix "getdirstripe" to show stripe info James Simmons <jsimmons@infradead.org> - 2016-07-22 05:40 +0200
  [PATCH 32/58] staging: lustre: delete striped directory James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 33/58] staging: lustre: obdclass: fix lmd_parse() to handle comma-separated NIDs James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 41/58] staging: lustre: mdc: fixup MDS_SWAP_LAYOUTS ELC handling James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 38/58] staging: lustre: llite: enable clients to inject error for lfsck James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 43/58] staging: lustre: const correct FID/OSTID/... helpers James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 40/58] staging: lustre: llite: a few fixes for migration. James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 35/58] staging: lustre: add ability to migrate inodes. James Simmons <jsimmons@infradead.org> - 2016-07-22 05:50 +0200
  [PATCH 39/58] staging: lustre: osc: allow to call brw_commit() multiple times James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 50/58] staging: lustre: lov: handle the case of stripe size is not power 2 James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 37/58] staging: lustre: libcfs: Only dump log once per sec. to avoid EEXIST James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 49/58] staging: lustre: llite: avoid a deadlock in page write James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 46/58] staging: lustre: lmv: access lum_stripe_offset as little endian James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 44/58] staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 42/58] staging: lustre: don't need to const __u64 parameters for lustre_idl.h James Simmons <jsimmons@infradead.org> - 2016-07-22 06:00 +0200
  [PATCH 45/58] staging: lustre: simplify inline functions in lustre_fid.h James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 55/58] staging: lustre: ldlm: flock completion fixes. James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 47/58] staging: lustre: lmv: lookup remote migrating object in LMV James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 52/58] staging: lustre: lmv: rename request to preq in lmv_getattr_name() James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 51/58] staging: lustre: lmv: cleanup req in lmv_getattr_name() James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 48/58] staging: lustre: lmv: Ensure lmv_intent_lookup cleans up reqp James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 53/58] staging: lustre: obdclass: unified flow control interfaces James Simmons <jsimmons@infradead.org> - 2016-07-22 06:10 +0200
  [PATCH 57/58] staging: lustre: llite: add error handler in inode prepare phase James Simmons <jsimmons@infradead.org> - 2016-07-22 06:20 +0200
  [PATCH 58/58] staging: lustre: ptlrpc: Early replies need to honor at_max James Simmons <jsimmons@infradead.org> - 2016-07-22 06:20 +0200
  [PATCH 54/58] staging: lustre: reorder LOV_MAGIC_* definition James Simmons <jsimmons@infradead.org> - 2016-07-22 06:20 +0200
  [PATCH 56/58] staging: lustre: move ioctls to lustre_ioctl.h James Simmons <jsimmons@infradead.org> - 2016-07-22 06:20 +0200

csiph-web