|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH XEN v8 02/29] tools: Refactor /dev/xen/evtchn wrappers into libxenevtchn.
Ian Campbell writes ("Re: [Xen-devel] [PATCH XEN v8 02/29] tools: Refactor
/dev/xen/evtchn wrappers into libxenevtchn."):
> Various of the tools/libs/*/include/*.h have a
>
> /* Callers who don't care don't need to #include <xentoollog.h> */
> typedef struct xentoollog_logger xentoollog_logger;
>
> but since that typedef matches in all cases I think it is allowed to be
> repeated like this, isn't it?
No, I'm afraid not. It is permitted to repeatedly mention `struct
xentoollog_logger', but the typedef must only occur once in any
translation unit.
If it is desirable to let callers avoid including xentoollog.h, then
all those headers need to say:
struct xentoollog_logger;
int some_function(..., struct xentoollog_logger *lg, ...);
So in your patches something like:
struct xentoollog_logger;
xenevtchn_handle *xenevtchn_open(struct xentoollog_logger *logger,
unsigned open_flags);
The separate `struct xentoollog_logger;' is needed because otherwise
the `struct xentoollog_logger *logger' in the formal parameters of
xenevtchn_open is a declaration, rather than a reference to a
previously-declared thing, and if it is a declaration its scope is
only the contained function prototype, so other mentions of `struct
xentoollog_logger' are treated as references to a different type.
This is, of course, insane.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |