From patchwork Fri Feb 2 03:44:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 195552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp189740dyc; Thu, 1 Feb 2024 19:45:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPVUjW9Ji6bK2E1nJ5zgw4RO+gKzOiWgnEcl1IwkTB0qSTJ+xqX4iRAy1G3NT7fnkHAGu0 X-Received: by 2002:a25:ef46:0:b0:dc6:cd98:406d with SMTP id w6-20020a25ef46000000b00dc6cd98406dmr990604ybm.49.1706845544855; Thu, 01 Feb 2024 19:45:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706845544; cv=pass; d=google.com; s=arc-20160816; b=Dz1TjugzezNBL7B/UZzeAG5sv/XBUs1vjV2pWlwY5EDXCciOgC/EwKkTMr3TYAIoN0 Pa43IG/pYLXgcEFkr/uwFWHJlnghwrArXkGk88MMEezcoBqZs2qXxztINmrmwba76x9o xYuwecVMm7tZ8cXbV2BfsI7nYVf02qftVjN6uyg0P2Bd1gqlfoXeOp/yTGe87lpEQLLk jhM6i0POZ+06tZyq7KHEE3GH9XGt0jdo/d8RPQ6GVFi5fanWfL5kaZCsNGCPgNvBOWHc UsYfOq/s/VK9B3eofqGJgbhD46iSfLiU/56+zHmnoZeo4EfctDzs2n/yTPgDTv+IS4qT q9PA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=FhDGektx+3oTkSzeRUpmjCM+yvBN/m1UWuemA9fuCj0=; fh=xOdIjzGjJss9sER6Vk1t2Cykg0weNBD/XGotGlE0jis=; b=W8AVJd3j8437SkVPHnAC+ls4d+geqTMbZFb2yXEYBfR5B3q8rcLaqqSXiwZmeAwaF7 8yOpOnw9EWm8LpgbPvt8pVfLoOwNTlqAMf8GuRV15P9rpOO7pje6ERawnnDmx9Qz9xwU oDLDWPu0IL8VgXY+MYrSKY3VZaSOJu8EC+jOcKUR1sIUbxQXpzjKb/5vy1V+Kw060Oet LXwdGCh/geQUclIRzzt4nOL9TKUUDMN19HOvd1dmOWQg//Eyesq1kzJMh5Rcg+sFh4dt 8xNm9WCEtBXARQosQthdRK9tKqiDcPkAXPsTrPClVMyvhpvRUlmnfHlDyHMPKq9A35Tt i74w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wkJwZkbb; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-49154-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49154-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCVhfK05IYQ3yWsey/Fr8yVyI7BMZvG36Dp0QiLR/uyW3qh7ws0REYEO0/JRreLgstkWGrJq6ukuKonpsRszLhwdfXh0ww== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u74-20020a63794d000000b005cdfa589cfbsi885262pgc.148.2024.02.01.19.45.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 19:45:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49154-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wkJwZkbb; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-49154-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49154-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 97A7028D6A8 for ; Fri, 2 Feb 2024 03:45:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AB4FF4F0; Fri, 2 Feb 2024 03:45:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wkJwZkbb" Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 577E6DF6A for ; Fri, 2 Feb 2024 03:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706845522; cv=none; b=nA5QvPXEfjct1TC+nIF0u56MbDIimC0mefwEgTxLHbwZEhKTArQnS2fIH7jTcq19MkQ9wTazw/QWh7BolVU/22F+sNGZW2kCHWXU9nMB/emShTGilUCSo2ZSNie8XfZT2a8oJj8zk6isD6RsEiNN4sAJ0sKVyDzZvMtRNzbPATY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706845522; c=relaxed/simple; bh=+sLC3/sMdldqreq8t261If0XmChHH3bybwx3J4jsT04=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Yt2xy6scKD6bPnbVdIJlfzVTfzI6dvm/S1ap9e1rruFMIs2FGs1MpAAF9w9ln5t/rjMF81ajxR6hyQaVO5yMEiqtmjopE+2klQZHRjU29B5ijODIIdB7BcjXEsm2MZGNuXH2/0Y939lZzUQxESLNjt2op9hLU/VGko+nMySq+lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=wkJwZkbb; arc=none smtp.client-ip=91.218.175.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1706845516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=FhDGektx+3oTkSzeRUpmjCM+yvBN/m1UWuemA9fuCj0=; b=wkJwZkbb8FTbQTYUmMCc+6wPEba6MbtYyoGnztwdtyD8u/BcuMHY2UAmU4/DrWiR/yr6Ik SJLMf1jvr6mRpoFs2k8hZtGv2LX/KGDpgHacW78RxbLQRk1H2juR0LGq5v83zJAEyQrS/M 6LiXrWwld7xmuiMo19amcNbhO01whQo= From: George Guo To: Paul Moore , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: George Guo , netdev@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] Modify macro NETLBL_CATMAP_MAPTYPE to define a type using typedef Date: Fri, 2 Feb 2024 11:44:48 +0800 Message-Id: <20240202034448.717589-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789757273683331036 X-GMAIL-MSGID: 1789757273683331036 From: George Guo Modify NETLBL_CATMAP_MAPTYPE to netlbl_catmap_map_t, which is more readable. Signed-off-by: George Guo --- 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;