All of lore.kernel.org
 help / color / mirror / Atom feed
* define struct workqueue_struct in C file
@ 2018-05-24 15:10 Liu, Changcheng
  2018-05-26  0:30 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Liu, Changcheng @ 2018-05-24 15:10 UTC (permalink / raw)
  To: jiangshanlai, tj; +Cc: linux-kernel

Hi all,
	I have one confusion about workqueue_struct:
	1) Why struct workqueue_struct is defined in C file instead of
	header file?
	   I'm trying to print "workqueue_struct:name" field in one external
	   build module. "workqueue_struct:name" can't be accessed directly.

	2) struct work_struct is defined in "workqueue.h", could struct
	workqueue_struct also be defined in it?

--Thanks
Changcheng

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: define struct workqueue_struct in C file
  2018-05-24 15:10 define struct workqueue_struct in C file Liu, Changcheng
@ 2018-05-26  0:30 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2018-05-26  0:30 UTC (permalink / raw)
  To: Liu, Changcheng; +Cc: jiangshanlai, tj, linux-kernel

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-26  0:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 15:10 define struct workqueue_struct in C file Liu, Changcheng
2018-05-26  0:30 ` Al Viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.