public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Liu, Changcheng" <changcheng.liu@intel.com>
Cc: jiangshanlai@gmail.com, tj@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: define struct workqueue_struct in C file
Date: Sat, 26 May 2018 01:30:26 +0100	[thread overview]
Message-ID: <20180526003026.GM30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180524151013.GA175207@sofia>

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.

      reply	other threads:[~2018-05-26  0:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 15:10 define struct workqueue_struct in C file Liu, Changcheng
2018-05-26  0:30 ` Al Viro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180526003026.GM30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=changcheng.liu@intel.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox