Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp113341imm; Fri, 25 May 2018 17:31:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr7LaWxvEaTLBwNS7D4kfaOB2aIiEb2uiLfc4TGPpgtjhKets/sUJN9xBn/6OZ/U33iT4DA X-Received: by 2002:a63:7211:: with SMTP id n17-v6mr3419594pgc.94.1527294669969; Fri, 25 May 2018 17:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527294669; cv=none; d=google.com; s=arc-20160816; b=wy2+HXc+SWctqADJtSSsvJOF8wk/HuNRx5AwicS+Q7LE47eT36gxp6tNBq0nnhol9u InirWCH9Lxw7n++xyopVZph0ziJ9QQlyujVYqp5yV+sHNV/v92fPFiopDUJhdoELiWd0 F2YuSztwQh4TD69x4wlpbUGAG/FjboS8cdC6YX3YiglZPWbwwRToR6LFaMTP0Xciu1BU jlpxmN1VWJvFe6o7UA4g907E9QURDgunjdFwhOvducvcmw4KkrJnBW1WJ5pHkP8E+tm/ Mvnt5lhorDqs/yzm7mpBd/tngbzwNbWmEadGjyfuy906RaxZ6UtXgaiObfjNOGC2qxsb yXkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=MQXTMYfXIbr94v9s6lFzBErGjPMshSGNqHzq5YMxpOo=; b=yPRCDdh2mhAa9Dq/ZVEx1s0+1+KzBHkyPA1PQHvVMRvE9jlUtgubZ5yTVsArDNRFNd 0rgL8t8dlypvRcS0Q0aTICR54V92Fi6OTzE7/Ljt4WqVLhnD5ZSy4Fq4ZUlxOmMoFUD/ fZU/Cj2BX22WsPsHdqngLX0E2YyUW6k9IiV2kZhkYLngoysop1LnrmrVyOE7DAQT4jJH Xac2w0I4ZJJJtNWP6WnmHIC0ymV1Xw0I1f6tb68jL5Rf++G2gXGWuC86mo5LL1fuaH9N 1/SZAXZV9Sb8i3CEZmn+zcp/pNRY+EGpyuyN5eSHImEHITwuljyEvQHKxfiiTaQMu/Rw o7rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si19686879pgs.396.2018.05.25.17.30.55; Fri, 25 May 2018 17:31:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030984AbeEZAan (ORCPT + 99 others); Fri, 25 May 2018 20:30:43 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:43752 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030839AbeEZAam (ORCPT ); Fri, 25 May 2018 20:30:42 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fMN6I-0003Gm-4H; Sat, 26 May 2018 00:30:26 +0000 Date: Sat, 26 May 2018 01:30:26 +0100 From: Al Viro To: "Liu, Changcheng" Cc: jiangshanlai@gmail.com, tj@kernel.org, linux-kernel@vger.kernel.org Subject: Re: define struct workqueue_struct in C file Message-ID: <20180526003026.GM30522@ZenIV.linux.org.uk> References: <20180524151013.GA175207@sofia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180524151013.GA175207@sofia> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 24, 2018 at 11:10:14PM +0800, Liu, Changcheng wrote: > Hi all, > I have one confusion about workqueue_struct: > 1) Why struct workqueue_struct is defined in C file instead of > header file? To prevent all other code poking in its guts? > I'm trying to print "workqueue_struct:name" field in one external > build module. "workqueue_struct:name" can't be accessed directly. ... thus allowing implementation details be changed at later point without worrying about breaking other code. There are objects that are accessible via opaque pointers, with the set of (widely used) primitives being the only code that has access to actual structure layout. Some are in a local header (outside of include search path, and very much *NOT* supposed to be included outside of a few C files implementing the public interfaces), some are outright local in C file.