[Spice-devel] [PATCH v3 05/10] server: move bit set/clear utilities out of red_worker.h
Alon Levy
alevy at redhat.com
Tue Aug 13 00:47:24 PDT 2013
---
server/Makefile.am | 1 +
server/red_dispatcher.c | 4 +++-
server/red_worker.c | 1 +
server/red_worker.h | 18 ------------------
server/spice_server_utils.h | 23 +++++++++++++++++++++++
5 files changed, 28 insertions(+), 19 deletions(-)
create mode 100644 server/spice_server_utils.h
diff --git a/server/Makefile.am b/server/Makefile.am
index e5392ba..feee2f1 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -99,6 +99,7 @@ libspice_server_la_SOURCES = \
zlib_encoder.h \
spice_bitmap_utils.h \
spice_bitmap_utils.c \
+ spice_server_utils.h \
$(NULL)
if SUPPORT_TUNNEL
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index ef47c28..03a4c4a 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -39,8 +39,10 @@
#endif // USE_OPENGL
#include "reds.h"
#include "dispatcher.h"
-#include "red_dispatcher.h"
#include "red_parse_qxl.h"
+#include "spice_server_utils.h"
+
+#include "red_dispatcher.h"
static int num_active_workers = 0;
diff --git a/server/red_worker.c b/server/red_worker.c
index 0704279..3b9c5b0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -82,6 +82,7 @@
#include "migration_protocol.h"
#include "spice_timer_queue.h"
#include "main_dispatcher.h"
+#include "spice_server_utils.h"
//#define COMPRESS_STAT
//#define DUMP_BITMAP
diff --git a/server/red_worker.h b/server/red_worker.h
index 796b090..272661f 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -22,24 +22,6 @@
#include <errno.h>
#include "red_common.h"
-
-static inline void set_bit(int index, uint32_t *addr)
-{
- uint32_t mask = 1 << index;
- __sync_or_and_fetch(addr, mask);
-}
-
-static inline void clear_bit(int index, uint32_t *addr)
-{
- uint32_t mask = ~(1 << index);
- __sync_and_and_fetch(addr, mask);
-}
-
-static inline int test_bit(int index, uint32_t val)
-{
- return val & (1u << index);
-}
-
enum {
RED_WORKER_PENDING_WAKEUP,
RED_WORKER_PENDING_OOM,
diff --git a/server/spice_server_utils.h b/server/spice_server_utils.h
new file mode 100644
index 0000000..b3ddc27
--- /dev/null
+++ b/server/spice_server_utils.h
@@ -0,0 +1,23 @@
+#ifndef H_SPICE_SERVER_UTIL
+#define H_SPICE_SERVER_UTIL
+
+#include <unistd.h>
+
+static inline void set_bit(int index, uint32_t *addr)
+{
+ uint32_t mask = 1 << index;
+ __sync_or_and_fetch(addr, mask);
+}
+
+static inline void clear_bit(int index, uint32_t *addr)
+{
+ uint32_t mask = ~(1 << index);
+ __sync_and_and_fetch(addr, mask);
+}
+
+static inline int test_bit(int index, uint32_t val)
+{
+ return val & (1u << index);
+}
+
+#endif
--
1.8.3.1
More information about the Spice-devel
mailing list