From patchwork Mon Sep 25 23:19:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 9970727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A83976038E for ; Mon, 25 Sep 2017 23:25:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A6A928C57 for ; Mon, 25 Sep 2017 23:25:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F57B28C4C; Mon, 25 Sep 2017 23:25:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 031EE28D0A for ; Mon, 25 Sep 2017 23:25:50 +0000 (UTC) Received: from localhost ([::1]:44732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwckm-0002hV-8E for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Sep 2017 19:25:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwcfF-0007od-PZ for qemu-devel@nongnu.org; Mon, 25 Sep 2017 19:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwcfB-00025J-PT for qemu-devel@nongnu.org; Mon, 25 Sep 2017 19:19:49 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:35582) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwcfB-00024Q-HO for qemu-devel@nongnu.org; Mon, 25 Sep 2017 19:19:45 -0400 Received: by mail-pg0-x243.google.com with SMTP id j16so5683950pga.2 for ; Mon, 25 Sep 2017 16:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aQVEsiSoMmCxK/9xCesTBuJO/5d1WczNt0PsVB54wkk=; b=XPKWeoqgp4fB12aql07zafp8fioFPVQBaSVKrh5j6yWPXINMUG8AAeOQvlZ6wAA31q ZnBDRQq7Do1j1mGWnFI5nKyNme7xuTjEKMMOvH9rsYCE4NXvg3O/viASOZy2FXP8Hsc8 2Wo2bm7DqpDAylLasTNiSve9DxJTaURum7ZqZ5Lw1w+eBaXfB1UsGAvSg9NCO8uNTaTC 7hvYRDpzDyCHejI1N2qCvGAflx2kT0bmEBQtXfkcjxeUkxmR4s3HqHn96/BTmTypqY7+ /X0qB2l4Sy3o3JrkEvniJr2O6HMeJBgSmH7i7VAa2/cx0DnQv6ste0RR2biHj5yDGggq z6bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aQVEsiSoMmCxK/9xCesTBuJO/5d1WczNt0PsVB54wkk=; b=XxqenzVTcYFvcsmut6Q9Rms0skfzP9m5jT7RHtlBwCZcTm0uzsAs03MhIN/bm2wAq0 3NxNKJrdCcDuTI46geUQL/q9Qef3GIwE3LuboDajKyJdC7aUevwUI3FjDMGnDC6mnTe5 PcxZeVr/PjYZ8Vsjar9x7sxKlVnfykrmthcpCw9wmKRrEX1189BoB/qtlEA7//ihpgzE jJOk+Qmrg0N7Ax0Ej0BjkaZM82ao8sdyP2D+gCFT4ZnF64DlFJ0QebI+vZ5AXKy3g00w 2mKZcM8BIJ4M9ornbeKWfu5O189E4WRxz/P1t3qrk2xU0xJcihexZWH/4MnKPKAYkWy1 afeg== X-Gm-Message-State: AHPjjUgtdcsPMphQxxJOsGKkwWjk165kjHeMD7LvPmxPB0AMGRnXkCjL Eko5G2+hb7BP13mEuoT+dYmidA== X-Google-Smtp-Source: AOwi7QAvvHR8emFNtSx2X4jHyumKMWt0Ye0u/I5Z1nnUgeRM4domo9B75OE2efY6+uWmw40pB8LxWQ== X-Received: by 10.84.138.1 with SMTP id 1mr9058108plo.404.1506381584352; Mon, 25 Sep 2017 16:19:44 -0700 (PDT) Received: from 172-11-32-171.lightspeed.mmphtn.sbcglobal.net (50-207-95-178-static.hfc.comcastbusiness.net. [50.207.95.178]) by smtp.gmail.com with ESMTPSA id i87sm13604453pfi.184.2017.09.25.16.19.42 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 25 Sep 2017 16:19:43 -0700 (PDT) From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= To: qemu-devel@nongnu.org Date: Mon, 25 Sep 2017 16:19:24 -0700 Message-Id: <20170925231924.31303-7-carenas@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170925231924.31303-6-carenas@gmail.com> References: <20170925231924.31303-1-carenas@gmail.com> <20170925231924.31303-2-carenas@gmail.com> <20170925231924.31303-3-carenas@gmail.com> <20170925231924.31303-4-carenas@gmail.com> <20170925231924.31303-5-carenas@gmail.com> <20170925231924.31303-6-carenas@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH v2 6/6] linux_user: consolidate sock_type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= , riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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