All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits
@ 2017-09-25 23:19 Carlo Marcelo Arenas Belón
  2017-09-25 23:19 ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
  2017-10-11  7:10 ` [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Arenas
  0 siblings, 2 replies; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio

the definitions in socket.h are meant to reflect the ones in linux for each
respective target, but are sometimes difficult to maintain.

hppa (AKA parisc) was initially merged with an independent file that mirrors
more closely the corresponding one in linux but hasn't been updated since.

this series updates hppa with the latest bits from linux 4.14 and makes sure
all relevant architectures had a sockbits file that would be easy to maintain
going forward.

most of the changes are pretty mechanical and I had made (thanks to Laurent's
tough review) every effort to ensure no value gets changed accidentaly and 
all changes (even the ones where the value remains but is now in a different
base to better match what was used in the linux headers) are documented, so
it should be fairly safe and will fix bugs (mostly for sparc).

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits
  2017-09-25 23:19 [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
@ 2017-09-25 23:19 ` Carlo Marcelo Arenas Belón
  2017-09-25 23:19   ` [Qemu-devel] [PATCH v2 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
  2017-10-11  8:00   ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Laurent Vivier
  2017-10-11  7:10 ` [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Arenas
  1 sibling, 2 replies; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio, Carlo Marcelo Arenas Belón

updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
include in socket.h changed to prefer a local path like all other qemu
headers and for consistency and clarity when adding all other arch

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 linux-user/hppa/sockbits.h | 148 +++++++++++++++++++++++----------------------
 linux-user/socket.h        |   2 +-
 2 files changed, 78 insertions(+), 72 deletions(-)

diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h
index 5044619e16..3dab31a76a 100644
--- a/linux-user/hppa/sockbits.h
+++ b/linux-user/hppa/sockbits.h
@@ -1,71 +1,77 @@
-#define TARGET_SOL_SOCKET      0xffff
+#define TARGET_SOL_SOCKET                       0xffff
 
-#define TARGET_SO_DEBUG        0x0001
-#define TARGET_SO_REUSEADDR    0x0004
-#define TARGET_SO_KEEPALIVE    0x0008
-#define TARGET_SO_DONTROUTE    0x0010
-#define TARGET_SO_BROADCAST    0x0020
-#define TARGET_SO_LINGER       0x0080
-#define TARGET_SO_OOBINLINE    0x0100
-#define TARGET_SO_REUSEPORT    0x0200
-#define TARGET_SO_SNDBUF       0x1001
-#define TARGET_SO_RCVBUF       0x1002
-#define TARGET_SO_SNDBUFFORCE  0x100a
-#define TARGET_SO_RCVBUFFORCE  0x100b
-#define TARGET_SO_SNDLOWAT     0x1003
-#define TARGET_SO_RCVLOWAT     0x1004
-#define TARGET_SO_SNDTIMEO     0x1005
-#define TARGET_SO_RCVTIMEO     0x1006
-#define TARGET_SO_ERROR        0x1007
-#define TARGET_SO_TYPE         0x1008
-#define TARGET_SO_PROTOCOL     0x1028
-#define TARGET_SO_DOMAIN       0x1029
-#define TARGET_SO_PEERNAME     0x2000
-#define TARGET_SO_NO_CHECK     0x400b
-#define TARGET_SO_PRIORITY     0x400c
-#define TARGET_SO_BSDCOMPAT    0x400e
-#define TARGET_SO_PASSCRED     0x4010
-#define TARGET_SO_PEERCRED     0x4011
-#define TARGET_SO_TIMESTAMP    0x4012
-#define TARGET_SCM_TIMESTAMP   TARGET_SO_TIMESTAMP
-#define TARGET_SO_TIMESTAMPNS  0x4013
-#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS
+#define TARGET_SO_DEBUG                         0x0001
+#define TARGET_SO_REUSEADDR                     0x0004
+#define TARGET_SO_KEEPALIVE                     0x0008
+#define TARGET_SO_DONTROUTE                     0x0010
+#define TARGET_SO_BROADCAST                     0x0020
+#define TARGET_SO_LINGER                        0x0080
+#define TARGET_SO_OOBINLINE                     0x0100
+#define TARGET_SO_REUSEPORT                     0x0200
+#define TARGET_SO_SNDBUF                        0x1001
+#define TARGET_SO_RCVBUF                        0x1002
+#define TARGET_SO_SNDBUFFORCE                   0x100a
+#define TARGET_SO_RCVBUFFORCE                   0x100b
+#define TARGET_SO_SNDLOWAT                      0x1003
+#define TARGET_SO_RCVLOWAT                      0x1004
+#define TARGET_SO_SNDTIMEO                      0x1005
+#define TARGET_SO_RCVTIMEO                      0x1006
+#define TARGET_SO_ERROR                         0x1007
+#define TARGET_SO_TYPE                          0x1008
+#define TARGET_SO_PROTOCOL                      0x1028
+#define TARGET_SO_DOMAIN                        0x1029
+#define TARGET_SO_PEERNAME                      0x2000
+#define TARGET_SO_NO_CHECK                      0x400b
+#define TARGET_SO_PRIORITY                      0x400c
+#define TARGET_SO_BSDCOMPAT                     0x400e
+#define TARGET_SO_PASSCRED                      0x4010
+#define TARGET_SO_PEERCRED                      0x4011
+#define TARGET_SO_TIMESTAMP                     0x4012
+#define TARGET_SCM_TIMESTAMP                    TARGET_SO_TIMESTAMP
+#define TARGET_SO_TIMESTAMPNS                   0x4013
+#define TARGET_SCM_TIMESTAMPNS                  TARGET_SO_TIMESTAMPNS
 
-#define TARGET_SO_SECURITY_AUTHENTICATION              0x4016
-#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        0x4017
-#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          0x4018
+#define TARGET_SO_SECURITY_AUTHENTICATION       0x4016
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK   0x4018
 
-#define TARGET_SO_BINDTODEVICE         0x4019
-#define TARGET_SO_ATTACH_FILTER        0x401a
-#define TARGET_SO_DETACH_FILTER        0x401b
-#define TARGET_SO_GET_FILTER           TARGET_SO_ATTACH_FILTER
-#define TARGET_SO_ACCEPTCONN           0x401c
-#define TARGET_SO_PEERSEC              0x401d
-#define TARGET_SO_PASSSEC              0x401e
-#define TARGET_SO_MARK                 0x401f
-#define TARGET_SO_TIMESTAMPING         0x4020
-#define TARGET_SCM_TIMESTAMPING        TARGET_SO_TIMESTAMPING
-#define TARGET_SO_RXQ_OVFL             0x4021
-#define TARGET_SO_WIFI_STATUS          0x4022
-#define TARGET_SCM_WIFI_STATUS         TARGET_SO_WIFI_STATUS
-#define TARGET_SO_PEEK_OFF             0x4023
-#define TARGET_SO_NOFCS                0x4024
-#define TARGET_SO_LOCK_FILTER          0x4025
-#define TARGET_SO_SELECT_ERR_QUEUE     0x4026
-#define TARGET_SO_BUSY_POLL            0x4027
-#define TARGET_SO_MAX_PACING_RATE      0x4028
-#define TARGET_SO_BPF_EXTENSIONS       0x4029
-#define TARGET_SO_INCOMING_CPU         0x402A
-#define TARGET_SO_ATTACH_BPF           0x402B
-#define TARGET_SO_DETACH_BPF           TARGET_SO_DETACH_FILTER
+#define TARGET_SO_BINDTODEVICE                  0x4019
+#define TARGET_SO_ATTACH_FILTER                 0x401a
+#define TARGET_SO_DETACH_FILTER                 0x401b
+#define TARGET_SO_GET_FILTER                    TARGET_SO_ATTACH_FILTER
+#define TARGET_SO_ACCEPTCONN                    0x401c
+#define TARGET_SO_PEERSEC                       0x401d
+#define TARGET_SO_PASSSEC                       0x401e
+#define TARGET_SO_MARK                          0x401f
+#define TARGET_SO_TIMESTAMPING                  0x4020
+#define TARGET_SCM_TIMESTAMPING                 TARGET_SO_TIMESTAMPING
+#define TARGET_SO_RXQ_OVFL                      0x4021
+#define TARGET_SO_WIFI_STATUS                   0x4022
+#define TARGET_SCM_WIFI_STATUS                  TARGET_SO_WIFI_STATUS
+#define TARGET_SO_PEEK_OFF                      0x4023
+#define TARGET_SO_NOFCS                         0x4024
+#define TARGET_SO_LOCK_FILTER                   0x4025
+#define TARGET_SO_SELECT_ERR_QUEUE              0x4026
+#define TARGET_SO_BUSY_POLL                     0x4027
+#define TARGET_SO_MAX_PACING_RATE               0x4028
+#define TARGET_SO_BPF_EXTENSIONS                0x4029
+#define TARGET_SO_INCOMING_CPU                  0x402A
+#define TARGET_SO_ATTACH_BPF                    0x402B
+#define TARGET_SO_DETACH_BPF                    TARGET_SO_DETACH_FILTER
 
-#define TARGET_SO_ATTACH_REUSEPORT_CBPF        0x402C
-#define TARGET_SO_ATTACH_REUSEPORT_EBPF        0x402D
+#define TARGET_SO_ATTACH_REUSEPORT_CBPF         0x402C
+#define TARGET_SO_ATTACH_REUSEPORT_EBPF         0x402D
 
-#define TARGET_SO_CNX_ADVICE           0x402E
+#define TARGET_SO_CNX_ADVICE                    0x402E
+#define TARGET_SCM_TIMESTAMPING_OPT_STATS       0x402F
+#define TARGET_SO_MEMINFO                       0x4030
+#define TARGET_SO_INCOMING_NAPI_ID              0x4031
+#define TARGET_SO_COOKIE                        0x4032
+#define TARGET_SCM_TIMESTAMPING_PKTINFO         0x4033
+#define TARGET_SO_PEERGROUPS                    0x4034
+#define TARGET_SO_ZEROCOPY                      0x4035
 
 /** sock_type - Socket types - default values
- *
  *
  * @SOCK_STREAM - stream (connection) socket
  * @SOCK_DGRAM - datagram (conn.less) socket
@@ -80,18 +86,18 @@
  * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
  */
 enum sock_type {
-   TARGET_SOCK_STREAM      = 1,
-   TARGET_SOCK_DGRAM       = 2,
-   TARGET_SOCK_RAW         = 3,
-   TARGET_SOCK_RDM         = 4,
-   TARGET_SOCK_SEQPACKET   = 5,
-   TARGET_SOCK_DCCP        = 6,
-   TARGET_SOCK_PACKET      = 10,
-   TARGET_SOCK_CLOEXEC     = 010000000,
-   TARGET_SOCK_NONBLOCK    = 0x40000000,
+    TARGET_SOCK_STREAM    = 1,
+    TARGET_SOCK_DGRAM     = 2,
+    TARGET_SOCK_RAW       = 3,
+    TARGET_SOCK_RDM       = 4,
+    TARGET_SOCK_SEQPACKET = 5,
+    TARGET_SOCK_DCCP      = 6,
+    TARGET_SOCK_PACKET    = 10,
+    TARGET_SOCK_CLOEXEC   = 010000000,
+    TARGET_SOCK_NONBLOCK  = 0x40000000,
 };
 
 #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-#define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
+#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
 
 #define ARCH_HAS_SOCKET_TYPES 1
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 7051cd2cf4..c7e6cb8ea1 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -206,7 +206,7 @@
     #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
     #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
 #elif defined(TARGET_HPPA)
-#include <hppa/sockbits.h>
+#include "hppa/sockbits.h"
 #else
 
 #if defined(TARGET_SPARC)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 2/6] linux-user: refactor socket.h for alpha
  2017-09-25 23:19 ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
@ 2017-09-25 23:19   ` Carlo Marcelo Arenas Belón
  2017-09-25 23:19     ` [Qemu-devel] [PATCH v2 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
  2017-10-11  8:00   ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Laurent Vivier
  1 sibling, 1 reply; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio, Carlo Marcelo Arenas Belón

based on fresh bits from linux 4.14 and therefore enabling SO_REUSEPORT
as a side effect

to easy on maintenance SO_NONBLOCK updated to match the value from linux
headers (in hexadecimal) as seen in arch/alpha/include/asm/socket.h

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 linux-user/alpha/sockbits.h | 104 ++++++++++++++++++++++++++++++++++++++++++++
 linux-user/socket.h         | 104 +-------------------------------------------
 2 files changed, 105 insertions(+), 103 deletions(-)
 create mode 100644 linux-user/alpha/sockbits.h

diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h
new file mode 100644
index 0000000000..768579a1f7
--- /dev/null
+++ b/linux-user/alpha/sockbits.h
@@ -0,0 +1,104 @@
+#define TARGET_SOL_SOCKET                       0xffff
+
+#define TARGET_SO_DEBUG                         0x0001
+#define TARGET_SO_REUSEADDR                     0x0004
+#define TARGET_SO_KEEPALIVE                     0x0008
+#define TARGET_SO_DONTROUTE                     0x0010
+#define TARGET_SO_BROADCAST                     0x0020
+#define TARGET_SO_LINGER                        0x0080
+#define TARGET_SO_OOBINLINE                     0x0100
+#define TARGET_SO_REUSEPORT                     0x0200
+#define TARGET_SO_TYPE                          0x1008
+#define TARGET_SO_ERROR                         0x1007
+#define TARGET_SO_SNDBUF                        0x1001
+#define TARGET_SO_RCVBUF                        0x1002
+#define TARGET_SO_SNDBUFFORCE                   0x100a
+#define TARGET_SO_RCVBUFFORCE                   0x100b
+#define TARGET_SO_RCVLOWAT                      0x1010
+#define TARGET_SO_SNDLOWAT                      0x1011
+#define TARGET_SO_RCVTIMEO                      0x1012
+#define TARGET_SO_SNDTIMEO                      0x1013
+#define TARGET_SO_ACCEPTCONN                    0x1014
+#define TARGET_SO_PROTOCOL                      0x1028
+#define TARGET_SO_DOMAIN                        0x1029
+#define TARGET_SO_NO_CHECK                      11
+#define TARGET_SO_PRIORITY                      12
+#define TARGET_SO_BSDCOMPAT                     14
+#define TARGET_SO_PASSCRED                      17
+#define TARGET_SO_PEERCRED                      18
+#define TARGET_SO_BINDTODEVICE                  25
+#define TARGET_SO_ATTACH_FILTER                 26
+#define TARGET_SO_DETACH_FILTER                 27
+#define TARGET_SO_GET_FILTER                    TARGET_SO_ATTACH_FILTER
+#define TARGET_SO_PEERNAME                      28
+#define TARGET_SO_TIMESTAMP                     29
+#define TARGET_SCM_TIMESTAMP                    TARGET_SO_TIMESTAMP
+#define TARGET_SO_PEERSEC                       30
+#define TARGET_SO_PASSSEC                       34
+#define TARGET_SO_TIMESTAMPNS                   35
+#define TARGET_SCM_TIMESTAMPNS                  TARGET_SO_TIMESTAMPNS
+#define TARGET_SO_SECURITY_AUTHENTICATION       19
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 20
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK   21
+#define TARGET_SO_MARK                          36
+#define TARGET_SO_TIMESTAMPING                  37
+#define TARGET_SCM_TIMESTAMPING                 TARGET_SO_TIMESTAMPING
+#define TARGET_SO_RXQ_OVFL                      40
+#define TARGET_SO_WIFI_STATUS                   41
+#define TARGET_SCM_WIFI_STATUS                  TARGET_SO_WIFI_STATUS
+#define TARGET_SO_PEEK_OFF                      42
+#define TARGET_SO_NOFCS                         43
+#define TARGET_SO_LOCK_FILTER                   44
+#define TARGET_SO_SELECT_ERR_QUEUE              45
+#define TARGET_SO_BUSY_POLL                     46
+#define TARGET_SO_MAX_PACING_RATE               47
+#define TARGET_SO_BPF_EXTENSIONS                48
+#define TARGET_SO_INCOMING_CPU                  49
+#define TARGET_SO_ATTACH_BPF                    50
+#define TARGET_SO_DETACH_BPF                    TARGET_SO_DETACH_FILTER
+#define TARGET_SO_ATTACH_REUSEPORT_CBPF         51
+#define TARGET_SO_ATTACH_REUSEPORT_EBPF         52
+#define TARGET_SO_CNX_ADVICE                    53
+#define TARGET_SCM_TIMESTAMPING_OPT_STATS       54
+#define TARGET_SO_MEMINFO                       55
+#define TARGET_SO_INCOMING_NAPI_ID              56
+#define TARGET_SO_COOKIE                        57
+#define TARGET_SCM_TIMESTAMPING_PKTINFO         58
+#define TARGET_SO_PEERGROUPS                    59
+#define TARGET_SO_ZEROCOPY                      60
+
+/** sock_type - Socket types
+ *
+ * Please notice that for binary compat reasons ALPHA has to
+ * override the enum sock_type in include/linux/net.h, so
+ * we define ARCH_HAS_SOCKET_TYPES here.
+ *
+ * @SOCK_STREAM - stream (connection) socket
+ * @SOCK_DGRAM - datagram (conn.less) socket
+ * @SOCK_RAW - raw socket
+ * @SOCK_RDM - reliably-delivered message
+ * @SOCK_SEQPACKET - sequential packet socket
+ * @SOCK_DCCP - Datagram Congestion Control Protocol socket
+ * @SOCK_PACKET - linux specific way of getting packets at the dev level.
+ *                For writing rarp and other similar things on the user
+ *                level.
+ * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
+ * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
+ */
+
+enum sock_type {
+    TARGET_SOCK_STREAM      = 1,
+    TARGET_SOCK_DGRAM       = 2,
+    TARGET_SOCK_RAW         = 3,
+    TARGET_SOCK_RDM         = 4,
+    TARGET_SOCK_SEQPACKET   = 5,
+    TARGET_SOCK_DCCP        = 6,
+    TARGET_SOCK_PACKET      = 10,
+    TARGET_SOCK_CLOEXEC     = 010000000,
+    TARGET_SOCK_NONBLOCK    = 0x40000000,
+};
+
+#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
+#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
+
+#define ARCH_HAS_SOCKET_TYPES 1
diff --git a/linux-user/socket.h b/linux-user/socket.h
index c7e6cb8ea1..115bdf2ddb 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -102,109 +102,7 @@
     #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
 
 #elif defined(TARGET_ALPHA)
-
-    /* For setsockopt(2) */
-    #define TARGET_SOL_SOCKET   0xffff
-
-    #define TARGET_SO_DEBUG 0x0001
-    #define TARGET_SO_REUSEADDR 0x0004
-    #define TARGET_SO_KEEPALIVE 0x0008
-    #define TARGET_SO_DONTROUTE 0x0010
-    #define TARGET_SO_BROADCAST 0x0020
-    #define TARGET_SO_LINGER    0x0080
-    #define TARGET_SO_OOBINLINE 0x0100
-    /* To add :#define TARGET_SO_REUSEPORT 0x0200 */
-
-    #define TARGET_SO_TYPE      0x1008
-    #define TARGET_SO_ERROR 0x1007
-    #define TARGET_SO_SNDBUF    0x1001
-    #define TARGET_SO_RCVBUF    0x1002
-    #define TARGET_SO_SNDBUFFORCE   0x100a
-    #define TARGET_SO_RCVBUFFORCE   0x100b
-    #define TARGET_SO_RCVLOWAT  0x1010
-    #define TARGET_SO_SNDLOWAT  0x1011
-    #define TARGET_SO_RCVTIMEO  0x1012
-    #define TARGET_SO_SNDTIMEO  0x1013
-    #define TARGET_SO_ACCEPTCONN    0x1014
-    #define TARGET_SO_PROTOCOL  0x1028
-    #define TARGET_SO_DOMAIN    0x1029
-
-    /* linux-specific, might as well be the same as on i386 */
-    #define TARGET_SO_NO_CHECK  11
-    #define TARGET_SO_PRIORITY  12
-    #define TARGET_SO_BSDCOMPAT 14
-
-    #define TARGET_SO_PASSCRED  17
-    #define TARGET_SO_PEERCRED  18
-    #define TARGET_SO_BINDTODEVICE 25
-
-    /* Socket filtering */
-    #define TARGET_SO_ATTACH_FILTER        26
-    #define TARGET_SO_DETACH_FILTER        27
-
-    #define TARGET_SO_PEERNAME      28
-    #define TARGET_SO_TIMESTAMP     29
-    #define TARGET_SCM_TIMESTAMP        TARGET_SO_TIMESTAMP
-
-    #define TARGET_SO_PEERSEC       30
-    #define TARGET_SO_PASSSEC       34
-    #define TARGET_SO_TIMESTAMPNS       35
-    #define TARGET_SCM_TIMESTAMPNS      TARGET_SO_TIMESTAMPNS
-
-    /* Security levels - as per NRL IPv6 - don't actually do anything */
-    #define TARGET_SO_SECURITY_AUTHENTICATION       19
-    #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 20
-    #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK       21
-
-    #define TARGET_SO_MARK          36
-
-    #define TARGET_SO_TIMESTAMPING      37
-    #define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING
-
-    #define TARGET_SO_RXQ_OVFL             40
-
-    #define TARGET_SO_WIFI_STATUS       41
-    #define TARGET_SCM_WIFI_STATUS      TARGET_SO_WIFI_STATUS
-    #define TARGET_SO_PEEK_OFF      42
-
-    /* Instruct lower device to use last 4-bytes of skb data as FCS */
-    #define TARGET_SO_NOFCS     43
-
-    /** sock_type - Socket types
-     *
-     * Please notice that for binary compat reasons ALPHA 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_DCCP - Datagram Congestion Control Protocol socket
-     * @SOCK_PACKET - linux specific way of getting packets at the dev level.
-     *                For writing rarp and other similar things on the user
-     *                level.
-     * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
-     * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
-     */
-
-    #define ARCH_HAS_SOCKET_TYPES          1
-
-    enum sock_type {
-           TARGET_SOCK_STREAM      = 1,
-           TARGET_SOCK_DGRAM       = 2,
-           TARGET_SOCK_RAW         = 3,
-           TARGET_SOCK_RDM         = 4,
-           TARGET_SOCK_SEQPACKET   = 5,
-           TARGET_SOCK_DCCP        = 6,
-           TARGET_SOCK_PACKET      = 10,
-           TARGET_SOCK_CLOEXEC     = 010000000,
-           TARGET_SOCK_NONBLOCK    = 010000000000,
-    };
-
-    #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-    #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
+#include "alpha/sockbits.h"
 #elif defined(TARGET_HPPA)
 #include "hppa/sockbits.h"
 #else
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 3/6] linux-user: refactor socket.h for mips
  2017-09-25 23:19   ` [Qemu-devel] [PATCH v2 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
@ 2017-09-25 23:19     ` Carlo Marcelo Arenas Belón
  2017-09-25 23:19       ` [Qemu-devel] [PATCH v2 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
  0 siblings, 1 reply; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio, Carlo Marcelo Arenas Belón

fresh bits from linux 4.14, redefine SO_STYLE and {SO,SCM}_TIMESTAMP to
the right target values and enables SO_REUSEPORT

to easy on maintenance SOCK_NONBLOCK has been updated to use the same
value (in hexadecimal) as defined for O_NONBLOCK from the linux header
arch/mips/linux/uapi/asm/fcntl.h

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/mips/sockbits.h | 107 +++++++++++++++++++++++++++++++++++++++++++++
 linux-user/socket.h        | 103 +------------------------------------------
 2 files changed, 108 insertions(+), 102 deletions(-)
 create mode 100644 linux-user/mips/sockbits.h

diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h
new file mode 100644
index 0000000000..6d8ea8aba2
--- /dev/null
+++ b/linux-user/mips/sockbits.h
@@ -0,0 +1,107 @@
+#define TARGET_SOL_SOCKET     0xffff
+
+#define TARGET_SO_DEBUG       0x0001 /* Record debugging information.  */
+#define TARGET_SO_REUSEADDR   0x0004 /* Allow reuse of local addresses.  */
+#define TARGET_SO_KEEPALIVE   0x0008 /* Keep connections alive and send
+                                        SIGPIPE when they die. */
+#define TARGET_SO_DONTROUTE   0x0010 /* Don't do local routing. */
+#define TARGET_SO_BROADCAST   0x0020 /* Allow transmission of
+                                        broadcast messages. */
+#define TARGET_SO_LINGER      0x0080 /* Block on close of a reliable
+                                        socket to transmit pending data. */
+#define TARGET_SO_OOBINLINE   0x0100 /* Receive out-of-band data in-band. */
+#define TARGET_SO_REUSEPORT   0x0200 /* Allow local address and port reuse. */
+#define TARGET_SO_TYPE        0x1008 /* Compatible name for TARGET_SO_STYLE. */
+#define TARGET_SO_STYLE       TARGET_SO_TYPE /* Synonym */
+#define TARGET_SO_ERROR       0x1007         /* get error status and clear */
+#define TARGET_SO_SNDBUF      0x1001         /* Send buffer size. */
+#define TARGET_SO_RCVBUF      0x1002         /* Receive buffer. */
+#define TARGET_SO_SNDLOWAT    0x1003         /* send low-water mark */
+#define TARGET_SO_RCVLOWAT    0x1004         /* receive low-water mark */
+#define TARGET_SO_SNDTIMEO    0x1005         /* send timeout */
+#define TARGET_SO_RCVTIMEO    0x1006         /* receive timeout */
+#define TARGET_SO_ACCEPTCONN  0x1009
+#define TARGET_SO_PROTOCOL    0x1028         /* protocol type */
+#define TARGET_SO_DOMAIN      0x1029         /* domain/socket family */
+#define TARGET_SO_NO_CHECK                      11
+#define TARGET_SO_PRIORITY                      12
+#define TARGET_SO_BSDCOMPAT                     14
+#define TARGET_SO_PASSCRED                      17
+#define TARGET_SO_PEERCRED                      18
+#define TARGET_SO_SECURITY_AUTHENTICATION       22
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK   24
+#define TARGET_SO_BINDTODEVICE                  25
+#define TARGET_SO_ATTACH_FILTER                 26
+#define TARGET_SO_DETACH_FILTER                 27
+#define TARGET_SO_GET_FILTER                    TARGET_SO_ATTACH_FILTER
+#define TARGET_SO_PEERNAME                      28
+#define TARGET_SO_TIMESTAMP                     29
+#define TARGET_SCM_TIMESTAMP                    TARGET_SO_TIMESTAMP
+#define TARGET_SO_PEERSEC                       30
+#define TARGET_SO_SNDBUFFORCE                   31
+#define TARGET_SO_RCVBUFFORCE                   33
+#define TARGET_SO_PASSSEC                       34
+#define TARGET_SO_TIMESTAMPNS                   35
+#define TARGET_SCM_TIMESTAMPNS                  TARGET_SO_TIMESTAMPNS
+#define TARGET_SO_MARK                          36
+#define TARGET_SO_TIMESTAMPING                  37
+#define TARGET_SCM_TIMESTAMPING                 TARGET_SO_TIMESTAMPING
+#define TARGET_SO_RXQ_OVFL                      40
+#define TARGET_SO_WIFI_STATUS                   41
+#define TARGET_SCM_WIFI_STATUS                  TARGET_SO_WIFI_STATUS
+#define TARGET_SO_PEEK_OFF                      42
+#define TARGET_SO_NOFCS                         43
+#define TARGET_SO_LOCK_FILTER                   44
+#define TARGET_SO_SELECT_ERR_QUEUE              45
+#define TARGET_SO_BUSY_POLL                     46
+#define TARGET_SO_MAX_PACING_RATE               47
+#define TARGET_SO_BPF_EXTENSIONS                48
+#define TARGET_SO_INCOMING_CPU                  49
+#define TARGET_SO_ATTACH_BPF                    50
+#define TARGET_SO_DETACH_BPF                    TARGET_SO_DETACH_FILTER
+#define TARGET_SO_ATTACH_REUSEPORT_CBPF         51
+#define TARGET_SO_ATTACH_REUSEPORT_EBPF         52
+#define TARGET_SO_CNX_ADVICE                    53
+#define TARGET_SCM_TIMESTAMPING_OPT_STATS       54
+#define TARGET_SO_MEMINFO                       55
+#define TARGET_SO_INCOMING_NAPI_ID              56
+#define TARGET_SO_COOKIE                        57
+#define TARGET_SCM_TIMESTAMPING_PKTINFO         58
+#define TARGET_SO_PEERGROUPS                    59
+#define TARGET_SO_ZEROCOPY                      60
+
+/** 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_DCCP - Datagram Congestion Control Protocol socket
+ * @SOCK_PACKET - linux specific way of getting packets at the dev level.
+ *                For writing rarp and other similar things on the user
+ *                level.
+ * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
+ * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
+ */
+enum sock_type {
+    TARGET_SOCK_DGRAM       = 1,
+    TARGET_SOCK_STREAM      = 2,
+    TARGET_SOCK_RAW         = 3,
+    TARGET_SOCK_RDM         = 4,
+    TARGET_SOCK_SEQPACKET   = 5,
+    TARGET_SOCK_DCCP        = 6,
+    TARGET_SOCK_PACKET      = 10,
+    TARGET_SOCK_CLOEXEC     = 02000000,
+    TARGET_SOCK_NONBLOCK    = 0x0080,
+};
+
+#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
+#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
+
+#define ARCH_HAS_SOCKET_TYPES 1
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 115bdf2ddb..036270a6e4 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -1,106 +1,5 @@
-
 #if defined(TARGET_MIPS)
-    /* MIPS special values for constants */
-
-    /*
-     * For setsockopt(2)
-     *
-     * This defines are ABI conformant as far as Linux supports these ...
-     */
-    #define TARGET_SOL_SOCKET      0xffff
-
-    #define TARGET_SO_DEBUG        0x0001  /* Record debugging information. */
-    #define TARGET_SO_REUSEADDR    0x0004  /* Allow reuse of local addresses. */
-    #define TARGET_SO_KEEPALIVE    0x0008  /* Keep connections alive and send
-                                              SIGPIPE when they die. */
-    #define TARGET_SO_DONTROUTE    0x0010  /* Don't do local routing. */
-    #define TARGET_SO_BROADCAST    0x0020  /* Allow transmission of
-                                              broadcast messages. */
-    #define TARGET_SO_LINGER       0x0080  /* Block on close of a reliable
-                                            * socket to transmit pending data.
-                                            */
-    #define TARGET_SO_OOBINLINE 0x0100     /* Receive out-of-band data in-band.
-                                            */
-    #if 0
-    /* To add: Allow local address and port reuse. */
-    #define TARGET_SO_REUSEPORT 0x0200
-    #endif
-
-    #define TARGET_SO_TYPE         0x1008  /* Compatible name for SO_STYLE. */
-    #define TARGET_SO_STYLE        SO_TYPE /* Synonym */
-    #define TARGET_SO_ERROR        0x1007  /* get error status and clear */
-    #define TARGET_SO_SNDBUF       0x1001  /* Send buffer size. */
-    #define TARGET_SO_RCVBUF       0x1002  /* Receive buffer. */
-    #define TARGET_SO_SNDLOWAT     0x1003  /* send low-water mark */
-    #define TARGET_SO_RCVLOWAT     0x1004  /* receive low-water mark */
-    #define TARGET_SO_SNDTIMEO     0x1005  /* send timeout */
-    #define TARGET_SO_RCVTIMEO     0x1006  /* receive timeout */
-    #define TARGET_SO_ACCEPTCONN   0x1009
-
-    /* linux-specific, might as well be the same as on i386 */
-    #define TARGET_SO_NO_CHECK     11
-    #define TARGET_SO_PRIORITY     12
-    #define TARGET_SO_BSDCOMPAT    14
-
-    #define TARGET_SO_PASSCRED     17
-    #define TARGET_SO_PEERCRED     18
-
-    /* Security levels - as per NRL IPv6 - don't actually do anything */
-    #define TARGET_SO_SECURITY_AUTHENTICATION              22
-    #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        23
-    #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          24
-
-    #define TARGET_SO_BINDTODEVICE         25
-
-    /* Socket filtering */
-    #define TARGET_SO_ATTACH_FILTER        26
-    #define TARGET_SO_DETACH_FILTER        27
-
-    #define TARGET_SO_PEERNAME             28
-    #define TARGET_SO_TIMESTAMP            29
-    #define SCM_TIMESTAMP          SO_TIMESTAMP
-
-    #define TARGET_SO_PEERSEC              30
-    #define TARGET_SO_SNDBUFFORCE          31
-    #define TARGET_SO_RCVBUFFORCE          33
-    #define TARGET_SO_PASSSEC              34
-
-    /** 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_DCCP - Datagram Congestion Control Protocol socket
-     * @SOCK_PACKET - linux specific way of getting packets at the dev level.
-     *                For writing rarp and other similar things on the user
-     *                level.
-     * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
-     * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
-     */
-
-    #define ARCH_HAS_SOCKET_TYPES          1
-
-    enum sock_type {
-           TARGET_SOCK_DGRAM       = 1,
-           TARGET_SOCK_STREAM      = 2,
-           TARGET_SOCK_RAW         = 3,
-           TARGET_SOCK_RDM         = 4,
-           TARGET_SOCK_SEQPACKET   = 5,
-           TARGET_SOCK_DCCP        = 6,
-           TARGET_SOCK_PACKET      = 10,
-           TARGET_SOCK_CLOEXEC     = 02000000,
-           TARGET_SOCK_NONBLOCK    = 0200,
-    };
-
-    #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-    #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
-
+#include "mips/sockbits.h"
 #elif defined(TARGET_ALPHA)
 #include "alpha/sockbits.h"
 #elif defined(TARGET_HPPA)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 4/6] linux-user: refactor socket.h for sparc
  2017-09-25 23:19     ` [Qemu-devel] [PATCH v2 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
@ 2017-09-25 23:19       ` Carlo Marcelo Arenas Belón
  2017-09-25 23:19         ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
  0 siblings, 1 reply; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio, Carlo Marcelo Arenas Belón

fixes SOL_SOCKET and SO_LINGER and all other values that didn't match the
default (SO_PASSSEC being the exception as it only changed base)

TARGET_SOCK_{NONBLOCK,CLOEXEC} updated to match the values for the header:
arch/sparc/include/uapi/asm/fcntl.h

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/socket.h         |  46 ++------------------
 linux-user/sparc/sockbits.h | 104 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 43 deletions(-)
 create mode 100644 linux-user/sparc/sockbits.h

diff --git a/linux-user/socket.h b/linux-user/socket.h
index 036270a6e4..dfa692286b 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -4,50 +4,10 @@
 #include "alpha/sockbits.h"
 #elif defined(TARGET_HPPA)
 #include "hppa/sockbits.h"
+#elif defined(TARGET_SPARC)
+#include "sparc/sockbits.h"
 #else
 
-#if defined(TARGET_SPARC)
-    /** sock_type - Socket types
-     *
-     * Please notice that for binary compat reasons SPARC 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_DCCP - Datagram Congestion Control Protocol socket
-     * @SOCK_PACKET - linux specific way of getting packets at the dev level.
-     *                For writing rarp and other similar things on the user
-     *                level.
-     * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
-     * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
-     */
-
-    #define ARCH_HAS_SOCKET_TYPES          1
-
-    enum sock_type {
-           TARGET_SOCK_STREAM      = 1,
-           TARGET_SOCK_DGRAM       = 2,
-           TARGET_SOCK_RAW         = 3,
-           TARGET_SOCK_RDM         = 4,
-           TARGET_SOCK_SEQPACKET   = 5,
-           TARGET_SOCK_DCCP        = 6,
-           TARGET_SOCK_PACKET      = 10,
-           TARGET_SOCK_CLOEXEC     = 020000000,
-           TARGET_SOCK_NONBLOCK    = 040000,
-    };
-
-    #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-    #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
-
-    #define TARGET_SO_PASSSEC        31
-#else
-    #define TARGET_SO_PASSSEC        34
-#endif
-
     /* For setsockopt(2) */
     #define TARGET_SOL_SOCKET      1
 
@@ -103,11 +63,11 @@
 
     #define TARGET_SO_PEERSEC              31
 
+    #define TARGET_SO_PASSSEC              34
 #endif
 
 #ifndef ARCH_HAS_SOCKET_TYPES
     /** sock_type - Socket types - default values
-     *
      *
      * @SOCK_STREAM - stream (connection) socket
      * @SOCK_DGRAM - datagram (conn.less) socket
diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h
new file mode 100644
index 0000000000..d51ae5f84f
--- /dev/null
+++ b/linux-user/sparc/sockbits.h
@@ -0,0 +1,104 @@
+#define TARGET_SOL_SOCKET                        0xffff
+
+#define TARGET_SO_DEBUG                          0x0001
+#define TARGET_SO_PASSCRED                       0x0002
+#define TARGET_SO_REUSEADDR                      0x0004
+#define TARGET_SO_KEEPALIVE                      0x0008
+#define TARGET_SO_DONTROUTE                      0x0010
+#define TARGET_SO_BROADCAST                      0x0020
+#define TARGET_SO_PEERCRED                       0x0040
+#define TARGET_SO_LINGER                         0x0080
+#define TARGET_SO_OOBINLINE                      0x0100
+#define TARGET_SO_REUSEPORT                      0x0200
+#define TARGET_SO_BSDCOMPAT                      0x0400
+#define TARGET_SO_RCVLOWAT                       0x0800
+#define TARGET_SO_SNDLOWAT                       0x1000
+#define TARGET_SO_RCVTIMEO                       0x2000
+#define TARGET_SO_SNDTIMEO                       0x4000
+#define TARGET_SO_ACCEPTCONN                     0x8000
+#define TARGET_SO_SNDBUF                         0x1001
+#define TARGET_SO_RCVBUF                         0x1002
+#define TARGET_SO_SNDBUFFORCE                    0x100a
+#define TARGET_SO_RCVBUFFORCE                    0x100b
+#define TARGET_SO_ERROR                          0x1007
+#define TARGET_SO_TYPE                           0x1008
+#define TARGET_SO_PROTOCOL                       0x1028
+#define TARGET_SO_DOMAIN                         0x1029
+#define TARGET_SO_NO_CHECK                       0x000b
+#define TARGET_SO_PRIORITY                       0x000c
+#define TARGET_SO_BINDTODEVICE                   0x000d
+#define TARGET_SO_ATTACH_FILTER                  0x001a
+#define TARGET_SO_DETACH_FILTER                  0x001b
+#define TARGET_SO_GET_FILTER                     TARGET_SO_ATTACH_FILTER
+#define TARGET_SO_PEERNAME                       0x001c
+#define TARGET_SO_TIMESTAMP                      0x001d
+#define TARGET_SCM_TIMESTAMP                     TARGET_SO_TIMESTAMP
+#define TARGET_SO_PEERSEC                        0x001e
+#define TARGET_SO_PASSSEC                        0x001f
+#define TARGET_SO_TIMESTAMPNS                    0x0021
+#define TARGET_SCM_TIMESTAMPNS                   TARGET_SO_TIMESTAMPNS
+#define TARGET_SO_MARK                           0x0022
+#define TARGET_SO_TIMESTAMPING                   0x0023
+#define TARGET_SCM_TIMESTAMPING                  TARGET_SO_TIMESTAMPING
+#define TARGET_SO_RXQ_OVFL                       0x0024
+#define TARGET_SO_WIFI_STATUS                    0x0025
+#define TARGET_SCM_WIFI_STATUS                   TARGET_SO_WIFI_STATUS
+#define TARGET_SO_PEEK_OFF                       0x0026
+#define TARGET_SO_NOFCS                          0x0027
+#define TARGET_SO_LOCK_FILTER                    0x0028
+#define TARGET_SO_SELECT_ERR_QUEUE               0x0029
+#define TARGET_SO_BUSY_POLL                      0x0030
+#define TARGET_SO_MAX_PACING_RATE                0x0031
+#define TARGET_SO_BPF_EXTENSIONS                 0x0032
+#define TARGET_SO_INCOMING_CPU                   0x0033
+#define TARGET_SO_ATTACH_BPF                     0x0034
+#define TARGET_SO_DETACH_BPF                     TARGET_SO_DETACH_FILTER
+#define TARGET_SO_ATTACH_REUSEPORT_CBPF          0x0035
+#define TARGET_SO_ATTACH_REUSEPORT_EBPF          0x0036
+#define TARGET_SO_CNX_ADVICE                     0x0037
+#define TARGET_SCM_TIMESTAMPING_OPT_STATS        0x0038
+#define TARGET_SO_MEMINFO                        0x0039
+#define TARGET_SO_INCOMING_NAPI_ID               0x003a
+#define TARGET_SO_COOKIE                         0x003b
+#define TARGET_SCM_TIMESTAMPING_PKTINFO          0x003c
+#define TARGET_SO_PEERGROUPS                     0x003d
+#define TARGET_SO_ZEROCOPY                       0x003e
+#define TARGET_SO_SECURITY_AUTHENTICATION        0x5001
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT  0x5002
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK    0x5004
+
+/** sock_type - Socket types
+ *
+ * Please notice that for binary compat reasons SPARC has to
+ * override the enum sock_type in include/linux/net.h, so
+ * we define ARCH_HAS_SOCKET_TYPES here.
+ *
+ * @SOCK_STREAM - stream (connection) socket
+ * @SOCK_DGRAM - datagram (conn.less) socket
+ * @SOCK_RAW - raw socket
+ * @SOCK_RDM - reliably-delivered message
+ * @SOCK_SEQPACKET - sequential packet socket
+ * @SOCK_DCCP - Datagram Congestion Control Protocol socket
+ * @SOCK_PACKET - linux specific way of getting packets at the dev level.
+ *                For writing rarp and other similar things on the user
+ *                level.
+ * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
+ * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
+ */
+
+enum sock_type {
+    TARGET_SOCK_STREAM      = 1,
+    TARGET_SOCK_DGRAM       = 2,
+    TARGET_SOCK_RAW         = 3,
+    TARGET_SOCK_RDM         = 4,
+    TARGET_SOCK_SEQPACKET   = 5,
+    TARGET_SOCK_DCCP        = 6,
+    TARGET_SOCK_PACKET      = 10,
+    TARGET_SOCK_CLOEXEC     = 0x400000,
+    TARGET_SOCK_NONBLOCK    = 0x4000,
+};
+
+#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
+#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
+
+#define ARCH_HAS_SOCKET_TYPES 1
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h
  2017-09-25 23:19       ` [Qemu-devel] [PATCH v2 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
@ 2017-09-25 23:19         ` Carlo Marcelo Arenas Belón
  2017-09-25 23:19           ` [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type Carlo Marcelo Arenas Belón
  2017-10-11 12:58           ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Laurent Vivier
  0 siblings, 2 replies; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio, Carlo Marcelo Arenas Belón

enable SO_REUSEPORT as a sideeffect and add SO_GET_FILTER alias

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 linux-user/socket.h | 59 +++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 48 insertions(+), 11 deletions(-)

diff --git a/linux-user/socket.h b/linux-user/socket.h
index dfa692286b..6f49255b5f 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -27,7 +27,7 @@
     #define TARGET_SO_PRIORITY     12
     #define TARGET_SO_LINGER       13
     #define TARGET_SO_BSDCOMPAT    14
-    /* To add :#define TARGET_SO_REUSEPORT 15 */
+    #define TARGET_SO_REUSEPORT    15
 #if defined(TARGET_PPC)
     #define TARGET_SO_RCVLOWAT     16
     #define TARGET_SO_SNDLOWAT     17
@@ -49,21 +49,58 @@
     #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        23
     #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          24
 
-    #define TARGET_SO_BINDTODEVICE 25
+    #define TARGET_SO_BINDTODEVICE            25
 
     /* Socket filtering */
-    #define TARGET_SO_ATTACH_FILTER        26
-    #define TARGET_SO_DETACH_FILTER        27
+    #define TARGET_SO_ATTACH_FILTER           26
+    #define TARGET_SO_DETACH_FILTER           27
+    #define TARGET_SO_GET_FILTER              TARGET_SO_ATTACH_FILTER
 
-    #define TARGET_SO_PEERNAME             28
-    #define TARGET_SO_TIMESTAMP            29
-    #define TARGET_SCM_TIMESTAMP           TARGET_SO_TIMESTAMP
+    #define TARGET_SO_PEERNAME                28
+    #define TARGET_SO_TIMESTAMP               29
+    #define TARGET_SCM_TIMESTAMP              TARGET_SO_TIMESTAMP
 
-    #define TARGET_SO_ACCEPTCONN           30
+    #define TARGET_SO_ACCEPTCONN              30
 
-    #define TARGET_SO_PEERSEC              31
+    #define TARGET_SO_PEERSEC                 31
+    #define TARGET_SO_PASSSEC                 34
+    #define TARGET_SO_TIMESTAMPNS             35
+    #define TARGET_SCM_TIMESTAMPNS            TARGET_SO_TIMESTAMPNS
+
+    #define TARGET_SO_MARK                    36
+
+    #define TARGET_SO_TIMESTAMPING            37
+    #define TARGET_SCM_TIMESTAMPING           TARGET_SO_TIMESTAMPING
+
+    #define TARGET_SO_PROTOCOL                38
+    #define TARGET_SO_DOMAIN                  39
+
+    #define TARGET_SO_RXQ_OVFL                40
+
+    #define TARGET_SO_WIFI_STATUS             41
+    #define TARGET_SCM_WIFI_STATUS            TARGET_SO_WIFI_STATUS
+    #define TARGET_SO_PEEK_OFF                42
+
+    #define TARGET_SO_NOFCS                   43
+    #define TARGET_SO_LOCK_FILTER             44
+    #define TARGET_SO_SELECT_ERR_QUEUE        45
+    #define TARGET_SO_BUSY_POLL               46
+    #define TARGET_SO_MAX_PACING_RATE         47
+    #define TARGET_SO_BPF_EXTENSIONS          48
+    #define TARGET_SO_INCOMING_CPU            49
+    #define TARGET_SO_ATTACH_BPF              50
+    #define TARGET_SO_DETACH_BPF              TARGET_SO_DETACH_FILTER
+    #define TARGET_SO_ATTACH_REUSEPORT_CBPF   51
+    #define TARGET_SO_ATTACH_REUSEPORT_EBPF   52
+    #define TARGET_SO_CNX_ADVICE              53
+    #define TARGET_SCM_TIMESTAMPING_OPT_STATS 54
+    #define TARGET_SO_MEMINFO                 55
+    #define TARGET_SO_INCOMING_NAPI_ID        56
+    #define TARGET_SO_COOKIE                  57
+    #define TARGET_SCM_TIMESTAMPING_PKTINFO   58
+    #define TARGET_SO_PEERGROUPS              59
+    #define TARGET_SO_ZEROCOPY                60
 
-    #define TARGET_SO_PASSSEC              34
 #endif
 
 #ifndef ARCH_HAS_SOCKET_TYPES
@@ -94,6 +131,6 @@
     };
 
     #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-    #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
+    #define TARGET_SOCK_TYPE_MASK  0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
 
 #endif
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type
  2017-09-25 23:19         ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
@ 2017-09-25 23:19           ` Carlo Marcelo Arenas Belón
  2017-10-11 13:23             ` Laurent Vivier
  2017-10-11 12:58           ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Laurent Vivier
  1 sibling, 1 reply; 15+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-25 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio, Carlo Marcelo Arenas Belón

remove unnecessary sock_type enum and other unused surrounding code to
allow for per arch sockbits to mirror better linux headers for maintenance

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 linux-user/alpha/sockbits.h | 36 ----------------------------
 linux-user/hppa/sockbits.h  | 30 -----------------------
 linux-user/mips/sockbits.h  | 35 ---------------------------
 linux-user/socket.h         | 58 ++++++++++++++++++++++-----------------------
 linux-user/sparc/sockbits.h | 35 ---------------------------
 5 files changed, 29 insertions(+), 165 deletions(-)

diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h
index 768579a1f7..defdb806ea 100644
--- a/linux-user/alpha/sockbits.h
+++ b/linux-user/alpha/sockbits.h
@@ -66,39 +66,3 @@
 #define TARGET_SCM_TIMESTAMPING_PKTINFO         58
 #define TARGET_SO_PEERGROUPS                    59
 #define TARGET_SO_ZEROCOPY                      60
-
-/** sock_type - Socket types
- *
- * Please notice that for binary compat reasons ALPHA has to
- * override the enum sock_type in include/linux/net.h, so
- * we define ARCH_HAS_SOCKET_TYPES here.
- *
- * @SOCK_STREAM - stream (connection) socket
- * @SOCK_DGRAM - datagram (conn.less) socket
- * @SOCK_RAW - raw socket
- * @SOCK_RDM - reliably-delivered message
- * @SOCK_SEQPACKET - sequential packet socket
- * @SOCK_DCCP - Datagram Congestion Control Protocol socket
- * @SOCK_PACKET - linux specific way of getting packets at the dev level.
- *                For writing rarp and other similar things on the user
- *                level.
- * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
- * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
- */
-
-enum sock_type {
-    TARGET_SOCK_STREAM      = 1,
-    TARGET_SOCK_DGRAM       = 2,
-    TARGET_SOCK_RAW         = 3,
-    TARGET_SOCK_RDM         = 4,
-    TARGET_SOCK_SEQPACKET   = 5,
-    TARGET_SOCK_DCCP        = 6,
-    TARGET_SOCK_PACKET      = 10,
-    TARGET_SOCK_CLOEXEC     = 010000000,
-    TARGET_SOCK_NONBLOCK    = 0x40000000,
-};
-
-#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
-
-#define ARCH_HAS_SOCKET_TYPES 1
diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h
index 3dab31a76a..32f81357d6 100644
--- a/linux-user/hppa/sockbits.h
+++ b/linux-user/hppa/sockbits.h
@@ -71,33 +71,3 @@
 #define TARGET_SO_PEERGROUPS                    0x4034
 #define TARGET_SO_ZEROCOPY                      0x4035
 
-/** sock_type - Socket types - default values
- *
- * @SOCK_STREAM - stream (connection) socket
- * @SOCK_DGRAM - datagram (conn.less) socket
- * @SOCK_RAW - raw socket
- * @SOCK_RDM - reliably-delivered message
- * @SOCK_SEQPACKET - sequential packet socket
- * @SOCK_DCCP - Datagram Congestion Control Protocol socket
- * @SOCK_PACKET - linux specific way of getting packets at the dev level.
- *                For writing rarp and other similar things on the user
- *                level.
- * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
- * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
- */
-enum sock_type {
-    TARGET_SOCK_STREAM    = 1,
-    TARGET_SOCK_DGRAM     = 2,
-    TARGET_SOCK_RAW       = 3,
-    TARGET_SOCK_RDM       = 4,
-    TARGET_SOCK_SEQPACKET = 5,
-    TARGET_SOCK_DCCP      = 6,
-    TARGET_SOCK_PACKET    = 10,
-    TARGET_SOCK_CLOEXEC   = 010000000,
-    TARGET_SOCK_NONBLOCK  = 0x40000000,
-};
-
-#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
-
-#define ARCH_HAS_SOCKET_TYPES 1
diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h
index 6d8ea8aba2..fa8062391d 100644
--- a/linux-user/mips/sockbits.h
+++ b/linux-user/mips/sockbits.h
@@ -70,38 +70,3 @@
 #define TARGET_SCM_TIMESTAMPING_PKTINFO         58
 #define TARGET_SO_PEERGROUPS                    59
 #define TARGET_SO_ZEROCOPY                      60
-
-/** 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_DCCP - Datagram Congestion Control Protocol socket
- * @SOCK_PACKET - linux specific way of getting packets at the dev level.
- *                For writing rarp and other similar things on the user
- *                level.
- * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
- * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
- */
-enum sock_type {
-    TARGET_SOCK_DGRAM       = 1,
-    TARGET_SOCK_STREAM      = 2,
-    TARGET_SOCK_RAW         = 3,
-    TARGET_SOCK_RDM         = 4,
-    TARGET_SOCK_SEQPACKET   = 5,
-    TARGET_SOCK_DCCP        = 6,
-    TARGET_SOCK_PACKET      = 10,
-    TARGET_SOCK_CLOEXEC     = 02000000,
-    TARGET_SOCK_NONBLOCK    = 0x0080,
-};
-
-#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
-
-#define ARCH_HAS_SOCKET_TYPES 1
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 6f49255b5f..8f21843d14 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -103,34 +103,34 @@
 
 #endif
 
-#ifndef ARCH_HAS_SOCKET_TYPES
-    /** sock_type - Socket types - default values
-     *
-     * @SOCK_STREAM - stream (connection) socket
-     * @SOCK_DGRAM - datagram (conn.less) socket
-     * @SOCK_RAW - raw socket
-     * @SOCK_RDM - reliably-delivered message
-     * @SOCK_SEQPACKET - sequential packet socket
-     * @SOCK_DCCP - Datagram Congestion Control Protocol socket
-     * @SOCK_PACKET - linux specific way of getting packets at the dev level.
-     *                For writing rarp and other similar things on the user
-     *                level.
-     * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
-     * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
-     */
-    enum sock_type {
-           TARGET_SOCK_STREAM      = 1,
-           TARGET_SOCK_DGRAM       = 2,
-           TARGET_SOCK_RAW         = 3,
-           TARGET_SOCK_RDM         = 4,
-           TARGET_SOCK_SEQPACKET   = 5,
-           TARGET_SOCK_DCCP        = 6,
-           TARGET_SOCK_PACKET      = 10,
-           TARGET_SOCK_CLOEXEC     = 02000000,
-           TARGET_SOCK_NONBLOCK    = 04000,
-    };
-
-    #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-    #define TARGET_SOCK_TYPE_MASK  0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
+#if defined(TARGET_MIPS)
+    #define TARGET_SOCK_DGRAM  1
+    #define TARGET_SOCK_STREAM 2
+#else
+    #define TARGET_SOCK_STREAM 1
+    #define TARGET_SOCK_DGRAM  2
+#endif
 
+#define TARGET_SOCK_RAW        3
+#define TARGET_SOCK_RDM        4
+#define TARGET_SOCK_SEQPACKET  5
+#define TARGET_SOCK_DCCP       6
+#define TARGET_SOCK_PACKET     10
+
+#if defined(TARGET_ALPHA) || defined(TARGET_HPPA)
+    #define TARGET_SOCK_CLOEXEC  010000000
+#else
+    #define TARGET_SOCK_CLOEXEC  02000000 /* 0x400000 */
 #endif
+
+#if defined(TARGET_MIPS)
+    #define TARGET_SOCK_NONBLOCK 0x0080
+#elif defined(TARGET_SPARC)
+    #define TARGET_SOCK_NONBLOCK 0x4000
+#elif defined(TARGET_ALPHA) || defined(TARGET_HPPA)
+    #define TARGET_SOCK_NONBLOCK 0x40000000
+#else
+    #define TARGET_SOCK_NONBLOCK 04000
+#endif
+
+#define TARGET_SOCK_TYPE_MASK  0xf
diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h
index d51ae5f84f..70bee083bb 100644
--- a/linux-user/sparc/sockbits.h
+++ b/linux-user/sparc/sockbits.h
@@ -67,38 +67,3 @@
 #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT  0x5002
 #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK    0x5004
 
-/** sock_type - Socket types
- *
- * Please notice that for binary compat reasons SPARC has to
- * override the enum sock_type in include/linux/net.h, so
- * we define ARCH_HAS_SOCKET_TYPES here.
- *
- * @SOCK_STREAM - stream (connection) socket
- * @SOCK_DGRAM - datagram (conn.less) socket
- * @SOCK_RAW - raw socket
- * @SOCK_RDM - reliably-delivered message
- * @SOCK_SEQPACKET - sequential packet socket
- * @SOCK_DCCP - Datagram Congestion Control Protocol socket
- * @SOCK_PACKET - linux specific way of getting packets at the dev level.
- *                For writing rarp and other similar things on the user
- *                level.
- * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
- * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
- */
-
-enum sock_type {
-    TARGET_SOCK_STREAM      = 1,
-    TARGET_SOCK_DGRAM       = 2,
-    TARGET_SOCK_RAW         = 3,
-    TARGET_SOCK_RDM         = 4,
-    TARGET_SOCK_SEQPACKET   = 5,
-    TARGET_SOCK_DCCP        = 6,
-    TARGET_SOCK_PACKET      = 10,
-    TARGET_SOCK_CLOEXEC     = 0x400000,
-    TARGET_SOCK_NONBLOCK    = 0x4000,
-};
-
-#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
-#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
-
-#define ARCH_HAS_SOCKET_TYPES 1
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits
  2017-09-25 23:19 [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
  2017-09-25 23:19 ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
@ 2017-10-11  7:10 ` Carlo Arenas
  2017-10-16 12:32   ` Riku Voipio
  1 sibling, 1 reply; 15+ messages in thread
From: Carlo Arenas @ 2017-10-11  7:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, riku.voipio

ping

some of the patches already have a Reviewed-by as shown by :

  http://patchwork.ozlabs.org/patch/818378/

On Mon, Sep 25, 2017 at 4:19 PM, Carlo Marcelo Arenas Belón
<carenas@gmail.com> wrote:
> the definitions in socket.h are meant to reflect the ones in linux for each
> respective target, but are sometimes difficult to maintain.
>
> hppa (AKA parisc) was initially merged with an independent file that mirrors
> more closely the corresponding one in linux but hasn't been updated since.
>
> this series updates hppa with the latest bits from linux 4.14 and makes sure
> all relevant architectures had a sockbits file that would be easy to maintain
> going forward.
>
> most of the changes are pretty mechanical and I had made (thanks to Laurent's
> tough review) every effort to ensure no value gets changed accidentaly and
> all changes (even the ones where the value remains but is now in a different
> base to better match what was used in the linux headers) are documented, so
> it should be fairly safe and will fix bugs (mostly for sparc).
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits
  2017-09-25 23:19 ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
  2017-09-25 23:19   ` [Qemu-devel] [PATCH v2 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
@ 2017-10-11  8:00   ` Laurent Vivier
  1 sibling, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-10-11  8:00 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: riku.voipio

Le 26/09/2017 à 01:19, Carlo Marcelo Arenas Belón a écrit :
> updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
> include in socket.h changed to prefer a local path like all other qemu
> headers and for consistency and clarity when adding all other arch
> 
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  linux-user/hppa/sockbits.h | 148 +++++++++++++++++++++++----------------------
>  linux-user/socket.h        |   2 +-
>  2 files changed, 78 insertions(+), 72 deletions(-)

As I said for the RFC, I think it's better not to change indentation.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h
  2017-09-25 23:19         ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
  2017-09-25 23:19           ` [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type Carlo Marcelo Arenas Belón
@ 2017-10-11 12:58           ` Laurent Vivier
  1 sibling, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-10-11 12:58 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: riku.voipio

Le 26/09/2017 à 01:19, Carlo Marcelo Arenas Belón a écrit :
> enable SO_REUSEPORT as a sideeffect and add SO_GET_FILTER alias
> 
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  linux-user/socket.h | 59 +++++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 48 insertions(+), 11 deletions(-)
> 
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index dfa692286b..6f49255b5f 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -27,7 +27,7 @@
>      #define TARGET_SO_PRIORITY     12
>      #define TARGET_SO_LINGER       13
>      #define TARGET_SO_BSDCOMPAT    14
> -    /* To add :#define TARGET_SO_REUSEPORT 15 */
> +    #define TARGET_SO_REUSEPORT    15
>  #if defined(TARGET_PPC)
>      #define TARGET_SO_RCVLOWAT     16
>      #define TARGET_SO_SNDLOWAT     17
> @@ -49,21 +49,58 @@
>      #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        23
>      #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          24
>  
> -    #define TARGET_SO_BINDTODEVICE 25
> +    #define TARGET_SO_BINDTODEVICE            25
>  
>      /* Socket filtering */
> -    #define TARGET_SO_ATTACH_FILTER        26
> -    #define TARGET_SO_DETACH_FILTER        27
> +    #define TARGET_SO_ATTACH_FILTER           26
> +    #define TARGET_SO_DETACH_FILTER           27
> +    #define TARGET_SO_GET_FILTER              TARGET_SO_ATTACH_FILTER
>  
> -    #define TARGET_SO_PEERNAME             28
> -    #define TARGET_SO_TIMESTAMP            29
> -    #define TARGET_SCM_TIMESTAMP           TARGET_SO_TIMESTAMP
> +    #define TARGET_SO_PEERNAME                28
> +    #define TARGET_SO_TIMESTAMP               29
> +    #define TARGET_SCM_TIMESTAMP              TARGET_SO_TIMESTAMP
>  
> -    #define TARGET_SO_ACCEPTCONN           30
> +    #define TARGET_SO_ACCEPTCONN              30
>  
> -    #define TARGET_SO_PEERSEC              31
> +    #define TARGET_SO_PEERSEC                 31
> +    #define TARGET_SO_PASSSEC                 34
> +    #define TARGET_SO_TIMESTAMPNS             35
> +    #define TARGET_SCM_TIMESTAMPNS            TARGET_SO_TIMESTAMPNS
> +
> +    #define TARGET_SO_MARK                    36
> +
> +    #define TARGET_SO_TIMESTAMPING            37
> +    #define TARGET_SCM_TIMESTAMPING           TARGET_SO_TIMESTAMPING
> +
> +    #define TARGET_SO_PROTOCOL                38
> +    #define TARGET_SO_DOMAIN                  39
> +
> +    #define TARGET_SO_RXQ_OVFL                40
> +
> +    #define TARGET_SO_WIFI_STATUS             41
> +    #define TARGET_SCM_WIFI_STATUS            TARGET_SO_WIFI_STATUS
> +    #define TARGET_SO_PEEK_OFF                42
> +
> +    #define TARGET_SO_NOFCS                   43
> +    #define TARGET_SO_LOCK_FILTER             44
> +    #define TARGET_SO_SELECT_ERR_QUEUE        45
> +    #define TARGET_SO_BUSY_POLL               46
> +    #define TARGET_SO_MAX_PACING_RATE         47
> +    #define TARGET_SO_BPF_EXTENSIONS          48
> +    #define TARGET_SO_INCOMING_CPU            49
> +    #define TARGET_SO_ATTACH_BPF              50
> +    #define TARGET_SO_DETACH_BPF              TARGET_SO_DETACH_FILTER
> +    #define TARGET_SO_ATTACH_REUSEPORT_CBPF   51
> +    #define TARGET_SO_ATTACH_REUSEPORT_EBPF   52
> +    #define TARGET_SO_CNX_ADVICE              53
> +    #define TARGET_SCM_TIMESTAMPING_OPT_STATS 54
> +    #define TARGET_SO_MEMINFO                 55
> +    #define TARGET_SO_INCOMING_NAPI_ID        56
> +    #define TARGET_SO_COOKIE                  57
> +    #define TARGET_SCM_TIMESTAMPING_PKTINFO   58
> +    #define TARGET_SO_PEERGROUPS              59
> +    #define TARGET_SO_ZEROCOPY                60
>  
> -    #define TARGET_SO_PASSSEC              34
>  #endif
>  
>  #ifndef ARCH_HAS_SOCKET_TYPES
> @@ -94,6 +131,6 @@
>      };
>  
>      #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
> -    #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
> +    #define TARGET_SOCK_TYPE_MASK  0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
>  
>  #endif
> 

As for patch 1/6 don't change indentation, only add the missing lines.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type
  2017-09-25 23:19           ` [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type Carlo Marcelo Arenas Belón
@ 2017-10-11 13:23             ` Laurent Vivier
  2017-10-17 17:36               ` Carlo Arenas
  0 siblings, 1 reply; 15+ messages in thread
From: Laurent Vivier @ 2017-10-11 13:23 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: riku.voipio

Le 26/09/2017 à 01:19, Carlo Marcelo Arenas Belón a écrit :
> remove unnecessary sock_type enum and other unused surrounding code to
> allow for per arch sockbits to mirror better linux headers for maintenance
> 
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  linux-user/alpha/sockbits.h | 36 ----------------------------
>  linux-user/hppa/sockbits.h  | 30 -----------------------
>  linux-user/mips/sockbits.h  | 35 ---------------------------
>  linux-user/socket.h         | 58 ++++++++++++++++++++++-----------------------
>  linux-user/sparc/sockbits.h | 35 ---------------------------
>  5 files changed, 29 insertions(+), 165 deletions(-)

I think it's not a good idea to mix again what we have just unmixed.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits
  2017-10-11  7:10 ` [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Arenas
@ 2017-10-16 12:32   ` Riku Voipio
  2017-10-17 14:35     ` Carlo Arenas
  0 siblings, 1 reply; 15+ messages in thread
From: Riku Voipio @ 2017-10-16 12:32 UTC (permalink / raw)
  To: Carlo Arenas; +Cc: qemu-devel, laurent

On Wed, Oct 11, 2017 at 12:10:04AM -0700, Carlo Arenas wrote:
> ping

Thanks for your patience
 
> some of the patches already have a Reviewed-by as shown by :
> 
>   http://patchwork.ozlabs.org/patch/818378/

Can you send the series without the whitespace-only changes?
 
> On Mon, Sep 25, 2017 at 4:19 PM, Carlo Marcelo Arenas Belón
> <carenas@gmail.com> wrote:
> > the definitions in socket.h are meant to reflect the ones in linux for each
> > respective target, but are sometimes difficult to maintain.
> >
> > hppa (AKA parisc) was initially merged with an independent file that mirrors
> > more closely the corresponding one in linux but hasn't been updated since.
> >
> > this series updates hppa with the latest bits from linux 4.14 and makes sure
> > all relevant architectures had a sockbits file that would be easy to maintain
> > going forward.
> >
> > most of the changes are pretty mechanical and I had made (thanks to Laurent's
> > tough review) every effort to ensure no value gets changed accidentaly and
> > all changes (even the ones where the value remains but is now in a different
> > base to better match what was used in the linux headers) are documented, so
> > it should be fairly safe and will fix bugs (mostly for sparc).
> >

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits
  2017-10-16 12:32   ` Riku Voipio
@ 2017-10-17 14:35     ` Carlo Arenas
  2017-10-20  7:25       ` Laurent Vivier
  0 siblings, 1 reply; 15+ messages in thread
From: Carlo Arenas @ 2017-10-17 14:35 UTC (permalink / raw)
  To: Riku Voipio; +Cc: qemu-devel, laurent

On Mon, Oct 16, 2017 at 5:32 AM, Riku Voipio <riku.voipio@iki.fi> wrote:
> On Wed, Oct 11, 2017 at 12:10:04AM -0700, Carlo Arenas wrote:
>> some of the patches already have a Reviewed-by as shown by :
>>
>>   http://patchwork.ozlabs.org/patch/818378/
>
> Can you send the series without the whitespace-only changes?

sure, but how would you suggest then to do the other changes which are
the overall objective for this?

* fix any incorrect values (mostly sparc, but there are also in all
other archs incorrect names)
* make sure that the arch specific file mirrors as much as possible
linux headers, so it will be straightforward to update them (even
possible through a script)
* update the arch specific files with latest bits from 4.14

should I send those as independent series?, or just as additional
patches in the series, so it is obvious what the dependency is.

there is also the problem with the enum and related defines which was
custom made and probably copy & pasted around

Carlo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type
  2017-10-11 13:23             ` Laurent Vivier
@ 2017-10-17 17:36               ` Carlo Arenas
  0 siblings, 0 replies; 15+ messages in thread
From: Carlo Arenas @ 2017-10-17 17:36 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel, riku.voipio

On Wed, Oct 11, 2017 at 6:23 AM, Laurent Vivier <laurent@vivier.eu> wrote:
> Le 26/09/2017 à 01:19, Carlo Marcelo Arenas Belón a écrit :
>> remove unnecessary sock_type enum and other unused surrounding code to
>> allow for per arch sockbits to mirror better linux headers for maintenance
>>
>> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
>> ---
>>  linux-user/alpha/sockbits.h | 36 ----------------------------
>>  linux-user/hppa/sockbits.h  | 30 -----------------------
>>  linux-user/mips/sockbits.h  | 35 ---------------------------
>>  linux-user/socket.h         | 58 ++++++++++++++++++++++-----------------------
>>  linux-user/sparc/sockbits.h | 35 ---------------------------
>>  5 files changed, 29 insertions(+), 165 deletions(-)
>
> I think it's not a good idea to mix again what we have just unmixed.

do you object to the fact it was done in 2 steps (first moving out
from socket.h and then added it back as a single block)?  it was done
that way to reuse as much as possible the code that was already
reviewed.

the end result is the important part, though; and it is a sockbits.h
for those 4 architectures (and a socket.h for the rest) that could be
automatically generated or compared with the corresponding linux
headers and therefore hopefully be easier to maintain going forward.

since we are going to redo the series anyway, could we get some
discussion/agreement on the design of it?, have to admit I am a little
surprised by all the patches flying by the list but not many
conversations, and being new to qemu linux-user I think I could have
benefited from it to avoid some of the mistakes made.

Carlo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits
  2017-10-17 14:35     ` Carlo Arenas
@ 2017-10-20  7:25       ` Laurent Vivier
  0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-10-20  7:25 UTC (permalink / raw)
  To: Carlo Arenas, Riku Voipio; +Cc: qemu-devel

Le 17/10/2017 à 16:35, Carlo Arenas a écrit :
> On Mon, Oct 16, 2017 at 5:32 AM, Riku Voipio <riku.voipio@iki.fi> wrote:
>> On Wed, Oct 11, 2017 at 12:10:04AM -0700, Carlo Arenas wrote:
>>> some of the patches already have a Reviewed-by as shown by :
>>>
>>>   http://patchwork.ozlabs.org/patch/818378/
>>
>> Can you send the series without the whitespace-only changes?
> 
> sure, but how would you suggest then to do the other changes which are
> the overall objective for this?
> 
> * fix any incorrect values (mostly sparc, but there are also in all
> other archs incorrect names)
> * make sure that the arch specific file mirrors as much as possible
> linux headers, so it will be straightforward to update them (even
> possible through a script)
> * update the arch specific files with latest bits from 4.14
> 
> should I send those as independent series?, or just as additional
> patches in the series, so it is obvious what the dependency is.
> 
> there is also the problem with the enum and related defines which was
> custom made and probably copy & pasted around

I think you should re-send your series without changing any indentation
and without "[PATCH v2 6/6]". So, I think they'll be applied.

Then, if you think the remaining changes are important, you could try to
submit a new patch series to do that.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-10-20  7:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-25 23:19 [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
2017-09-25 23:19 ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
2017-09-25 23:19   ` [Qemu-devel] [PATCH v2 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
2017-09-25 23:19     ` [Qemu-devel] [PATCH v2 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
2017-09-25 23:19       ` [Qemu-devel] [PATCH v2 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
2017-09-25 23:19         ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
2017-09-25 23:19           ` [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type Carlo Marcelo Arenas Belón
2017-10-11 13:23             ` Laurent Vivier
2017-10-17 17:36               ` Carlo Arenas
2017-10-11 12:58           ` [Qemu-devel] [PATCH v2 5/6] linux-user: update default socket.h Laurent Vivier
2017-10-11  8:00   ` [Qemu-devel] [PATCH v2 1/6] linux-user: update hppa sockbits Laurent Vivier
2017-10-11  7:10 ` [Qemu-devel] linux-user: refactor socket.h into architecture specific sockbits Carlo Arenas
2017-10-16 12:32   ` Riku Voipio
2017-10-17 14:35     ` Carlo Arenas
2017-10-20  7:25       ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.