From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH v2 net-next] net: filter: export pkt_type_offset() helper Date: Wed, 03 Sep 2014 19:05:48 -0700 Message-ID: <1409796348.26422.76.camel@edumazet-glaptop2.roam.corp.google.com> References: <1409778511-21273-1-git-send-email-kda@linux-powerpc.org> <54078FBC.5050402@redhat.com> <1409792893.26422.60.camel@edumazet-glaptop2.roam.corp.google.com> <1409793959.3362714.163402573.6A26EDE1@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Alexei Starovoitov , Daniel Borkmann , Eric Dumazet , Denis Kirjanov , netdev@vger.kernel.org, Markos Chandras , Martin Schwidefsky To: Hannes Frederic Sowa Return-path: Received: from mail-pa0-f49.google.com ([209.85.220.49]:64296 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756161AbaIDCFu (ORCPT ); Wed, 3 Sep 2014 22:05:50 -0400 Received: by mail-pa0-f49.google.com with SMTP id kq14so18516474pab.8 for ; Wed, 03 Sep 2014 19:05:49 -0700 (PDT) In-Reply-To: <1409793959.3362714.163402573.6A26EDE1@webmail.messagingengine.com> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, 2014-09-04 at 03:25 +0200, Hannes Frederic Sowa wrote: > Can't we add an address marker to struct sk_buff? > > Several possibilities are available: > > ptrdiff_t pkt_type_offset[0] before the pkt_type flags field > > If one wants to make it more expressive: > typedef struct {} mark_struct_offset; > and add > mark_struct_offset pkt_type_offset; > at appropriate places > > Or maybe an anonymous union? > > pkt_type_offset would become a simple offsetof(struct sk_buff, > pkt_type_offset) then and there is no need for BUG_ON then. You can try, and make sure this works on all gcc compilers, even the one Andrew Morton uses. And of course, you need to not introduce holes doing so.