staging: lustre: use BIT macro
PATCH 1/1 staging: lustre: use BIT macro
This commit changes changes left shift operator to use BIT macro
--- .../staging/lustre/include/linux/lnet/lib-types.h | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-types.h +13 -13
@@ -160,9 +160,9 @@ struct lnet_libmd { } md_iov; }; -#define LNET_MD_FLAG_ZOMBIE (1 << 0) -#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) -#define LNET_MD_FLAG_ABORTED (1 << 2) +#define LNET_MD_FLAG_ZOMBIE BIT(0) +#define LNET_MD_FLAG_AUTO_UNLINK BIT(1) +#define LNET_MD_FLAG_ABORTED BIT(2)struct lnet_test_peer {/* info about peers we are trying to fail */
@@ -287,9 +287,9 @@ struct lnet_ni {* of old LNet, so there shouldn't be any compatibility issue */ #define LNET_PING_FEAT_INVAL (0)/* no feature */ -#define LNET_PING_FEAT_BASE (1 << 0)/* just a ping */ -#define LNET_PING_FEAT_NI_STATUS (1 << 1)/* return NI status */ -#define LNET_PING_FEAT_RTE_DISABLED (1 << 2)/* Routing enabled */ +#define LNET_PING_FEAT_BASE BIT(0)/* just a ping */ +#define LNET_PING_FEAT_NI_STATUS BIT(1)/* return NI status */ +#define LNET_PING_FEAT_RTE_DISABLED BIT(2)/* Routing enabled */ #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \ LNET_PING_FEAT_NI_STATUS)
@@ -440,21 +440,21 @@ struct lnet_rtrbuf {enum lnet_match_flags {/* Didn't match anything */ -LNET_MATCHMD_NONE = (1 <<0 ), +LNET_MATCHMD_NONE =BIT (0 ),/* Matched OK */ -LNET_MATCHMD_OK = (1 <<1 ), +LNET_MATCHMD_OK =BIT (1 ),/* Must be discarded */ -LNET_MATCHMD_DROP = (1 <<2 ), +LNET_MATCHMD_DROP =BIT (2 ),/* match and buffer is exhausted */ -LNET_MATCHMD_EXHAUSTED = (1 <<3 ), +LNET_MATCHMD_EXHAUSTED =BIT (3 ),/* match or drop */ LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK |LNET_MATCHMD_DROP ), };/* Options for lnet_portal::ptl_options */ -#define LNET_PTL_LAZY (1 << 0) -#define LNET_PTL_MATCH_UNIQUE (1 << 1)/* unique match, for RDMA */ -#define LNET_PTL_MATCH_WILDCARD (1 << 2)/* wildcard match, +#define LNET_PTL_LAZY BIT(0) +#define LNET_PTL_MATCH_UNIQUE BIT(1)/* unique match, for RDMA */ +#define LNET_PTL_MATCH_WILDCARD BIT(2)/* wildcard match, * request portal */
Signature · 1 line
2.7.4
Quoted 55 lines · Keerthi Reddy
This commit changes changes left shift operator to use BIT macro
Signed-off-by Keerthi Reddy <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-types.h | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-types.h +10
-10@@ -160,9 +160,9 @@ struct lnet_libmd { } md_iov; }; -#define LNET_MD_FLAG_ZOMBIE (1 << 0) -#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) -#define LNET_MD_FLAG_ABORTED (1 << 2) +#define LNET_MD_FLAG_ZOMBIE BIT(0) +#define LNET_MD_FLAG_AUTO_UNLINK BIT(1) +#define LNET_MD_FLAG_ABORTED BIT(2)struct lnet_test_peer {/* info about peers we are trying to fail */ @@ -287,9 +287,9 @@ struct lnet_ni {* of old LNet, so there shouldn't be any compatibility issue */ #define LNET_PING_FEAT_INVAL (0)/* no feature */ -#define LNET_PING_FEAT_BASE (1 << 0)/* just a ping */ -#define LNET_PING_FEAT_NI_STATUS (1 << 1)/* return NI status */ -#define LNET_PING_FEAT_RTE_DISABLED (1 << 2)/* Routing enabled */ +#define LNET_PING_FEAT_BASE BIT(0)/* just a ping */ +#define LNET_PING_FEAT_NI_STATUS BIT(1)/* return NI status */ +#define LNET_PING_FEAT_RTE_DISABLED BIT(2)/* Routing enabled */ #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \ LNET_PING_FEAT_NI_STATUS)@@ -440,21 +440,21 @@ struct lnet_rtrbuf {enum lnet_match_flags {/* Didn't match anything */ -LNET_MATCHMD_NONE = (1 <<0 ), +LNET_MATCHMD_NONE =BIT (0 ),/* Matched OK */ -LNET_MATCHMD_OK = (1 <<1 ), +LNET_MATCHMD_OK =BIT (1 ),/* Must be discarded */ -LNET_MATCHMD_DROP = (1 <<2 ), +LNET_MATCHMD_DROP =BIT (2 ),/* match and buffer is exhausted */ -LNET_MATCHMD_EXHAUSTED = (1 <<3 ), +LNET_MATCHMD_EXHAUSTED =BIT (3 ),/* match or drop */ LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK |LNET_MATCHMD_DROP ), };
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_rtrbuf { · line 459
Quoted 10 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +3
-3/* Options for lnet_portal::ptl_options */ -#define LNET_PTL_LAZY (1 << 0) -#define LNET_PTL_MATCH_UNIQUE (1 << 1)/* unique match, for RDMA */ -#define LNET_PTL_MATCH_WILDCARD (1 << 2)/* wildcard match, +#define LNET_PTL_LAZY BIT(0) +#define LNET_PTL_MATCH_UNIQUE BIT(1)/* unique match, for RDMA */ +#define LNET_PTL_MATCH_WILDCARD BIT(2)/* wildcard match, * request portal */
It looks like the final comment could be on only one line?
julia
Quoted 11 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-1--2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171002131042.GA12477%40manoharreddy.
For more options, visit https://groups.google.com/d/optout.
Quoted 77 lines · Julia Lawall
Quoted 5 lines · Keerthi Reddy
This commit changes changes left shift operator to use BIT macro
Signed-off-by Keerthi Reddy <[email protected] <javascript:>>---
.../staging/lustre/include/linux/lnet/lib-types.h | 26+++++++++++-----------
Review
Quoted 3 lines
1 file changed, 13 insertions(+), 13 deletions(-)(quoted diff) +0
-0
b/drivers/staging/lustre/include/linux/lnet/lib-types.hQuoted 17 lines
index eea3b8e..15837a3 100644
drivers/staging/lustre/include/linux/lnet/lib-types.h +3
-3@@ -160,9 +160,9 @@ struct lnet_libmd { } md_iov; }; -#define LNET_MD_FLAG_ZOMBIE (1 << 0) -#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) -#define LNET_MD_FLAG_ABORTED (1 << 2) +#define LNET_MD_FLAG_ZOMBIE BIT(0) +#define LNET_MD_FLAG_AUTO_UNLINK BIT(1) +#define LNET_MD_FLAG_ABORTED BIT(2)struct lnet_test_peer {/* info about peers we are trying to fail */ drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 289
Quoted 3 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-0@@ -287,9 +287,9 @@ struct lnet_ni {* of old LNet, so there shouldn't be any compatibility issue */ #define LNET_PING_FEAT_INVAL (0)/* no feature */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 290
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-1-#define LNET_PING_FEAT_BASE (1 << 0)/* just a ping */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 291
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-1-#define LNET_PING_FEAT_NI_STATUS (1 << 1)/* return NI status */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 292
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-1-#define LNET_PING_FEAT_RTE_DISABLED (1 << 2)/* Routing enabled */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 290
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-0+#define LNET_PING_FEAT_BASE BIT(0)/* just a ping */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 291
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-0+#define LNET_PING_FEAT_NI_STATUS BIT(1)/* return NI status */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_ni { · line 292
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-0+#define LNET_PING_FEAT_RTE_DISABLED BIT(2)/* Routing enabled */
Quoted 10 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-1#define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \ LNET_PING_FEAT_NI_STATUS)@@ -440,21 +440,21 @@ struct lnet_rtrbuf {enum lnet_match_flags {/* Didn't match anything */ -LNET_MATCHMD_NONE = (1 <<0 ), +LNET_MATCHMD_NONE =BIT (0 ),/* Matched OK */ drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_rtrbuf { · line 451
Quoted 10 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +3
-3-LNET_MATCHMD_OK = (1 <<1 ), +LNET_MATCHMD_OK =BIT (1 ),/* Must be discarded */ -LNET_MATCHMD_DROP = (1 <<2 ), +LNET_MATCHMD_DROP =BIT (2 ),/* match and buffer is exhausted */ -LNET_MATCHMD_EXHAUSTED = (1 <<3 ), +LNET_MATCHMD_EXHAUSTED =BIT (3 ),/* match or drop */ LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK |
LNET_MATCHMD_DROP),drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_rtrbuf {
Quoted 5 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-2};/* Options for lnet_portal::ptl_options */ -#define LNET_PTL_LAZY (1 << 0) -#define LNET_PTL_MATCH_UNIQUE (1 << 1)/* unique match, for RDMA */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_rtrbuf { · line 457
Quoted 1 line
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-1-#define LNET_PTL_MATCH_WILDCARD (1 << 2)/* wildcard match,
Quoted 9 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_rtrbuf { · line 456
Quoted 2 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +2
-0+#define LNET_PTL_LAZY BIT(0) +#define LNET_PTL_MATCH_UNIQUE BIT(1)/* unique match, for RDMA */
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_rtrbuf { · line 459
Quoted 3 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-0+#define LNET_PTL_MATCH_WILDCARD BIT(2)/* wildcard match, * request portal */ It looks like the final comment could be on only one line?
It's a multi line comment style that author has used throughout the file. Similarly we
can see the same style in lines 420, 412 too.
-Keerthi.
Quoted 19 lines
julia
Quoted 6 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +0
-1--2.7.4
Signature · 1 line
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20171002131042.GA12477%40manoharreddy.
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Quoted 93 lines · Keerthi Reddy
On Monday, October 2, 2017 at 6:45:43 PM UTC+5:30, Julia Lawall wrote:
On Mon, 2 Oct 2017, Keerthi Reddy wrote:
> This commit changes changes left shift operator to use BIT
macro
>
> Signed-off-by: Keerthi Reddy <[email protected]>
> ---
> ᅵ.../staging/lustre/include/linux/lnet/lib-types.h ᅵ| 26
+++++++++++-----------
> ᅵ1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git
a/drivers/staging/lustre/include/linux/lnet/lib-types.h
b/drivers/staging/lustre/include/linux/lnet/lib-types.h
> index eea3b8e..15837a3 100644
> ---a/drivers/staging/lustre/include/linux/lnet/lib-types.h
> +++b/drivers/staging/lustre/include/linux/lnet/lib-types.h
> @@ -160,9 +160,9 @@ structlnet_libmd{
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ}md_iov;
> ᅵ};
>
> -#define LNET_MD_FLAG_ZOMBIEᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 0)
> -#define LNET_MD_FLAG_AUTO_UNLINKᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 1)
> -#define LNET_MD_FLAG_ABORTEDᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 2)
> +#define LNET_MD_FLAG_ZOMBIEᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵBIT(0)
> +#define LNET_MD_FLAG_AUTO_UNLINKᅵᅵᅵᅵᅵᅵᅵᅵBIT(1)
> +#define LNET_MD_FLAG_ABORTEDᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵBIT(2)
>
> ᅵstructlnet_test_peer{
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* info about peers we are trying to fail */
> @@ -287,9 +287,9 @@ structlnet_ni{
> ᅵ * of old LNet, so there shouldn't be any compatibility issue
> ᅵ */
> ᅵ#define LNET_PING_FEAT_INVALᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ(0)ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* no
feature */
> -#define LNET_PING_FEAT_BASEᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 0)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
just a ping */
> -#define LNET_PING_FEAT_NI_STATUSᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 1)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
return NI status */
> -#define LNET_PING_FEAT_RTE_DISABLEDᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 2)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
Routing enabled */
> +#define LNET_PING_FEAT_BASEᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵBIT(0)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
just a ping */
> +#define LNET_PING_FEAT_NI_STATUSᅵᅵᅵᅵᅵᅵᅵᅵBIT(1)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
return NI status */
> +#define LNET_PING_FEAT_RTE_DISABLEDᅵᅵᅵᅵᅵᅵᅵᅵBIT(2)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
Routing enabled */
>
> ᅵ#define
LNET_PING_FEAT_MASKᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ(LNET_PING_FEAT_BASE | \
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵLNET_PING_FEAT_NI_STATUS)
> @@ -440,21 +440,21 @@ structlnet_rtrbuf{
>
> ᅵenumlnet_match_flags{
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* Didn't match anything */
> -ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_NONEᅵᅵᅵᅵᅵᅵᅵᅵ= (1 << 0),
> +ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_NONEᅵᅵᅵᅵᅵᅵᅵᅵ= BIT(0),
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* Matched OK */
> -ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_OKᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ= (1 << 1),
> +ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_OKᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ= BIT(1),
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* Must be discarded */
> -ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_DROPᅵᅵᅵᅵᅵᅵᅵᅵ= (1 << 2),
> +ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_DROPᅵᅵᅵᅵᅵᅵᅵᅵ= BIT(2),
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* match and buffer is exhausted */
> -ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_EXHAUSTEDᅵᅵᅵᅵᅵᅵᅵᅵ= (1 << 3),
> +ᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_EXHAUSTEDᅵᅵᅵᅵᅵᅵᅵᅵ= BIT(3),
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵ/* match or drop */
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵLNET_MATCHMD_FINISHᅵᅵᅵᅵᅵᅵᅵᅵ= (LNET_MATCHMD_OK|
LNET_MATCHMD_DROP),
> ᅵ};
>
> ᅵ/* Options forlnet_portal::ptl_options*/
> -#define LNET_PTL_LAZYᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 0)
> -#define LNET_PTL_MATCH_UNIQUEᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 1)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
unique match, for RDMA */
> -#define LNET_PTL_MATCH_WILDCARDᅵᅵᅵᅵᅵᅵᅵᅵ(1 << 2)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
wildcard match,
> +#define LNET_PTL_LAZYᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵBIT(0)
> +#define LNET_PTL_MATCH_UNIQUEᅵᅵᅵᅵᅵᅵᅵᅵBIT(1)ᅵᅵᅵᅵᅵᅵᅵᅵ/* unique
match, for RDMA */
> +#define LNET_PTL_MATCH_WILDCARDᅵᅵᅵᅵᅵᅵᅵᅵBIT(2)ᅵᅵᅵᅵᅵᅵᅵᅵ/*
wildcard match,
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ * request portal
> ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ */
Quoted 6 lines
It looks like the final comment could be on only one line?
ᅵ
It's a multi line comment style that author has used throughout the file. Similarly weᅵ
can see the same style in lines 420, 412 too.ᅵ
If the comment can be on a single line without exceeding 80 characters that would be more readable. Your BIT code is shorter than the original code, so it could now be possible. If needed, the comment could be one space closer to the BIT calls and/or the BIT calls could be closer to the macro names. One line is always easier to read than multiple lines, if it fits in 80 characters.
julia