linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Roman Gushchin <guro@fb.com>, netdev@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	linux-kernel@vger.kernel.org, kernel-team@fb.com,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v3 net-next 1/5] device_cgroup: add DEVCG_ prefix to ACC_* and DEV_* constants
Date: Thu, 02 Nov 2017 10:54:12 -0700	[thread overview]
Message-ID: <1509645252.31043.91.camel@perches.com> (raw)
In-Reply-To: <20171102171530.7627-2-guro@fb.com>

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 <linux/rcupdate.h>
>  #include <linux/mutex.h>
>  
> -#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';
>  }

  reply	other threads:[~2017-11-02 17:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 17:15 [PATCH v3 net-next 0/5] eBPF-based device cgroup controller Roman Gushchin
2017-11-02 17:15 ` [PATCH v3 net-next 1/5] device_cgroup: add DEVCG_ prefix to ACC_* and DEV_* constants Roman Gushchin
2017-11-02 17:54   ` Joe Perches [this message]
2017-11-02 20:06     ` Roman Gushchin
2017-11-02 17:15 ` [PATCH v3 net-next 2/5] device_cgroup: prepare code for bpf-based device controller Roman Gushchin
2017-11-02 17:15 ` [PATCH v3 net-next 3/5] bpf, cgroup: implement eBPF-based device controller for cgroup v2 Roman Gushchin
2017-11-02 17:15 ` [PATCH v3 net-next 4/5] bpf: move cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/ Roman Gushchin
2017-11-02 17:15 ` [PATCH v3 net-next 5/5] selftests/bpf: add a test for device cgroup controller Roman Gushchin
2017-11-04 13:40 ` [PATCH v3 net-next 0/5] eBPF-based " David Miller
2017-11-05 13:15   ` Roman Gushchin
2017-11-05 13:15     ` [PATCH v3 net-next 1/5] device_cgroup: add DEVCG_ prefix to ACC_* and DEV_* constants Roman Gushchin
2017-11-05 13:15     ` [PATCH v3 net-next 2/5] device_cgroup: prepare code for bpf-based device controller Roman Gushchin
2017-11-05 13:15     ` [PATCH v3 net-next 3/5] bpf, cgroup: implement eBPF-based device controller for cgroup v2 Roman Gushchin
2017-11-05 13:15     ` [PATCH v3 net-next 4/5] bpf: move cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/ Roman Gushchin
2017-11-05 13:15     ` [PATCH v3 net-next 5/5] selftests/bpf: add a test for device cgroup controller Roman Gushchin
2017-11-05 14:27     ` [PATCH v3 net-next 0/5] eBPF-based " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509645252.31043.91.camel@perches.com \
    --to=joe@perches.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=guro@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).