From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754543AbbCIO6w (ORCPT ); Mon, 9 Mar 2015 10:58:52 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:36821 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738AbbCIO6u (ORCPT ); Mon, 9 Mar 2015 10:58:50 -0400 Date: Mon, 9 Mar 2015 15:58:44 +0100 From: Ingo Molnar To: Denys Vlasenko Cc: Andy Lutomirski , Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] move offsetofend() from vfio.h to stddef.h Message-ID: <20150309145844.GA19511@gmail.com> References: <1425912738-559-1-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1425912738-559-1-git-send-email-dvlasenk@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Denys Vlasenko wrote: > Suggested by Linus. > > Signed-off-by: Denys Vlasenko > CC: Linus Torvalds > CC: Steven Rostedt > CC: Ingo Molnar > CC: Borislav Petkov > CC: "H. Peter Anvin" > CC: Andy Lutomirski > CC: Oleg Nesterov > CC: Frederic Weisbecker > CC: Alexei Starovoitov > CC: Will Drewry > CC: Kees Cook > CC: x86@kernel.org > CC: linux-kernel@vger.kernel.org > --- > include/linux/stddef.h | 9 +++++++++ > include/linux/vfio.h | 13 ------------- > 2 files changed, 9 insertions(+), 13 deletions(-) > > diff --git a/include/linux/stddef.h b/include/linux/stddef.h > index f4aec0e..076af43 100644 > --- a/include/linux/stddef.h > +++ b/include/linux/stddef.h > @@ -19,3 +19,12 @@ enum { > #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) > #endif > #endif > + > +/** > + * offsetofend(TYPE, MEMBER) > + * > + * @TYPE: The type of the structure > + * @MEMBER: The member within the structure to get the end offset of > + */ > +#define offsetofend(TYPE, MEMBER) \ > + (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER)) > diff --git a/include/linux/vfio.h b/include/linux/vfio.h > index 2d67b89..049b2f4 100644 > --- a/include/linux/vfio.h > +++ b/include/linux/vfio.h > @@ -78,19 +78,6 @@ extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops); > extern void vfio_unregister_iommu_driver( > const struct vfio_iommu_driver_ops *ops); > > -/** > - * offsetofend(TYPE, MEMBER) > - * > - * @TYPE: The type of the structure > - * @MEMBER: The member within the structure to get the end offset of > - * > - * Simple helper macro for dealing with variable sized structures passed > - * from user space. This allows us to easily determine if the provided > - * structure is sized to include various fields. > - */ > -#define offsetofend(TYPE, MEMBER) \ > - (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER)) So I like it, and because it is not particularly trivial when to use this primitive it was explained nicely in a description in the vfio.h version. But you lost that nice description during the code move!! Please don't. Thanks, Ingo