When splitting out various functionality from libxc into tools/libs/*
I attempted to make it possible to avoid callers being unnecessarily
exposed to the xentoollog interface by providing a typedef of the
xentoollog_logger handle in each of the headers.
However such typedefs are not allowed in C, instead it is necessary to
forward declare the struct and then use the struct xentoollog_logger
variant in the prototypes.
It appears that older gcc (e.g. 4.4) complains about this issue while
newer ones (e.g. 4.9) are more tolerant unless -pedantic-errors is
used, this was a deliberate change
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=
ce3765bf44e49ef0568a1ad4a0b7f807591d6412
As well as tools/libs/* it is also now necessary to give libvchan the
same treatment, since it previously inhereted the typedef via one of
tools/libs/*.
Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
#include <stddef.h>
/* Callers who don't care don't need to #include <xentoollog.h> */
-typedef struct xentoollog_logger xentoollog_logger;
+struct xentoollog_logger;
typedef struct xencall_handle xencall_handle;
* Calling xencall_close() is the only safe operation on a
* xencall_handle which has been inherited.
*/
-xencall_handle *xencall_open(xentoollog_logger *logger, unsigned open_flags);
+xencall_handle *xencall_open(struct xentoollog_logger *logger,
+ unsigned open_flags);
/*
* Close a handle previously allocated with xencall_open().
typedef struct xenevtchn_handle xenevtchn_handle;
/* Callers who don't care don't need to #include <xentoollog.h> */
-typedef struct xentoollog_logger xentoollog_logger;
+struct xentoollog_logger;
/*
* EVENT CHANNEL FUNCTIONS
* xenevtchn_handle which has been inherited.
*/
/* Currently no flags are defined */
-xenevtchn_handle *xenevtchn_open(xentoollog_logger *logger, unsigned open_flags);
+xenevtchn_handle *xenevtchn_open(struct xentoollog_logger *logger,
+ unsigned open_flags);
/*
* Close a handle previously allocated with xenevtchn_open().
#include <xen/xen.h>
/* Callers who don't care don't need to #include <xentoollog.h> */
-typedef struct xentoollog_logger xentoollog_logger;
+struct xentoollog_logger;
typedef struct xenforeignmemory_handle xenforeignmemory_handle;
* Calling xenforeignmemory_close() is the only safe operation on a
* xenforeignmemory_handle which has been inherited.
*/
-xenforeignmemory_handle *xenforeignmemory_open(xentoollog_logger *logger,
+xenforeignmemory_handle *xenforeignmemory_open(struct xentoollog_logger *logger,
unsigned open_flags);
/*
#include <xen/event_channel.h>
/* Callers who don't care don't need to #include <xentoollog.h> */
-typedef struct xentoollog_logger xentoollog_logger;
+struct xentoollog_logger;
/*
* PRODUCING AND CONSUMING GRANT REFERENCES
* xengnttab_handle which has been inherited. xengnttab_unmap() must
* not be called under such circumstances.
*/
-xengnttab_handle *xengnttab_open(xentoollog_logger *logger, unsigned open_flags);
+xengnttab_handle *xengnttab_open(struct xentoollog_logger *logger,
+ unsigned open_flags);
/*
* Close a handle previously allocated with xengnttab_open(),
* Calling xengntshr_close() is the only safe operation on a
* xengntshr_handle which has been inherited.
*/
-xengntshr_handle *xengntshr_open(xentoollog_logger *logger,
+xengntshr_handle *xengntshr_open(struct xentoollog_logger *logger,
unsigned open_flags);
/*
goto out;
}
-static int init_evt_srv(struct libxenvchan *ctrl, int domain, xentoollog_logger *logger)
+static int init_evt_srv(struct libxenvchan *ctrl, int domain,
+ struct xentoollog_logger *logger)
{
evtchn_port_or_error_t port;
return rv;
}
-struct libxenvchan *libxenvchan_server_init(xentoollog_logger *logger, int domain, const char* xs_path, size_t left_min, size_t right_min)
+struct libxenvchan *libxenvchan_server_init(struct xentoollog_logger *logger,
+ int domain, const char* xs_path,
+ size_t left_min, size_t right_min)
{
struct libxenvchan *ctrl;
int ring_ref;
return 0;
}
-static int init_evt_cli(struct libxenvchan *ctrl, int domain, xentoollog_logger *logger)
+static int init_evt_cli(struct libxenvchan *ctrl, int domain,
+ struct xentoollog_logger *logger)
{
evtchn_port_or_error_t port;
}
-struct libxenvchan *libxenvchan_client_init(xentoollog_logger *logger, int domain, const char* xs_path)
+struct libxenvchan *libxenvchan_client_init(struct xentoollog_logger *logger,
+ int domain, const char* xs_path)
{
struct libxenvchan *ctrl = malloc(sizeof(struct libxenvchan));
struct xs_handle *xs = NULL;
#include <xenevtchn.h>
#include <xengnttab.h>
+/* Callers who don't care don't need to #include <xentoollog.h> */
+struct xentoollog_logger;
+
struct libxenvchan_ring {
/* Pointer into the shared page. Offsets into buffer. */
struct ring_shared* shr;
* @param recv_min The minimum size (in bytes) of the receive ring (right)
* @return The structure, or NULL in case of an error
*/
-struct libxenvchan *libxenvchan_server_init(xentoollog_logger *logger, int domain, const char* xs_path, size_t read_min, size_t write_min);
+struct libxenvchan *libxenvchan_server_init(struct xentoollog_logger *logger,
+ int domain, const char* xs_path,
+ size_t read_min, size_t write_min);
/**
* Connect to an existing vchan. Note: you can reconnect to an existing vchan
* safely, however no locking is performed, so you must prevent multiple clients
* @param xs_path Base xenstore path for storing ring/event data
* @return The structure, or NULL in case of an error
*/
-struct libxenvchan *libxenvchan_client_init(xentoollog_logger *logger, int domain, const char* xs_path);
+struct libxenvchan *libxenvchan_client_init(struct xentoollog_logger *logger,
+ int domain, const char* xs_path);
/**
* Close a vchan. This deallocates the vchan and attempts to free its
* resources. The other side is notified of the close, but can still read any