From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934315AbdKBRyg (ORCPT ); Thu, 2 Nov 2017 13:54:36 -0400 Received: from smtprelay0192.hostedemail.com ([216.40.44.192]:42345 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933423AbdKBRyR (ORCPT ); Thu, 2 Nov 2017 13:54:17 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2693:2828:2894:2901:3138:3139:3140:3141:3142:3354:3622:3865:3867:3868:3870:3871:4321:5007:6691:7903:10004:10400:10848:11026:11232:11473:11658:11914:12043:12296:12679:12740:12760:12895:13069:13255:13311:13357:13439:14659:14721:21080:21433:21451:21611:21627:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: goat14_25013042b861d X-Filterd-Recvd-Size: 2882 Message-ID: <1509645252.31043.91.camel@perches.com> Subject: Re: [PATCH v3 net-next 1/5] device_cgroup: add DEVCG_ prefix to ACC_* and DEV_* constants From: Joe Perches To: Roman Gushchin , netdev@vger.kernel.org Cc: Tejun Heo , Alexei Starovoitov , Daniel Borkmann , linux-kernel@vger.kernel.org, kernel-team@fb.com, "David S . Miller" Date: Thu, 02 Nov 2017 10:54:12 -0700 In-Reply-To: <20171102171530.7627-2-guro@fb.com> References: <20171102171530.7627-1-guro@fb.com> <20171102171530.7627-2-guro@fb.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-11-02 at 13:15 -0400, Roman Gushchin wrote: > Rename device type and access type constants defined in > security/device_cgroup.c by adding the DEVCG_ prefix. > > The reason behind this renaming is to make them global namespace > friendly, as they will be moved to the corresponding header file > by following patches. [] > diff --git a/security/device_cgroup.c b/security/device_cgroup.c [] > @@ -14,14 +14,14 @@ > #include > #include > > -#define ACC_MKNOD 1 > -#define ACC_READ 2 > -#define ACC_WRITE 4 > -#define ACC_MASK (ACC_MKNOD | ACC_READ | ACC_WRITE) > +#define DEVCG_ACC_MKNOD 1 > +#define DEVCG_ACC_READ 2 > +#define DEVCG_ACC_WRITE 4 > +#define DEVCG_ACC_MASK (DEVCG_ACC_MKNOD | DEVCG_ACC_READ | DEVCG_ACC_WRITE) trivia: major and minor are u32 but all the type and access uses seem to be "short" Perhaps u16 (or __u16 if uapi public) instead? > -#define DEV_BLOCK 1 > -#define DEV_CHAR 2 > -#define DEV_ALL 4 /* this represents all devices */ > +#define DEVCG_DEV_BLOCK 1 > +#define DEVCG_DEV_CHAR 2 > +#define DEVCG_DEV_ALL 4 /* this represents all devices */ > > static DEFINE_MUTEX(devcgroup_mutex); > > @@ -245,21 +245,21 @@ static void set_access(char *acc, short access) > { > int idx = 0; > memset(acc, 0, ACCLEN); > - if (access & ACC_READ) > + if (access & DEVCG_ACC_READ) > acc[idx++] = 'r'; > - if (access & ACC_WRITE) > + if (access & DEVCG_ACC_WRITE) > acc[idx++] = 'w'; > - if (access & ACC_MKNOD) > + if (access & DEVCG_ACC_MKNOD) > acc[idx++] = 'm'; > } > > static char type_to_char(short type) > { > - if (type == DEV_ALL) > + if (type == DEVCG_DEV_ALL) > return 'a'; > - if (type == DEV_CHAR) > + if (type == DEVCG_DEV_CHAR) > return 'c'; > - if (type == DEV_BLOCK) > + if (type == DEVCG_DEV_BLOCK) > return 'b'; > return 'X'; > }