summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>2004-09-15 10:58:53 -0300
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>2004-09-15 10:58:53 -0300
commit3b1160334fa7c005fbde5af8fa12a991cd7ccbcd (patch)
tree0ef8a82f171f350caba1f902fdef27df0bafef08
parent5c5b9c24188adf7a37ad51844910f2dea4d0dfab (diff)
[SOCKET] make enum socket_type be arch overridable
To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped to deal with binary compat. Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br> Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@redhat.com>
-rw-r--r--include/asm-mips/socket.h27
-rw-r--r--include/linux/net.h10
2 files changed, 36 insertions, 1 deletions
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 855b86f3ea0e..eba99d2ac63b 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -68,4 +68,31 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
#define SO_PEERSEC 30
+/** sock_type - Socket types
+ *
+ * Please notice that for binary compat reasons MIPS has to
+ * override the enum sock_type in include/linux/net.h, so
+ * we define ARCH_HAS_SOCKET_TYPES here.
+ *
+ * @SOCK_DGRAM - datagram (conn.less) socket
+ * @SOCK_STREAM - stream (connection) socket
+ * @SOCK_RAW - raw socket
+ * @SOCK_RDM - reliably-delivered message
+ * @SOCK_SEQPACKET - sequential packet socket
+ * @SOCK_PACKET - linux specific way of getting packets at the dev level.
+ * For writing rarp and other similar things on the user level.
+ */
+enum sock_type {
+ SOCK_DGRAM = 1,
+ SOCK_STREAM = 2,
+ SOCK_RAW = 3,
+ SOCK_RDM = 4,
+ SOCK_SEQPACKET = 5,
+ SOCK_PACKET = 10,
+};
+
+#define SOCK_MAX (SOCK_PACKET + 1)
+
+#define ARCH_HAS_SOCKET_TYPES
+
#endif /* _ASM_SOCKET_H */
diff --git a/include/linux/net.h b/include/linux/net.h
index 0f710b7e4121..2c4572f630a1 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -21,6 +21,7 @@
#include <linux/config.h>
#include <linux/wait.h>
#include <linux/stringify.h>
+#include <asm/socket.h>
struct poll_table_struct;
struct inode;
@@ -61,8 +62,13 @@ typedef enum {
#define SOCK_ASYNC_WAITDATA 1
#define SOCK_NOSPACE 2
+#ifndef ARCH_HAS_SOCKET_TYPES
/** sock_type - Socket types
- *
+ *
+ * When adding some new socket type please
+ * grep ARCH_HAS_SOCKET_TYPE include/asm-* /socket.h, at least MIPS
+ * overrides this enum for binary compat reasons.
+ *
* @SOCK_STREAM - stream (connection) socket
* @SOCK_DGRAM - datagram (conn.less) socket
* @SOCK_RAW - raw socket
@@ -82,6 +88,8 @@ enum sock_type {
#define SOCK_MAX (SOCK_PACKET + 1)
+#endif /* ARCH_HAS_SOCKET_TYPES */
+
/**
* struct socket - general BSD socket
* @state - socket state (%SS_CONNECTED, etc)