[RFC wayland v2 1/2] connection: Move definitions

Boyan Ding stu_dby at 126.com
Wed Jul 23 01:21:20 PDT 2014


wayland-tracer will use them.

Signed-off-by: Boyan Ding <stu_dby at 126.com>
---
 src/connection.c      | 18 +++---------------
 src/wayland-private.h | 18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index f292853..79197c9 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -44,23 +44,11 @@
 
 #define DIV_ROUNDUP(n, a) ( ((n) + ((a) - 1)) / (a) )
 
-struct wl_buffer {
-	char data[4096];
-	uint32_t head, tail;
-};
-
 #define MASK(i) ((i) & 4095)
 
 #define MAX_FDS_OUT	28
 #define CLEN		(CMSG_LEN(MAX_FDS_OUT * sizeof(int32_t)))
 
-struct wl_connection {
-	struct wl_buffer in, out;
-	struct wl_buffer fds_in, fds_out;
-	int fd;
-	int want_flush;
-};
-
 static int
 wl_buffer_put(struct wl_buffer *b, const void *data, size_t count)
 {
@@ -135,7 +123,7 @@ wl_buffer_get_iov(struct wl_buffer *b, struct iovec *iov, int *count)
 	}
 }
 
-static void
+void
 wl_buffer_copy(struct wl_buffer *b, void *data, size_t count)
 {
 	uint32_t tail, size;
@@ -150,7 +138,7 @@ wl_buffer_copy(struct wl_buffer *b, void *data, size_t count)
 	}
 }
 
-static uint32_t
+uint32_t
 wl_buffer_size(struct wl_buffer *b)
 {
 	return b->head - b->tail;
@@ -394,7 +382,7 @@ wl_message_count_arrays(const struct wl_message *message)
 	return arrays;
 }
 
-static int
+int
 wl_connection_put_fd(struct wl_connection *connection, int32_t fd)
 {
 	if (wl_buffer_size(&connection->fds_out) == MAX_FDS_OUT * sizeof fd) {
diff --git a/src/wayland-private.h b/src/wayland-private.h
index 67e8783..ad5313e 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -78,13 +78,28 @@ void *wl_map_lookup(struct wl_map *map, uint32_t i);
 uint32_t wl_map_lookup_flags(struct wl_map *map, uint32_t i);
 void wl_map_for_each(struct wl_map *map, wl_iterator_func_t func, void *data);
 
-struct wl_connection;
+
+struct wl_buffer {
+	char data[4096];
+	uint32_t head, tail;
+};
+
+struct wl_connection {
+	struct wl_buffer in, out;
+	struct wl_buffer fds_in, fds_out;
+	int fd;
+	int want_flush;
+};
+
 struct wl_closure;
 struct wl_proxy;
 
 int wl_interface_equal(const struct wl_interface *iface1,
 		       const struct wl_interface *iface2);
 
+void wl_buffer_copy(struct wl_buffer *b, void *data, size_t count);
+uint32_t wl_buffer_size(struct wl_buffer *b);
+
 struct wl_connection *wl_connection_create(int fd);
 void wl_connection_destroy(struct wl_connection *connection);
 void wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
@@ -96,6 +111,7 @@ int wl_connection_read(struct wl_connection *connection);
 int wl_connection_write(struct wl_connection *connection, const void *data, size_t count);
 int wl_connection_queue(struct wl_connection *connection,
 			const void *data, size_t count);
+int wl_connection_put_fd(struct wl_connection *connection, int32_t fd);
 
 struct wl_closure {
 	int count;
-- 
2.0.1




More information about the wayland-devel mailing list