[libvirt] [PATCH] remove src/socketcompat.h; no longer needed

Jim Meyering jim at meyering.net
Tue Oct 28 18:24:43 UTC 2008


"Daniel P. Berrange" <berrange at redhat.com> wrote:
...
>> So how about if I remove socketcompat.h once these changes
>> are committed?
>
> Works for me

Here you go:

>From 57cc6abb180564463bb4824c54017544564ac77c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 28 Oct 2008 19:17:20 +0100
Subject: [PATCH] remove src/socketcompat.h;  no longer needed

* src/socketcompat.h: Remove file.
* src/remote_internal.c: Don't include socketcompat.h.
* qemud/qemud.h: Likewise.
* qemud/remote_protocol.x: Likewise, but do include <arpa/inet.h>
for htonl.
* src/remote_internal.c: Likewise, but do include <errno.h>.
* qemud/remote_protocol.c: Regenererate.
* qemud/remote_protocol.h: Regenererate.
* src/Makefile.am (REMOTE_DRIVER_SOURCES): Remove socketcompat.h.
---
 qemud/qemud.h           |    4 +---
 qemud/remote_protocol.c |    2 +-
 qemud/remote_protocol.h |    2 +-
 qemud/remote_protocol.x |    4 ++--
 src/Makefile.am         |    3 +--
 src/remote_internal.c   |    3 ++-
 src/socketcompat.h      |   42 ------------------------------------------
 7 files changed, 8 insertions(+), 52 deletions(-)
 delete mode 100644 src/socketcompat.h

diff --git a/qemud/qemud.h b/qemud/qemud.h
index 83d65b6..822ed93 100644
--- a/qemud/qemud.h
+++ b/qemud/qemud.h
@@ -1,7 +1,7 @@
 /*
  * qemud.h: daemon data structure definitions
  *
- * Copyright (C) 2006, 2007 Red Hat, Inc.
+ * Copyright (C) 2006-2008 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -27,8 +27,6 @@

 #include <config.h>

-#include "socketcompat.h"
-
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 #include "gnutls_1_0_compat.h"
diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c
index 5ef80e5..e0edd25 100644
--- a/qemud/remote_protocol.c
+++ b/qemud/remote_protocol.c
@@ -6,7 +6,7 @@
 #include "remote_protocol.h"
 #include <config.h>
 #include "internal.h"
-#include "socketcompat.h"
+#include <arpa/inet.h>

 bool_t
 xdr_remote_nonnull_string (XDR *xdrs, remote_nonnull_string *objp)
diff --git a/qemud/remote_protocol.h b/qemud/remote_protocol.h
index e43514d..ec1beb4 100644
--- a/qemud/remote_protocol.h
+++ b/qemud/remote_protocol.h
@@ -15,7 +15,7 @@ extern "C" {

 #include <config.h>
 #include "internal.h"
-#include "socketcompat.h"
+#include <arpa/inet.h>
 #define REMOTE_MESSAGE_MAX 262144
 #define REMOTE_STRING_MAX 65536

diff --git a/qemud/remote_protocol.x b/qemud/remote_protocol.x
index b7e41aa..bef9711 100644
--- a/qemud/remote_protocol.x
+++ b/qemud/remote_protocol.x
@@ -3,7 +3,7 @@
  *   remote_internal driver and libvirtd.  This protocol is
  *   internal and may change at any time.
  *
- * Copyright (C) 2006-2007 Red Hat, Inc.
+ * Copyright (C) 2006-2008 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@

 %#include <config.h>
 %#include "internal.h"
-%#include "socketcompat.h"
+%#include <arpa/inet.h>

 /*----- Data types. -----*/

diff --git a/src/Makefile.am b/src/Makefile.am
index e743f24..8934c3c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -74,8 +74,7 @@ REMOTE_DRIVER_SOURCES =						\
 		gnutls_1_0_compat.h				\
 		remote_internal.c remote_internal.h		\
 		../qemud/remote_protocol.c			\
-		../qemud/remote_protocol.h			\
-		socketcompat.h
+		../qemud/remote_protocol.h

 # Mock driver, covering domains, storage, networks, etc
 TEST_DRIVER_SOURCES =						\
diff --git a/src/remote_internal.c b/src/remote_internal.c
index e6dcfcf..5b82f99 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -24,7 +24,8 @@
 #include <config.h>

 /* Windows socket compatibility functions. */
-#include "socketcompat.h"
+#include <errno.h>
+#include <sys/socket.h>

 #include <stdio.h>
 #include <stdlib.h>
diff --git a/src/socketcompat.h b/src/socketcompat.h
deleted file mode 100644
index a06fe36..0000000
--- a/src/socketcompat.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * socketcompat.h: Socket compatibility for Windows, making it slightly
- * less painful to use.
- *
- * Use this header under the following circumstances:
- * (a) Instead of including any of: <net/if.h>, <netinet/in.h>,
- *     <sys/socket.h>, <netdb.h>, <netinet/tcp.h>, AND
- * (b) The file will be part of what is built on Windows (basically
- *     just remote client stuff).
- *
- * You need to use socket_errno() instead of errno to get socket
- * errors.
- *
- * Copyright (C) 2008 Red Hat, Inc.
- *
- * See COPYING.LIB for the License of this software
- *
- * Richard W.M. Jones <rjones at redhat.com>
- */
-
-#ifndef __SOCKETCOMPAT_H__
-#define __SOCKETCOMPAT_H__
-
-#include <config.h>
-
-#include <errno.h>
-#include <sys/socket.h>
-
-static inline int
-socket_errno (void)
-{
-  return errno;
-}
-
-#ifndef HAVE_WINSOCK2_H		/* Unix & Cygwin. */
-# include <sys/un.h>
-# include <net/if.h>
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-#endif /* HAVE_WINSOCK2_H */
-
-#endif /* __WINSOCKWRAPPER_H__ */
--
1.6.0.3.756.gb776d




More information about the libvir-list mailing list