define struct workqueue_struct in C file
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
Quoted 4 lines · Changcheng
Hi all,
I have one confusion aboutworkqueue_struct:
1) Why structworkqueue_structis defined in C file instead of header file?
To prevent all other code poking in its guts?
Quoted 2 lines
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.