netlabel: cleanup struct netlbl_lsm_catmap
Simplify the code from macro NETLBL_CATMAP_MAPTYPE to u64, and fix warning "Macros with complex values should be enclosed in parentheses" on "#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01", which is modified to "#define NETLBL_CATMAP_BIT ((u64)0x01)". Signed-off-by: George Guo <guodongtai@kylinos.cn> Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: David S. Miller <davem@davemloft.net>pull/981/head
parent
9bc791341b
commit
23c5ae6d46
|
|
@ -145,15 +145,14 @@ struct netlbl_lsm_cache {
|
||||||
* processing.
|
* processing.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define NETLBL_CATMAP_MAPTYPE u64
|
|
||||||
#define NETLBL_CATMAP_MAPCNT 4
|
#define NETLBL_CATMAP_MAPCNT 4
|
||||||
#define NETLBL_CATMAP_MAPSIZE (sizeof(NETLBL_CATMAP_MAPTYPE) * 8)
|
#define NETLBL_CATMAP_MAPSIZE (sizeof(u64) * 8)
|
||||||
#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \
|
#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \
|
||||||
NETLBL_CATMAP_MAPCNT)
|
NETLBL_CATMAP_MAPCNT)
|
||||||
#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01
|
#define NETLBL_CATMAP_BIT ((u64)0x01)
|
||||||
struct netlbl_lsm_catmap {
|
struct netlbl_lsm_catmap {
|
||||||
u32 startbit;
|
u32 startbit;
|
||||||
NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT];
|
u64 bitmap[NETLBL_CATMAP_MAPCNT];
|
||||||
struct netlbl_lsm_catmap *next;
|
struct netlbl_lsm_catmap *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -610,7 +610,7 @@ int netlbl_catmap_walk(struct netlbl_lsm_catmap *catmap, u32 offset)
|
||||||
struct netlbl_lsm_catmap *iter;
|
struct netlbl_lsm_catmap *iter;
|
||||||
u32 idx;
|
u32 idx;
|
||||||
u32 bit;
|
u32 bit;
|
||||||
NETLBL_CATMAP_MAPTYPE bitmap;
|
u64 bitmap;
|
||||||
|
|
||||||
iter = _netlbl_catmap_getnode(&catmap, offset, _CM_F_WALK, 0);
|
iter = _netlbl_catmap_getnode(&catmap, offset, _CM_F_WALK, 0);
|
||||||
if (iter == NULL)
|
if (iter == NULL)
|
||||||
|
|
@ -666,8 +666,8 @@ int netlbl_catmap_walkrng(struct netlbl_lsm_catmap *catmap, u32 offset)
|
||||||
struct netlbl_lsm_catmap *prev = NULL;
|
struct netlbl_lsm_catmap *prev = NULL;
|
||||||
u32 idx;
|
u32 idx;
|
||||||
u32 bit;
|
u32 bit;
|
||||||
NETLBL_CATMAP_MAPTYPE bitmask;
|
u64 bitmask;
|
||||||
NETLBL_CATMAP_MAPTYPE bitmap;
|
u64 bitmap;
|
||||||
|
|
||||||
iter = _netlbl_catmap_getnode(&catmap, offset, _CM_F_WALK, 0);
|
iter = _netlbl_catmap_getnode(&catmap, offset, _CM_F_WALK, 0);
|
||||||
if (iter == NULL)
|
if (iter == NULL)
|
||||||
|
|
@ -857,7 +857,7 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
|
||||||
|
|
||||||
offset -= iter->startbit;
|
offset -= iter->startbit;
|
||||||
idx = offset / NETLBL_CATMAP_MAPSIZE;
|
idx = offset / NETLBL_CATMAP_MAPSIZE;
|
||||||
iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap
|
iter->bitmap[idx] |= (u64)bitmap
|
||||||
<< (offset % NETLBL_CATMAP_MAPSIZE);
|
<< (offset % NETLBL_CATMAP_MAPSIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue