Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp740012pxa; Thu, 27 Aug 2020 14:37:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzk9g5c0ia305/dylsAc036TvxKX3jO22AmWMWHqdaRc5OhKBUvFkb2sS2g0kS2eFXEpXba X-Received: by 2002:a05:6402:b1c:: with SMTP id bm28mr22014025edb.116.1598564276454; Thu, 27 Aug 2020 14:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598564276; cv=none; d=google.com; s=arc-20160816; b=Hv35spvqmt4RXsOij7gchvYTVlpRWl1XviZXoVKGIAhLg/vK9794OIXBK0+ES+Scve aPBb/kSoLaq30HmMUt5xUZSvt/ooCOutIHrU+PS0AR3uqJuBpTcEk6TS6rlW7qfIHq2Y nkLUS1Tz8Jss1LqmP4EOqenjYgerCGt7UOuyaKeMGq9VvTwfw27EU2mZYZNN3BFEBT19 sthjqceABEfvbRcKpoOkxsSggWGG3okV0ghSdjdSgBOyjm+asxxM3aTbnZdk1SDlKO5v 0WqZsublevlo0s/tWRy9vnR80rNGE/aaQFjWB0CxLm8Li/zuzmbBPEt2XNz95q/Sm93o /s9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=v/pNHi1xaujxAme9jwr3/Kn8deOWTiHYhMOluIe5fVU=; b=V3m4iZ86jjK0t+HmR5v2tkvgn4DMHQUVVrf/ZLk7NOzqfB8G5hl04Td6KTyIQM/IIw DovM7d01yxY8fuFHL26dF10Dqnc92nuydclVMg+fBa7UvfWihXh+Bb22COnROiAttMhq CaynCjbdI2l/+FaxTWsg1DbTVPzF5NY7awrrze8FFh3rqZKWXN1SwwDQmtdvHVDizJXc 4HL5N7tpsvnGf/okPyKZwklir5AIfPxjF46iGVUsf6Jsh5AWHqDoeSQ18/aYJK+CIIc9 to2cNvrciKsnsqcE7ecmWVNGrtU5S0iO+Sx1+gQuAy1VxkJqs9DdcDAD1ume+Uej+ZjR JBEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si2088846ejo.326.2020.08.27.14.37.33; Thu, 27 Aug 2020 14:37:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727864AbgH0Vgt (ORCPT + 99 others); Thu, 27 Aug 2020 17:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbgH0Vgq (ORCPT ); Thu, 27 Aug 2020 17:36:46 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CC01C061264 for ; Thu, 27 Aug 2020 14:36:46 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBPZU-005mIB-Ux; Thu, 27 Aug 2020 21:36:37 +0000 Date: Thu, 27 Aug 2020 22:36:36 +0100 From: Al Viro To: Linus Torvalds Cc: Kees Cook , James Bottomley , Allen Pais , Andrew Morton , Thomas Gleixner , Linux Kernel Mailing List , Greg Kroah-Hartman , Jens Axboe Subject: Re: [PATCH] linux/kernel.h: add container_from() Message-ID: <20200827213636.GF1236603@ZenIV.linux.org.uk> References: <20200827013636.149307-1-allen.lkml@gmail.com> <1598553133.4237.8.camel@HansenPartnership.com> <202008271150.7231B901@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 01:46:33PM -0700, Linus Torvalds wrote: > You really have to pick some pretty excessive type names (or variable > names) to get close to 80 characters. Again, to pick an example: > > struct timer_group_priv *priv = container_of(handle, > struct timer_group_priv, timer[handle->num]); > > ends up being long even if you were to split it, but that funky > container_from() wouldn't have helped the real problem - the fact that > the above is complex and nasty. > > And I had to _search_ for that example. All the normal cases of > split-line container-of's were due to doing it with the declaration, > or beause the first argument ended up being an expression in itself > and the nested expressions made it more complex. Speaking of searching, this kind of typeof use is, IMO, actively harmful - it makes finding the places where we might get from e.g. linked list to containing objects much harder. container_of (unless combined with obfuscating use of typeof()) at least gives you a chance to grep - struct foo *not* followed by '*' is a pattern that doesn't give too many false positives. This one, OTOH, is essentially impossible to grep for.