diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2013-10-22 15:55:03 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2014-01-20 12:15:42 +0100 |
commit | 1f7123298fbebce4134e12b33d35fe62621f631b (patch) | |
tree | 96f53f030fa4363177e7a7e1b73a1fd6beedf881 | |
parent | 7ff743c43141739286aabcf08f3aa37e8e333a49 (diff) |
Add RedsStream::priv
The private data is allocated at the same time as RedsStream and
goes immediatly after the main RedsStream data.
This private member will allow to hide internal RedsStream
implementation details from the rest of spice-server.
-rw-r--r-- | server/reds_stream.c | 6 | ||||
-rw-r--r-- | server/reds_stream.h | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/server/reds_stream.c b/server/reds_stream.c index 2703ec75..e94995ce 100644 --- a/server/reds_stream.c +++ b/server/reds_stream.c @@ -33,6 +33,9 @@ extern SpiceCoreInterface *core; +struct RedsStreamPrivate { +}; + static ssize_t stream_write_cb(RedsStream *s, const void *buf, size_t size) { return write(s->socket, buf, size); @@ -238,7 +241,8 @@ RedsStream *reds_stream_new(int socket) { RedsStream *stream; - stream = spice_new0(RedsStream, 1); + stream = spice_malloc0(sizeof(RedsStream) + sizeof(RedsStreamPrivate)); + stream->priv = (RedsStreamPrivate *)(((char *)stream) + sizeof(RedsStream)); stream->info = spice_new0(SpiceChannelEventInfo, 1); reds_stream_set_socket(stream, socket); diff --git a/server/reds_stream.h b/server/reds_stream.h index cae244b2..4927336d 100644 --- a/server/reds_stream.h +++ b/server/reds_stream.h @@ -74,6 +74,8 @@ void async_read_set_error_handler(AsyncRead *async, AsyncReadError error_handler, void *opaque); +typedef struct RedsStreamPrivate RedsStreamPrivate; + struct RedsStream { int socket; SpiceWatch *watch; @@ -99,6 +101,8 @@ struct RedsStream { ssize_t (*read)(RedsStream *s, void *buf, size_t nbyte); ssize_t (*write)(RedsStream *s, const void *buf, size_t nbyte); ssize_t (*writev)(RedsStream *s, const struct iovec *iov, int iovcnt); + + RedsStreamPrivate *priv; }; typedef enum { |