Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755145AbbKQW4F (ORCPT ); Tue, 17 Nov 2015 17:56:05 -0500 Received: from ares41.inai.de ([46.4.122.207]:35912 "EHLO ares41.inai.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755109AbbKQW4C (ORCPT ); Tue, 17 Nov 2015 17:56:02 -0500 Date: Tue, 17 Nov 2015 23:56:00 +0100 (CET) From: Jan Engelhardt To: Tejun Heo cc: davem@davemloft.net, pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu, lizefan@huawei.com, hannes@cmpxchg.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, daniel@iogearbox.net, daniel.wagner@bmw-carit.de, nhorman@tuxdriver.com Subject: Re: [PATCH 5/5] netfilter: implement xt_cgroup2 match In-Reply-To: <1447789240-29394-6-git-send-email-tj@kernel.org> Message-ID: References: <1447789240-29394-1-git-send-email-tj@kernel.org> <1447789240-29394-6-git-send-email-tj@kernel.org> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1101 Lines: 39 On Tuesday 2015-11-17 20:40, Tejun Heo wrote: >@@ -0,0 +1,14 @@ >+#ifndef _XT_CGROUP2_H >+#define _XT_CGROUP2_H >+ >+#include >+ >+struct xt_cgroup2_info { >+ char path[PATH_MAX]; >+ __u8 invert; Should be included? (For PATH_MAX) >+ /* kernel internal data */ >+ void *priv; >+}; void *priv __attribute__((aligned(8))); >+static bool cgroup2_mt(const struct sk_buff *skb, struct xt_action_param *par) >+{ >+ const struct xt_cgroup2_info *info = par->matchinfo; >+ struct cgroup *ancestor = info->priv; There is no modification planned on the cgroup, so this too can be const struct cgroup * if-and-when cgroup_is_descendant is made to take const ptrs as well. >+ if (!skb->sk || !sk_fullsock(skb->sk)) >+ return false; >+ >+ return cgroup_is_descendant(skb->sk->sk_cgroup, ancestor) ^ info->invert; >+} -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/