* [PATCH 1/1] Modify macro NETLBL_CATMAP_MAPTYPE to define a type using typedef
@ 2024-02-02 3:44 George Guo
2024-02-02 15:31 ` Paul Moore
0 siblings, 1 reply; 3+ messages in thread
From: George Guo @ 2024-02-02 3:44 UTC (permalink / raw)
To: Paul Moore, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: George Guo, netdev, linux-security-module, linux-kernel
From: George Guo <guodongtai@kylinos.cn>
Modify NETLBL_CATMAP_MAPTYPE to netlbl_catmap_map_t, which is more
readable.
Signed-off-by: George Guo <guodongtai@kylinos.cn>
---
include/net/netlabel.h | 8 ++++----
net/netlabel/netlabel_kapi.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 43ae50337685..9f8387fc7e27 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -145,15 +145,15 @@ struct netlbl_lsm_cache {
* processing.
*
*/
-#define NETLBL_CATMAP_MAPTYPE u64
+typedef u64 netlbl_catmap_map_t;
#define NETLBL_CATMAP_MAPCNT 4
-#define NETLBL_CATMAP_MAPSIZE (sizeof(NETLBL_CATMAP_MAPTYPE) * 8)
+#define NETLBL_CATMAP_MAPSIZE (sizeof(netlbl_catmap_map_t) * 8)
#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \
NETLBL_CATMAP_MAPCNT)
-#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01
+#define NETLBL_CATMAP_BIT ((netlbl_catmap_map_t)0x01)
struct netlbl_lsm_catmap {
u32 startbit;
- NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT];
+ netlbl_catmap_map_t bitmap[NETLBL_CATMAP_MAPCNT];
struct netlbl_lsm_catmap *next;
};
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 27511c90a26f..a8fa336be1cd 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -610,7 +610,7 @@ int netlbl_catmap_walk(struct netlbl_lsm_catmap *catmap, u32 offset)
struct netlbl_lsm_catmap *iter;
u32 idx;
u32 bit;
- NETLBL_CATMAP_MAPTYPE bitmap;
+ netlbl_catmap_map_t bitmap;
iter = _netlbl_catmap_getnode(&catmap, offset, _CM_F_WALK, 0);
if (iter == NULL)
@@ -666,8 +666,8 @@ int netlbl_catmap_walkrng(struct netlbl_lsm_catmap *catmap, u32 offset)
struct netlbl_lsm_catmap *prev = NULL;
u32 idx;
u32 bit;
- NETLBL_CATMAP_MAPTYPE bitmask;
- NETLBL_CATMAP_MAPTYPE bitmap;
+ netlbl_catmap_map_t bitmask;
+ netlbl_catmap_map_t bitmap;
iter = _netlbl_catmap_getnode(&catmap, offset, _CM_F_WALK, 0);
if (iter == NULL)
@@ -857,7 +857,7 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
offset -= iter->startbit;
idx = offset / NETLBL_CATMAP_MAPSIZE;
- iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap
+ iter->bitmap[idx] |= (netlbl_catmap_map_t)bitmap
<< (offset % NETLBL_CATMAP_MAPSIZE);
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] Modify macro NETLBL_CATMAP_MAPTYPE to define a type using typedef
2024-02-02 3:44 [PATCH 1/1] Modify macro NETLBL_CATMAP_MAPTYPE to define a type using typedef George Guo
@ 2024-02-02 15:31 ` Paul Moore
2024-02-02 19:12 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Paul Moore @ 2024-02-02 15:31 UTC (permalink / raw)
To: George Guo
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
George Guo, netdev, linux-security-module, linux-kernel
On Thu, Feb 1, 2024 at 10:45 PM George Guo <dongtai.guo@linux.dev> wrote:
>
> From: George Guo <guodongtai@kylinos.cn>
>
> Modify NETLBL_CATMAP_MAPTYPE to netlbl_catmap_map_t, which is more
> readable.
>
> Signed-off-by: George Guo <guodongtai@kylinos.cn>
> ---
> include/net/netlabel.h | 8 ++++----
> net/netlabel/netlabel_kapi.c | 8 ++++----
> 2 files changed, 8 insertions(+), 8 deletions(-)
I'm generally not in favor of minor rename patches like this unless
they are part of a larger effort (code churn with little benefit).
I'm not going to block it if the netdev folks want to merge this, but
I can't say I really support it either.
--
paul-moore.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] Modify macro NETLBL_CATMAP_MAPTYPE to define a type using typedef
2024-02-02 15:31 ` Paul Moore
@ 2024-02-02 19:12 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2024-02-02 19:12 UTC (permalink / raw)
To: Paul Moore
Cc: George Guo, David S. Miller, Eric Dumazet, Paolo Abeni,
George Guo, netdev, linux-security-module, linux-kernel
On Fri, 2 Feb 2024 10:31:37 -0500 Paul Moore wrote:
> > Modify NETLBL_CATMAP_MAPTYPE to netlbl_catmap_map_t, which is more
> > readable.
>
> I'm generally not in favor of minor rename patches like this unless
> they are part of a larger effort (code churn with little benefit).
> I'm not going to block it if the netdev folks want to merge this, but
> I can't say I really support it either.
FWIW the netdev (or should I say my?) policy is also "don't take it
unless explicitly acked by the area maintainer". Looking at the patch
I'm not sure why the typedef at all, not just use u64? So whatever,
I'm tossing this from pw. Not worth expending brain cycles over.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-02 19:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02 3:44 [PATCH 1/1] Modify macro NETLBL_CATMAP_MAPTYPE to define a type using typedef George Guo
2024-02-02 15:31 ` Paul Moore
2024-02-02 19:12 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).