From patchwork Mon Oct 24 04:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 901EDC38A2D for ; Mon, 24 Oct 2022 06:25:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompY1-0003uB-9V; Mon, 24 Oct 2022 00:58:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXo-0003qC-Dm for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:36 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXi-00066V-QW for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:36 -0400 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wKB6020372; Sun, 23 Oct 2022 21:58:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=MNo6gmgNvmlaFJz8/xTNhlf9gRt8GQNbkh7TRymwHGg=; b=Ku9ao9ROowVDZOCL/aDMt8BAOuDXzvwLntTcvE+VaEWe/V+mFSE62jTUmy+I3mEsOoGP 3K5ybVNyxICtpz4kp1LkJSW2LxxdOPYFxDJdkAMfIKx0QcL41gnP4yWrDNiunPjjdWOy ByCoizT4sXV/HTwO7p+WcTfL9xHhoVUEI8k8ITpo1Q9R9CQ8khKIOzaWQxoIG+tTNw3Q 9ANn8zGAkv+/QMOprbIKU0DCnVzaLqlMMO5tslRoK8GW8CbnrE9wFyn0JGTSCX5UMtKN 1dXqxmfD2+sqY56Ydd+fIIL8Ey0KtkV8zXmrrPXjsjcaXWNy5pO/KMZDv9SHPrUwQI5s 0g== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcbt51s14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KfAMC5jTfjK69gcaePRmhShmpCVMza6sy439Eb/2sPoIPt4SPOBAkGjtNgC8GCI6UKlHTHk5EE0BvcER6QQq5ZkuIr9iZT8Dg1P20b7Wse7YvZ5ZMDHZ3uprfTxGyKjrBpz7UM/n1u1sHkcWsNlpdz9ZbLfV/4bRUhRLctFIE41bLI6sF42HGWQ2RjhCxsKigfbgFqXsBe1CcqDNHLrmxCl0LMBDH8ZewuA5mCiEOuwwxMo5dODKpkDkMgsPghSfDK1jx+/lUzPhme0VakH6My0byen3JrVA2QhhkwFqxBIMKptiGigSGivP/uSi37rWEB5TLfwGsIFeytkyBnWCDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MNo6gmgNvmlaFJz8/xTNhlf9gRt8GQNbkh7TRymwHGg=; b=fkTPWWBHskd7mJmcmprVSCjcKiFTvzjgWor/D8mkY5PqEf52Jr9Hws3jebxRZ1CvgfRfSrV0VSgpXLke4vTTd5yMvjlQlPwLc27t4Y5xcZjM5mYYUGKjq6qah4ZX2FHUcPX9f8MDMXxYMSsoXwbjCurwqM4229CIe1ziTXUl3Z4H8zflmuBvtFa4ok0vxm/KJY+tXfpHpD1y0wsVEtNysA4DWOFyKQM4Q9nByfnXg0AFHVsjjIFN+PSPr3RyfkIWwM2VFntIhGJXgMJo0sBGub/jYbZM5Ml9OCndv8d3cyX//zTN9DUtGTr9xqVkPrZ3YPNP3DQdvmZ1P2GGFGPNog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:18 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:18 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Keno Fischer , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Will Cohen Subject: [PATCH 01/16] qemu/xattr.h: Exclude for Windows Date: Mon, 24 Oct 2022 12:57:44 +0800 Message-Id: <20221024045759.448014-2-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f42da0a-5291-4dee-e079-08dab57c5da8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DyNOX+PVOwJSI9sJN00X2WgRqelElXRYw8ElKIH/Fl28aWQTQJKHwM9NJw6kx+rB1Ga7mToUNkMMZPA49aOPacT3dzCe9/X7m7eRhRxbsuG7xmBLFHrLMqxvw25y9vbxUMasu8+ojF2Iw1vmgz4LfWNrpClIAZdMYsCU8oxgvj2WhHjZ00Me6cqQVLID/GgslNzG7mv6hR1wwGA2BjVp0Opv+f8XNJERafVfLrcPDJ8qdvmnGI7j+fYZjhX4y+kTPaFvCCbNro1tIgaSfXmWxk3vTqNBUtBSiLEQUJy0vGxotbyQIa5CpwUTLmgpksHF69FOVaIhQUpmEVaHdtqkL+sOifGAnGNhWbwFN69WFK63eeKQkXsswQk1pSoQh3Ub1ra2Qu6csFKPig4zMMmsc6g3k4fwz6RMnPC/nXckj2NSBF1avm9FbC2xVcb0Ws2/9lNl1mVN4LON773pxhqaLIqdIqcrZKJE0DWrKXDIZ8b+cSpdJK52P2sl0g3fm13UOfIR1YPwGVskRYF7fP0uDaB+FMQ6bnR0B+l3clKpCpqZU31AWmjtGR9He4vJo0QpIbJIQa93aYsaqrOE+IX0zKt6gKMDfGd32+XXmd2agbzuWVVJCmeCEaq/lZGh26yEOPXnPCo6tLA9/tflJQcljez/rk5majsZPPwgXPNROEx1aLtVviUzZFVCg7qDd5ExYGbb26jTWLnylV2WGY5uPIJGSsctZSk1UMxM/ECyIfgXq4GbIPqE/9qI+cIRsAfI/2qo8PgyX7eROzXfjN50wQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VPHOnYCAR2xeaSRXMM4L/MXqAJfZrzP7Fj1+8FqkmBFv/nmB7QBLrMmRvaAC/8RmnF6Iajhf5uDwdy1D8ZvwtWNW3Te9osIEWskT8bVntxvHUH0bzpnBPMhWNsCCHfpwldXFEZvJLcDjqk31SracT/WAOQy3iCVdvv7ebnPjkGfJbcjrFx/MP/5K356jkypUueuv71IRorZ2LKK61Z7PM0NFxaNuQUD23XaCIil6AbGkwMYy9VTtVtl7ThJsHHvKu/sTQzLATNkCeRz86s1tQkX6rVxwAIBSVmnWxaRBO0/7fyfMjvyXJrmilU5b5K5nMcbvwN2c2d50Z8IkNvq9QKPtg5x1gI6+jRuQp4xHcPjityJ6J4gJDl5pdZFrZPC59fXSv4QT4daBv9IUgTEVwS3qzx6UfO5bysgXnbdkJngBmYzIHOSNDdghD4lEaXjT3CsofmYgs/EMMAB6GmQmVOIOIJalDHZ1b6wRAcTBTojYS/QYYJHkvHHpYbxeXqjjOxF0W0U+tJJ85UTkj9hvebNupnzma6hpBSqZnbufN2x5Bx4FTOdLMrtKvoQm24AfnYEW7aPELJ7ahD6htXW64NXKOeTiQTz37XILR6/AAUZvlnZWiaBHIv+9nt3iyBTKb/dUYUSeRlVbb2TkeDLFK5Jk6TjYos0eaB/jOEvFSxcpfxZKYrJHg/pzrnXNh55uGpg/8hdN4rM47lFNQ2ey0xpYSmKpAL/Ti1oEYMTmTytWSqkQiqG1xAdEAedKbDoACkdFCvS8eZ00/x/Fx6Im9hpCFlMPwa0Gjn+zSn2qy88HH9zwqXgOrhxf84TQGNWPro036efo6UDOzzWH411Je8QcItvd8Bo5Mi71Sz3pqWz5D9Kzocm0Mcca/3nzD+It24p/k4qfZzX/hs+85ipLCAfGBDJYEhVAR/cIGugg/FQS2zEU+YLUHNdfGUr1TFf044KS5F2RKmk+ixkLNXCIIH8LpjRMEX5PAoFfcy0EbxDni04EylejjkZFSuNsizUoRD3i4rT/D4+aVIliVhyt+mdYzZQE5GIKfri4hO4onLOdyLwf1vDeEtCsZTfib4t7Mb6ROPH2IuBu5G9QprEQv4dW98kpiqfmwIqXpVDgh/ZyyGoBQuo0+aVx7tbP4cIH012PnwAw2VgZWAsaG+EO4WbPm9eJC6aC/W4hQx0Ukr8rCWraI+/MBGUNyeUv8LVFfRD5w7THAEGMBrIvjEQnrmCuwBeIkdCMfEzScB6t3XLJVKI6EKpBV1r3gPxsgIl9w6t3sMcxvzFDJMstudqLlwI3+TXM/GF/TQ0dQmOU57AeAAxMB1vhKfEdJZy9z1ec44ezxS5Uz+ougcasdpIHw1iD94z83KueGMhgINXecl8reARjT/nKB6uxeOIW/zov4af0hW9MCc3sLUOphnOvgt+Ef3gxPpspPi6BM+1jDVSnUIt0OQrr4Djiu1d5Qznir6IuGj4T5GfWpE1ZyXoWBO1cE10jITL4h5VAEdHuFDB/Zg2CK6pqIdJMDfZfEiPmM+piNvGzwYiSpE7je0h1NrhDKuanK7gWN3hG25KYHMqQ/lspcotK2yQqbfVHyH9ofE8ow5o1ZQ5w2Zvtzguw/A== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f42da0a-5291-4dee-e079-08dab57c5da8 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:18.0610 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kqyA3vHLRjB2xFK84XZMUPy9PWXKuYsBDrt1yw214D8AubLOjZrbEwvi4wB9X3xWE7PEjnJUl8MhvQpVeKbSng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: iwfSrogsvPxD6tXUM83Qx2MOJJsMFwDH X-Proofpoint-GUID: iwfSrogsvPxD6tXUM83Qx2MOJJsMFwDH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=547 priorityscore=1501 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Windows does not have . Signed-off-by: Bin Meng --- include/qemu/xattr.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/qemu/xattr.h b/include/qemu/xattr.h index f1d0f7be74..b08a934acc 100644 --- a/include/qemu/xattr.h +++ b/include/qemu/xattr.h @@ -25,7 +25,9 @@ # if !defined(ENOATTR) # define ENOATTR ENODATA # endif -# include +# ifndef CONFIG_WIN32 +# include +# endif #endif #endif From patchwork Mon Oct 24 04:57:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F15EC3A59D for ; Mon, 24 Oct 2022 07:13:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompY7-00045B-On; Mon, 24 Oct 2022 00:58:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXp-0003qN-O5 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:38 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXn-00067k-Tb for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:37 -0400 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4mkTM015442; Sun, 23 Oct 2022 21:58:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=JUfNkvsNca0vVxdygxUEC2C5ZSCP6t/V/Z28oTxp0ak=; b=q99Ab1enPsuJL6WRykIF7O6dxPJM52dbtQvN62M96l0Bt/nhtK1up59LuhLx8HSmZUhE cfSQtuD4D6YH/MwdyZwqwnAM/KHJ8LOnsCEKzt1lqMdB3nw/vrg+6K63jdnXNDokaGM+ xLJv3p5izBYUNMLAhQLfyeIhzvNCVcEp/BSS5kmriEdjKefBkduxv0fhx5B/W5xGkwY8 uao509qIDjoyXdcLiwxB2KFiwlOymjYUJEU2isveGe6oSwSYL1Z2WE+N4pewqn1HF097 gKnLIHAyvuvrA8dtkXcmsFAGMwg9LHJRQkMi22vFnq5Vb8n4yDKJw/PFIemeZPatTvuI CA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksma8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9KCZ3PzenzWPIgCY4HTW0qAEf+iLQEdKc69i8an2tSWx61oR3cHM5bvzgKQVKFIUI8lx1sum1FqXE8NHEFVYtmhkiUN2ei/EfQ+Y1HLHMJZgenZp+w6YiuZRvU9yQs3qBIQLBjdlD0rKjuJ6rb/ui1HRF18TSPHZLi/KVOREdr0/RfAge7VcPfVwNAaqKGAbQJdViVOEcawcXEP3NMaFt450PJEKh3xqsb9CbOaO/OuIJY6zR2mLZ80+xTKzeUwvd6yWKFQWPQiYnZCbmQGPHRYKfvpntOo0+n3UaueINXYUe30GzgCN/NKo5IhdC1zfQD4Xi90yB4o6EOi0YPUgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JUfNkvsNca0vVxdygxUEC2C5ZSCP6t/V/Z28oTxp0ak=; b=eAGka9224hX5bN22+wy0EWPPjxGyjf79500y8yxK5aVTJsqnjWvhJjhrWTFjbFh8UbEd2t4SmQ/+g1axNJFWAzx2DRqUMkJhj7LEqCsALn/1iEEyLEoTalfTtQXVnj1Uk1Lri7Mli5wqEnaDZdfqIFMKZ06RRDgyWlFukKx2FG2IMCDDUInPBTIGJNZFzc21hGwqSIFLrxqs501b/r3FWAgPZyW2k4zfFRMRyZL+wdGe/F0fNxG63LIlHAsd9o4BoSRHlaKVPTFuIuBRJuCSh+5GlXxW+K3C2fYcwrH3eFgwv54zb3Xmgjyu6VPFE2tBYnkJeFyCYuYTs1rLtgILsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:20 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:20 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH 02/16] hw/9pfs: Drop unnecessary *xattr wrapper API declarations Date: Mon, 24 Oct 2022 12:57:45 +0800 Message-Id: <20221024045759.448014-3-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d0f00d9-bc29-451f-e72d-08dab57c5eea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 88JKkbMVugABb/dySD+4W0tecLyK8BhoHGD7JhLgTQPOROj9B+7WMlUhMFJfireXS2Y3pS3PTLnSisNEyk4KyQ30iBAigaQ5SCaUqZiTrSh6dPm2AQUOtto99GfRWWBXJytbK2aZJjWgFArlx14/XYG98OaG7CAx5WAKN1bLSHqBaAUwtWe7gy2mCQef8oofBYxWE3ue3QV5Jw0508/MxrO9qmOcVR5JNyQQtEGubq3n83mWWdYf9uU6EgBkskQo2tMiS1U3wtdks+uv5aZLKfnSKLOZvKDsSLCnhtVcOvbljnbX38keuiGj1jZC6iP/xMhwRNq3cQsJM497bFtO1+SvI/xCxeWZOW3QF6sEXZ5oAVHN60UQdHtGTewgfq3IaJtNmbmyLD5HfsTVIzwF/4tp1gdrNeFEW5IqD9NucqGcNMHUQq0SRD2AX9GgsrYhuofc1lz3s+Cn3wv/yw0QKEdPCSP1zPi/PsCO34F2jVyFk2Zptvz9byqje7NrXhkVvTV9Mn6TAn/biYbTLtuuqV8PcrysBk20+lHhoGvQD+0SSeGuM9/EyaRLXATuvRzhCfWFuWfJAGWvxfJU2huhZmTZAONflhb5WiRcFLGLPCgrzbnhNlOEq6bzelr5mf5+1/APPZzyU9SLVLdJlEq3a85aA0nepHrQr+tc+bnsjzChS8hcMfUvW3iUFAOoI4EvOfs5wggzakyaB38q4Fyx/7M4MJoylcW2N4nAfRWhuqVpTVxsKKQDRQLUXDaClpnShoKITFOPsCzpZjHosWpZzg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8Q94tdp1Gbx1RSdTpaflTn3Nun758yYgeN9YDNOpF+UlrxrDmALOmNp5n9mOcyt/ext6CTWLyJvYJcZIB4QalAaWQ2sYEB1htdL22JSUFdQEOE5LVTmK6q8zvjzcukaxnLE5GBgJ5kEV/FxDVMXePeetC3zeTqekIA6KchUhOPMR1xf2NzZMMjPlUJlwlhRJ7Pbx2kjtwon2/9ykzIZ5c+eicgAl2MQkBGq5jMNeMHHuK/m1L2I3ZoqO/Ab0kgAM+vLFq+SOjhOhAqmoANfWCu2kf5xFoXXdqYwv6i9C4kDqdh1Yd5gJldGPMpotvBtfDlHjB0wSpeON3MiI9RvrVo+F8CDfz10jcIT7LaAMt6qGdGpRAAwqu38FAXm+NqkrYYtXPIhnrtTDZWcNA7zDPF38PHNNnbFx3g8gFL80GNv4Awa4MWonhnWw3GZB6V1B8fpoyetnOSLr5CtdqoUpOK3vmUnHKJ6Q3zRwGPF1WAMuuhgRb3yEeQW/DL/qZIOENHYEc312SKchakvLwmKz8Hbk/0eNCVdGeGU4aPu3mzsCMyX54TQb8Owy7YvIr7FzAv6BWmtHXsfxeJ+uXU2UHueYK3h7wh/BOztLieRFkEQQ/cUYmYWjX/j5qz0mD9LPNyP9B6M5VP9c/cYDpjrFbfzj5O88S/wwhoJ/s2qXP++RAcIF0bHGTHUf584JM1ytw+PY/29vIYozohvzW+/g+c2LnppvquA9x+N0iytWSKrasu0rYrJ0GORcG0LBJhl3PkwvvDIabgmQPUG6tr1z07sFrN85c4uKyIiEb5KKq7p16ehGn1ugtL9CPmZS2wGmlp8QkeJW+BA0TT2TAaCMwGVH7R3WE0Juc47yWI4J5unD6CuS8njklZfYCoX8Lq3NkV6nE7tiJZq4bG/m6kQITX54NIEESOQ0QYY+yE8Wf10EyyfYbUoE66IXvj/9YLnArXDlegXdAVqxHpgExtAw7vkBVFaVOWT4CoUBykIIq2T0wGBxyfi1x0ByvSS7ShzIAbro4JEDdx/Yk61OHoVRindWCfIr3fDN3TFSWhSEHKmwrbaVVwF5o1r3311Abz5LG43c0qGBqLqbSnzejBpfmuk21JKXviomdafSSXZKKn+ngB4+2w3AZ5l9MS+ZtQDHEuO+9liMti5OihrMwldb2h+sEjow7F0MidvhFhcrBTQTS50QAcuVRxD9CQSkO2rrXlNSg9a+sIeVxkMOWQuGdJdXBJl7mULvTlKX3brEit5vYPz97x5YqAquOs6Zibq89NKrxyz0iTDn7g/VmJtER6bucpVuQleKC79611RysHU97jquOCgj6/jGSYQFzgMSX80LtafYJpVCCgGPR8SN5mV67kywV+JTc8yByR8OPl9kNuKCDWg0clkoGCWOuc5JIDJxVmx2kCCmsIBbrFQen34XhdIbn7hcxCdfDQ7CwVTjAQMu4Ub+EVO56SEykEHWJQfz7ZNde+vixMYlmmzvoDQk82z2Miknj6jQi/0luYQVrXy6/BQVlasTV2PFm3qczcCojwugQn9/hV0QgTTD1NoubgnSDQT6HTUnnOGF+aGwdzAY/TQHW6aBSQ9r8unDxCT8Y48EQgr+I/fD6/lLlA== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d0f00d9-bc29-451f-e72d-08dab57c5eea X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:20.1245 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Z5mekhV2aOdmqR+4oan8Sv5XGL/xIx4E4ziwy0MUdS8kXIp3SoDc7Xm1STTAC1++T5bTj4s9RpJrUmZwmCeLzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: tL-nEIQB6GDJicQGSK1IzamLjTrRuq37 X-Proofpoint-GUID: tL-nEIQB6GDJicQGSK1IzamLjTrRuq37 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=713 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org These are not used anywhere in the source tree. Drop them. Signed-off-by: Bin Meng --- hw/9pfs/9p-util.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index c3526144c9..ccfc8b1cb3 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -90,19 +90,8 @@ static inline int errno_to_dotl(int err) { #ifdef CONFIG_DARWIN #define qemu_fgetxattr(...) fgetxattr(__VA_ARGS__, 0, 0) -#define qemu_lgetxattr(...) getxattr(__VA_ARGS__, 0, XATTR_NOFOLLOW) -#define qemu_llistxattr(...) listxattr(__VA_ARGS__, XATTR_NOFOLLOW) -#define qemu_lremovexattr(...) removexattr(__VA_ARGS__, XATTR_NOFOLLOW) -static inline int qemu_lsetxattr(const char *path, const char *name, - const void *value, size_t size, int flags) { - return setxattr(path, name, value, size, 0, flags | XATTR_NOFOLLOW); -} #else #define qemu_fgetxattr fgetxattr -#define qemu_lgetxattr lgetxattr -#define qemu_llistxattr llistxattr -#define qemu_lremovexattr lremovexattr -#define qemu_lsetxattr lsetxattr #endif static inline void close_preserve_errno(int fd) From patchwork Mon Oct 24 04:57:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C6FDC3A59D for ; Mon, 24 Oct 2022 05:40:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompY9-0004BR-3P; Mon, 24 Oct 2022 00:58:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXs-0003rx-6t for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:41 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXp-00068B-Kh for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:39 -0400 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4rWf0025182; Sun, 23 Oct 2022 21:58:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=R3zsBy+TCgtsGTT4WRluFlAR+9iL6gS1nLR7/kVXLtw=; b=UMeH1pBQA1Oz8Ea0JiuPOT9EDqY9n2O89+1fS1l+2wBPHSTWGj3YrIWLyFtFXdEEByDu ORPTq8GAyQH/JS8BlUeXgTgLKM5EdqkKL6JocUkG/zYKSCMkU84KkpFwBQISK+1XO0I5 +mjyQoSOz6GeH+WTuCDtDJtQhPSQHmY9+ZbWINqilmcK6R8YHLzh9BECQta+5m13Brx9 xcmhOlj2Goge3GjgejGDPozQuY/wc3I9RSXC6err7TQuGfNe5WJbKDrPRbmfBvbTdLxd RcSjESnjAP9cvG+PvBV7lH+m89RkaEDaPtJjq4OIyn+bVrAT1rnXl8mHDs1yq6OOckpz jA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksma9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JUMIdd4KymK/Am9eUIY5ie+f5fQwP/NfWlcrsEjlnY+Qh5dDg2d3GSqBVjhzb3OUkn3OeF5EUpajg/TptvT47JByylXiGFtg9i2CQ4VdYpJsbQwJ4DkBf2qxOYjX1YZ/uBf/1I912c2Psm/ANfXhv41od/n6smIqEAyj8H/HhWUR/vs6WMbDkvJzGuk5cp63bxGh2CUxsha9gUu+2MxHH0/1eu5aCWL6D6jxiGWLRY9LqyGGx+fweGDg0f5JnBlxko1381AmE0Y9f9eJbZe9riE176enPtm1WzZCiyREmXtY5arT4LEsHppdYm8N0HQwL/caocw/Jsjqe0powd+Bgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R3zsBy+TCgtsGTT4WRluFlAR+9iL6gS1nLR7/kVXLtw=; b=fs70tCrx9RQC31vnSbAKdT29WKG4OVUFHNMpfLXV6i/KwWiYmLoZjkVEX3rsZBrTvAH2wfFOfPY0+H02p3A60rb1LYPHVZslfeEexYy7lpKxgDrAhoEmWA/FrdFxqxSbdML1JSUKijhNT6cFe3RwAvIxaBL8RSAAm8NZykRhLqu684PbbjSDPSRr+a6KRK2OOdLw4eiKBdN4iqoan4Rue450MmbZZ4OJdjE8e11vOZ9O1AJQoNUywlpcI4a+FSxKPM4gr4lUogiJ7pe65VQFrp151NJr5jz9GqA6vUyrsWN7Njqq59TAWZzGd8mXq+YwjHDMME7WEPx27IrQtQViwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:22 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:22 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH 03/16] hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper Date: Mon, 24 Oct 2022 12:57:46 +0800 Message-Id: <20221024045759.448014-4-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 6955e678-2ffa-4b35-1800-08dab57c600e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PRCT7ibY0wUD2y3WjFKuQ0xMGIFPoS9MoA3dn/8LTUIINQmDEMfpFcxUipMqM/98nSWMJ9M1iTDFU+CFXnQO2gDc4CPFvbEoDv2yhadhfBcvJi0nk8iPjWQuqt7L6V7q+PWUfet7McT4PoiOOYdylSoS2IednHFAIXhCw85RVd8GgZHyBOSD94H2S0Cp77H2AS+mhQkm768wGWEf+mBxLSHPSVVJo3buwQnxqyMWwWonS15m7PlbR0Hb4HbGojCqrGEDUAQu65Ixce0xqkbLulmHCWSc2B/1w6qdF82caA+OFDZgfKfwpDXsYqhWnsynxcX9QxrltYGXHkrkkO4NN68N/DeDjd/pcl4FXo4oesbTOXw5tIc2J9QfU9ssOUVoLDsE5eNLMTFL1hWLxpxevEUyt7VlBX9k9rukDVayRneQl95P+55mPPEu6hhxzC2N4cP4S+yEynPftRHeihn/4NullGwxaMJhtBwCfYGZoYuDYJDVAyodFXpf5imME0esbsGKmyEDkdL9YhB6B7lIYh0A4W7fk42oKbRr9XIm8qoeWLzgKkeebalFjyZUPdcOqHJ/la7zj06STrPLLIt4ErXg8fJycy5eLR4ncO4eeM9fn0VojIfe+I/1/l4D/4ZlEjTuCXZrfpz4LlVsli3YiaP2HQTqDICWpaapyj5GotYDW+lnaiDQiVYmQmFM+KUH6njkx+y7bsMiOlbPpNrI2JDuDnxbS0kZaz2Kznl4UNJOCjHO10PLgaxxs3kLZUcFfJemvtEfWN0lq/Eavaqn5g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Focq3eQKubbjDqnAYhEBGRYqpIGy7cCHrUQiKhYaUTKjiK/oTJvTGetxY6JwjYnitwFQxnmss3Nb3S+Df9RQknT2X1D4A+k7jUkkwQUxcQeQupyiUuVJGrjFMRgvi1Jupilc8NFr1papyjSPO45uaPBkhRaS/mp9nBDoDBK0JvxjVBc+QOPhxIbodmptHybWYKsLtqEiLoNvft1Z3ySvFkhFBi1mJWrgvYt1aLKLKMUN+meMAqsV34P1e0lLy6/nTQIH86QOMGpjy3ptOhkPOTEpEdaTBHPqiR8uW+EkOvnrJyObp/bsZIh8JwSAqBeLjIUg8VHwivjuE9ZbICxJtQwsBLZ0FpEVocjOVjNZFN8Z0NOQSttdHV7tgN06bAZ6qzzu81yE1I9D4ps8rIE0FtReqZ9NmhrAUeVxdy6FXj+ZBACVlUD8bKxN7isRT9bznPW5tt+e+ypKNSra5u3Dr5Yva+gdOQ5GkLMw9oX1bMetSBtcSgqbLgwe9iAeln9/O1AD+F93FjwxdsBKuozNOfPy60eeCdvGfsUmd/bjt76+WuFxY7EWnoaJYaLKQAwTtdslPhKTjyZYGRC41hXGhjj11fH5an9cfl4yA+PY1QzcJdnJPbKZdDB4/hog9Z+fQduoSv8osO7NawEosGGv12/7YnP2344LbK0KUdz2zTK9rIWBjBVOrlQ2weMlAvxr5gJxnQrJnwfKigs+x1mM3C69m2BO/DC5yZg4rN/K24N96qnF7p6TXSwXmNND//EM0JUMCYDyObovrMttg33QWNaJTGYvszZKwQ7uIAwRo+9YARmfu4J1CTFtb5cGzx6wrAaN3FIBzBIMn+QDUNRyTdTl8vvFVjyETeqQmOxLEGwjy/Xli3v8Y/AHyEFfF6U3TFYyfQDIGsn84KEptXRLfsjpsnLbPv+wnZksnTvfVrwJg0H1r7NDOzdjgjHYqawlB5Xhn5Js2Hy+EK2I4U5h3/vVLB6OjR1Q2zsHKlNdSRBZW9TdExkJxyihfKENj+IAtdFw3iLqokc8ZNpWRheW6fNMGIIEnUlByvfmloOoQVWPizrNM3S/AiI+C/xrB6JimuTjMDRorFb03E1A5qVLri+gogPNp24YQFGTL4Hg7dHWjj3Pu4/OqdXZxzeo7xBsBG33LlSjkPM68BbTtZxULgc8Mmpo94gkvtI+HyazKBX+IGrXIdeHtf1s3t2trdySx6/MqRviqX6iruGmJhx1dx+rLRvPM6mmMaq/3pHQTt2QfnhvpL8R8/udZABRQb50Mp9o/Ib0IpnwCIq6KGRwaap+2KYpg2eAdFND9dxR7MWgAHOaJG11vKVrAM0XH3vqXZcG/8ZDW8xol6Kcx/vM1shObSD+u41+MIZ7h0xKGIa1v+LEgkk2Ui8Z49VM+v1bG2jQKgUASTGbLdFGhtl7K1yRVwVgMZqE0O7T6VJThCmrE0qeOAmVFrtqy4VTteQNcYjxsFrKRQ7gDQN5vy7xFIpwOb9hA6b4LVIE67zr0EzxSKD6f48oiHQYdtJxVJ14iKFi6Ar2qqG8uDHEiLdW2RosAaAMM4Bgx4EFc+PtOvZR7Xid8+s/qpGa9qfElc9qb4vMNdQG//vaU6IgA4kNtg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6955e678-2ffa-4b35-1800-08dab57c600e X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:22.0006 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bPNsHkZ8lyar6OyuwbTq1rc2UIyzede1tP5lQTcV5ysg9REWRBOc4kpwRhHB13Cc+8oG30jqBBWakBmrjLrAiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: Iz69Qq1NslHgL9AetrOU5nxu-zTyTQVQ X-Proofpoint-GUID: Iz69Qq1NslHgL9AetrOU5nxu-zTyTQVQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=601 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org xxxat() APIs are only available on POSIX platforms. For future extension to Windows, let's replace the direct call to xxxat() APIs with a wrapper. Signed-off-by: Bin Meng --- hw/9pfs/9p-util.h | 15 +++++++++++---- hw/9pfs/9p-local.c | 32 ++++++++++++++++---------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index ccfc8b1cb3..c314cf381d 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -94,6 +94,13 @@ static inline int errno_to_dotl(int err) { #define qemu_fgetxattr fgetxattr #endif +#define qemu_openat openat +#define qemu_fstatat fstatat +#define qemu_mkdirat mkdirat +#define qemu_renameat renameat +#define qemu_utimensat utimensat +#define qemu_unlinkat unlinkat + static inline void close_preserve_errno(int fd) { int serrno = errno; @@ -103,8 +110,8 @@ static inline void close_preserve_errno(int fd) static inline int openat_dir(int dirfd, const char *name) { - return openat(dirfd, name, - O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_PATH_9P_UTIL); + return qemu_openat(dirfd, name, + O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_PATH_9P_UTIL); } static inline int openat_file(int dirfd, const char *name, int flags, @@ -115,8 +122,8 @@ static inline int openat_file(int dirfd, const char *name, int flags, #ifndef CONFIG_DARWIN again: #endif - fd = openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, - mode); + fd = qemu_openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, + mode); if (fd == -1) { #ifndef CONFIG_DARWIN if (errno == EPERM && (flags & O_NOATIME)) { diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d42ce6d8b8..d2246a3d7e 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -103,14 +103,14 @@ static void renameat_preserve_errno(int odirfd, const char *opath, int ndirfd, const char *npath) { int serrno = errno; - renameat(odirfd, opath, ndirfd, npath); + qemu_renameat(odirfd, opath, ndirfd, npath); errno = serrno; } static void unlinkat_preserve_errno(int dirfd, const char *path, int flags) { int serrno = errno; - unlinkat(dirfd, path, flags); + qemu_unlinkat(dirfd, path, flags); errno = serrno; } @@ -194,7 +194,7 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf) goto out; } - err = fstatat(dirfd, name, stbuf, AT_SYMLINK_NOFOLLOW); + err = qemu_fstatat(dirfd, name, stbuf, AT_SYMLINK_NOFOLLOW); if (err) { goto err_out; } @@ -253,7 +253,7 @@ static int local_set_mapped_file_attrat(int dirfd, const char *name, } } } else { - ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700); + ret = qemu_mkdirat(dirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { return -1; } @@ -349,7 +349,7 @@ static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) */ /* First, we clear non-racing symlinks out of the way. */ - if (fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW)) { + if (qemu_fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW)) { return -1; } if (S_ISLNK(stbuf.st_mode)) { @@ -734,7 +734,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { - err = mkdirat(dirfd, name, fs_ctx->dmode); + err = qemu_mkdirat(dirfd, name, fs_ctx->dmode); if (err == -1) { goto out; } @@ -750,7 +750,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { - err = mkdirat(dirfd, name, credp->fc_mode); + err = qemu_mkdirat(dirfd, name, credp->fc_mode); if (err == -1) { goto out; } @@ -990,7 +990,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath, if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { int omap_dirfd, nmap_dirfd; - ret = mkdirat(ndirfd, VIRTFS_META_DIR, 0700); + ret = qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { goto err_undo_link; } @@ -1085,7 +1085,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, goto out; } - ret = utimensat(dirfd, name, buf, AT_SYMLINK_NOFOLLOW); + ret = qemu_utimensat(dirfd, name, buf, AT_SYMLINK_NOFOLLOW); close_preserve_errno(dirfd); out: g_free(dirpath); @@ -1116,7 +1116,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, if (fd == -1) { return -1; } - ret = unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); + ret = qemu_unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); close_preserve_errno(fd); if (ret < 0 && errno != ENOENT) { return -1; @@ -1124,7 +1124,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); if (map_dirfd != -1) { - ret = unlinkat(map_dirfd, name, 0); + ret = qemu_unlinkat(map_dirfd, name, 0); close_preserve_errno(map_dirfd); if (ret < 0 && errno != ENOENT) { return -1; @@ -1134,7 +1134,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, } } - return unlinkat(dirfd, name, flags); + return qemu_unlinkat(dirfd, name, flags); } static int local_remove(FsContext *ctx, const char *path) @@ -1151,7 +1151,7 @@ static int local_remove(FsContext *ctx, const char *path) goto out; } - if (fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { + if (qemu_fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { goto err_out; } @@ -1296,7 +1296,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, return -1; } - ret = renameat(odirfd, old_name, ndirfd, new_name); + ret = qemu_renameat(odirfd, old_name, ndirfd, new_name); if (ret < 0) { goto out; } @@ -1304,7 +1304,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { int omap_dirfd, nmap_dirfd; - ret = mkdirat(ndirfd, VIRTFS_META_DIR, 0700); + ret = qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { goto err_undo_rename; } @@ -1321,7 +1321,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, } /* rename the .virtfs_metadata files */ - ret = renameat(omap_dirfd, old_name, nmap_dirfd, new_name); + ret = qemu_renameat(omap_dirfd, old_name, nmap_dirfd, new_name); close_preserve_errno(nmap_dirfd); close_preserve_errno(omap_dirfd); if (ret < 0 && errno != ENOENT) { From patchwork Mon Oct 24 04:57:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E049C3A59D for ; Mon, 24 Oct 2022 05:10:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYB-0004Fn-Tl; Mon, 24 Oct 2022 00:59:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXu-0003tB-Sk for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:43 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXq-00068W-Bz for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:42 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4mRCJ026938; Mon, 24 Oct 2022 04:58:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=OQo5jnoZPC0PninEK2UB/sHoF3/ivHf4XYEtM2sDYds=; b=UR9towlvPrYnamW1zKh9tTxPLcjtwbQ/MitxeGZ4PoYHfHRdc5L7xCxse99L7snz4hBg sVBna+ICzBCVBo1shEmPMYvfUa7X/ox2v3g7nbfagtY25aEUMxyBLSm/GGTnsYuEle61 qu6apf3GLo6XLlslUN24ElBQVXsO9P5gA+dt6L3ANsgwTSi/xl1zVpf8pJGIMkg/ZrLG tBCTuN34ffm+Ug4wRDEe7LM6u++fhUK3WEkZrma4zaAYWepjQIsytRutXYad2ygk1Lwz a9/KTjqFBKclG8iQKswb+LWSoBOAbHBVLwBKzEh+0S996m4ox/x21yg2AIKKH3t1NGE4 Ug== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jvSu3G6oL6AgAzH12YLzRTAHP54KuJzHoAgqCc+gfskBJqpvspDP2F/90PB+DXyEybiKKF7enCROXZ4R7M6h8fevI5xZ5XnVc7F3gBM6m2ZY4R0uwvoS4Oqd29CW3t4tMa7GPAYO0vm5O+HCZcXBJayBz3QCQB/ZQyXpthSTejdwkb02gU2uw9aPAduIhYAuQM+/L9YJPNbQ9XZFAsS+kZso5hIhPBSliUVA0jdCI4K7SVagI12XVTKiTuZL1xhBzdDkb1rcz8AIG6Z+B18GksexEui1YYMYi9Jtw4YXN0uyFdjfXLly9zKcEtARHtyIXj427Ez8FjxP6HrqBXTIvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OQo5jnoZPC0PninEK2UB/sHoF3/ivHf4XYEtM2sDYds=; b=ZVJCibscG4t930FOoDqHoX8wVp56hH7bZxhUwLzEWrDxfNUps9vxuP4eRS2L0ILjSgOAU//+B0WaDpJziLymOkd5i/qz2QLCZmJERTWPVK6SVEFjHn72PKNIR3FqORYBiMM28a4gWP2IBh1krbgiHT2raGkPU9l/10US7LlqP1e+5gOeusgVgOHPxGrfYZKqIqFW5IuneQgZjSLmlV128pcJwRq9EX4cqvrWC7so+qBuh9YC6sY9iLGyQt6ESyG0H/M1vdJsNGyaDWdTCgEI0nuzse9ksqVg92z6hJ6gfhY4wgarx3wicEDfi9FLLu5Baxl6aNAGLb3jKVdp/rshIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:23 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:23 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH 04/16] hw/9pfs: Introduce an opaque type 9P_FILE_ID Date: Mon, 24 Oct 2022 12:57:47 +0800 Message-Id: <20221024045759.448014-5-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 109361d9-d446-41c8-113a-08dab57c6125 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B0MqBfurEe9YK7wYpZETeFt+QJneUQfQIb/WRNdeVSumoIiDpHqV2NSnRWje5EOjSDv0lJgAWHvz0KAz+1CErjM9iMDR6ucQ+RNJOrhr3n7NJy8LRKzf0+q86QwYkbgZbMy8aeMqJ0I6bNxTBGtvMixFSV6EaA/7uQ/UV5jCAwYxN3nYZc3ZbQbRV+zhczqajMEx9bYYZfQjOe3LwnKABcFH4yxMLo5cCe9XYUflVewnAmRJ3lWc6f+zVtcXcVJh+SHfL/r2KvTHh2Ho8R9o4Z1K4+RRS491GRT9U0xHtIi65AZQC5UlatIZPeJpaK1LuGUgHhWc4NZSQRsFJW+y4BlPFQMWI8mu6De3SBABTEz1GkE+0TZ1EamWhlpkQp/GvKGkAD1XdJKGDqRpMuqoFnJds1/wlAYz3pHzPSjKdsdqmVlnN5lKKpstIJ2qc6VTMDWTuDNWfF+/rD2WQje8IxJdOlpwByFAgnRHqW9fXWROAk7KUkQeI/nTVwaszyEMQnC1VjXD33wvsbcudBiPwEFccS8zWB4+n98XEzXqSC6U+g+aL3Ldg51Vdxh3Pgx4Ryx7TiXIWfeRlj5kthUAeJRN3KZspl+/tbiRrlA4YzGK79VsSlAfd4z5FwnnQMM1lObtIOZpRGLMAZA9chZ+Bkn8AhOR7W3UO3hz+STbjNAl1yQh8ulT93/21Gam7XrAeDoy5KAxhAefKCc3tj8N5lvfAj6mWo8RYh/JYs4cyEnwfSU0OSuq+4J/ozdN1+yOcHkowQreL4rnTasq+KmatA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(30864003)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CJh5KcNX38mdKLjaQEpwb3m/sFpkz/1gMbEwMDz7nILa4wz222LsM39PU8KXLbQN8wZCOyf9eBr/Y3cFKCHmck5TBfLaM1aP3JDSQVdRzoX+5kLusuoO9NxKG99WtlChw7qqG0+c0WtaE7ST2NdxEGCnR6sGu7McQdwPylGqNB6pSYFepT5Bgj6dJJ5oDRkL1zrAiTnm+sc59/CTVrKChlYFyxpsUaIXxDjW8xjI1uFBLj4jGV4D2LXc7S9jqIqy30xN3peBC90hJvj2P8tVX2X/H43DgMg9ssuoSpGy+arVJDsVEt7WhauDuRtRMypINP8ZUXetC4o57sqSde32rY5FklGqeqmdl6+m6eG95e7uoznHo+F/oMY8Sg8jgQezWMfzv4br3393N5RolmTgO8V0jGIrBCsWYWSkezc2T6PgJm2QCPIBNnP9KZDfRKrIX2p35/cgmG5DJSseukEPeLpSO0GnlUFz/O/KNbyqDMeJ0/jzTvlCrglMsjvktw3oeUTUUR9oDxJOiqVZfC1xyTb9J0d+jiZhnwg1SHqYT1ZsmZD4/Io+qtzeSsz59sIPUWCpH/ujoXXdl+TbqTAUx7gfjPU+Za73RDxIopLCpZVpXnxxDwDPMh4hWr6TaoulHe+fBhlOjiU3KRVcBTWl1G2oXVRjgIY/aW9mamEXa3nXuZq1FdqxUlB0ehlMwfw6suCNIKsTnDQ5neqjudU4PpikuGN5946SnL4ihohNWCO0xLy7soN/zz+TmigtuKYBDK680pNbxk2pxRWL86KomldY53RwTwQle+IJwD3F3EHQKGOGk9q1p95N0EsERZz9So/vKm10hARNVBCz/LMDkkPomsrAN6wQRa0ypTsH5FUYzDwAanqKFniw2bcz2pHwELrunDG1HXvgzuryVsrgqymMv6adf34IISQjH3wNjiMGOGNb9XoH7fCXrg+a1nGpIiTNZnaigZGwtpq7q/kVd1g2RCFgQ80dB5mO9jZLfdjQ68Sx2+2hfs+qXgYZY0+IzxjYUfvK4mx4tdiwi324D9M8s/rrlV2ETjZswqaYhZqe1+r+S9uM3tJhN1N8eU1cloO3MEqe/SsC5LyPZh5OeNUyVuyrQ4Ga6H/xy1THkKfJFOQKijiroUsF7zWfJ0RhoUvO/EAcIqiVOXptIeveAaTqHNUcDovvWhuU8pzx9irX1cJ4coC19dkjOOVD0A5E1vwdZdRM8Ljv9k4R22J3c/TZiFxUGkoEYqRiovtWKvATerDmq4aKBMhM/uNMuXMIrd7scOBQa+yFt6YbRM3oXbQ2cbSw+fHTw4A0Bxv4u4KPrcbAH0tPRGQ3vl+dkyn5uhWHJtvpLclp9KSNCb3uKpDb4rEp+fr55ZCBoTUUqgb/wvOx9q5eZQd7Uk6anxyrgk9j9k661csGvR7xGXeQpf22GIGIltnMfuZs9sfoPrDvOUiPYCP3+DnN74W6A+X2OsY90EbMRleEXVGCmYsWcqLyotW1ePcfXBkMhYZStic4ecQYP9yRAuX7IQ5uMwdhjjEl/lg+ic75Tn6HCfvdfu/Za63kUhuYxb24g067d/9HJlwTfztwPa2fidSqmikoOuDYsv9OiTDCNzzBCzCoAg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 109361d9-d446-41c8-113a-08dab57c6125 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:23.8300 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LEmoPOvarmEKcxG1AT9eCw2uHnWM15XcZmm2YD3gCzu+q2JYrGJNbLNdfLkd40MhzXWOH62NsEwLH7cnT7cH7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: gLl_et4pQfNYBlMgB7YU7VxZ_7MPkNVc X-Proofpoint-ORIG-GUID: gLl_et4pQfNYBlMgB7YU7VxZ_7MPkNVc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Introduce an opaque type to represent a file in the 9pfs. This is file descriptor on POSIX systems. In the upcoming patches, we can extend it to support Windows. With this new opaque type, it significantly reduces the number of deviated code paths when adding Windows support. Signed-off-by: Bin Meng --- hw/9pfs/9p-file-id.h | 21 +++++ hw/9pfs/9p-local.h | 8 +- hw/9pfs/9p-util.h | 28 ++++--- hw/9pfs/9p-local.c | 166 ++++++++++++++++++++------------------- hw/9pfs/9p-util-darwin.c | 14 ++-- hw/9pfs/9p-util-linux.c | 14 ++-- hw/9pfs/9p-xattr.c | 16 ++-- 7 files changed, 150 insertions(+), 117 deletions(-) create mode 100644 hw/9pfs/9p-file-id.h diff --git a/hw/9pfs/9p-file-id.h b/hw/9pfs/9p-file-id.h new file mode 100644 index 0000000000..60cbfbf4dd --- /dev/null +++ b/hw/9pfs/9p-file-id.h @@ -0,0 +1,21 @@ +/* + * 9p file representation for different hosts + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_9P_FILE_ID_H +#define QEMU_9P_FILE_ID_H + +/* + * 9pfs file id + * + * This is file descriptor on POSIX platforms + */ +typedef int P9_FILE_ID; + +/* invalid value for P9_FILE_ID */ +#define P9_INVALID_FILE -1 + +#endif diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index 32c72749d9..c8404063e5 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -13,8 +13,10 @@ #ifndef QEMU_9P_LOCAL_H #define QEMU_9P_LOCAL_H -int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, - mode_t mode); -int local_opendir_nofollow(FsContext *fs_ctx, const char *path); +#include "9p-file-id.h" + +P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, + mode_t mode); +P9_FILE_ID local_opendir_nofollow(FsContext *fs_ctx, const char *path); #endif diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index c314cf381d..1e7dc76345 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -13,6 +13,8 @@ #ifndef QEMU_9P_UTIL_H #define QEMU_9P_UTIL_H +#include "9p-file-id.h" + #ifdef O_PATH #define O_PATH_9P_UTIL O_PATH #else @@ -101,30 +103,31 @@ static inline int errno_to_dotl(int err) { #define qemu_utimensat utimensat #define qemu_unlinkat unlinkat -static inline void close_preserve_errno(int fd) +static inline void close_preserve_errno(P9_FILE_ID fd) { int serrno = errno; close(fd); errno = serrno; } -static inline int openat_dir(int dirfd, const char *name) +static inline P9_FILE_ID openat_dir(P9_FILE_ID dirfd, const char *name) { return qemu_openat(dirfd, name, O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_PATH_9P_UTIL); } -static inline int openat_file(int dirfd, const char *name, int flags, - mode_t mode) +static inline P9_FILE_ID openat_file(P9_FILE_ID dirfd, const char *name, + int flags, mode_t mode) { - int fd, serrno, ret; + int serrno, ret; + P9_FILE_ID fd; #ifndef CONFIG_DARWIN again: #endif fd = qemu_openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, mode); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { #ifndef CONFIG_DARWIN if (errno == EPERM && (flags & O_NOATIME)) { /* @@ -155,13 +158,13 @@ again: return fd; } -ssize_t fgetxattrat_nofollow(int dirfd, const char *path, const char *name, - void *value, size_t size); -int fsetxattrat_nofollow(int dirfd, const char *path, const char *name, +ssize_t fgetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, + const char *name, void *value, size_t size); +int fsetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, const char *name, void *value, size_t size, int flags); -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, char *list, size_t size); -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, const char *name); /* @@ -219,6 +222,7 @@ static inline struct dirent *qemu_dirent_dup(struct dirent *dent) #if defined CONFIG_DARWIN && defined CONFIG_PTHREAD_FCHDIR_NP int pthread_fchdir_np(int fd) __attribute__((weak_import)); #endif -int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev); +int qemu_mknodat(P9_FILE_ID dirfd, const char *filename, mode_t mode, + dev_t dev); #endif diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d2246a3d7e..7e8d8492ea 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -54,18 +54,18 @@ #endif typedef struct { - int mountfd; + P9_FILE_ID mountfd; } LocalData; -int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, - mode_t mode) +P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, + mode_t mode) { LocalData *data = fs_ctx->private; - int fd = data->mountfd; + P9_FILE_ID fd = data->mountfd; - while (*path && fd != -1) { + while (*path && fd != P9_INVALID_FILE) { const char *c; - int next_fd; + P9_FILE_ID next_fd; char *head; /* Only relative paths without consecutive slashes */ @@ -94,20 +94,21 @@ int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, return fd; } -int local_opendir_nofollow(FsContext *fs_ctx, const char *path) +P9_FILE_ID local_opendir_nofollow(FsContext *fs_ctx, const char *path) { return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0); } -static void renameat_preserve_errno(int odirfd, const char *opath, int ndirfd, - const char *npath) +static void renameat_preserve_errno(P9_FILE_ID odirfd, const char *opath, + P9_FILE_ID ndirfd, const char *npath) { int serrno = errno; qemu_renameat(odirfd, opath, ndirfd, npath); errno = serrno; } -static void unlinkat_preserve_errno(int dirfd, const char *path, int flags) +static void unlinkat_preserve_errno(P9_FILE_ID dirfd, const char *path, + int flags) { int serrno = errno; qemu_unlinkat(dirfd, path, flags); @@ -117,9 +118,10 @@ static void unlinkat_preserve_errno(int dirfd, const char *path, int flags) #define VIRTFS_META_DIR ".virtfs_metadata" #define VIRTFS_META_ROOT_FILE VIRTFS_META_DIR "_root" -static FILE *local_fopenat(int dirfd, const char *name, const char *mode) +static FILE *local_fopenat(P9_FILE_ID dirfd, const char *name, const char *mode) { - int fd, o_mode = 0; + P9_FILE_ID fd; + int o_mode = 0; FILE *fp; int flags; /* @@ -134,7 +136,7 @@ static FILE *local_fopenat(int dirfd, const char *name, const char *mode) return NULL; } fd = openat_file(dirfd, name, flags, o_mode); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return NULL; } fp = fdopen(fd, mode); @@ -145,16 +147,16 @@ static FILE *local_fopenat(int dirfd, const char *name, const char *mode) } #define ATTR_MAX 100 -static void local_mapped_file_attr(int dirfd, const char *name, +static void local_mapped_file_attr(P9_FILE_ID dirfd, const char *name, struct stat *stbuf) { FILE *fp; char buf[ATTR_MAX]; - int map_dirfd; + P9_FILE_ID map_dirfd; if (strcmp(name, ".")) { map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd == -1) { + if (map_dirfd == P9_INVALID_FILE) { return; } @@ -187,10 +189,10 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf) int err = -1; char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); - int dirfd; + P9_FILE_ID dirfd; dirfd = local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -233,14 +235,14 @@ out: return err; } -static int local_set_mapped_file_attrat(int dirfd, const char *name, +static int local_set_mapped_file_attrat(P9_FILE_ID dirfd, const char *name, FsCred *credp) { FILE *fp; int ret; char buf[ATTR_MAX]; int uid = -1, gid = -1, mode = -1, rdev = -1; - int map_dirfd = -1, map_fd; + P9_FILE_ID map_dirfd = P9_INVALID_FILE, map_fd; bool is_root = !strcmp(name, "."); if (is_root) { @@ -259,7 +261,7 @@ static int local_set_mapped_file_attrat(int dirfd, const char *name, } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd == -1) { + if (map_dirfd == P9_INVALID_FILE) { return -1; } @@ -296,7 +298,7 @@ update_map_file: /* We can't go this far with map_dirfd not being a valid file descriptor * but some versions of gcc aren't smart enough to see it. */ - if (map_dirfd != -1) { + if (map_dirfd != P9_INVALID_FILE) { close_preserve_errno(map_dirfd); } } @@ -305,7 +307,7 @@ update_map_file: } map_fd = fileno(fp); - assert(map_fd != -1); + assert(map_fd != P9_INVALID_FILE); ret = fchmod(map_fd, 0600); assert(ret == 0); @@ -339,10 +341,11 @@ update_map_file: return 0; } -static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) +static int fchmodat_nofollow(P9_FILE_ID dirfd, const char *name, mode_t mode) { struct stat stbuf; - int fd, ret; + P9_FILE_ID fd; + int ret; /* FIXME: this should be handled with fchmodat(AT_SYMLINK_NOFOLLOW). * Unfortunately, the linux kernel doesn't implement it yet. @@ -362,16 +365,16 @@ static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) /* Fallback for systems that don't support O_PATH: we depend on the file * being readable or writable. */ - if (fd == -1) { + if (fd == P9_INVALID_FILE) { /* In case the file is writable-only and isn't a directory. */ if (errno == EACCES) { fd = openat_file(dirfd, name, O_WRONLY, 0); } - if (fd == -1 && errno == EISDIR) { + if (fd == P9_INVALID_FILE && errno == EISDIR) { errno = EACCES; } } - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return -1; } ret = fchmod(fd, mode); @@ -380,7 +383,7 @@ static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) * link, O_PATH | O_NOFOLLOW causes openat(2) to return a file descriptor * referring to the symbolic link. */ - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return -1; } @@ -401,7 +404,7 @@ static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) return ret; } -static int local_set_xattrat(int dirfd, const char *path, FsCred *credp) +static int local_set_xattrat(P9_FILE_ID dirfd, const char *path, FsCred *credp) { int err; @@ -440,7 +443,7 @@ static int local_set_xattrat(int dirfd, const char *path, FsCred *credp) return 0; } -static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd, +static int local_set_cred_passthrough(FsContext *fs_ctx, P9_FILE_ID dirfd, const char *name, FsCred *credp) { if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid, @@ -478,10 +481,10 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, (fs_ctx->export_flags & V9FS_SM_NONE)) { char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); - int dirfd; + P9_FILE_ID dirfd; dirfd = local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -507,10 +510,10 @@ static int local_closedir(FsContext *ctx, V9fsFidOpenState *fs) static int local_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { - int fd; + P9_FILE_ID fd; fd = local_open_nofollow(ctx, fs_path->data, flags, 0); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return -1; } fs->fd = fd; @@ -520,11 +523,11 @@ static int local_open(FsContext *ctx, V9fsPath *fs_path, static int local_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { - int dirfd; + P9_FILE_ID dirfd; DIR *stream; dirfd = local_opendir_nofollow(ctx, fs_path->data); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } @@ -640,10 +643,10 @@ static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); int ret = -1; - int dirfd; + P9_FILE_ID dirfd; dirfd = local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -667,7 +670,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, FsCred *credp) { int err = -1; - int dirfd; + P9_FILE_ID dirfd; if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -676,7 +679,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, } dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } @@ -719,7 +722,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, FsCred *credp) { int err = -1; - int dirfd; + P9_FILE_ID dirfd; if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -728,7 +731,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, } dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } @@ -816,9 +819,9 @@ static int local_fstat(FsContext *fs_ctx, int fid_type, static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, int flags, FsCred *credp, V9fsFidOpenState *fs) { - int fd = -1; + P9_FILE_ID fd = P9_INVALID_FILE; int err = -1; - int dirfd; + P9_FILE_ID dirfd; if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -832,7 +835,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, flags |= O_NOFOLLOW; dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } @@ -840,7 +843,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { fd = openat_file(dirfd, name, flags, fs_ctx->fmode); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { goto out; } credp->fc_mode = credp->fc_mode | S_IFREG; @@ -856,7 +859,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { fd = openat_file(dirfd, name, flags, credp->fc_mode); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { goto out; } err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); @@ -882,7 +885,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath, V9fsPath *dir_path, const char *name, FsCred *credp) { int err = -1; - int dirfd; + P9_FILE_ID dirfd; if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -891,7 +894,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath, } dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } @@ -903,7 +906,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath, fd = openat_file(dirfd, name, O_CREAT | O_EXCL | O_RDWR, fs_ctx->fmode); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { goto out; } /* Write the oldpath (target) to the file. */ @@ -962,7 +965,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath, char *odirpath = g_path_get_dirname(oldpath->data); char *oname = g_path_get_basename(oldpath->data); int ret = -1; - int odirfd, ndirfd; + P9_FILE_ID odirfd, ndirfd; if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { @@ -971,12 +974,12 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath, } odirfd = local_opendir_nofollow(ctx, odirpath); - if (odirfd == -1) { + if (odirfd == P9_INVALID_FILE) { goto out; } ndirfd = local_opendir_nofollow(ctx, dirpath->data); - if (ndirfd == -1) { + if (ndirfd == P9_INVALID_FILE) { close_preserve_errno(odirfd); goto out; } @@ -996,12 +999,12 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath, } omap_dirfd = openat_dir(odirfd, VIRTFS_META_DIR); - if (omap_dirfd == -1) { + if (omap_dirfd == P9_INVALID_FILE) { goto err; } nmap_dirfd = openat_dir(ndirfd, VIRTFS_META_DIR); - if (nmap_dirfd == -1) { + if (nmap_dirfd == P9_INVALID_FILE) { close_preserve_errno(omap_dirfd); goto err; } @@ -1032,10 +1035,11 @@ out: static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) { - int fd, ret; + P9_FILE_ID fd; + int ret; fd = local_open_nofollow(ctx, fs_path->data, O_WRONLY, 0); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return -1; } ret = ftruncate(fd, size); @@ -1048,10 +1052,10 @@ static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); int ret = -1; - int dirfd; + P9_FILE_ID dirfd; dirfd = local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -1078,10 +1082,11 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, { char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); - int dirfd, ret = -1; + P9_FILE_ID dirfd; + int ret = -1; dirfd = local_opendir_nofollow(s, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -1093,13 +1098,13 @@ out: return ret; } -static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, - int flags) +static int local_unlinkat_common(FsContext *ctx, P9_FILE_ID dirfd, + const char *name, int flags) { int ret; if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { - int map_dirfd; + P9_FILE_ID map_dirfd; /* We need to remove the metadata as well: * - the metadata directory if we're removing a directory @@ -1110,10 +1115,10 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, * mode. We just ignore the error. */ if (flags == AT_REMOVEDIR) { - int fd; + P9_FILE_ID fd; fd = openat_dir(dirfd, name); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return -1; } ret = qemu_unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); @@ -1123,7 +1128,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, } } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd != -1) { + if (map_dirfd != P9_INVALID_FILE) { ret = qemu_unlinkat(map_dirfd, name, 0); close_preserve_errno(map_dirfd); if (ret < 0 && errno != ENOENT) { @@ -1143,11 +1148,11 @@ static int local_remove(FsContext *ctx, const char *path) char *dirpath = g_path_get_dirname(path); char *name = g_path_get_basename(path); int flags = 0; - int dirfd; + P9_FILE_ID dirfd; int err = -1; dirfd = local_opendir_nofollow(ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -1188,10 +1193,11 @@ static int local_fsync(FsContext *ctx, int fid_type, static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { - int fd, ret; + P9_FILE_ID fd; + int ret; fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0); - if (fd == -1) { + if (fd == P9_INVALID_FILE) { return -1; } ret = fstatfs(fd, stbuf); @@ -1276,7 +1282,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, const char *new_name) { int ret; - int odirfd, ndirfd; + P9_FILE_ID odirfd, ndirfd; if (ctx->export_flags & V9FS_SM_MAPPED_FILE && (local_is_mapped_file_metadata(ctx, old_name) || @@ -1286,12 +1292,12 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, } odirfd = local_opendir_nofollow(ctx, olddir->data); - if (odirfd == -1) { + if (odirfd == P9_INVALID_FILE) { return -1; } ndirfd = local_opendir_nofollow(ctx, newdir->data); - if (ndirfd == -1) { + if (ndirfd == P9_INVALID_FILE) { close_preserve_errno(odirfd); return -1; } @@ -1302,7 +1308,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, } if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { - int omap_dirfd, nmap_dirfd; + P9_FILE_ID omap_dirfd, nmap_dirfd; ret = qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { @@ -1310,12 +1316,12 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, } omap_dirfd = openat_dir(odirfd, VIRTFS_META_DIR); - if (omap_dirfd == -1) { + if (omap_dirfd == P9_INVALID_FILE) { goto err; } nmap_dirfd = openat_dir(ndirfd, VIRTFS_META_DIR); - if (nmap_dirfd == -1) { + if (nmap_dirfd == P9_INVALID_FILE) { close_preserve_errno(omap_dirfd); goto err; } @@ -1373,7 +1379,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; - int dirfd; + P9_FILE_ID dirfd; if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { @@ -1382,7 +1388,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir, } dirfd = local_opendir_nofollow(ctx, dir->data); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c index 95146e7354..c509034fb2 100644 --- a/hw/9pfs/9p-util-darwin.c +++ b/hw/9pfs/9p-util-darwin.c @@ -11,8 +11,8 @@ #include "qemu/error-report.h" #include "9p-util.h" -ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size) +ssize_t fgetxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, + const char *name, void *value, size_t size) { int ret; int fd = openat_file(dirfd, filename, @@ -25,7 +25,7 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, return ret; } -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, char *list, size_t size) { int ret; @@ -39,7 +39,7 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *filename, return ret; } -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, const char *name) { int ret; @@ -52,8 +52,8 @@ ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, return ret; } -int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size, int flags) +int fsetxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, + const char *name, void *value, size_t size, int flags) { int ret; int fd = openat_file(dirfd, filename, O_PATH_9P_UTIL | O_NOFOLLOW, 0); @@ -110,7 +110,7 @@ out: return err; } -int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +int qemu_mknodat(P9_FILE_ID dirfd, const char *filename, mode_t mode, dev_t dev) { int preserved_errno, err; diff --git a/hw/9pfs/9p-util-linux.c b/hw/9pfs/9p-util-linux.c index db451b0784..cb5e988354 100644 --- a/hw/9pfs/9p-util-linux.c +++ b/hw/9pfs/9p-util-linux.c @@ -19,8 +19,8 @@ #include "qemu/xattr.h" #include "9p-util.h" -ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size) +ssize_t fgetxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, + const char *name, void *value, size_t size) { char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename); int ret; @@ -30,7 +30,7 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, return ret; } -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, char *list, size_t size) { char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename); @@ -41,7 +41,7 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *filename, return ret; } -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, const char *name) { char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename); @@ -52,8 +52,8 @@ ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, return ret; } -int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size, int flags) +int fsetxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, + const char *name, void *value, size_t size, int flags) { char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename); int ret; @@ -64,7 +64,7 @@ int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, } -int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +int qemu_mknodat(P9_FILE_ID dirfd, const char *filename, mode_t mode, dev_t dev) { return mknodat(dirfd, filename, mode, dev); } diff --git a/hw/9pfs/9p-xattr.c b/hw/9pfs/9p-xattr.c index 9ae69dd8db..aaa364ea4a 100644 --- a/hw/9pfs/9p-xattr.c +++ b/hw/9pfs/9p-xattr.c @@ -78,13 +78,13 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, char *orig_value, *orig_value_start; ssize_t xattr_len, parsed_len = 0, attr_len; char *dirpath, *name; - int dirfd; + P9_FILE_ID dirfd; /* Get the actual len */ dirpath = g_path_get_dirname(path); dirfd = local_opendir_nofollow(ctx, dirpath); g_free(dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { return -1; } @@ -168,11 +168,11 @@ ssize_t local_getxattr_nofollow(FsContext *ctx, const char *path, { char *dirpath = g_path_get_dirname(path); char *filename = g_path_get_basename(path); - int dirfd; + P9_FILE_ID dirfd; ssize_t ret = -1; dirfd = local_opendir_nofollow(ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -196,11 +196,11 @@ ssize_t local_setxattr_nofollow(FsContext *ctx, const char *path, { char *dirpath = g_path_get_dirname(path); char *filename = g_path_get_basename(path); - int dirfd; + P9_FILE_ID dirfd; ssize_t ret = -1; dirfd = local_opendir_nofollow(ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } @@ -223,11 +223,11 @@ ssize_t local_removexattr_nofollow(FsContext *ctx, const char *path, { char *dirpath = g_path_get_dirname(path); char *filename = g_path_get_basename(path); - int dirfd; + P9_FILE_ID dirfd; ssize_t ret = -1; dirfd = local_opendir_nofollow(ctx, dirpath); - if (dirfd == -1) { + if (dirfd == P9_INVALID_FILE) { goto out; } From patchwork Mon Oct 24 04:57:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 168D9C3A59D for ; Mon, 24 Oct 2022 05:01:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYB-0004ES-57; Mon, 24 Oct 2022 00:58:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXu-0003t3-3D for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:43 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXq-00068S-Bj for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:41 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wR9p014323; Mon, 24 Oct 2022 04:58:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=R+duudYh1J0kX/mffKQJ3Z6PLhCTv7qtHEh0HvLqpvo=; b=fPnBjh9nJrw3Aj2/kqBAsPyLndP092C4gLrCR9Nk90hnF/Yb5gdLNhT6Jqvu3hpZI8IL XRygCmC6M4DtD7NNim6z5GR32uaOGoQweA4sc0k2NuBwZHfZkOL6x+ldmJ2bcK1wTwcM Z/N+8vV/W+yOHlrWpVg+OLggaxE+qzJlcLPww1daMAY2PHeBDYHhpUt6deGJGuz8aG/l H+vODrdadT9/nDy0jJYQXd95GqqtRbVYTIB4rf/Ztr8IxkhJpndwAWzgi7RrkkWs7l9s 9LzF1PsRfK/0B/SHg6YEMt9poVEjOtcJ3TBnRVkCA4dMzQVvXQFQGJ2CHp4HsdgBD2Te hg== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XL2ijE9AbRrI4WqsrInfv0fAqjpLNAbeXdR6GRm5lhbSfKnijIohiLTwBz1tR1npSw0GvtTGJWxeR91vXT2i1+We1RKn+YXnROtwkqdu4WgdFp30A9PpuqD4jdp3eznmKlZBByGFbkYSrxtC3oBLm/6tPJGNnEDmt7febSDqCNhC4cbDVZEA3GnoDf2f/pBL3o9dtUIPJZi1Z3VMBKeSk+YzxttZ67E/D/uYECOCERCSIs7xEeCuDqPJeBSpSdh1DLEjwiicc6eeR5hKod2EJzOEIEKrhfHCi3bNDeR88KKAetBDv7KRiN0c8SHGkV71E5/CGdDk1sHHEU3gat35Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R+duudYh1J0kX/mffKQJ3Z6PLhCTv7qtHEh0HvLqpvo=; b=NI4XLtejuvOoaXaQ++4fJBu3OWwxlRMfaUIj4WDKcQ6bVfy6BUOXLQi64vh+wvi7TA37pVZw8eBWVabKtStMj+FLkA0A83SLgKcYlD/pUQmW/7ezj7ENnCHCZw3tiTwaO6ERr/iLdhRbVlKY5WyzyIORVNSSVbk1okGhLnnnNimtmd2kJyXN4SJz78ephtAvWlvEHmmrJI8dxpWnT+Vr3sPdAdzT0/dIR0vzUMciXbFMdjzLxE1GejEWPQMwXuat2emB1odgbpPqQU21yXoTeezpIGLZRJtlsg2J+tjQuJmEt/ovkn/+H7kJ2Apwhxw6aIUJSTI6MwiQcLO3qCitCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:25 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:25 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH 05/16] hw/9pfs: Update P9_FILE_ID to support Windows Date: Mon, 24 Oct 2022 12:57:48 +0800 Message-Id: <20221024045759.448014-6-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: c17bee60-238e-42bf-e4f2-08dab57c624c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wgghzCmL7QuXl/OVZzPBacudKlptNLbmLMSt7iuiur2leIHj1WHKXaB0LLix/dORcEuxJSbmnbxPKq3qmTotkK7nIt6RcIPeYqxCKG53Yz2BaGtFobiYppvCumoqL4zE9sg3hQIv3PU+38Vc2C0cNAY2gChRvhVyIUQ0Ftc+4DfKUlJ3ImdhBg9RMU0++i3f0JBx3jwwBcrL5cndxjS3hGLY/Z2pDqmj9dxU0PlYOKSgaGGSyAyBMvUac57lg4zyTMB2ui+BHI6QnZQvUE//lG763RXpyZSsxOhK3OZWMtyDXJZo70m82zCD0aAAn2ds7rQePf8uDNatW4XCvN000kY998ISmmo+WZad5qhwCeIHBYtyiYITFA/Lvrp5MW4ZzdC8ReUkyR0jrs9sGAtby86YVJGAzn7qgfO1JEahroL6VfanhtNsK1AXdA9ieew3NflFjFmvbriJWMkCHwh/oLkck4P8j/o1OgoOvm4v8B7zyvz58+mcHR22KhiJ/UR68kmSBdnfUJ4hECRai+axg8egcqbkYnT7jEKVY11kbuxs9MQfdDt4q4MNh06/M3RpQUTKG7N6g8u2q7E0w1rW9J3TCfhN8lQ95DbQ8Px9bMqBMUC9HteTeX2aV5eGAfkR7hbV+dqICai3G765hK6/5ETk169Z64AHwqFJWMCFMeKj0Sqy5OZ6/613+o5AcUdBrlaqPORfxc9aSXXS+JKJRdjz1H9aNRBdNxWP7/X4/+oEmR/8N2mTFg42cc1padmq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3meQ3teh1xTxL/vK6ffceVuDlVALCGREa1OjlVvMwfByggkKd1qBonnHrfZruilPLPQoF89MMydcfUVME3VQgh72CN8NyoV49K4++Dwq9uNpqsj+fa3geu2SUW9r1pTe47AUJzbFZJu7RqD0Zit8DUkTy058IgMpqt07PvKok8OS4wlkT4uMVjaORN1DoB6fyLfAR/sEKYTsNsQy2UbXuIxm3C/Hb8vHFqCjn7+izR+wSPn3TBPTAAPo4RWHY+sVvuXjJuTPcBmqdCDwkrv3U6MbMEmjtHDuK51V5MSK0UFVJydyNEqnr09tyPl7zHtKn687hXlQubgh6JTVapGq5SI+WVZSFJca0LuRH1KgMfDDSYVRDZWJumHGWN7mA069u73OLjcTkA5WNWApc1OOTiIwUFs0+u+aIc9gVYDkddX4aHX7Rh2ZLNv1ibRrhK8BBLADitEN7z8LuVp1sO5oLhy6aN+gLhnSOb/7JKOYaWblb6xYFGuLk7dQfuYfd6VCzsKOm0LxiR85SnKreyA20BJFDNbp3SOt1pjP19a/0X+O7tOlE+P9Y9EF+eDBZ8u+YIN3ljQDKByRscXOScVtqnxp0KozCFbZe002hpq/9VcgKNeI5y0peqxKwGGY2bZM8Gy2pzn3reYOuc3qJqEfAUQPhaTM2x8te3lExa+j801qlb5ohKh/EJnOvsidD/rGm4QW/Rzx2+yNCZtLW0tCpS3M4NYvh4gY08OzkmaBJtn3F5FV6TmMFTYs70fFhB1w+sOH8r7eiwpAC4ars3hv7+CPighnOsP75o5O7HRMfv+GkE9VlNDnRDghKMWp2vnb8xkqdJ3+oqeHENKjPhX9ZCt4T83HivnxAAcfcR2FPE3vHkcERqTE+O4G2V7iQmjWO+CzJDXWFG1WXLq90VD4ge2dimunP2FFz1+CG/SQ++Gq7IEuZ7UNJt643qXYye4eJc9W01zqYJaDQlNxvr3AoY6idljABYmqjeERj+tAgxt5LlCRFbRQKOkxCS+4eALC+RQ8EvLcHlolrziAfR4c8gu3CcUB/sEDqHcreh16xZK/GYsSc6pIvCac2dr6ye4i5OQw4CD8bP3c5vqjgGxJvSN7TxaLKMMeHYV3aGghT6/S3nC/7uUbRcyCa5AfmvgB0NpAKDcFjjg7WmjAECMPsenOVX/1FO/FymYaQlH9VNKarRHL6CQxGqDQVvCG3cwBlODywowVwN6w5ww3td/HPc6pNZOLqSL89cr5wPYkPT337cCpVELUC1L2cnJqP14Eb9H7sBcJYobyAs7LcgQwvqVgRGhbFmx8PD9QHZTlZKT+2KExDzC0I4jCsIOiHW0uBHbt59yBoGLH++1iqbaQd7nqKATGZmxPNHj7+87EqGEmcW52Qi9UgARlZyF//rvcR4qZgnZT5AYjTn9dyKREFmbj1rPox7xHIbFHIv1Ju6v2SMoIpuWYty1jv3aIzW1hWrVQME1JIdNorQ/Kaehz8IQSq9IuCT6OEHXnhN4/8JwkbMthDqaVVpw3guwlJuMZlCpLTkpDIOvN4czvsOdPbT1AsjWFdRH/wAZufX4QaXcqEp6h6xgm25FzeRaH2YqoS3/0ESaXjo7eRINmZeWuJg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c17bee60-238e-42bf-e4f2-08dab57c624c X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:25.7999 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /07WMoAiTCyyzHOyPsINbGuklX/UHSvEv3EgfCUlrpKwqufbH37p7KwlFb4JrFr6wlgGx4GjWcNX6rk5t9q/WQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: b4cKdonRYx6U4OXJ03rmOZKW6HrrmBHc X-Proofpoint-ORIG-GUID: b4cKdonRYx6U4OXJ03rmOZKW6HrrmBHc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=580 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Windows P9_FILE_ID points to a file handle. Signed-off-by: Bin Meng --- hw/9pfs/9p-file-id.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-file-id.h b/hw/9pfs/9p-file-id.h index 60cbfbf4dd..00903048e6 100644 --- a/hw/9pfs/9p-file-id.h +++ b/hw/9pfs/9p-file-id.h @@ -11,11 +11,19 @@ /* * 9pfs file id * - * This is file descriptor on POSIX platforms + * This is file descriptor on POSIX platforms, handle on Windows */ +#ifndef CONFIG_WIN32 typedef int P9_FILE_ID; +#else +typedef HANDLE P9_FILE_ID; +#endif /* invalid value for P9_FILE_ID */ +#ifndef CONFIG_WIN32 #define P9_INVALID_FILE -1 +#else +#define P9_INVALID_FILE INVALID_HANDLE_VALUE +#endif #endif From patchwork Mon Oct 24 04:57:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB3D2C3A59D for ; Mon, 24 Oct 2022 06:32:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYD-0004Hu-Ki; Mon, 24 Oct 2022 00:59:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXv-0003tC-PL for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:45 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXt-00068u-R9 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:43 -0400 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wTX9017633; Mon, 24 Oct 2022 04:58:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=VUDe3U1eqSLzc8yDGCxSdlQo2llDVsZM9his1/vi9PM=; b=jCil0BNNFw20t14s9vwcxD13kk6+DbF3qEv+U9TEZcL8iDsekALLMZDB+ThOj8E0xUjj pVREvXrhqyKFpBPDB45wAklCcVIL9E2jJf1yfQ6mCEbAS0KSYdvbmQT5s6p7x2qWRGyo Hy/Idg3SfzvV62gxuUHEBdQcy002ZfexYPTbBEQHrWVQTjp1Y9AtOQamholBG+RzMcxj 1fUmSS8dly1T3oIRnt7o/F6o7VduFCWvq8h/2s6ohn/wERNuBmb6WtoCzc/5EkQ0aBSV Ol9WsDNGwy3Asfd5N9bldNay9SlQR4UaESu6fUQvRZa1xCPzYOgQt7mdMZGaqZlzdCE9 bA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc5r2svrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kBUzder0SZgv0ZEt+vj/epDAseviVjH2HwZCsrDvteuOeAcVdtbZ4DhNfFybhvyhGhaLKHKFxoWo7GFE7SLnbE73YBrca6mbCkcNwk94g4DXBWT9NCV4rNVqvk957ZxixY5jA4HQXWPWQWyjIeimpm7bATXBE8sicRRHxuWDd3aD7xStU5f2Niigr2wplm2TTeVe3u2GutdmuErkKKGTXF5Qy2WqBBA/TcFmfIg8U3I34tJnGkwt93o8T1gIWVeXbN4zzvPkDusreP5a0v+nIklHrLauGJR4LsXWha772oJPiXEtv84WvIYuOSrGOWfIzFUuJGYu8bfAAjX2WwhJsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VUDe3U1eqSLzc8yDGCxSdlQo2llDVsZM9his1/vi9PM=; b=PXcYf8hd5xZnBXnP9haTKH9793MCTDugZw1fszFSP5uBDctMPooMCY/2AVKEDT7AQ+rMerhA+BDrzwIWBPaZV6P1O3i2e7/+VW4dhnjuTXQCo6eKirAxSVgjs5AwsB7xWFWdkMLYh070gDu0ohN2KlSGrOp7Egxf3VzBxD9IvPmyoTw1ai6slJi/G7JqFmwSCeRqQtot8llwtqbVRPSSqeOarENzz78xTP6wFRO1DNULjHYUH49WK7GobjnMqvxhdKTg0+1U81Yz6En5Rk0JBRbupFNJU3JEe/NB/5tf521lS7NMSf+GMSp9cuJeCVIed27z+grfw6ejvP6AQaT4yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:28 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:28 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 06/16] hw/9pfs: Add missing definitions for Windows Date: Mon, 24 Oct 2022 12:57:49 +0800 Message-Id: <20221024045759.448014-7-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: e80b15f3-5241-4d0d-30a8-08dab57c63a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FJF3eWOWW4ZknASoHW/J7xnawrAOWfz/A/oebnCau2QHMejf6UNSO5NEFtOK6viSCtC4yzc0W/SJeNivr/c1FsR3mawjX/cFEmxxQ7YUy6n0N3yCizDYgmambx9xaQ6uxdRXk6f6ZQVBk3XySlIcfBbN/1ssXX2kWiu+AWYBbUB1+SRq0IL0hbOGDp7Nu5gx2YFze098L39jbPDUCiR7/bbb9tvUflDE+4ycusHIUDJJEdEMyjwKthLthL8iX0dw0cIV2sMDO7QMLT+NedyjERC2c109rcTeSyv/D1PyuK6v0kS5yrMo+JoVOoclQUmpYaXefhivkmr5mXNFFxLEI2B7ijwSPPPkQsiUzlt+iFN+uBLs0a4KXKmVrw0gRR8qbCPEWv0ypwPtTxPpvIbuIo3eryO93SZ9sKI5pHrNWYzivfyKVgScPn5/cSHpcHRsOsfZ5nAIFtJQWR0hdr3LpPDtQtau79IUyWxrb1OoqEqcD5zTPMWOhW2gbL+fU7TPzhte/kn8+UCPXJPZ0IKLs6Pz9p8PxTj0d+r5zuZh7XEPj4Vqs/Vxn52C3IEmwyAjSEk4FwJbeMFfuApXiEmZOhTTmQW366uTguntFg6dOVmZvWD7JRmm3lTNI3nUHoQfeWkKELOl4aGpStnKedmcMxVKwo1J1K24qPDWSt9p+Ehy9wx0kouZFMtsN/izjfPzYgrB3t93Mv8UQ7XmqTj6Ka5xlozXMGc9g1o/IdQ9uAV9xx/1qfIPD3dDbdTp2PUzJ5s8R0AOcMxF+soW+xHH2/0V7CtYlc9MJCnkcbP6qaQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(966005)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dnVO5QrGsXJpfUz41Ylq47zqqcWSBGefb1ChJvknyQhqsJ/Hz7QlR0OcVVZgAdI0xPgwA7hjquLSGS5/Ssk3UOsZzAsopJObvEhQsyTXFlUzbVufAtMjXQkj6p2UkcFKNlKcs7HY73Yi8u+49eGf9W7ItWAKf8fD54r83GM6M37vWijppFqu2thUJO4zjUaVktDQcMxkGMrQbfPGQQeVHclYVt0HfW2zcOHKZYyUHS/bZNVBxX4dL2lNSXtU2p7SgHlbskCybW0mD16EuAakG5Qvrg89exHRmPIuzZXoo8knh2iLV8oCafvtlnMA9vxAEBTcGjuxqMMZDwGlh1rJxv/botukVDDnvODHW6UlCS4s2EM3gpeVt212PHOj/PZ3PsX2biuMPAfDk9N5jNvjP+AvrNid73J7sVHg98YQw3DPnazOPGmdJHWFbFJK5xIkiuNo+ZYrDKJN+j3P+E9yoA1HQ156cPNnR0dvWp/1bpyyvdD60PP8LyV+S3JO1Mt59H8tjfnRg1tGnnMN7tcncacXNVavheU56nA1BHAcLipDyVe5yFnW7W87ilyywsRyFalDBwHcULeHWq0vQjvvEoX3Z7dBGKaPAZcJnV89Bx8NggY6Gt1DVFdXM+BA9TBDl7cBBgMOvJYokJvm8GrjSL8jDD86PH2kq9ok6/FNHVq+Whtpy4woG8FfI4wFLvwbNTgIyAEGB891ML8FEFbiczvf89j0VLkNjqCM18lK6sY8xjY+jZye977Z0QsYDZoECyczS1AyQj6+t9mNNJZgRdZ+aD8PIbJlm6QD6Y6g2uCYuv8/1x92H4vf84YaOQcJ3ygRpTqXi3GQH+6bZaBogvdehGWbPEIfgY2fOib8kl4MXGLDeGg9ZZO7nTT0/HQY3e4uHLOAsRGmNnPN0LTc54r4yi/wXEQyDHlbX2/F+yt7xe1898A00vSl+i8Tgity/ozbDyYTFdBqxiG/bO6A/MM3EKqQf9fxFQ3gUqnPM0tF3VqZIo85Wc6FP0oFTofpuUjCUmO46jT5m4sKwOGU1dtDAhCDnU9j9bDOJX90qNYFM1yhhHqJmiYWDlFQMJx0Hw4km62hswbPMieeweFNzQKiEDAEWdKr7JkJI3EmR7e/5WKnVUCMR/CtChHD7UfMzdrrzfQ86kkWGnkOy2li41H2LctbeOu8rP9M6Tvni26xe1jnoF3ou6ogOvG12QOhEdtgtNjiYxKDruNCI2RXYiH/hF0jsYeovu+YmRnBcsluw77zqqFWbNOm97uJtQ4645epqxSePpWqTmWUz0ixs7UAIWkw2KZVoduYzUCWen1oEHunxAhM7jkUBL6dZKkk8jKlrLHZRokuHSpwHrnWb1tLln7WBnPAJvGtJ9eKow8LQPab9Me2AjKRDajCrXRkeT476VPN5MoSHCdW8h3HGh05QMCa7F5IKq+8elbwT028suzb+tsDdK6PxCHfwJglIbmOnRMjxplhesYf7jquk04M2pfGmEs6hhgJsPMoKF9JbBMeZ8UTFKTotUOZI72eKPGxKiZJGeVH2Rz2BDWPKFiJVtVJgttIIRyGEhHzfOxyhpVCxviE7HVY0wiNzT0vF+4XAKn6AROLR2uyNnbgXQ== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e80b15f3-5241-4d0d-30a8-08dab57c63a4 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:27.9717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MqZgNQkgWzMrAZRVNRwYwSP1NpJhaUb0rhGMipaZ/3jQ1lwv1XSuryhh+QEsTP76lhiRR7wndemIo+JqZmweCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: sEA-AloqPglvPUw3K7M5LJhx7wE_93sZ X-Proofpoint-GUID: sEA-AloqPglvPUw3K7M5LJhx7wE_93sZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=608 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Some definitions currently used by the 9pfs codes are only available on POSIX platforms. Let's add our own ones in preparation to adding 9pfs support for Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- fsdev/file-op-9p.h | 33 +++++++++++++++++++++++++++++++++ hw/9pfs/9p.h | 11 +++++++++++ 2 files changed, 44 insertions(+) diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 4997677460..7d9a736b66 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -27,6 +27,39 @@ # include #endif +#ifdef CONFIG_WIN32 + +/* POSIX structure not defined in Windows */ + +typedef uint32_t uid_t; +typedef uint32_t gid_t; + +/* from http://man7.org/linux/man-pages/man2/statfs.2.html */ +typedef uint32_t __fsword_t; +typedef uint32_t fsblkcnt_t; +typedef uint32_t fsfilcnt_t; + +/* from linux/include/uapi/asm-generic/posix_types.h */ +typedef struct { + long __val[2]; +} fsid_t; + +struct statfs { + __fsword_t f_type; + __fsword_t f_bsize; + fsblkcnt_t f_blocks; + fsblkcnt_t f_bfree; + fsblkcnt_t f_bavail; + fsfilcnt_t f_files; + fsfilcnt_t f_ffree; + fsid_t f_fsid; + __fsword_t f_namelen; + __fsword_t f_frsize; + __fsword_t f_flags; +}; + +#endif /* CONFIG_WIN32 */ + #define SM_LOCAL_MODE_BITS 0600 #define SM_LOCAL_DIR_MODE_BITS 0700 diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 994f952600..670f5dc4fb 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -3,13 +3,24 @@ #include #include +#ifndef CONFIG_WIN32 #include +#endif #include "fsdev/file-op-9p.h" #include "fsdev/9p-iov-marshal.h" #include "qemu/thread.h" #include "qemu/coroutine.h" #include "qemu/qht.h" +#ifdef CONFIG_WIN32 +#define NAME_MAX MAX_PATH + +/* macros required for build, values do not matter */ +#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links */ +#define AT_REMOVEDIR 0x200 /* Remove directory instead of file */ +#define O_DIRECTORY 02000000 +#endif + enum { P9_TLERROR = 6, P9_RLERROR, From patchwork Mon Oct 24 04:57:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CAAAC3A59D for ; Mon, 24 Oct 2022 06:30:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYT-0004Qx-0v; Mon, 24 Oct 2022 00:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY2-0003zK-JV for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:51 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXy-0006AX-O2 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:50 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4uZvQ011846; Mon, 24 Oct 2022 04:58:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=6aclRzkAXh0uzcBoQTvPL1E++MVkrMwSiPU1IskNBXU=; b=UlgFe+d5GugHlqC8cbVFzTPZlRwzd8q6F6ghN78UBduswv+O2mwFlyxW8eE+TMtQmE08 jucl/VCkDfAJbjlSfEB0ao3Fg+t3I6qZLGqR+XQAeIYeusN96JfvyhdknfLEKmDWboLp PWvxbNrR6kRQlCAeqDEQV4pzPUiYGE5IZTl6V7U0mCQifOpRhFS7SoAcJRvhOUGbSlMs h+oUGLJKVzwksnsdRLYWEAalYy7e9d8ZjljZHJfIxTDq6XFv1GXMyZHXE2aq8VSH3061 XfCN4eB9fxwjdidynP3xClTc63eUv4Cou1q3Sc3OUAbQQkcyKophUbEUWyNcYO+BHCOr ow== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mNfbY5QGs/3SJiukQYQ2uxJdvw0ZGCsFVz3haXSm/c21N57P3rPUA+Cpc+LsbDrbGDWphGTiOZihW4ZXVXamsTqtxUE2glKdL26IT91lZZ1AdwuHkODEkKvZt968FTTx2jHjW4DpQHJn9UpBogDUMdBZ85xASRt9n19kPzSuYKgpoXSuU9TBhF+Yi1AuiZNXzuld9yCSkBFJUajQ2EZJsnNUu9IJ5mkreBrF36IUcOe2lXdMy8vUSSHM8Su5UU46IBOXj8oahgCOGareq+iR8JSVfQvkXPxthF2SDNnO4J4HfLRoqVCwhslp2gaDkJYIxWPZPKfR/gvRLVX5N+xiBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6aclRzkAXh0uzcBoQTvPL1E++MVkrMwSiPU1IskNBXU=; b=Ztse8BQg4ERaVCdoHw59ifHddZc1mVbE5RlzzSsuf2ydCwKvkpjmtkxSgVZp+PMg5/i6142dR1FH5jKVXcFtXwweGLB7LxFgyw4z983qT4u4/G0mfnJdvwccUxalbpTLdsU36Aos/ZFBLTZttb11BRD4NhzCXW2KmWhvcVSH3btX8HaTCVqImFS0cOiw0f0RbU8NJeIYS6tlKUHCxA1DVJw5sJ5gfHg9aUoIIdlJ+L2GOJNB0bJiVueot+0xNoWWko78nnHA6aRqpKbyKE8JZgCA7Jqts8tSlGnRy4JarbnOEgy1ZQAh3KQl0XhqkAZeWipsZRJPDdCnA75ZvJs1/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:30 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:30 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 07/16] hw/9pfs: Implement Windows specific utilities functions for 9pfs Date: Mon, 24 Oct 2022 12:57:50 +0800 Message-Id: <20221024045759.448014-8-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c95dae0-c5e8-4f48-e237-08dab57c64d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u9fAi5PiNRImI9/iSsb4iBqg9zwfwvF77Omelt6WA3g9DBqFHEFTJT3t7YzMNOR7Cptu6tS/cUgyuwL/4ERLPRhUAUnlBBzYM13DHlqnvrYJHVw7Npxhw1UdEI7gEND2WuOvoo83o9sbGHgiqOQSauZ1TdA+Txw7yZXzXnpKpg1RusUbPW9WnzScnZR7zzSshkfOMbI+zngTgcNqKsT/qQeEHQcU+uOmpkLEiG70nPO+4beXzHtQtSmvthHdfsDRQjHBojAo5f/gwvJeVCSdxCcn75ODwGRUNodwUSAkj57w856m50uvVAfpJjG11Hjc6g483pFWFZWKZqoCLmRv2IfrJPX2bTsP+BQf8V+y9ns1rL4gjCpcipYXjVtOqQR5NR9VGgWhLIIdZJyiQ9YGeBblV6vhgjqr+AasO+w6D2kcI1GMWZu96k7CGs9SBiq9jqT6N/uccfPlznX1Y3ORihoyPgKsGguKxmDlhNe16g5Zrutiq7+UR5fyYCFxdiC6GOIgicUbAkxJ70cG0rVT6QBDk7QmBsgXZpb9w54u47ZMB13gz+lw0HVBZ0tc9LO5rKwUhM/9EiBPx0A4/C22lDXImoBBOZP5rlYkPthkVEZi4D0gQUy8+HJ39fMI43y1DGjPJL6Xzls5xBzgaglpVsJQiTq/WMzyq2VjnfPhkfBHWEIkRRvsA/66t0X4dkW00BnxVO+49y/Af0AcwTUrvSGrvTqIeW5nKJDIwVo9RMZ326SvOcGWhgAFN4IQcOcBuyrU7KBIPLd+GMsJOTeqjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(30864003)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oudslNHSAAq4SHxcgTTBRUTXex2T877Njb7EjxlMVpwP6nJ+8S6PcgChxaIxYi8upSpyrcPWp/UtRjoyTXVa5b3mb7bNGwn9jE27Xx4KLXWBwxd9/om7MWcJrTn6IaqIz0gByTpUoy4CShK8jCnsfdzBPLs8ZUUUAfG6hUpYLLDJ+SXWSax0K89/I5+JPP/GHskm+e/ZJkQXY5Dw7ahwqT5pdyfysEVaE4JXNbxf4w8evqNwmK3lh90zi/S/My/icTyr1SsRXqqywi9oATNCef88rEcuLBrBTwO6fY2xyZh2pQPfXvXUN4g3BAi03GYjs+hO2QdAcGeJ5PJRGitem5mIHM9ZLEcllGA7vDl1WUvBdRaqr+MXmhf7RdICf0Z2VP/B2d8D85fFKAnZIv9ssOa8hH1saR9w1piRfSTKw/xtSuNx0JoFmxmJKEa2xSTy+zrGb31GB733MfJk1Ptkqu7SPTH0nM5syKeqGPDKl7h+ZZBH60/HCQYtmNpleg8kW+ejtb2dYfFRwO7Dfr9KpmhN1X3kFhbeIDc6dEIQsDn84eFE0DUcl3Upk2Wmrue7uIuJkUMpqqWNeuaJTnjSK+Vvhw80kjMh10Vgnc4h0OV2CtADSlawycQ4oA5g7cTY2v/4GHeoto6XYAGke8dw6dWdP5uz5a6sB0FYsF4R10CnAjxXboQDYupficS6ngvM7MGfhp0OI+Q4i5+XASTMi1u1mJjUaOvnlLnrFQwfOBMdW64V94OihYWoHztE1gjPvfci5W6d0i7c5YaAAZwyyAlD1Inj7EuOlIj0jH13oiDHno84KxCeEVPrirNhNt+6CbSFhtflwvJDpaa53EcvuloUaxZ2RQ4wOMtPfd3/CtPTqSZDk109eNPSXlCbQIsaLs3rjeF6Zh6YU936C9eRktS5ZdTUDCewbAbkMkwbuXtDlY5cb8modYbEuY1TYWygQrEbjBDnj873wMBsxkxx+GsWfj31Yb1cT4hEDJrO6eZg0j8K/K6vuVkkl0yoKXqv1vzzRa+70fBNnX5pbUho33QXvU+lVpTJrlXohDL2zAVntJcRM39MtGdz/hh6Qz0HnXRyNr4FdLW1eOl0dkwauuxO/QaQxkcXSYhWLo1fVDrzOTuayfPIqARMgOvCfbVXiKglneSoWuppZsHqai/ktmeD4TtltyiZFpCe4Jj693feJp11twBVCZXHk7iy4o2dQ3XamnGMKJDlKUZlSOOc25rBsbnHLFDP3lj+bAG7HRGXi++2rA2QIoZWcBX7WlmZHz5tYkJfvO2ucLXCWdS/K1SvPTJoacjghmFp9XgeWBnkuHBQBc4046IQgAOiRaSZ0Hnot9QdxEi56tdMyV3VCmLnpu2BCDDu0vGwKyH4erC/9hxZKjcH0cikkHFmb595Tv/B6nl6wJxDduRs9fHg9VUMAWZpAr19uh83LLVxwvziiUzNpisKVCqdtjCowANDIJ8x9jM4Nscsqhi8yDa/ulXzBHXYh6g0dq35+WhFnsc002Wh3zTGlrVGLvT3O4BKMuy20TLGStFWzMURE+/dMk0z2SdoJJqf0hkMNKftAnao7KaYcZhNer67mHpoW0Qc0/tHl89LPzAKk6mDnPycZg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c95dae0-c5e8-4f48-e237-08dab57c64d7 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:30.0350 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: md+OxQ+qo/++o9/I6llTYrQSCr8hK92EMb53wFRC8AqL1p9q7o3oUFAngTLKVGpRI+y/7vsPEbpo9AdtvhGc9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: W2M-d8zIpLGoGnVBAt2SiT6cbkL47XJC X-Proofpoint-ORIG-GUID: W2M-d8zIpLGoGnVBAt2SiT6cbkL47XJC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Windows POSIX API and MinGW library do not provide the NO_FOLLOW flag, and do not allow opening a directory by POSIX open(). This causes all xxx_at() functions cannot work directly. However, we can provide Windows handle based functions to emulate xxx_at() functions (e.g.: openat_win32, utimensat_win32, etc.). Windows does not support extended attributes. 9pfs for Windows uses NTFS ADS (Alternate Data Streams) to emulate extended attributes. Windows does not provide POSIX compatible readlink(), and symbolic link feature in 9pfs will be disabled on Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-local.h | 7 + hw/9pfs/9p-util.h | 40 +- hw/9pfs/9p-local.c | 4 - hw/9pfs/9p-util-win32.c | 885 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 931 insertions(+), 5 deletions(-) create mode 100644 hw/9pfs/9p-util-win32.c diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index c8404063e5..02fd894ba3 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -15,6 +15,13 @@ #include "9p-file-id.h" +typedef struct { + P9_FILE_ID mountfd; +#ifdef CONFIG_WIN32 + char *root_path; +#endif +} LocalData; + P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, mode_t mode); P9_FILE_ID local_opendir_nofollow(FsContext *fs_ctx, const char *path); diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 1e7dc76345..82b2d0c3e4 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -90,26 +90,61 @@ static inline int errno_to_dotl(int err) { return err; } -#ifdef CONFIG_DARWIN +#if defined(CONFIG_DARWIN) #define qemu_fgetxattr(...) fgetxattr(__VA_ARGS__, 0, 0) +#elif defined(CONFIG_WIN32) +#define qemu_fgetxattr fgetxattr_win32 #else #define qemu_fgetxattr fgetxattr #endif +#ifdef CONFIG_WIN32 +#define qemu_openat openat_win32 +#define qemu_fstatat fstatat_win32 +#define qemu_mkdirat mkdirat_win32 +#define qemu_renameat renameat_win32 +#define qemu_utimensat utimensat_win32 +#define qemu_unlinkat unlinkat_win32 +#else #define qemu_openat openat #define qemu_fstatat fstatat #define qemu_mkdirat mkdirat #define qemu_renameat renameat #define qemu_utimensat utimensat #define qemu_unlinkat unlinkat +#endif + +#ifdef CONFIG_WIN32 +char *get_full_path_win32(P9_FILE_ID fd, const char *name); +ssize_t fgetxattr_win32(int fd, const char *name, void *value, size_t size); +P9_FILE_ID openat_win32(P9_FILE_ID dirfd, const char *pathname, int flags, + mode_t mode); +int fstatat_win32(P9_FILE_ID dirfd, const char *pathname, + struct stat *statbuf, int flags); +int mkdirat_win32(P9_FILE_ID dirfd, const char *pathname, mode_t mode); +int renameat_win32(P9_FILE_ID olddirfd, const char *oldpath, + P9_FILE_ID newdirfd, const char *newpath); +int utimensat_win32(P9_FILE_ID dirfd, const char *pathname, + const struct timespec times[2], int flags); +int unlinkat_win32(P9_FILE_ID dirfd, const char *pathname, int flags); +int statfs_win32(const char *root_path, struct statfs *stbuf); +P9_FILE_ID openat_dir(P9_FILE_ID dirfd, const char *name); +P9_FILE_ID openat_file(P9_FILE_ID dirfd, const char *name, int flags, + mode_t mode); +#endif static inline void close_preserve_errno(P9_FILE_ID fd) { int serrno = errno; +#ifndef CONFIG_WIN32 close(fd); +#else + CloseHandle(fd); +#endif errno = serrno; } +#ifndef CONFIG_WIN32 static inline P9_FILE_ID openat_dir(P9_FILE_ID dirfd, const char *name) { return qemu_openat(dirfd, name, @@ -157,6 +192,7 @@ again: errno = serrno; return fd; } +#endif ssize_t fgetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, const char *name, void *value, size_t size); @@ -167,6 +203,7 @@ ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, const char *name); +#ifndef CONFIG_WIN32 /* * Darwin has d_seekoff, which appears to function similarly to d_off. * However, it does not appear to be supported on all file systems, @@ -181,6 +218,7 @@ static inline off_t qemu_dirent_off(struct dirent *dent) return dent->d_off; #endif } +#endif /* !CONFIG_WIN32 */ /** * qemu_dirent_dup() - Duplicate directory entry @dent. diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 7e8d8492ea..d0d6d93549 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -53,10 +53,6 @@ #define BTRFS_SUPER_MAGIC 0x9123683E #endif -typedef struct { - P9_FILE_ID mountfd; -} LocalData; - P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, mode_t mode) { diff --git a/hw/9pfs/9p-util-win32.c b/hw/9pfs/9p-util-win32.c new file mode 100644 index 0000000000..953e7da6fa --- /dev/null +++ b/hw/9pfs/9p-util-win32.c @@ -0,0 +1,885 @@ +/* + * 9p utilities (Windows Implementation) + * + * Copyright (c) 2022 Wind River Systems, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +/* + * This file contains Windows only functions for 9pfs. + * + * For 9pfs Windows host, the following features are different from Linux host: + * + * 1. Windows POSIX API does not provide the NO_FOLLOW flag, that means MinGW + * cannot detect if a path is a symbolic link or not. Also Windows do not + * provide POSIX compatible readlink(). Supporting symbolic link in 9pfs on + * Windows may cause security issues, so symbolic link support is disabled + * completely. + * + * 2. Windows file system does not support extended attributes directly. 9pfs + * for Windows uses NTFS ADS (Alternate Data Streams) to emulate extended + * attributes. + * + * 3. statfs() is not available on Windows. qemu_statfs() is used to emulate it. + * + * 4. On Windows trying to open a directory with the open() API will fail. + * This is because Windows does not allow opening directory in normal usage. + * + * As a result of this, all xxx_at() functions won't work directly on + * Windows, e.g.: openat(), unlinkat(), etc. + * + * As xxx_at() can prevent parent directory to be modified on Linux host, + * to support this and prevent security issue, all xxx_at() APIs are replaced + * by xxx_at_win32() and Windows handle is used to replace the directory fd. + * + * Windows file system does not allow replacing a file or directory if it is + * referenced by a handle. Keep the handle open will lock and protect the + * parent directory and make the access to files atomically. + * + * If we don't protect (lock) the parent directory, the parent directory may + * be replaced by others (e.g.: a symbolic link) and cause security issues. + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "9p.h" +#include "9p-util.h" +#include "9p-local.h" + +#include +#include + +#define V9FS_MAGIC 0x53465039 /* string "9PFS" */ + +/* + * build_ads_name - construct Windows ADS name + * + * This function constructs Windows NTFS ADS (Alternate Data Streams) name + * to . + */ +static int build_ads_name(char *namebuf, size_t namebuf_len, + const char *filename, const char *ads_name) +{ + size_t total_size; + + total_size = strlen(filename) + strlen(ads_name) + 2; + if (total_size > namebuf_len) { + return -1; + } + + /* + * NTFS ADS (Alternate Data Streams) name format: filename:ads_name + * e.g.: D:\1.txt:my_ads_name + */ + + strcpy(namebuf, filename); + strcat(namebuf, ":"); + strcat(namebuf, ads_name); + + return 0; +} + +/* + * copy_ads_name - copy ADS name from buffer returned by FindNextStreamW() + * + * This function removes string "$DATA" in ADS name string returned by + * FindNextStreamW(), and copies the real ADS name to . + */ +static ssize_t copy_ads_name(char *namebuf, size_t namebuf_len, + char *full_ads_name) +{ + char *p1, *p2; + + /* + * NTFS ADS (Alternate Data Streams) name from enumerate data format: + * :ads_name:$DATA, e.g.: :my_ads_name:$DATA + * + * ADS name from FindNextStreamW() always has ":$DATA" string at the end. + * + * This function copies ADS name to namebuf. + */ + + p1 = strchr(full_ads_name, ':'); + if (p1 == NULL) { + return -1; + } + + p2 = strchr(p1 + 1, ':'); + if (p2 == NULL) { + return -1; + } + + /* skip empty ads name */ + if (p2 - p1 == 1) { + return 0; + } + + if (p2 - p1 + 1 > namebuf_len) { + return -1; + } + + memcpy(namebuf, p1 + 1, p2 - p1 - 1); + namebuf[p2 - p1 - 1] = '\0'; + + return p2 - p1; +} + +/* + * get_full_path_win32 - get full file name base on a handle + * + * This function gets full file name based on a handle specified by to + * a file or directory. + * + * Caller function needs to free the file name string after use. + */ +char *get_full_path_win32(P9_FILE_ID fd, const char *name) +{ + g_autofree char *full_file_name = NULL; + DWORD total_size; + DWORD name_size; + + full_file_name = g_malloc0(NAME_MAX); + + /* get parent directory full file name */ + name_size = GetFinalPathNameByHandle(fd, full_file_name, + NAME_MAX - 1, FILE_NAME_NORMALIZED); + if (name_size == 0 || name_size > NAME_MAX - 1) { + return NULL; + } + + /* full path returned is the "\\?\" syntax, remove the lead string */ + memmove(full_file_name, full_file_name + 4, NAME_MAX - 4); + + if (name != NULL) { + total_size = strlen(full_file_name) + strlen(name) + 2; + + if (total_size > NAME_MAX) { + return NULL; + } + + /* build sub-directory file name */ + strcat(full_file_name, "\\"); + strcat(full_file_name, name); + } + + return g_steal_pointer(&full_file_name); +} + +/* + * fgetxattr_win32 - get extended attribute by fd + * + * This function gets extened attribute by . will be translated to + * Windows handle. + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t fgetxattr_win32(int fd, const char *name, void *value, size_t size) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = {0}; + DWORD dwBytesRead; + HANDLE hStream; + HANDLE hFile; + + hFile = (HANDLE)_get_osfhandle(fd); + + full_file_name = get_full_path_win32(hFile, NULL); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0) { + errno = EIO; + return -1; + } + + hStream = CreateFile(ads_file_name, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_FILE_NOT_FOUND) { + errno = ENODATA; + return -1; + } + + if (ReadFile(hStream, value, size, &dwBytesRead, NULL) == FALSE) { + errno = EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return dwBytesRead; +} + +/* + * openat_win32 - emulate openat() + * + * This function emulates openat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So openat_win32() has to use a directory handle instead of a directory fd. + * + * For symbolic access: + * 1. Parent directory handle should not be a symbolic link because + * it is opened by openat_dir() which can prevent from opening a link to + * a dirctory. + * 2. Link flag in is not set because Windows does not have this flag. + * Create a new symbolic link will be denied. + * 3. This function checks file symbolic link attribute after open. + * + * So symbolic link will not be accessed by 9p client. + */ +P9_FILE_ID openat_win32(P9_FILE_ID dirfd, const char *pathname, int flags, + mode_t mode) +{ + g_autofree char *full_file_name1 = NULL; + g_autofree char *full_file_name2 = NULL; + HANDLE hFile = INVALID_HANDLE_VALUE; + int fd; + + full_file_name1 = get_full_path_win32(dirfd, pathname); + if (full_file_name1 == NULL) { + return hFile; + } + + fd = open(full_file_name1, flags, mode); + if (fd > 0) { + DWORD attribute; + hFile = (HANDLE)_get_osfhandle(fd); + + full_file_name2 = get_full_path_win32(hFile, NULL); + attribute = GetFileAttributes(full_file_name2); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + errno = EACCES; + hFile = INVALID_HANDLE_VALUE; + close(fd); + } + } + + return hFile; +} + +/* + * fstatat_win32 - emulate fstatat() + * + * This function emulates fstatat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So fstatat_win32() has to use a directory handle instead of a directory fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int fstatat_win32(P9_FILE_ID dirfd, const char *pathname, + struct stat *statbuf, int flags) +{ + g_autofree char *full_file_name = NULL; + HANDLE hFile = INVALID_HANDLE_VALUE; + DWORD attribute; + int err = 0; + int ret = -1; + + full_file_name = get_full_path_win32(dirfd, pathname); + if (full_file_name == NULL) { + return ret; + } + + /* open file to lock it */ + hFile = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS + | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) { + err = EACCES; + goto out; + } + + attribute = GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + errno = EACCES; + goto out; + } + + ret = stat(full_file_name, statbuf); + +out: + if (hFile != INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + } + + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * mkdirat_win32 - emulate mkdirat() + * + * This function emulates mkdirat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So mkdirat_win32() has to use a directory handle instead of a directory fd. + */ +int mkdirat_win32(P9_FILE_ID dirfd, const char *pathname, mode_t mode) +{ + g_autofree char *full_file_name = NULL; + int ret = -1; + + full_file_name = get_full_path_win32(dirfd, pathname); + if (full_file_name == NULL) { + return ret; + } + + ret = mkdir(full_file_name); + + return ret; +} + +/* + * renameat_win32 - emulate renameat() + * + * This function emulates renameat(). + * + * Windows POSIX API does not support openning a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So renameat_win32() has to use a directory handle instead of a directory fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int renameat_win32(HANDLE olddirfd, const char *oldpath, + HANDLE newdirfd, const char *newpath) +{ + g_autofree char *full_old_name = NULL; + g_autofree char *full_new_name = NULL; + HANDLE hFile; + DWORD attribute; + int err = 0; + int ret = -1; + + full_old_name = get_full_path_win32(olddirfd, oldpath); + full_new_name = get_full_path_win32(newdirfd, newpath); + if (full_old_name == NULL || full_new_name == NULL) { + return ret; + } + + /* open file to lock it */ + hFile = CreateFile(full_old_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + attribute = GetFileAttributes(full_old_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + err = EACCES; + goto out; + } + + CloseHandle(hFile); + + ret = rename(full_old_name, full_new_name); +out: + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * utimensat_win32 - emulate utimensat() + * + * This function emulates utimensat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So utimensat_win32() has to use a directory handle instead of a directory fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int utimensat_win32(P9_FILE_ID dirfd, const char *pathname, + const struct timespec times[2], int flags) +{ + g_autofree char *full_file_name = NULL; + HANDLE hFile = INVALID_HANDLE_VALUE; + DWORD attribute; + struct utimbuf tm; + int err = 0; + int ret = -1; + + full_file_name = get_full_path_win32(dirfd, pathname); + if (full_file_name == NULL) { + return ret; + } + + /* open file to lock it */ + hFile = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS + | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) { + err = EACCES; + goto out; + } + + attribute = GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + errno = EACCES; + goto out; + } + + tm.actime = times[0].tv_sec; + tm.modtime = times[1].tv_sec; + + ret = utime(full_file_name, &tm); + +out: + if (hFile != INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + } + + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * unlinkat_win32 - emulate unlinkat() + * + * This function emulates unlinkat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So unlinkat_win32() has to use a directory handle instead of a directory fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ + +int unlinkat_win32(P9_FILE_ID dirfd, const char *pathname, int flags) +{ + g_autofree char *full_file_name = NULL; + HANDLE hFile; + DWORD attribute; + int err = 0; + int ret = -1; + + full_file_name = get_full_path_win32(dirfd, pathname); + if (full_file_name == NULL) { + return ret; + } + + /* open file to prevent other one modify it */ + hFile = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + attribute = GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + err = EACCES; + goto out; + } + + if (flags == AT_REMOVEDIR) { /* remove directory */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) == 0) { + err = ENOTDIR; + goto out; + } + ret = rmdir(full_file_name); + } else { /* remove regular file */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) != 0) { + err = EISDIR; + goto out; + } + ret = remove(full_file_name); + } + + /* after last handle closed, file will be removed */ + CloseHandle(hFile); + +out: + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * statfs_win32 - statfs() on Windows + * + * This function emulates statfs() on Windows host. + */ +int statfs_win32(const char *path, struct statfs *stbuf) +{ + char RealPath[4] = { 0 }; + unsigned long SectorsPerCluster; + unsigned long BytesPerSector; + unsigned long NumberOfFreeClusters; + unsigned long TotalNumberOfClusters; + + /* only need first 3 bytes, e.g. "C:\ABC", only need "C:\" */ + memcpy(RealPath, path, 3); + + if (GetDiskFreeSpace(RealPath, &SectorsPerCluster, &BytesPerSector, + &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) { + errno = EIO; + return -1; + } + + stbuf->f_type = V9FS_MAGIC; + stbuf->f_bsize = + (__fsword_t)SectorsPerCluster * (__fsword_t)BytesPerSector; + stbuf->f_blocks = (fsblkcnt_t)TotalNumberOfClusters; + stbuf->f_bfree = (fsblkcnt_t)NumberOfFreeClusters; + stbuf->f_bavail = (fsblkcnt_t)NumberOfFreeClusters; + stbuf->f_files = -1; + stbuf->f_ffree = -1; + stbuf->f_namelen = NAME_MAX; + stbuf->f_frsize = 0; + stbuf->f_flags = 0; + + return 0; +} + +/* + * openat_dir - emulate openat_dir() + * + * This function emulates openat_dir(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So openat_dir() has to use a directory handle instead of a directory fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +P9_FILE_ID openat_dir(P9_FILE_ID dirfd, const char *name) +{ + g_autofree char *full_file_name = NULL; + HANDLE hSubDir; + DWORD attribute; + + full_file_name = get_full_path_win32(dirfd, name); + if (full_file_name == NULL) { + return INVALID_HANDLE_VALUE; + } + + attribute = GetFileAttributes(full_file_name); + if (attribute == INVALID_FILE_ATTRIBUTES) { + return INVALID_HANDLE_VALUE; + } + + /* check if it is a directory */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) == 0) { + return INVALID_HANDLE_VALUE; + } + + /* do not allow opening a symbolic link */ + if ((attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + return INVALID_HANDLE_VALUE; + } + + /* open it */ + hSubDir = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + return hSubDir; +} + +P9_FILE_ID openat_file(P9_FILE_ID dirfd, const char *name, int flags, + mode_t mode) +{ + return openat_win32(dirfd, name, flags | _O_BINARY, mode); +} + +/* + * fgetxattrat_nofollow - get extended attribute + * + * This function gets extended attribute from file in the directory + * specified by . The extended atrribute name is specified by + * and return value will be put in . + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t fgetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, + const char *name, void *value, size_t size) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = { 0 }; + DWORD dwBytesRead; + HANDLE hStream; + + full_file_name = get_full_path_win32(dirfd, path); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0) { + errno = EIO; + return -1; + } + + hStream = CreateFile(ads_file_name, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_FILE_NOT_FOUND) { + errno = ENODATA; + return -1; + } + + if (ReadFile(hStream, value, size, &dwBytesRead, NULL) == FALSE) { + errno = EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return dwBytesRead; +} + +/* + * fsetxattrat_nofollow - set extended attribute + * + * This function set extended attribute to file in the directory + * specified by . + * + * This function emulates extended attribute by NTFS ADS. + */ + +int fsetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, const char *name, + void *value, size_t size, int flags) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = { 0 }; + DWORD dwBytesWrite; + HANDLE hStream; + + full_file_name = get_full_path_win32(dirfd, path); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0) { + errno = EIO; + return -1; + } + + hStream = CreateFile(ads_file_name, GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream == INVALID_HANDLE_VALUE) { + errno = EIO; + return -1; + } + + if (WriteFile(hStream, value, size, &dwBytesWrite, NULL) == FALSE) { + errno = EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return 0; +} + +/* + * flistxattrat_nofollow - list extended attribute + * + * This function gets extended attribute lists from file in the + * directory specified by . Lists returned will be put in . + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, + char *list, size_t size) +{ + g_autofree char *full_file_name = NULL; + WCHAR WideCharStr[NAME_MAX + 1] = { 0 }; + char full_ads_name[NAME_MAX + 1]; + WIN32_FIND_STREAM_DATA fsd; + BOOL bFindNext; + char *list_ptr = list; + size_t list_left_size = size; + HANDLE hFind; + int ret; + + full_file_name = get_full_path_win32(dirfd, filename); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + /* + * ADS enumerate function only has WCHAR version, so we need to + * covert filename to utf-8 string. + */ + ret = MultiByteToWideChar(CP_UTF8, 0, full_file_name, + strlen(full_file_name), WideCharStr, NAME_MAX); + if (ret == 0) { + errno = EIO; + return -1; + } + + hFind = FindFirstStreamW(WideCharStr, FindStreamInfoStandard, &fsd, 0); + if (hFind == INVALID_HANDLE_VALUE) { + errno = ENODATA; + return -1; + } + + do { + memset(full_ads_name, 0, sizeof(full_ads_name)); + + /* + * ADS enumerate function only has WCHAR version, so we need to + * covert cStreamName to utf-8 string. + */ + ret = WideCharToMultiByte(CP_UTF8, 0, + fsd.cStreamName, wcslen(fsd.cStreamName) + 1, + full_ads_name, sizeof(full_ads_name) - 1, + NULL, NULL); + if (ret == 0) { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + errno = ERANGE; + } + CloseHandle(hFind); + return -1; + } + + ret = copy_ads_name(list_ptr, list_left_size, full_ads_name); + if (ret < 0) { + errno = ERANGE; + CloseHandle(hFind); + return -1; + } + + list_ptr = list_ptr + ret; + list_left_size = list_left_size - ret; + + bFindNext = FindNextStreamW(hFind, &fsd); + } while (bFindNext); + + CloseHandle(hFind); + + return size - list_left_size; +} + +/* + * fremovexattrat_nofollow - remove extended attribute + * + * This function removes an extended attribute from file in the + * directory specified by . + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, + const char *name) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = { 0 }; + + full_file_name = get_full_path_win32(dirfd, filename); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, filename, name) < 0) { + errno = EIO; + return -1; + } + + if (DeleteFile(ads_file_name) != 0) { + if (GetLastError() == ERROR_FILE_NOT_FOUND) { + errno = ENODATA; + return -1; + } + } + + return 0; +} + +/* + * local_opendir_nofollow - open a Windows directory + * + * This function returns a Windows file handle of the directory specified by + * based on 9pfs mount point. + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * This function checks the resolved path of . If the resolved + * path is not in the scope of root directory (e.g. by symbolic link), then + * this function will fail to prevent any security issues. + */ +HANDLE local_opendir_nofollow(FsContext *fs_ctx, const char *dirpath) +{ + g_autofree char *full_file_name = NULL; + LocalData *data = fs_ctx->private; + HANDLE hDir; + + hDir = openat_dir(data->mountfd, dirpath); + if (hDir == INVALID_HANDLE_VALUE) { + return INVALID_HANDLE_VALUE; + } + + full_file_name = get_full_path_win32(hDir, NULL); + if (full_file_name == NULL) { + CloseHandle(hDir); + return INVALID_HANDLE_VALUE; + } + + /* + * Check if the resolved path is in the root directory scope: + * data->root_path and full_file_name are full path with symbolic + * link resolved, so fs_ctx->root_path must be in the head of + * full_file_name. If not, that means guest OS tries to open a file not + * in the scope of mount point. This operation should be denied. + */ + if (memcmp(full_file_name, data->root_path, + strlen(data->root_path)) != 0) { + CloseHandle(hDir); + hDir = INVALID_HANDLE_VALUE; + } + + return hDir; +} From patchwork Mon Oct 24 04:57:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A95A6C3A59D for ; Mon, 24 Oct 2022 06:00:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYH-0004KF-Gi; Mon, 24 Oct 2022 00:59:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY2-0003yy-FE for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:50 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompXz-0006AU-D9 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:48 -0400 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wYbA001509; Sun, 23 Oct 2022 21:58:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=3U3KU1/kIZJ+WxIAWSD9j1TgVnA4Rw8EBOumkxO+04Y=; b=R5+Sf2GawTkc56Qzt2JgKMlwVuc0AXI13B04excTE8rPXO9evfd0Q4vklJU1/7m7c5Qq rXuBnvpxG5PrPOUPd95MrHwAasn+ahP7glXRarOHz0hqLY4xQ6xad0Ag0/ZkZgjccY7V K9wNvI40tjCwjCeHpDoGsGUz2snrkZbQcwR1RygFOID3OJVjTeiL083sPfuGsNu9n2Gn Q7u0CHKNrbmVGYWfDvSkEdfYDwjnJb/SdYBpsMdUwXmfq97K239Gb0b024t9Ohmbh5kJ QE8zH1Me6PFZZ+bBlB0JRzixsI9eN2jmHwGRNX5pWw4lOmaN2p5l9KOTZmP/91/ZkwaB Zw== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksmac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QAgrghJylMgIkBfY7EoJFHrHFhbK6/VPUrUtT/H4nHVrVUSS3zAQQ6HGlbOxXRdX97O4QXPVdbkkZlxNz8jwFABxpOkUbm0M1juQCeNUHLJHaR1ZkXq03VnJGueygAnnhXEwAunp00T8LOxUxPsf/a6ErCsVgRsyXLJALQWjNquqC/5yhcd0B3WFp3S+7Ctxi0paOIHlb3cUls0TZdRDXU3aYxVYOxyE5jhzCiBAKT2zXCJqhFptcM2QS2lB69nM8F2QvppOIFCZwASjcgGwx4DU5xrs7HCA7NxW7A/qHnjSx1EmVINYpLN9wecmLoRZsgn0w2bncV9+cx4GzvAQ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3U3KU1/kIZJ+WxIAWSD9j1TgVnA4Rw8EBOumkxO+04Y=; b=cdDfIGn1tihej7XMyv3sq2l+fE0+rhvSJe+sGgjYPtu00j8VKMX+jiIRgyefpuuO4sGAvsV2DiSJBFSkLWlzrfcrgv7PFAjDElBug3fF6BvpssRPpiQEf1pgowG/hGBTAGxhKHjLcacYhM9iuJ1cGolqzJyiEZiPAt7UR106HdjKgLzGHsg+Or8hYgaPc2761cg3R2+2SqfaStMi3xYZLHsSqm6vRCjn4TmOLke0W0127kyviVWaChi6091ACuzsjHkgt4vA0tVEbL4oSXZkgxtOtn10GloJ9M3xEWZHuw7JCoKrXaTxTwO4zTWuv0tdl/2fPpx3E7Ws3sOtFJbs3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:32 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:32 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 08/16] hw/9pfs: Handle current directory offset for Windows Date: Mon, 24 Oct 2022 12:57:51 +0800 Message-Id: <20221024045759.448014-9-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: d0bb1661-74b2-457c-cb51-08dab57c6612 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +ZflbNViBIM9Kch8uNmO/VA3n/RYz2TRBm7JUGZAyN7iDwkppyet3hQJbMlqglrmtcCco8EdrBgmLHYLXa8gSVAPuNG9qGpqZo5HBd8bK8s808WAZPbK5eJy+1vbNJr9SRvcc8SQPIFynazPXastPufF+tJqhNYgZtd2prU2Gzj59zqIZe0ayzk/PgZhC4BtyPPosPOWUzzmK4KaQFyHuHSaKkPMC1MEX/aqYO6m5++mXQtQfIoSE25yNDXkfypG7NWD3XmKojw4CMvE33Zco9fY5db8VIZUyp/2Zq98J4mCgrbqQFkjmULkny1aWTRbCfjRfR1EahxlfTMTXyR8OwIIClQQ3jKQmoPfdVBLLruOIlfE5u9Nk2r+YCKE+5pPP1arMyRhPzptbzM+iWCGkSFYSQ1cqELHWkyUqeyfR5NV77S4SnmVP23qRBdGY97TIZcAoLm48Aa4QgBFiZBD70amAIcQvASY9aP8OGBu3a3K1SBPj3k3GfHth5OHlzu0mG2l38PboqFs66BjSa92+aftb+TfZY/3EZzGlIBb3ZCN8L4X4FVQ9GitguwMBzq0aWrbYjpumO0zybDYG6Ekw8C3Juc+JJXTB4CFE8MnGO98Z2MQWl8uhx2XDgU7WlGOFOEqic7W5KpTzHOscTq+gthX/IvzURNEwNRa+cDBSLtofk5tp1ekWURLTm65+y6LyHXgwcG+dyIz8DRIeO85J0r4thtsiLrJHz0+VaAck8JrqMsxa0qqR+LaqiH1sXJtmidu174BukgR71n9C7komA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gzBddoOYQ2/e5N9d8Ktnk+ENIYmdd1LuxNnOJ+gjS6V/mvNjqGqSA3ij9fDLvZrPty+DgiPaSjasR4KZCUIRXTR1QnxcTmEGVonELG83+2VpzY67guT1n5L2E+iXVSc9NYUNYmWVmW7XaLiKqcKFmDGO7VStK80twj8DJJ0xh0P34gmY/P0S7DPPpx+0+IF2XS1ewciTR93Rq71pgm0ipeUBDG52QA6yapPA1A4zNwn0UIg0YmkvmMBeG9Qa9oR/Se9iHxBQIZE1dTi04EoxzcLoec1ESLCC3nItnt36nfd+Z0qOZ8Mucs1R00QH7hds8LiaCJ4R8EJeFA+awlfLZ5OPZ9l4w8pA3ySDoKC9ooFu+duthtp3EZz2e/mUqsFIT6BoTg8lodEdcwoomHzayPGQ9MbNCBKRbAzG61fiybBwwdDs816uIhlqgVP0VHV0TLgGjFnsbvpbSajI2/CBNIL7PY/Sk8rKIGKXx9QxgZdwETMGoOAdJnXjMFQGx3mG0xzyAvhDbEyG5lUe8ZLaL/4JkWDJOc/gRR9pG/HJ0yzwP07Ds75tj1du9PZV3/W1f1JD8TjGdBpShUG+exIW62dq5lLbOBgLIzepr5HSfrb3UjkxM8vEduYejjLWRhjY8Ojpy9DllzXB8YESrp9l8qDCPmskR2Of77PdLIXAne2R+X9b5Pe2ihi4icTiVr9Z37iJvZ5OkyDHgEbrKn20GUGiuCvb1tBF5kxIFqmQ/Hiw8P04Zw1U9+DPLyrqDWxRn6H8jB19/IO4bQOyolY5jqopdbZ7ryFlmAFTouReJvHnuRi3CnClSMjYjzMXhfjQR13jDfeh2ZBvutzh6rO0NAjrCev0TO0+vvevowbYz/GMqzu1CrMEgJvJa5eN6FiRTORuaik1T0cs+EoHuMm/xy1H+L/ydjIdEdu+pCEtcKyhpSqokse3fjoXSihrCeGJD6WUxqW5zHrirI2HPfLeUYZ7F3XxK+zlGvn8sR3fzU5Axjz3OveojHqHev/5sdzhc+iBcHLaZ9GV+mkCmyh0Je48AtbJcEZy9HwalToSEiA3f95iB8JxXbUcSGPy/FFRqkb/qSRpL3K+ioAj2Kv3P1y/pbjpdpt+cBE4n18VszkDDsWsUjxRQdnaCA8ALNw36+WM19Mo+xtemkAJ1x8haVNxFwX9sedpDIrWEJqi/+fqvM9mD7uiBqW52iUQpceCNK4qDXwYr1M6OyNT+L7ivZarM/+m3+OHm7atqmeQ9UA+M4DpOEoM6611HlJY+W+FY8UVYHKDuUxHAVCc3npgJnBQBtxtWwV26s0/Oqm6dM2V3XjRz9oNiPUk9irJZcNT701USKantMTHUbGov5+bhUjr0vdXWnwdU5IIP3Xh1Niec3I5gWnx2XUPgDpK8Io0Nd7+gNTqkUFozhfQXt0/Ky+CpNOqxvN0t0GaJWgegSfMIVrWJyBCAnoR7uarGq8XBg7DnYaxRbp926cY3EwGrLCBE+3qyBpy5Wt15Aq5+LkdWkpadHVwQDeVt2D8wHZZL+tPZPcg/YrNRuiATZ4cnCy4FVuvSfk2NAEWSmd1m4Q+FA8AB+7IlJqtNO6juJlTBQZJrTOkM674OWkhRpm44g== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0bb1661-74b2-457c-cb51-08dab57c6612 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:32.0844 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4m0cB+Sb+/k/hsEeZdyZdLpMcmitOzR9oTy/TAOk8nWYUxT1guyuzSoDHuizJNAkGcOnztBPo5uGvSDJqUpK8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: zbn_FH_RkY_fg9mIviFmH_jExSoMLiQa X-Proofpoint-GUID: zbn_FH_RkY_fg9mIviFmH_jExSoMLiQa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=734 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi On Windows 'struct dirent' does not have current directory offset. We have to save current directory offset and update offset when reading directory. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p.c | 16 ++++++++++++++++ hw/9pfs/codir.c | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index aebadeaa03..6c4af86240 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2319,7 +2319,15 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu, count += len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); +#ifndef CONFIG_WIN32 saved_dir_pos = qemu_dirent_off(dent); +#else + /* + * Get offset by calling telldir() manually, + * as Windows does not have dent->d_off. + */ + saved_dir_pos = v9fs_co_telldir(pdu, fidp); +#endif } v9fs_readdir_unlock(&fidp->fs.dir); @@ -2520,7 +2528,15 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, qid.version = 0; } +#ifndef CONFIG_WIN32 off = qemu_dirent_off(dent); +#else + /* + * Get offset by calling telldir() manually, + * as Windows does not have dent->d_off. + */ + off = v9fs_co_telldir(pdu, fidp); +#endif v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c index 93ba44fb75..2fbe7b831b 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -78,6 +78,9 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp, int len, err = 0; int32_t size = 0; off_t saved_dir_pos; +#ifdef CONFIG_WIN32 + off_t next_dir_pos; +#endif struct dirent *dent; struct V9fsDirEnt *e = NULL; V9fsPath path; @@ -124,6 +127,14 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp, break; } +#ifdef CONFIG_WIN32 + next_dir_pos = s->ops->telldir(&s->ctx, &fidp->fs); + if (next_dir_pos < 0) { + err = next_dir_pos; + goto out; + } +#endif + /* * stop this loop as soon as it would exceed the allowed maximum * response message size for the directory entries collected so far, @@ -168,7 +179,11 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp, } size += len; +#ifndef CONFIG_WIN32 saved_dir_pos = qemu_dirent_off(dent); +#else + saved_dir_pos = next_dir_pos; +#endif } /* restore (last) saved position */ From patchwork Mon Oct 24 04:57:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCEE7C38A2D for ; Mon, 24 Oct 2022 06:30:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYW-0004Yu-Vk; Mon, 24 Oct 2022 00:59:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY4-00040j-RZ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:53 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY2-0006Ay-FJ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:52 -0400 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4gMkN001865; Sun, 23 Oct 2022 21:58:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=Dd827HPsvBbns/j7gw5UZ9B7zDyrUeNWaRHKjcmMvLg=; b=aM99FhlRmiPV4hzWKtFQ8N3xm+Tgh5lOX49nQEkwedmHGrQHqVU9SwBJFjuE87RwKzeN bjhqhlOYxaU6bAVSEIPZmWjuymLjHalESGb95/GiGfNHlm+uteKfkiFYlIgFZtMOY5xr 15aqHH8cgLJYPVoH6Djg+ur8oS3r8cmV2Fdj/xGIwl6cJZ6Qak/XN1IEK8Y8/cBqTulK t6A8+4ODjSCUetYFATnng90I0rf0aYYHm6wE9F0KfrSaagjTOrzQsnuD9hRWoKwCWh0N ORXGDBwacscFBpFzMhED/P1nVUNaQu4auK4Oak6GNP4l3wnH1R/ow2oGu5+l45Uq3rKD 2w== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksmad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LZk1EKGl2RDkLCqkqW7Yo3LN/EDVKJlDcTZbQV9v9cQ679Aywe6pNydl7LU8kwTEizkgNy6+nqPdwQqg/oCvkoveXpH66sSOhF15dvhh7xxHRRjK8KS9GDn13tVWthySB8nT70P8QhkYnbM7fCIyAee59GkEsPXjQ6V4Vtz1n7Xbc5rQjnTQ+6CWABpdOlrjWL4S/Sh7IoTgNXiHdIRFSZ//9pzbYwKbKBNxMMHaJw6TBWhbVDbqunKHD7/TncoT+tvyk2OH2ShyflKyRZ/7+lhdcUIPR7x4/RnkLwXY2b3DMxXx8W+1QA0pn0UPIjZLtjTnmgFHN6M995oYuo9Mrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Dd827HPsvBbns/j7gw5UZ9B7zDyrUeNWaRHKjcmMvLg=; b=ngev+AW0kz2C/G73LlQnaQ0QaAVpAdbbb4Jvka4cunyMWgX2bPXtYrM+RTpRGAAN9XG3sCs+LJwiqTKXLhxA8I4TobXK+YpAErKAr/REPGiVvAi6QRUgm8jY/NOeOyr5deqscByIoHnGQ1dsc54/ib66Wt3VzxHIQceLRyq8d58EzGQ2Sn0DIKNKajJmVJ0GUibOHJAeglCzWlr+MEIpQRw8pDM68m4GK4+MsVkpY6o7w/nPAEUy6GUJaxQWulacsu/yuWSaUSVGlL4mtwtpWq+fhakbhcRTCAj/aVeeoyYnr2fuOSd/WxoZuUxn/B2MuL6KIDuAiq84QT+5XfcK3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:34 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:34 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 09/16] hw/9pfs: Disable unsupported flags and features for Windows Date: Mon, 24 Oct 2022 12:57:52 +0800 Message-Id: <20221024045759.448014-10-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e3a05d1-3957-4800-febd-08dab57c6754 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BB+T/6x5EiBbcuSb2nxRnHr4PPqgWRSi4J83jL0U5GwWAjDeL1yVn6l7Yd5fVhU4hH9pZGYayBmyjZvYNBGE7H1CkQyXmy+cSgBoNrSfw+k8JltkK82NHvfYzJ7xYBbdldibGOfeUxTVZ4qylChlDU+5U+KD49b7YzLZ+KsHjcCQTA8Q9wv+nX9Lg0L5fsVnjNfMru0HCVGr7ap/Uwf8xThZfKmtj1J1l5gV9ttz+FsKy1o0WY9ERkPOll9BBbaI9/5tzVBjWpXIeGYJ3dVdspWCHM16mONfTxkfkoy/3utSynmRXwUuSY5DOsn6KLjT7fEe+WgOgOkpd8uReRKVtcW2RTuEMGQLdhWR5AUP0guYlVsN5iDIEVLJKExFZb53A8abVfvChBpNyhZSDU9fhuGK4qmdIAtIFsU4NQpdTOAGM2P8tHcuEf/zghr4x3/hUbkWZoAJr3h7hwo9ng170nUe72u5K4/3uRuY+hTZ0FVR7SO4/G76LOHurh/1vtwXojvp4Qimccz0Ecpw8fSlbQnXPY8ut1DxPHAWrVrqfIIZCCihGD0ldJVhQv43ebOBK6cgp7d7zJ5hYFF7w/nas/1X5VWzGPI3iVhJYzP7HuFaCGzK0bPr1BqRz9Lbkgasm1ZfwXG74zvv5nkw55MQXdYnzcbfg6k4kpu8NjLKONdmD71hJNDfTxTs8hs7NkMOpsBLUaViTfydNCnRwKVQlqRaeK9F7kAYkgdHo+COsDfN9/8lKH45ZcR99QKYySKv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9bmjAgwlDObnM+OPxY7K+lodDqSfPcYpvHola0p9y5rlUFwuW3U9g20DcMfjkgqMTdg167th6FZihUmtuZ/eJycQkFM5N1JXc/xIUKbvLJkB60HGnCzN8EPIHBM0xNyX0kKDgi/ybcWpZIHAM98lRJD17zaI04GyOMxNeqXDPOQZ41WStzHo6nYLwKd9lrqJ0UuCGEAMW8zh90fB3VMQMjV1wwQTUWj781U1GOhxhxSDBo4zlFur+BAZGePVGbSDBkapDzRXhcBhSEyqDVSg8YT+45nZ8alRHTuzKqu3+SZ0677iKBsdCvLopRyQyhldLkZ+VCbL3y56aBiuAdN2VNRLSpyyGdmGhpHuSYvhF2IDgpC33jwF5pVqfMHnjEN4DobfVieOzxnL4uoYKHdzXqzjdU1s/g7c0b6eVfy/pe5RGlbor+rFvRK9UmgAf2JzQkgdhjZS5b/2LvjOABYHLNF3tVuNjz4CuXiJ7muY5/yUBw/lH8MOdd5js9Jf8pa/85jCgoc4EPF16D+Oy3UXMgAdsWMWyVFWgPzvZfBoPNKPk0PC0eUeOFaCNtDRwOVJibLoe4KmHTsb3TrRdVDXYproBKgQHXTtVkKGCB+4z785CTCUSpLzMSQMy8AxbyNdAbWY8TsmhfoivNCYuIFSJN+AKfUs+vOAXCy8gbHeVq+Z8mWCLPaWjNtQyI1+kXQzM1OrI4mMCgs0bPdfeCLtmRTmc7qXlJjfmaF3dfDeu8tJISxEp37TJmJt79y9ZeuX8rzJMBX7S+sP+Uo79O/S/R+OM1qgD5eFFkFxjuOZnNZf5NBvhcrlPfg8Y4/jnzUr+qYxQIm2R0nuo+gfKfniPeSyajUETxHDu9GXD4rR9ZJ3v7nXJAUkMycv7RRiVkjC8GnSWgWvXYVznwwzSE7vRfb48qp4sh7pTN5DrBSsEzV+M1e16/aG0F8/r8wFn4Bbja+NWrv/BhM9ggFhx3NtCGl+3iuNLTA1yA24BvEHRVJS82TjtkINn8393SvVIIVknK+79SRlhTwQgKlT2UiNeIIRlsAqaOVwEyYJ5ci0d+/ePS7kWKQdlaq323B/EfuM1+KOGiD3yrOVJO95C5BwjXAUhDD1zY4pZCin3Lbpwvi4WSBiio3dNxay0mGwLXTX6C27Rv3h2d62eZhewSiJzrcSejneov6+ZNIJ/7rANqvpEvNIKimYDEP4m8M/49N+lQ06/jgqhJstGXISWl/NVxf4GB5lMATMp22f/rj/Fb8yRCPKImXGi+E1+xptYaaqqXK6c34L9EJSpB63ESc7gYP5o11KYMGgHjcvHt0vhBvl0kHhJZifQMlr4lLQz+/ccXQD5jy2v73bbXV+WNMNqAT9+Oyhx00IAMO+QGnlwqt9y1TIFCmPtQoMNJZhmlc4H++DOeAqJAFN6pBz5KhPHRVdHbmhyY/+Oou+KNzk4JJrnTH8JkOInly6Am1Anki/pGxjxu84NkWULDKN/1MXx8wHQGL/Xi77eMxLmgs9mVYdMg8QSXXrvU9hq4hl2uTCcElBlALeQLs93dipAjQZdmQThGljhZU4xy8094ywiGju12XhhAwat+mdBYKpW9DLo2XkQtDsD3h+4XAlyczBkw== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e3a05d1-3957-4800-febd-08dab57c6754 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:34.1949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gi+QT2KrK2OLmH0JYZObM0Cg1nqk7KCepHBwLwL+iOOKUpWmDAiBnA3F3ZKYRGJ4MF8QOcpixeVgGTSY/ssWFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: 5pssW_kazj2W5zlXIpo5YrBQuIAY3VeJ X-Proofpoint-GUID: 5pssW_kazj2W5zlXIpo5YrBQuIAY3VeJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Some flags and features are not supported on Windows, like mknod, readlink, file mode, etc. Update the codes for Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-util.h | 6 +++- hw/9pfs/9p.c | 90 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 86 insertions(+), 10 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 82b2d0c3e4..3d154e9103 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -53,8 +53,10 @@ static inline uint64_t makedev_dotl(uint32_t dev_major, uint32_t dev_minor) */ static inline uint64_t host_dev_to_dotl_dev(dev_t dev) { -#ifdef CONFIG_LINUX +#if defined(CONFIG_LINUX) return dev; +#elif defined(CONFIG_WIN32) + return 0; #else return makedev_dotl(major(dev), minor(dev)); #endif @@ -260,7 +262,9 @@ static inline struct dirent *qemu_dirent_dup(struct dirent *dent) #if defined CONFIG_DARWIN && defined CONFIG_PTHREAD_FCHDIR_NP int pthread_fchdir_np(int fd) __attribute__((weak_import)); #endif +#ifndef CONFIG_WIN32 int qemu_mknodat(P9_FILE_ID dirfd, const char *filename, mode_t mode, dev_t dev); +#endif #endif diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 6c4af86240..771aab34ac 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -39,6 +39,11 @@ #include "qemu/xxhash.h" #include +#ifdef CONFIG_WIN32 +#define UTIME_NOW ((1l << 30) - 1l) +#define UTIME_OMIT ((1l << 30) - 2l) +#endif + int open_fd_hw; int total_open_fd; static int open_fd_rc; @@ -132,13 +137,17 @@ static int dotl_to_open_flags(int flags) DotlOpenflagMap dotl_oflag_map[] = { { P9_DOTL_CREATE, O_CREAT }, { P9_DOTL_EXCL, O_EXCL }, +#ifndef CONFIG_WIN32 { P9_DOTL_NOCTTY , O_NOCTTY }, +#endif { P9_DOTL_TRUNC, O_TRUNC }, { P9_DOTL_APPEND, O_APPEND }, +#ifndef CONFIG_WIN32 { P9_DOTL_NONBLOCK, O_NONBLOCK } , { P9_DOTL_DSYNC, O_DSYNC }, { P9_DOTL_FASYNC, FASYNC }, -#ifndef CONFIG_DARWIN +#endif +#ifdef CONFIG_LINUX { P9_DOTL_NOATIME, O_NOATIME }, /* * On Darwin, we could map to F_NOCACHE, which is @@ -151,8 +160,10 @@ static int dotl_to_open_flags(int flags) #endif { P9_DOTL_LARGEFILE, O_LARGEFILE }, { P9_DOTL_DIRECTORY, O_DIRECTORY }, +#ifndef CONFIG_WIN32 { P9_DOTL_NOFOLLOW, O_NOFOLLOW }, { P9_DOTL_SYNC, O_SYNC }, +#endif }; for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { @@ -179,8 +190,11 @@ static int get_dotl_openflags(V9fsState *s, int oflags) * Filter the client open flags */ flags = dotl_to_open_flags(oflags); - flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT); -#ifndef CONFIG_DARWIN + flags &= ~(O_CREAT); +#ifndef CONFIG_WIN32 + flags &= ~(O_NOCTTY | O_ASYNC); +#endif +#ifdef CONFIG_LINUX /* * Ignore direct disk access hint until the server supports it. */ @@ -986,9 +1000,11 @@ static int stat_to_qid(V9fsPDU *pdu, const struct stat *stbuf, V9fsQID *qidp) if (S_ISDIR(stbuf->st_mode)) { qidp->type |= P9_QID_TYPE_DIR; } +#ifndef CONFIG_WIN32 if (S_ISLNK(stbuf->st_mode)) { qidp->type |= P9_QID_TYPE_SYMLINK; } +#endif return 0; } @@ -1097,6 +1113,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension) ret |= S_IFDIR; } +#ifndef CONFIG_WIN32 if (mode & P9_STAT_MODE_SYMLINK) { ret |= S_IFLNK; } @@ -1106,6 +1123,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension) if (mode & P9_STAT_MODE_NAMED_PIPE) { ret |= S_IFIFO; } +#endif if (mode & P9_STAT_MODE_DEVICE) { if (extension->size && extension->data[0] == 'c') { ret |= S_IFCHR; @@ -1118,6 +1136,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension) ret |= S_IFREG; } +#ifndef CONFIG_WIN32 if (mode & P9_STAT_MODE_SETUID) { ret |= S_ISUID; } @@ -1127,6 +1146,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension) if (mode & P9_STAT_MODE_SETVTX) { ret |= S_ISVTX; } +#endif return ret; } @@ -1182,6 +1202,7 @@ static uint32_t stat_to_v9mode(const struct stat *stbuf) mode |= P9_STAT_MODE_DIR; } +#ifndef CONFIG_WIN32 if (S_ISLNK(stbuf->st_mode)) { mode |= P9_STAT_MODE_SYMLINK; } @@ -1193,11 +1214,13 @@ static uint32_t stat_to_v9mode(const struct stat *stbuf) if (S_ISFIFO(stbuf->st_mode)) { mode |= P9_STAT_MODE_NAMED_PIPE; } +#endif if (S_ISBLK(stbuf->st_mode) || S_ISCHR(stbuf->st_mode)) { mode |= P9_STAT_MODE_DEVICE; } +#ifndef CONFIG_WIN32 if (stbuf->st_mode & S_ISUID) { mode |= P9_STAT_MODE_SETUID; } @@ -1209,6 +1232,7 @@ static uint32_t stat_to_v9mode(const struct stat *stbuf) if (stbuf->st_mode & S_ISVTX) { mode |= P9_STAT_MODE_SETVTX; } +#endif return mode; } @@ -1247,9 +1271,17 @@ static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu, V9fsPath *path, return err; } } else if (v9stat->mode & P9_STAT_MODE_DEVICE) { + unsigned maj, min; + +#ifndef CONFIG_WIN32 + maj = major(stbuf->st_rdev); + min = minor(stbuf->st_rdev); +#else + maj = min = 0; +#endif v9fs_string_sprintf(&v9stat->extension, "%c %u %u", S_ISCHR(stbuf->st_mode) ? 'c' : 'b', - major(stbuf->st_rdev), minor(stbuf->st_rdev)); + maj, min); } else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) { v9fs_string_sprintf(&v9stat->extension, "%s %lu", "HARDLINKCOUNT", (unsigned long)stbuf->st_nlink); @@ -1317,7 +1349,14 @@ static int32_t blksize_to_iounit(const V9fsPDU *pdu, int32_t blksize) static int32_t stat_to_iounit(const V9fsPDU *pdu, const struct stat *stbuf) { - return blksize_to_iounit(pdu, stbuf->st_blksize); + int32_t blksize; + +#ifndef CONFIG_WIN32 + blksize = stbuf->st_blksize); +#else + blksize = 0; +#endif + return blksize_to_iounit(pdu, blksize); } static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, @@ -1332,7 +1371,11 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, v9lstat->st_rdev = host_dev_to_dotl_dev(stbuf->st_rdev); v9lstat->st_size = stbuf->st_size; v9lstat->st_blksize = stat_to_iounit(pdu, stbuf); +#ifndef CONFIG_WIN32 v9lstat->st_blocks = stbuf->st_blocks; +#else + v9lstat->st_blocks = 0; +#endif v9lstat->st_atime_sec = stbuf->st_atime; v9lstat->st_mtime_sec = stbuf->st_mtime; v9lstat->st_ctime_sec = stbuf->st_ctime; @@ -1340,7 +1383,8 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, v9lstat->st_atime_nsec = stbuf->st_atimespec.tv_nsec; v9lstat->st_mtime_nsec = stbuf->st_mtimespec.tv_nsec; v9lstat->st_ctime_nsec = stbuf->st_ctimespec.tv_nsec; -#else +#endif +#ifdef CONFIG_LINUX v9lstat->st_atime_nsec = stbuf->st_atim.tv_nsec; v9lstat->st_mtime_nsec = stbuf->st_mtim.tv_nsec; v9lstat->st_ctime_nsec = stbuf->st_ctim.tv_nsec; @@ -2471,6 +2515,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent *dent; struct stat *st; struct V9fsDirEnt *entries = NULL; + unsigned char d_type = 0; /* * inode remapping requires the device id, which in turn might be @@ -2540,10 +2585,13 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); +#ifndef CONFIG_WIN32 + d_type = dent->d_type; +#endif /* 11 = 7 + 4 (7 = start offset, 4 = space for storing count) */ len = pdu_marshal(pdu, 11 + count, "Qqbs", &qid, off, - dent->d_type, &name); + d_type, &name); v9fs_string_free(&name); @@ -2873,8 +2921,12 @@ static void coroutine_fn v9fs_create(void *opaque) } nmode |= perm & 0777; +#ifndef CONFIG_WIN32 err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); +#else + err = -ENOTSUP; +#endif if (err < 0) { goto out; } @@ -2899,8 +2951,12 @@ static void coroutine_fn v9fs_create(void *opaque) v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); } else if (perm & P9_STAT_MODE_SOCKET) { +#ifndef CONFIG_WIN32 err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); +#else + err = -ENOTSUP; +#endif if (err < 0) { goto out; } @@ -3634,7 +3690,7 @@ out_nofid: static void coroutine_fn v9fs_mknod(void *opaque) { - +#ifndef CONFIG_WIN32 int mode; gid_t gid; int32_t fid; @@ -3691,6 +3747,10 @@ out: out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); +#else + V9fsPDU *pdu = opaque; + pdu_complete(pdu, -1); +#endif } /* @@ -3963,7 +4023,7 @@ out_nofid: #if defined(CONFIG_LINUX) /* Currently, only Linux has XATTR_SIZE_MAX */ #define P9_XATTR_SIZE_MAX XATTR_SIZE_MAX -#elif defined(CONFIG_DARWIN) +#elif defined(CONFIG_DARWIN) || defined(CONFIG_WIN32) /* * Darwin doesn't seem to define a maximum xattr size in its user * space header, so manually configure it across platforms as 64k. @@ -3980,6 +4040,7 @@ out_nofid: static void coroutine_fn v9fs_xattrcreate(void *opaque) { +#ifndef CONFIG_WIN32 int flags, rflags = 0; int32_t fid; uint64_t size; @@ -4041,10 +4102,15 @@ out_put_fid: out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); +#else + V9fsPDU *pdu = opaque; + pdu_complete(pdu, -1); +#endif } static void coroutine_fn v9fs_readlink(void *opaque) { +#ifndef CONFIG_WIN32 V9fsPDU *pdu = opaque; size_t offset = 7; V9fsString target; @@ -4080,6 +4146,10 @@ out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); +#else + V9fsPDU *pdu = opaque; + pdu_complete(pdu, -1); +#endif } static CoroutineEntry *pdu_co_handlers[] = { @@ -4341,6 +4411,7 @@ void v9fs_reset(V9fsState *s) static void __attribute__((__constructor__)) v9fs_set_fd_limit(void) { +#ifndef CONFIG_WIN32 struct rlimit rlim; if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { error_report("Failed to get the resource limit"); @@ -4348,4 +4419,5 @@ static void __attribute__((__constructor__)) v9fs_set_fd_limit(void) } open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur / 3); open_fd_rc = rlim.rlim_cur / 2; +#endif } From patchwork Mon Oct 24 04:57:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BB4EC38A2D for ; Mon, 24 Oct 2022 07:02:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYX-0004cc-Ru; Mon, 24 Oct 2022 00:59:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY4-00040k-SO for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:53 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY2-0006Av-6x for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:52 -0400 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wcqL017682; Mon, 24 Oct 2022 04:58:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=hDKyFjUO2d0ZQCKUFKsW1EMc1WJrDhhLACoty+3AVCQ=; b=K+ZZBh5WH2LO0EMv7X43XY2gbH8gqOrlX+nLmDIZ0u0biE8jduP63SFaY9UwtLlR9Rh3 y8gaKsxwcM7eYLJUupJxB7Z/FpQBZEPVhCIGgmzPCCx0RRGWIbGHd1zWo1hSlvcxaYJO DtRnu8OFij8U+joJ30hwcdEkvhw6bW/iCh6G+82nURzfRk9efZiodMfuLaPDIVsRzW/r WsS5zpa+YMauh0Pf5ud/QWwsQLnfkanHl0Hj3f2q6ZJQdfnj00qbI68OCLKIyIp7aN2J +tCdtZ+C/wyyQyEhT7aKk4x6RBFJZfqBoi1iUAnSl/fHw/k3DmdKXc27alcxD063hYtx gw== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc5r2svrf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NzjqvY9rcZVojy5cgZfvsibiMaeD0hCfRN16t2Ojn6z5WvuK4/kV6Wvg8ZaKvgk3IRROtgmJloLw7VmlSLppQW4lSZw6+fRAjlYNDWJKtihGtzs5fPuahgOLJRxDXpyYxcxkqR51UY2e7K+ioVfUNwt6CoRsi8tUIZeofpep7HrGrNnOShhntO0u48xyMBN+bpzJYSjsP7Pfmah4u4xP396tJnpda9ULqAIY+pl8OIdPL9krpmRSIL4LOHDyUuN2o1Mz+IXzvCJ9RnPdIw0EhV2qME3c05P50d/uG2xkVT5qDFRxK41iNvcwPZ3jh+fiJQYIoJAPc2hILDuEZNoAFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hDKyFjUO2d0ZQCKUFKsW1EMc1WJrDhhLACoty+3AVCQ=; b=Iovz5uHiheIbO3ex4feYki7uDZ2HiqLXjqqEo+IQdljMtAF0yj3YuGzYSdFgxMgLo/TJPB+U8VB/+MtH3NR9FPGA5EZZiFL6IxsID6ogMPXo7vFSPNxaU/4cQXQxxd3cHmKaO2iH4ETgDaP/UuLJKwXadHpf8zjpxnEsf02CtvOfKFsc2MyGmVsmd4IWBAJDzxLk5ZMBVCtfVA85lQdAqm6jiLtJAQmclDx6iF8Ih0q7YDOGvbTTAMf/Rb78gZwRNOO441WyuRUf9xQ34R5Pojd4zJ3NHZYQezA+pF982K1UwyeC3QQL0jXhL59Lsxzw8fjdMKgtx2mNuOPPumBNuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:36 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:36 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 10/16] hw/9pfs: Update the local fs driver to support Windows Date: Mon, 24 Oct 2022 12:57:53 +0800 Message-Id: <20221024045759.448014-11-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 5049416d-5c93-464e-a6b7-08dab57c6894 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XUZnBJE0HFbAJbnNGv9zT4QrsU3S7n7qqYNUOaV6i9Xc6ucwaGoh/s5ycoJq/tdQn3pWAu9M0QiL0vNTG/Y43O3GKo20lTupTJ7/CI52gBLBqmX0jQmpYDHemkt+UkFvmcT+u2PJw3xPXdeOA52PsviCPgrOiDSSkflpgr3ZROdUT7tyRwjvDtanekzMlZROwSaI7oLtY/+C+kZf2+/ctpeJ8P614otOMvie+poucBEknVVd/mJ/PTyEGp9Q44B7HdiPOKKVaBXP30B3pWU2rGT5gYjISmXOWhKTRJjImzSPT+1Ftiy1I4VCBoL6u6Pf/5RhjmLNfUhRM7MITAlyEwUwBU7OD7vasHr7sjm6E+0zLorBV3rsDEXNMKTN1+7xFQcO9PQG/Cq8WyMyP5Mp0B9RPDcEB6JgrDqRRfHkQcBqgYWMmV4JoCckYXRWhIX1OXnIYbpJSOmmHhZd6gt+zpM+scOmucQzU+T5eM7ZYWoCkPbOzsYOc06q6UT+O0jBWoDtlKuBSeXyeU8lMjAmZ/9wDOh+lcAjal5NQB00cukKiyHwGeXl5dVifvp2v4NqcNnr/tomB/OLQrqj/qEM+rCvqxg08AyU1TQgypGeNHLJDpz1bpjuJ8SqnNfW3bjtp0iFPI99mq76KeHOZCwdx6xp2xg2HMEvT7PZviKJ1+Y43Rz2m8jrodEW5shHmcGG5Rx653dT2eAvBcXUbo0jQ80McPQVbE96vpzbQ0Qcl9xCrdBUAbUGrRsGF4GFkqD+t+StmHpH3cxxPr8n5K6GEA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(15650500001)(2906002)(30864003)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9g6VSRLbJ8ri7dpb5h7muTM6HrTE5Hvz5hPbs6tff1Zy6/ROsd6cj/VJk0RDU5A4Fum2Cn4OrBQefNAiPK0WqQz266BDsGh48AbXaOQZQ/tJk1aeG2ouNGCP95p+oj0IhEzi2d/eTtueXyAPQhpk3reAtBtMli7n2doQUIlCL290uDFoeUt9QleIvZZ8KHjQwJBWYY/mSUCCrOWOGgzJ1KXAEef9rDACukl3IkWtwDcJu4OFmajwRGHWKVhdzBIEHSv4NP7SRh9ww/o7xSuyUZu1Iw/JoA/ejujFX1SR87yD7DCjVQOh/4487kPyEyGwy0lFtXYE1hs8eBwawIecuF8TAmNKO1bP2mInBaiyi+stweqyHWESg5NsE+noJMMlCqjuCs+j8+gnGjGWv+NZuxwNawxIy7fXMQg+rzC1IpMl3ZrCIXM+YBGWyccylwPDsWSZkJWyulWDPCrqucBJihnHnDUFE2udsxYqFQ255PbIZTIXK8DTv9leRBRZbb9BNw+AlmuPHd0qxc4F2FZni0iFcBdmrVC/Xh7NSVi87piKzxfNmCj7U1ZiPT7GyVpHSgZrNmDtAMTTnRBFikLcwsJHc9IKuGUJuGqL+k9yarHcCOccGHFhHpeoBr9cEbAhnVZ5mITM+KIibHQwNs/zOf/7IlChyxJVB7OmUJ/+qTpZqzL0Q8OEBBqaMDOBm2aL1IP/J1H+GAiWR/wfy7c46Ki9yynWij2OJfdezsf9okTdbVjJpMlK+bHE99S4/e/Zkk1Z8tmYr1jVpdIx+DRrkIyHbr8U9GkDdCmljb7bhLLkXGrdfzCMrQKaFKuBs73wPAz/B3BrinhWV117VTpe+Qq8MbhvwZk+E90ity3nPeSDWr8/1TzBmTwppNA/mD/ozXn4rKf9XClsliAz7yJ/0Q0IGmH2YUSOEIct+opNEar+AdVFC6RYffqew+i9v5IBify3sDWGXKGHVVliztGLL8Zx6Lw/q1u8z88ZHOk1QbH4A79p7XVmLILtWb44bxeLlcPAx+CW+SDd9ZJ4JP+Vkkdr0NWDuicZ+39V2jNfIXFz9hMHLzyLYA4QfpkDUpUGnBBWsiD0NEO+TxAMuZo8fesQhGIuebqodsFFf0TIxrIVWPSUAKYrcxFVRxCegnLD4d8J+6McAMzEvWRw/H3+NNuCvva+fj+tyoM3g/tsrdZYMqDtMEqvX6gjyyJb4XwE2zpSc6dhHOVZ9itw87xxlYgjgC0x2O8P84WaCcH9T5H/CXRtyKXI0aLxzYg/DXnqIKKvVvCDi8amUiEHMEQDPUiKy2VTXg1Cdwn14KM7t1wcloyNT01jIRMxVnQGtCSh2vv93VBq2hNgcMPDJD8XbedU3d6JCw6rWbZ7ZgX3FCfJ72osK2D/Jc0Elv7o+uJlMVtmKqBHJAORbx20ZGR1JpvT3mOZuKOQzJjGPAdkb5OGMT7EgUYHZ6QNF5UdPnE1TQqvL4xTMS6yIvc0K41/ajQ0Xbg57dhtgOXPZ7DkCDAbC9n9zO3NFgOf7I9PE7G4JPoRNeyrxZ/wACpZ5HHthzwlLxelJnvu9RgOiF6oETTE++YFX8A8NDr6WRgn81yMhJqgS3idMyv3+6w7JTViqQ== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5049416d-5c93-464e-a6b7-08dab57c6894 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:36.2740 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5i+pJE9RFtR40vjyw2uoUDmHlU/93Npir8plmZ/l/YpncGpkjtadekZItuaYBWs/qbmLf3sUW83wVsM0gzIcYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: Gc0zWYZd9J1j4w4cSrzFCclt6C84OV2i X-Proofpoint-GUID: Gc0zWYZd9J1j4w4cSrzFCclt6C84OV2i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=882 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_OTHER_BAD_TLD=1.997, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi At present there is no Windows support for 9p file system. This commit adds initial Windows support for 9p file system. 'local' file system backend driver is supported on Windows, including open, read, write, close, rename, remove, etc. All security models are supported. The mapped (mapped-xattr) security model is implemented using NTFS Alternate Data Stream (ADS) so the 9p export path shall be on an NTFS partition. Symbolic link and hard link are not supported because Windows NTFS does not fully support them with POSIX compatability. inode remap is always enabled because Windows file system does not have inode number. mknod() is not supported because Windows does not support it. chown() and chmod() are not supported when 9pfs is configured with security mode to 'none' or 'passthrough' because Windows host does not support such type request. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-local.c | 336 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 327 insertions(+), 9 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d0d6d93549..b5680d046a 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1,5 +1,5 @@ /* - * 9p Posix callback + * 9p callback * * Copyright IBM, Corp. 2010 * @@ -21,11 +21,13 @@ #include "9p-xattr.h" #include "9p-util.h" #include "fsdev/qemu-fsdev.h" /* local_ops */ +#ifndef CONFIG_WIN32 #include #include #include #include #include +#endif #include "qemu/xattr.h" #include "qapi/error.h" #include "qemu/cutils.h" @@ -38,7 +40,9 @@ #include #endif #endif +#ifndef CONFIG_WIN32 #include +#endif #ifndef XFS_SUPER_MAGIC #define XFS_SUPER_MAGIC 0x58465342 @@ -90,10 +94,12 @@ P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, return fd; } +#ifndef CONFIG_WIN32 P9_FILE_ID local_opendir_nofollow(FsContext *fs_ctx, const char *path) { return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0); } +#endif static void renameat_preserve_errno(P9_FILE_ID odirfd, const char *opath, P9_FILE_ID ndirfd, const char *npath) @@ -135,10 +141,20 @@ static FILE *local_fopenat(P9_FILE_ID dirfd, const char *name, const char *mode) if (fd == P9_INVALID_FILE) { return NULL; } +#ifdef CONFIG_WIN32 + int _flags = mode[0] == 'r' ? O_RDONLY : 0; + int _fd = _open_osfhandle((intptr_t)fd, _flags); + assert(_fd != -1); + fp = fdopen(_fd, mode); + if (!fp) { + close(_fd); + } +#else fp = fdopen(fd, mode); if (!fp) { close(fd); } +#endif return fp; } @@ -238,7 +254,7 @@ static int local_set_mapped_file_attrat(P9_FILE_ID dirfd, const char *name, int ret; char buf[ATTR_MAX]; int uid = -1, gid = -1, mode = -1, rdev = -1; - P9_FILE_ID map_dirfd = P9_INVALID_FILE, map_fd; + P9_FILE_ID map_dirfd = P9_INVALID_FILE; bool is_root = !strcmp(name, "."); if (is_root) { @@ -302,10 +318,12 @@ update_map_file: return -1; } - map_fd = fileno(fp); +#ifndef CONFIG_WIN32 + P9_FILE_ID map_fd = fileno(fp); assert(map_fd != P9_INVALID_FILE); ret = fchmod(map_fd, 0600); assert(ret == 0); +#endif if (credp->fc_uid != -1) { uid = credp->fc_uid; @@ -337,6 +355,7 @@ update_map_file: return 0; } +#ifndef CONFIG_WIN32 static int fchmodat_nofollow(P9_FILE_ID dirfd, const char *name, mode_t mode) { struct stat stbuf; @@ -399,6 +418,7 @@ static int fchmodat_nofollow(P9_FILE_ID dirfd, const char *name, mode_t mode) close_preserve_errno(fd); return ret; } +#endif static int local_set_xattrat(P9_FILE_ID dirfd, const char *path, FsCred *credp) { @@ -439,6 +459,7 @@ static int local_set_xattrat(P9_FILE_ID dirfd, const char *path, FsCred *credp) return 0; } +#ifndef CONFIG_WIN32 static int local_set_cred_passthrough(FsContext *fs_ctx, P9_FILE_ID dirfd, const char *name, FsCred *credp) { @@ -455,10 +476,15 @@ static int local_set_cred_passthrough(FsContext *fs_ctx, P9_FILE_ID dirfd, return fchmodat_nofollow(dirfd, name, credp->fc_mode & 07777); } +#endif static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + return -1; +#else ssize_t tsize = -1; if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || @@ -491,6 +517,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, g_free(dirpath); } return tsize; +#endif } static int local_close(FsContext *ctx, V9fsFidOpenState *fs) @@ -512,7 +539,13 @@ static int local_open(FsContext *ctx, V9fsPath *fs_path, if (fd == P9_INVALID_FILE) { return -1; } +#ifdef CONFIG_WIN32 + int _fd = _open_osfhandle((intptr_t)fd, 0); + assert(_fd != -1); + fs->fd = _fd; +#else fs->fd = fd; +#endif return fs->fd; } @@ -527,9 +560,24 @@ static int local_opendir(FsContext *ctx, return -1; } +#ifdef CONFIG_WIN32 + char *full_file_name = get_full_path_win32(dirfd, NULL); + if (full_file_name == NULL) { + CloseHandle(dirfd); + return -1; + } + stream = opendir(full_file_name); + g_free(full_file_name); +#else stream = fdopendir(dirfd); +#endif + if (!stream) { +#ifdef CONFIG_WIN32 + CloseHandle(dirfd); +#else close(dirfd); +#endif return -1; } fs->dir.stream = stream; @@ -572,13 +620,17 @@ again: #endif if (ctx->export_flags & V9FS_SM_MAPPED) { +#ifndef CONFIG_WIN32 entry->d_type = DT_UNKNOWN; +#endif } else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { if (local_is_mapped_file_metadata(ctx, entry->d_name)) { /* skip the meta data */ goto again; } +#ifndef CONFIG_WIN32 entry->d_type = DT_UNKNOWN; +#endif } return entry; @@ -586,7 +638,94 @@ again: static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) { +#ifndef CONFIG_WIN32 + seekdir(fs->dir.stream, off); +#else + off_t count; + struct dirent *findentry; + struct dirent *entry; + size_t namelen[3] = { 0 }; + off_t direntoff[3] = { -1, -1, -1 }; + char *d_name[3]; + int i; + + /* + * MinGW's seekdir() requires directory is not modified. If guest OS is + * modifying the directory when calling seekdir(), e.g.: "rm -rf *", + * then MinGW's seekdir() will seek to a wrong offset. + * + * This function saves some old offset directory entry name, + * and looks up current entry again, and compares the offset. + * + * If the new offset is less than the old offset, that means someone is + * deleting files in the directory, thus we need to seek offset backward. + * + * If the new offset is larger than the old offset, that means someone is + * creating files in the directory, thus we need to seek offset forward. + */ + + direntoff[0] = telldir(fs->dir.stream); + + /* do nothing if current offset is 0 or EOF */ + if (direntoff[0] == 0 || direntoff[0] < 0) { + seekdir(fs->dir.stream, off); + return; + } + + d_name[0] = g_malloc0(sizeof(entry->d_name) * 3); + d_name[1] = d_name[0] + sizeof(entry->d_name); + d_name[2] = d_name[1] + sizeof(entry->d_name); + + /* save 3 nearest entries and offsets */ + for (i = 0; i < 3; i++) { + entry = &fs->dir.stream->dd_dir; + + memcpy(d_name[i], entry->d_name, entry->d_namlen); + namelen[i] = strlen(d_name[i]) + 1; + + direntoff[i] = telldir(fs->dir.stream); + + entry = readdir(fs->dir.stream); + if (entry == NULL) { + break; + } + } + + /* look up saved entries again */ + for (i = 0; i < 3 && direntoff[i] != -1; i++) { + rewinddir(fs->dir.stream); + count = 0; + while ((findentry = readdir(fs->dir.stream)) != NULL) { + count++; + + if (memcmp(findentry->d_name, d_name[i], namelen[i]) == 0) { + if (count + i == direntoff[i]) { + seekdir(fs->dir.stream, off); + goto out; + } else if (count + i < direntoff[i]) { + off = off - (direntoff[i] - count) - i; + if (off <= 0) { + off = 0; + } + seekdir(fs->dir.stream, off); + goto out; + } else { + off = off + (count - direntoff[i]) - i; + seekdir(fs->dir.stream, off); + goto out; + } + } + } + } + + /* cannot get anything, seek backward */ + off = off - 1; seekdir(fs->dir.stream, off); + +out: + g_free(d_name[0]); + return; +#endif } static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs, @@ -652,7 +791,12 @@ static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) ret = local_set_mapped_file_attrat(dirfd, name, credp); } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + ret = -1; +#else ret = fchmodat_nofollow(dirfd, name, credp->fc_mode); +#endif } close_preserve_errno(dirfd); @@ -665,6 +809,10 @@ out: static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, FsCred *credp) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + return -1; +#else int err = -1; P9_FILE_ID dirfd; @@ -712,6 +860,7 @@ err_end: out: close_preserve_errno(dirfd); return err; +#endif } static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, @@ -753,10 +902,12 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, if (err == -1) { goto out; } +#ifndef CONFIG_WIN32 err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err == -1) { goto err_end; } +#endif } goto out; @@ -773,7 +924,12 @@ static int local_fstat(FsContext *fs_ctx, int fid_type, int err, fd; if (fid_type == P9_FID_DIR) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + return -1; /* Windows do not allow opening a directory by open() */ +#else fd = dirfd(fs->dir.stream); +#endif } else { fd = fs->fd; } @@ -825,10 +981,10 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, return -1; } - /* - * Mark all the open to not follow symlinks - */ +#ifndef CONFIG_WIN32 + /* Mark all the open to not follow symlinks */ flags |= O_NOFOLLOW; +#endif dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); if (dirfd == P9_INVALID_FILE) { @@ -858,13 +1014,22 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, if (fd == P9_INVALID_FILE) { goto out; } +#ifndef CONFIG_WIN32 err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err == -1) { goto err_end; } +#endif } +#ifdef CONFIG_WIN32 + int _fd = _open_osfhandle((intptr_t)fd, 0); + assert(_fd != -1); + err = _fd; + fs->fd = _fd; +#else err = fd; fs->fd = fd; +#endif goto out; err_end: @@ -880,6 +1045,18 @@ out: static int local_symlink(FsContext *fs_ctx, const char *oldpath, V9fsPath *dir_path, const char *name, FsCred *credp) { +#ifdef CONFIG_WIN32 + /* + * Windows symbolic link requires administrator privilage. + * And Windows does not provide any interface like readlink(). + * All symbolic links on Windows are always absolute paths. + * It's not 100% compatible with POSIX symbolic link. + * + * With above reasons, symbolic link feature is disabled on Windows host. + */ + errno = ENOTSUP; + return -1; +#else int err = -1; P9_FILE_ID dirfd; @@ -953,11 +1130,16 @@ err_end: out: close_preserve_errno(dirfd); return err; +#endif } static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + return -1; +#else char *odirpath = g_path_get_dirname(oldpath->data); char *oname = g_path_get_basename(oldpath->data); int ret = -1; @@ -1027,6 +1209,7 @@ out: g_free(oname); g_free(odirpath); return ret; +#endif } static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) @@ -1038,7 +1221,13 @@ static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) if (fd == P9_INVALID_FILE) { return -1; } +#ifdef CONFIG_WIN32 + int _fd = _open_osfhandle((intptr_t)fd, 0); + assert(_fd != -1); + ret = ftruncate(_fd, size); +#else ret = ftruncate(fd, size); +#endif close_preserve_errno(fd); return ret; } @@ -1058,8 +1247,13 @@ static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) if ((credp->fc_uid == -1 && credp->fc_gid == -1) || (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + ret = -1; +#else ret = fchownat(dirfd, name, credp->fc_uid, credp->fc_gid, AT_SYMLINK_NOFOLLOW); +#endif } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) { ret = local_set_xattrat(dirfd, name, credp); } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { @@ -1172,6 +1366,12 @@ out: static int local_fsync(FsContext *ctx, int fid_type, V9fsFidOpenState *fs, int datasync) { +#ifdef CONFIG_WIN32 + if (fid_type != P9_FID_DIR) { + return _commit(fs->fd); + } + return 0; +#else int fd; if (fid_type == P9_FID_DIR) { @@ -1185,12 +1385,14 @@ static int local_fsync(FsContext *ctx, int fid_type, } else { return fsync(fd); } +#endif } static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { - P9_FILE_ID fd; int ret; +#ifndef CONFIG_WIN32 + P9_FILE_ID fd; fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0); if (fd == P9_INVALID_FILE) { @@ -1198,39 +1400,65 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) } ret = fstatfs(fd, stbuf); close_preserve_errno(fd); +#else + LocalData *data = (LocalData *)s->private; + + ret = statfs_win32(data->root_path, stbuf); + if (ret == 0) { + /* use context address as fsid */ + memcpy(&stbuf->f_fsid, s, sizeof(intptr_t)); + } +#endif + return ret; } static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, void *value, size_t size) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_get_xattr(ctx, path, name, value, size); +#endif } static ssize_t local_llistxattr(FsContext *ctx, V9fsPath *fs_path, void *value, size_t size) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_list_xattr(ctx, path, value, size); +#endif } static int local_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, void *value, size_t size, int flags) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_set_xattr(ctx, path, name, value, size, flags); +#endif } static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path, const char *name) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_remove_xattr(ctx, path, name); +#endif } static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, @@ -1393,6 +1621,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir, return ret; } +#ifndef CONFIG_WIN32 #ifdef FS_IOC_GETVERSION static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) @@ -1442,11 +1671,72 @@ static int local_ioc_getversion_init(FsContext *ctx, LocalData *data, Error **er #endif return 0; } +#endif -static int local_init(FsContext *ctx, Error **errp) +#ifdef CONFIG_WIN32 +static int init_win32_root_directory(FsContext *ctx, LocalData *data, + Error **errp) { - LocalData *data = g_malloc(sizeof(*data)); + HANDLE mountfd; + char *root_path; + + mountfd = CreateFile(ctx->fs_root, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (mountfd == INVALID_HANDLE_VALUE) { + error_setg_errno(errp, EINVAL, "cannot open %s", ctx->fs_root); + return -1; + } + + if ((ctx->export_flags & V9FS_SM_MAPPED) != 0) { + wchar_t fs_name[MAX_PATH + 1] = {0}; + wchar_t ntfs_name[5] = {'N', 'T', 'F', 'S'}; + + /* Get file system type name */ + if (GetVolumeInformationByHandleW(mountfd, NULL, 0, NULL, NULL, NULL, + fs_name, MAX_PATH + 1) == 0) { + error_setg_errno(errp, EINVAL, + "cannot get file system information"); + CloseHandle(mountfd); + return -1; + } + /* + * security_model=mapped(-xattr) requires a fileystem on Windows that + * supports Alternate Data Stream (ADS). NTFS is one of them, and is + * probably most popular on Windows. It is fair enough to assume + * Windows users to use NTFS for the mapped security model. + */ + if (wcscmp(fs_name, ntfs_name) != 0) { + CloseHandle(mountfd); + error_setg_errno(errp, EINVAL, "require NTFS file system"); + return -1; + } + } + + root_path = get_full_path_win32(mountfd, NULL); + if (root_path == NULL) { + CloseHandle(mountfd); + error_setg_errno(errp, EINVAL, "cannot get full root path"); + return -1; + } + + /* + * hold the root handle will prevent other one to delete or replace the + * root directory during runtime. + */ + data->mountfd = mountfd; + data->root_path = root_path; + + return 0; +} +#endif + +static int local_init(FsContext *ctx, Error **errp) +{ + LocalData *data = g_malloc0(sizeof(*data)); +#ifndef CONFIG_WIN32 data->mountfd = open(ctx->fs_root, O_DIRECTORY | O_RDONLY); if (data->mountfd == -1) { error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); @@ -1457,7 +1747,17 @@ static int local_init(FsContext *ctx, Error **errp) close(data->mountfd); goto err; } +#else + if (init_win32_root_directory(ctx, data, errp) != 0) { + goto err; + } + /* + * Always enable inode remap since Windows file system does not + * have inode number. + */ + ctx->export_flags |= V9FS_REMAP_INODES; +#endif if (ctx->export_flags & V9FS_SM_PASSTHROUGH) { ctx->xops = passthrough_xattr_ops; } else if (ctx->export_flags & V9FS_SM_MAPPED) { @@ -1477,6 +1777,15 @@ static int local_init(FsContext *ctx, Error **errp) return 0; err: +#ifdef CONFIG_WIN32 + if (data->root_path != NULL) { + g_free(data->root_path); + } + + if (data->mountfd != 0 && data->mountfd != INVALID_HANDLE_VALUE) { + CloseHandle(data->mountfd); + } +#endif g_free(data); return -1; } @@ -1488,8 +1797,17 @@ static void local_cleanup(FsContext *ctx) if (!data) { return; } +#ifdef CONFIG_WIN32 + if (data->root_path != NULL) { + g_free(data->root_path); + } + if (data->mountfd != 0 && data->mountfd != INVALID_HANDLE_VALUE) { + CloseHandle(data->mountfd); + } +#else close(data->mountfd); +#endif g_free(data); } From patchwork Mon Oct 24 04:57:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96108C3A59D for ; Mon, 24 Oct 2022 06:18:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYZ-0004ev-GA; Mon, 24 Oct 2022 00:59:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY7-00046L-H8 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY5-0006Bf-9V for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4weRa014413; Mon, 24 Oct 2022 04:58:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=+0mnYaFnS5jmeC+73F35KaOsy23psAhs23ArV2VeOh4=; b=GYQNrjhr+MZ4cfPyASznEZtKgZTvEcapaXp7Rluy2L1WloG+71n76eWsOcSz1D5VMpOx FeN/vPGeC9uCiI6TeTaMnrU6bF3nyvgc/3nFjp+1Ccwwt2uw3rD/P2HYV8MgVXwr6Kr9 sPmvnihQjC24wBe3pyYg7VPSRjXmEaB7QAj2XXV6AXrz//wOYGsM/IxEitqCb4UPQ69K Ois+w3RU7CJrC6q+Aospc1vPuyqVDSwpDLeyCA2ddASJaqKi/OyOVAJCfXVitrmzVxxJ zKmnVM8oe2gWgXfGboa1lv4O78qDUncaljRDmzE89LZQc8tf/uDT1AHJ+/RiNbKNzcEt cA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ri3R3xyTz3GlALdPtACbPSdW02/8kq1nrLGV3eB1Dz8hpUKHkd5QLjjkHr3aKMKZp73rwtgdnyZyDxEr2EXohBAc4By1r5YTGGzUtE+WtPSk8ZvKjfYC7rVDGxrWzLFFjF7je0lHiRp8Pmz7C5/Whi+2haeyoqS/VrwlYmHviXdkUYuqovq1lFjwGs7nU5Lq2FSycdUH1ROeywMWW77o8wDxhUZ+x4LsfFepKSALDRa+QAVUGmfDLtIyzfqHD6Zu/nx5WcIkLU23QhW+QCTSznijPsJJZa32cIQUeea48wfG1IQDqs6symWw1Iye0rxDzXvYZ2QAG3Lv/TEf8Zl6+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+0mnYaFnS5jmeC+73F35KaOsy23psAhs23ArV2VeOh4=; b=CqhaRfETU3qjB0tHcCoWNd2LPLZcUTElCbHsDl2E94Q96JzmntsQswiJn7WP9mchpmFru1l5DUaNdLX91jFxlGWwgUP/LqQ0UdLeAFDv2XN1IlZO3uy+kr4SYLj2WEr4rHYeMVECqJVTyIHrzryH1kUmwKXaGaHI+hxNuacsVGFHsMtfklNdzOVzWbAegJsIPP9/rPkeAZu9PMdGtzL/QMq/lHLWFyhi+OP4ske1r+wbLVMUj/Qy9Y6vAp/w7cMSJ0FbtHAr15MMQrzrEQa1yWPBjCGT0mKWd3NjwmIKYlHMLFOx4uSe0sEhOts11OpzPn559v8SqzyaV4ySCRTu5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:38 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:38 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 11/16] hw/9pfs: Add Linux error number definition Date: Mon, 24 Oct 2022 12:57:54 +0800 Message-Id: <20221024045759.448014-12-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 342b7cac-e3fa-4956-831f-08dab57c69d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lYFXcrDdqeHJWPcBrrZ8/S5q8oO8OA/VXgjCWmd8MYO8LAzrZvJcnhyYNfgpdoz2YaS805nN1tpMzyVstTAVEe5JaRRhW6Acd/CfpQ3cvGxH6V/OPOdQ5qUdghNoR+BRJLMNYReIJMycA8WFEoG6P1Yq2LCk6yTjbZVd1sXyueDW04A+6CQPXMP6JDAlLiywmnM+ngnIooMMtUL9KGYEIiirH5bx3tkA5/yHbF4PtgxugBoM5y3yqJbBffzn0/IxopOLFoM8O5YwASIOH5ARfwpyHlxk3ecf+0IG0VdZZgOzXzGqsQ9ilx9yme9O/zoD4Ze6/RLD0Nv35cXT/YFnKQNSwkaUMZQB7x33b+BpEYoHMqETYFS0hHaNm8UT+2BCeya0IURuVSXU+MWqCx6/mEC5dBzFBEKw01Yub06XCsR4jivGVRis4Kk3HU3viVTbM7+xpn3htsI8yHprnmGZtALVrC5dX+UPmNLxYo/BuIjSSaDY80YJizRC+G2ymoNxLxLVZ2lv5f/XdzdhsblU6V3shh9txNif3x6mbXEKlGNO17D4uOSN/2TnmPFonTMSiQ6REtKCtwzU7kbL7mus1cOH1ucmh0NBCu2VOw9kUzHROPVNtBCC23b+ZaLGhSDvkXAU4yOxX+EjWwWL6J18FIvUD/oou6IWIqmyYx9pNg4hyn68J5OejzJGtcrb+CtTNEUCqA5Tmf75uIQrDqsCBWfCjg1pk8DvZ6/pYqt1pJKfzbHp7C48NlzJRq9n8PZs X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1NawIDuYmI+S9O9V7A1K2i+kS/nY50ZeuidA/42zlIh8/mgmVIkS+QHiOMzDgbs7g8d0ZaOUcuyKzll6wN2W7JFB0qRfLzwJM6nsu50aIUfZMifR5pHMReG224iauYog+oBOKwPzoO21jN/qPO26v3hYFConWBY/U2h6TS+Z8b+AAjU5hdHprzBly1XF32pkqUURFKvpEFd7DNwdAVFEGdpI8li+k0hOIvEXyj83PhOHjr1sKRUz9WaRaXnCVM8hVqHx9OXxMKnjrHm+FIsr+LIKDArm2J99XCEFxYAxbXKZ9/p+V55ASLNmy9xdF0Pes1MirLq+E6m2a/RknBDJ+06O2HAanNSE/goVorDJG2TOw9FdrdtvygreY8ySboLJ1iB36megvQdJSZg+sH+hW/g0qNImLYM7aFDRmFUklsreMwfhH1lXdt6y2xAtG6ngPeo2twJpeWTtPqlXjIHGJJTKTJVusc4k2mI+6/1aHcBWn1U6WG1vInfFFEKZjLa4GPFguE1yKjOF9wA9SIKHQpQtOFcTuhFzZFk+4AyIfbVSO1EaJY7wDfbzchb6bxWVdgSeGdksUzEHeO8ZUWdXd7NHBLzCDq3lE1a7KGnEFlrAX9F6P8N3WQKPRUVJq4U9VQldafn54EQTWzghUgwcnlwY+4R+30/XP1AsC08PktCCCklT+xyd1dLiw5jZrztHtObGCEVV3w+gG86vi4j27Zw2EMgH6GdJ3UxQ8Al4lLEKGjZM/W0zBtMKXaBUNa5YuLZnNoTJ4OIYOoIFK7JWmwkHKdhJQ91rsC88N/McLSpESDi/oJcBe7SU7h+A502gtzxRvGusBVIGKbwL7hkhZYp9hKMuSNC5vFZwVHMwA+DWUzoj9QK7rRV2EmGUyLRbpItcNkQNko+iF6TF6Lck6ZWFB1VKR+fK1pWV+Pf0IhqnEWH0yfRfgq0sMa+Wo3lAzZnfvHjvusi4PdmjuA7CDumxKacNqHsHHegq65ZJ+qtRa9cyD+JKJyywz3Bw1pLcEwJjLgWkfHJpGUb/n9hQx2EK3aN5WQo3FtBBlzly0e4sbl+0NAJOFjxMrx8fb4vOZBSY9miRH3fa5uBi3/R7oqLc8cEpTFixErXEnpHG7KhfEh/Z4EUA05DvMOuhFqHKOmM6ZMFjPJ09BtMIQT62slR8f1z72Xz7SE5kAIfYpM0ugXwWSrIHaa996vH+5523aERRJz0oiVgwSQOEIlV58t891sbmPFM1vnC2oPjnbOCLVIALnCVgIPZw4zzUPNGymhX2Lej25PzRMz4AZDrQoH6GRV2ye53cPsdga/n94gDX5nLScTMlTDdYI4eLawHESu7Fk/41HWh/jxAzUIEyfR7lEFDP4Mcf8gnO6ZltJQIAv5aSJ82GE7it7GWLaJDk6RoO4ThlA0FryIFXHZJU2ehrxU0o8egn0A9dRY8yN/GmtAL/t2w7biYkQUndqTL7JW3W3Y99H2nVta81c71NZ+yJwOCIJ3aqh9MLRIM8kuXEEcsAe3Rf2g0g6fyqJKGekeXLnKwCFD2yr9pSeNtcFVUiy/0Ysl3+czYeJmcAxWjw82eMzw8WXHMGWYNWWgRz9jOsg82CEa081Jg6M4nXIA== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 342b7cac-e3fa-4956-831f-08dab57c69d6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:38.3677 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oVT0GIgXgAIbnNQcK5/JrQrc96hBnIbqc1k1RrllFMl0BLicAdRnkA4F7uGOvEfWiqVIA9QmDcnaAtriBynBBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: PHRMBcgTc6VndYx-B8kEoPWs5_Kopaaz X-Proofpoint-ORIG-GUID: PHRMBcgTc6VndYx-B8kEoPWs5_Kopaaz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=804 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi When using 9p2000.L protocol, the errno should use the Linux errno. Currently magic numbers with comments are used. Replace these with macros for future expansion. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-linux-errno.h | 151 +++++++++++++++++++++++++++++++++++++++ hw/9pfs/9p-util.h | 38 ++++++---- 2 files changed, 176 insertions(+), 13 deletions(-) create mode 100644 hw/9pfs/9p-linux-errno.h diff --git a/hw/9pfs/9p-linux-errno.h b/hw/9pfs/9p-linux-errno.h new file mode 100644 index 0000000000..56c37fa293 --- /dev/null +++ b/hw/9pfs/9p-linux-errno.h @@ -0,0 +1,151 @@ +/* + * 9p Linux errno translation definition + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include + +#ifndef QEMU_9P_LINUX_ERRNO_H +#define QEMU_9P_LINUX_ERRNO_H + +/* + * This file contains the Linux errno definitions to translate errnos set by + * the 9P server (running on non-Linux hosts) to a corresponding errno value. + * + * This list should be periodically reviewed and updated; particularly for + * errnos that might be set as a result of a file system operation. + */ + +#define L_EPERM 1 /* Operation not permitted */ +#define L_ENOENT 2 /* No such file or directory */ +#define L_ESRCH 3 /* No such process */ +#define L_EINTR 4 /* Interrupted system call */ +#define L_EIO 5 /* I/O error */ +#define L_ENXIO 6 /* No such device or address */ +#define L_E2BIG 7 /* Argument list too long */ +#define L_ENOEXEC 8 /* Exec format error */ +#define L_EBADF 9 /* Bad file number */ +#define L_ECHILD 10 /* No child processes */ +#define L_EAGAIN 11 /* Try again */ +#define L_ENOMEM 12 /* Out of memory */ +#define L_EACCES 13 /* Permission denied */ +#define L_EFAULT 14 /* Bad address */ +#define L_ENOTBLK 15 /* Block device required */ +#define L_EBUSY 16 /* Device or resource busy */ +#define L_EEXIST 17 /* File exists */ +#define L_EXDEV 18 /* Cross-device link */ +#define L_ENODEV 19 /* No such device */ +#define L_ENOTDIR 20 /* Not a directory */ +#define L_EISDIR 21 /* Is a directory */ +#define L_EINVAL 22 /* Invalid argument */ +#define L_ENFILE 23 /* File table overflow */ +#define L_EMFILE 24 /* Too many open files */ +#define L_ENOTTY 25 /* Not a typewriter */ +#define L_ETXTBSY 26 /* Text file busy */ +#define L_EFBIG 27 /* File too large */ +#define L_ENOSPC 28 /* No space left on device */ +#define L_ESPIPE 29 /* Illegal seek */ +#define L_EROFS 30 /* Read-only file system */ +#define L_EMLINK 31 /* Too many links */ +#define L_EPIPE 32 /* Broken pipe */ +#define L_EDOM 33 /* Math argument out of domain of func */ +#define L_ERANGE 34 /* Math result not representable */ +#define L_EDEADLK 35 /* Resource deadlock would occur */ +#define L_ENAMETOOLONG 36 /* File name too long */ +#define L_ENOLCK 37 /* No record locks available */ +#define L_ENOSYS 38 /* Function not implemented */ +#define L_ENOTEMPTY 39 /* Directory not empty */ +#define L_ELOOP 40 /* Too many symbolic links encountered */ +#define L_ENOMSG 42 /* No message of desired type */ +#define L_EIDRM 43 /* Identifier removed */ +#define L_ECHRNG 44 /* Channel number out of range */ +#define L_EL2NSYNC 45 /* Level 2 not synchronized */ +#define L_EL3HLT 46 /* Level 3 halted */ +#define L_EL3RST 47 /* Level 3 reset */ +#define L_ELNRNG 48 /* Link number out of range */ +#define L_EUNATCH 49 /* Protocol driver not attached */ +#define L_ENOCSI 50 /* No CSI structure available */ +#define L_EL2HLT 51 /* Level 2 halted */ +#define L_EBADE 52 /* Invalid exchange */ +#define L_EBADR 53 /* Invalid request descriptor */ +#define L_EXFULL 54 /* Exchange full */ +#define L_ENOANO 55 /* No anode */ +#define L_EBADRQC 56 /* Invalid request code */ +#define L_EBADSLT 57 /* Invalid slot */ +#define L_EBFONT 58 /* Bad font file format */ +#define L_ENOSTR 59 /* Device not a stream */ +#define L_ENODATA 61 /* No data available */ +#define L_ETIME 62 /* Timer expired */ +#define L_ENOSR 63 /* Out of streams resources */ +#define L_ENONET 64 /* Machine is not on the network */ +#define L_ENOPKG 65 /* Package not installed */ +#define L_EREMOTE 66 /* Object is remote */ +#define L_ENOLINK 67 /* Link has been severed */ +#define L_EADV 68 /* Advertise error */ +#define L_ESRMNT 69 /* Srmount error */ +#define L_ECOMM 70 /* Communication error on send */ +#define L_EPROTO 71 /* Protocol error */ +#define L_EMULTIHOP 72 /* Multihop attempted */ +#define L_EDOTDOT 73 /* RFS specific error */ +#define L_EBADMSG 74 /* Not a data message */ +#define L_EOVERFLOW 75 /* Value too large for defined data type */ +#define L_ENOTUNIQ 76 /* Name not unique on network */ +#define L_EBADFD 77 /* File descriptor in bad state */ +#define L_EREMCHG 78 /* Remote address changed */ +#define L_ELIBACC 79 /* Can not access a needed shared library */ +#define L_ELIBBAD 80 /* Accessing a corrupted shared library */ +#define L_ELIBSCN 81 /* .lib section in a.out corrupted */ +#define L_ELIBMAX 82 /* Attempting to link in too many shared libs */ +#define L_ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define L_EILSEQ 84 /* Illegal byte sequence */ +#define L_ERESTART 85 /* Interrupted system call should be restarted */ +#define L_ESTRPIPE 86 /* Streams pipe error */ +#define L_EUSERS 87 /* Too many users */ +#define L_ENOTSOCK 88 /* Socket operation on non-socket */ +#define L_EDESTADDRREQ 89 /* Destination address required */ +#define L_EMSGSIZE 90 /* Message too long */ +#define L_EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define L_ENOPROTOOPT 92 /* Protocol not available */ +#define L_EPROTONOSUPPORT 93 /* Protocol not supported */ +#define L_ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define L_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define L_EPFNOSUPPORT 96 /* Protocol family not supported */ +#define L_EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define L_EADDRINUSE 98 /* Address already in use */ +#define L_EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define L_ENETDOWN 100 /* Network is down */ +#define L_ENETUNREACH 101 /* Network is unreachable */ +#define L_ENETRESET 102 /* Network dropped connection because of reset */ +#define L_ECONNABORTED 103 /* Software caused connection abort */ +#define L_ECONNRESET 104 /* Connection reset by peer */ +#define L_ENOBUFS 105 /* No buffer space available */ +#define L_EISCONN 106 /* Transport endpoint is already connected */ +#define L_ENOTCONN 107 /* Transport endpoint is not connected */ +#define L_ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define L_ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define L_ETIMEDOUT 110 /* Connection timed out */ +#define L_ECONNREFUSED 111 /* Connection refused */ +#define L_EHOSTDOWN 112 /* Host is down */ +#define L_EHOSTUNREACH 113 /* No route to host */ +#define L_EALREADY 114 /* Operation already in progress */ +#define L_EINPROGRESS 115 /* Operation now in progress */ +#define L_ESTALE 116 /* Stale NFS file handle */ +#define L_EUCLEAN 117 /* Structure needs cleaning */ +#define L_ENOTNAM 118 /* Not a XENIX named type file */ +#define L_ENAVAIL 119 /* No XENIX semaphores available */ +#define L_EISNAM 120 /* Is a named type file */ +#define L_EREMOTEIO 121 /* Remote I/O error */ +#define L_EDQUOT 122 /* Quota exceeded */ +#define L_ENOMEDIUM 123 /* No medium found */ +#define L_EMEDIUMTYPE 124 /* Wrong medium type */ +#define L_ECANCELED 125 /* Operation Canceled */ +#define L_ENOKEY 126 /* Required key not available */ +#define L_EKEYEXPIRED 127 /* Key has expired */ +#define L_EKEYREVOKED 128 /* Key has been revoked */ +#define L_EKEYREJECTED 129 /* Key was rejected by service */ +#define L_EOWNERDEAD 130 /* Owner died */ +#define L_ENOTRECOVERABLE 131 /* State not recoverable */ + +#endif /* QEMU_9P_LINUX_ERRNO_H */ diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 3d154e9103..281fdcbf8c 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -62,8 +62,11 @@ static inline uint64_t host_dev_to_dotl_dev(dev_t dev) #endif } +#include "9p-linux-errno.h" + /* Translates errno from host -> Linux if needed */ -static inline int errno_to_dotl(int err) { +static inline int errno_to_dotl(int err) +{ #if defined(CONFIG_LINUX) /* nothing to translate (Linux -> Linux) */ #elif defined(CONFIG_DARWIN) @@ -73,18 +76,27 @@ static inline int errno_to_dotl(int err) { * FIXME: Only most important errnos translated here yet, this should be * extended to as many errnos being translated as possible in future. */ - if (err == ENAMETOOLONG) { - err = 36; /* ==ENAMETOOLONG on Linux */ - } else if (err == ENOTEMPTY) { - err = 39; /* ==ENOTEMPTY on Linux */ - } else if (err == ELOOP) { - err = 40; /* ==ELOOP on Linux */ - } else if (err == ENOATTR) { - err = 61; /* ==ENODATA on Linux */ - } else if (err == ENOTSUP) { - err = 95; /* ==EOPNOTSUPP on Linux */ - } else if (err == EOPNOTSUPP) { - err = 95; /* ==EOPNOTSUPP on Linux */ + switch (err) { + case ENAMETOOLONG: + err = L_ENAMETOOLONG; + break; + case ENOTEMPTY: + err = L_ENOTEMPTY; + break; + case ELOOP: + err = L_ELOOP; + break; + case ENOATTR: + err = L_ENODATA; + break; + case ENOTSUP + err = L_EOPNOTSUPP; + break; + case EOPNOTSUPP: + err = L_EOPNOTSUPP; + break; + default: + break; } #else #error Missing errno translation to Linux for this host system From patchwork Mon Oct 24 04:57:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 72F26C38A2D for ; Mon, 24 Oct 2022 05:57:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYY-0004dz-Oi; Mon, 24 Oct 2022 00:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY6-000433-Ce for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY4-0006BT-PJ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:54 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4uZvR011846; Mon, 24 Oct 2022 04:58:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=6XgbaW1j3UaX/Qr65o3z7cIMt9V1DanK+ZYU3xctle8=; b=rMIykFBKbvQotD2qYXB0RFtqOXt4TUb2qBP3PRKQZj4QSv85qoXJPmlPYHEZVuGK/X9I Hh7sXAoQlIbG/Lzw41bzi9kKssYv2up//UmwUF56LyaqCwNMWW7vSQj+sXdKHtMJwdG2 CefmTWE1Ypbat914gyg+XwU907mKOczTHsv9dpATQyOaRGhSbqxJ7TxTLO7phfdu3qlz fBuZSafeCTkHZc6t1eZp4C6zStOlEUXReua+B+2CdY+zlgJM6BeuL0hGj5+nVXZHbtZQ RopbtUROQxCeFs2RlSsZZUs7VQdzTdlifLx7ckcT1bIb8aUVhogeEsaC+lM/wE6tlUqS iQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j2tj7Ngi7r8y1xB8+B1WTwR9oKQLtGswEY77OWtgBVL34mB2WMtO0gsZMsp+gBMizZjP6h26fruvC3ih+eHSg5Wzb8JtNPzZQrpDq2xXPdiuecWdqXy4GoJcLMhkU934FIyNqzuz7fsk953nxdjeKbMQDkSmsgcdTA22DwMszY1BO0hd17DThE3yNi0HqYP/nL7oQt2XJH6DobNV1JGEZgX4Q45Dr9INwBZe307eWjsZrtr3HgMvxvlQREx6sQPJ4T5i8+foT3ai9tmfMztxgNQ0sXXPOQmWoEdf+KCT6G2yGiJ94yXll0K46AMskXHvygzjwnYOY5U0JHk/gS5Kog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6XgbaW1j3UaX/Qr65o3z7cIMt9V1DanK+ZYU3xctle8=; b=PkLUfnPc5+lpGMISZpG6NgTCbaWp67TE+eAOG0kLn75ZtSFuAb8jnaUkdnlE+IAgolJ6kxx/8oE3w9MGAv/Xjr6u2WD3Zg8NUkN/YMiEjnrXfqLna5v3otRP6Vwmy1nKcWs5WLWX9DT29I/voxbCIAnHSN71w8Gx+Y8o0c4/wOtN00cLu4ohzGnWqbUeOyg6nVaYorPx6R7EvR8jQbDsxrjoGhy/d2s5b3KAo6cLnzhFUcWeDQD31yFERmOPkeCwYBcSZH7vuL6OVGi4+BdZp9XZzub5sHQZNIssH5X5HjOF65JtmavuWkXbRcZFRP92NCz4Y6SVQt2xDydu/ZgD4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:40 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:40 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 12/16] hw/9pfs: Translate Windows errno to Linux value Date: Mon, 24 Oct 2022 12:57:55 +0800 Message-Id: <20221024045759.448014-13-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: e0761660-2c7f-4cde-f273-08dab57c6b0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qtDruQI0nPSWsSJu1JT0pKlUUE1jTxmz5nzTYSOwtjRh2ElDv8GkFqJPJyAqe9UOg3jqXEQ+e4wSXf4QUuiObGRRcpCO1i/38Wqs3jKTAoo3acQCgs/o9QNoQmxzQiDYXHafpZZkcw87nb01Pv+mf5YjcktmmLPiCItCDuuJ7lADPeKY6eCF4aSSFjlW84Z9bO3OY9q1w/K0SCzB/oLmmZBpLr42+XVPuULQmauREN+PjXi7RSmV/9ZLWmgrDw/8NWhKZ4HJvS9jHzFuP2OnOSpRPC4PKeHcoTfzpkFRkChY/tvgSsXKMXBSnG1I3M2E/MsnvEtiP7GQRaLnOqNgkwimZev58AcJtaUYI0RT7rJV09DTp1nuBci1m1MdhESogGAEJExrYHmXEz62PNO62qQ1hZmkF+X991TfWMs16y+0+ImgQ1g0e6/HssQ2hr6lTTlQfUPrxhc+fHpKByw3mQm9HY6RuCw6pjFaBCYyBuTUDcl9cXgz3zMd//KzmFhQQQl6r23QDbAmZViKN54xThPZg06hyEDYBanp5ZwNi3fuLfMmBW/vlEfa+NCVysMyZNRY0wGEUdgcCu8h4y8UpW6qF/j6PcjnscTtqjQ84S7QaJ8s7+Ip9d21YvjYDPsW3FAHRErll419kSp54SBYeYo2dFmBh2tN5lqYIeSYT91NZronej6vfKTsyf0Sg22JGqs52d7v7APLAwF3om9EoYKCC/KZUEeFE80MWcdY50Zb35XhELCXL3MRcM2WCuI95uF32DXMDo8wFQlxeN/xxw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6FW62tE4MuE9Z8Cid8Q1ErFPS4Y9JKm1WGfLa0iTHIzeB+4jiBz6iTfZR6UZ+OCPHNC2KuFb0YmAcfy8XlSuy6bpvKT2kvtXrQ5PkpvAdun/l1eLhmLS/6mnKgYEIJotSsoeDLpVvOELGUarzqnTAOs93zBDugdT5CtbpUdAbIQqtUM++CFyxT6rYJ2O0s5LUGOkEAWGxVBV0DRH4gEn3RUqBSng2S7gKBkotsucLnjKmwhE0VNp4io/k32vVhvYIiv4qnfxZRSus1kko9UPbNUkYWkeuFrJ2EpZD7Rd8D+N9/r6y68bZEg3AZTUrVFKceVY6z6wp/RS5TzGCKtwbAcYSmC4tpDo3Uoi4nXqoAtXM3Qt6djZJOogb0uUgS0tj0Cu5VTq/IAJZuWIG9NGw0WrR0X4ygu5/BJvApbqt92txkFr4oLlscVV+bB4H/kQVkK7UAh7vAY0svGywptHVH37feJhZxOIngG9A4SR1EZvrYfachSq50VpFZ3iL9VtyTGyoWUimBs8wRV8cYcdo68CdDXWHn5M0WN8aSjFPd6oMjQUYdWZBwkPnswp0gOxoefy9cqSTwwBPAeGIzjmIIOT0cdLS3Immid23N8G3CSvVL2HKvY/4IlbVRspw/TFwtszWKCqkJJy8dVZPB/doVPct5PlBAO1ZoHeeIe712vnbtGgHCbevqV+eGLz4u34lIntBwYOtAGV0M6Swd6yHQeF6paEJ4W+tGQnokctdS2zUmvHavV+qHEYaRvcarkhvW+UxWPi6idKI8Ng7mcBmNzDXdV33OpZka3yF4pNmSuKiKtPsjZyTv9q+e2QBZ/KcfgI2GMKErbuA8WHDbJY9VpW+/S3SmJ0WACC5PkudJ0LEPT6vlSAbB/k1TFXKm8uCi5Hg2Zn9C1FgHPrG2hBxymP1IdNUbuFm/mqMxaQ53JGYRbCVQnb1m7/a9i70O2v9/BXuGf+ui4a0YSq7dBTd6ZQII2iYc7lmNf3Eip8k7nxqPE4fsuv649dbjhmx1/FtWR7aer4V889IkBB9wq++Q0coDGIyPFXz2BlCZyiishTI7B7DqH6dbm5PO7QJxABol54rES5SATiJos/NsKcsOLHemPrWu7PX6SkoHtyve9dU3qQYQoqnRSoJ+bU7c0Ti6kiA/UmkG3f08sc5xS7pNpN7P5Bi3q+wPu2g1/nrnewwdcd5lZrBo1exI45g3VZfN2kLpLg7RUwOiBI7re/HJ1BhdFiIra2QDNCRu+29kWnmSNUZH0RYlRfHSuHmVYY7wlADkIzKqJHwV5PngW81FQWmEfERRby1I3Cwx1BkYthRL8fB+SJODyvzaBYn+NOf9MS/ZreK5cnPFhT4yvBwNV1U70ZwsVdfBhoABzOMKJbRTlHdRiqk20dT/BoAQV6VuPIVvJijJOyIdNqOC3hplsu2CaNIVZqDWJFzJzHTOMlgB/dadn4MMVdbg8AlBuGEcQkvxZyOOzpzKRPqdTyI83uawWLsEQgqpgpAwtIzUAeeQS6ru6Ue0Jzpl2XATj2DGVYHb7QVFwsMg8WAyCZGpPLo5Zrp6hZHYj6wF3gG80sn4w6MfAO2AJgD3pY9hnfCrUq+C9XcqHhH80mporAow== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0761660-2c7f-4cde-f273-08dab57c6b0e X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:40.4466 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HtrUauHKvs6e/UCsmSt0lgKiFEbeb31XLmhkV0wGj3jwfKd6W4L3aIFQN2/qbwqMBPuCWulGvvAo33NSux83iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: Fpkp-sllKNhfRijf7MG0zlLnpxh0oLbZ X-Proofpoint-ORIG-GUID: Fpkp-sllKNhfRijf7MG0zlLnpxh0oLbZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=564 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Some of Windows error numbers have different value from Linux ones. For example, ENOTEMPTY is defined to 39 in Linux, but is defined to 41 in Windows. So deleting a directory from a Linux guest on top of QEMU from a Windows host complains: # rmdir tmp rmdir: 'tmp': Unknown error 41 This commit provides error number translation from Windows to Linux. It can make Linux guest OS happy with the error number when running on top of QEMU from a Windows host. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-util.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 281fdcbf8c..145a3117dc 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -69,9 +69,9 @@ static inline int errno_to_dotl(int err) { #if defined(CONFIG_LINUX) /* nothing to translate (Linux -> Linux) */ -#elif defined(CONFIG_DARWIN) +#elif defined(CONFIG_DARWIN) || defined(CONFIG_WIN32) /* - * translation mandatory for macOS hosts + * translation mandatory for different hosts * * FIXME: Only most important errnos translated here yet, this should be * extended to as many errnos being translated as possible in future. @@ -86,6 +86,7 @@ static inline int errno_to_dotl(int err) case ELOOP: err = L_ELOOP; break; +#ifdef CONFIG_DARWIN case ENOATTR: err = L_ENODATA; break; @@ -95,6 +96,21 @@ static inline int errno_to_dotl(int err) case EOPNOTSUPP: err = L_EOPNOTSUPP; break; +#endif +#ifdef CONFIG_WIN32 + case EDEADLK: + err = L_EDEADLK; + break; + case ENOLCK: + err = L_ENOLCK; + break; + case ENOSYS: + err = L_ENOSYS; + break; + case EILSEQ: + err = L_EILSEQ; + break; +#endif default: break; } From patchwork Mon Oct 24 04:57:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41C44C3A59D for ; Mon, 24 Oct 2022 05:24:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYa-0004gI-Bl; Mon, 24 Oct 2022 00:59:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY8-00048I-6a for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:56 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompY6-0006C4-LM for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wibr017751; Mon, 24 Oct 2022 04:58:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=sdc1sBW+ClvCoAfMr2NakYHq4WgtRTi5ldHN/9cqbdI=; b=i1WV7XN4417ZmPl+DD9leukskdsnn/90hGG1EnhUD5hOnDPrjaIBWvc39r2NX+WDsuX2 u0uY+TIlstapDlEG38hDWe4V+0ZSxCDD1gXE+X6oPGblParurPl69i3ynkukro3I4aIv 1mRs6scZxshCZUobpJzIUki12WL9+eHUQhnw3zhlQoNFtccMRK0LLIpQNZLNLAc0HDMd MpuExgNcA0neQqgBfJIz228zxncnw38JfFJohxYYmSaEklEJNx5dCC+rtOcvjpuX/qO6 +ETB/F+Egsa6jyFeA7+LLui74TUeRZCfLbuBNi9YvMekRSM5SsZ8ByP+Z9Oq2nPxiu3c PA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc5r2svrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWHlbTTk9VJBbPoCpP4qP3q71p1WdBy3I4/yeJztZ0uzKulva1pPD3cbrv1+o+PczClj2jccUfdlms83yF+9QhVFJbRt409Cf0LVPp8pHFL6UjDHhQx2JdtgYmLMiLtSQvxngGiDyeU683D37LfTHqbqKjE+CQgMjBOvFCKf5yV6ZRpoamZHTTHKJWDQ0fT+jkdXVjtnV9Lghf2VN760QrTRNwj7gDQ4ByblPmmxkEMPqVUyI0gCoAO9vlorygfxPRk+vvaO/CIp0qaTwVswQUFa0JEhcgnB0GcsMi9pqkUpimpeacL7RnQQNlWdpCo8qNGoCOJfLWHw8P/a5xFBOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sdc1sBW+ClvCoAfMr2NakYHq4WgtRTi5ldHN/9cqbdI=; b=VNmPN7huick9GEcTdjozaAu29wpJbHd7BSSDPeBOLGcMUfiAp3q+9BrUVEf5KYuKSmdEMQvIkd0zIzI7slSGeXEDURnb1CopmRZmGOVyNQAfAUyOEM+OBXsz5bh7+1yXXfKXTXzdrqY2WVuGyudR+W98U8Gl5L96kqYgzXgBJpO4tKeDtf1aV3NfYyWDrNO8QHrYCrOFjh84tB/EM7gouc7913B0E5fSDodHOaXH5tX5FWtZau02iOUvAM8/CXrfvBRFNriR2T84blz2d2YKnDiizx7tI4dmm8E/aNgNhIWNGFQB/Lz4MnRLsAvqDw2YX9r//B7hZPoDaQELskimzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:42 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:42 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 13/16] fsdev: Disable proxy fs driver on Windows Date: Mon, 24 Oct 2022 12:57:56 +0800 Message-Id: <20221024045759.448014-14-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 9611af09-8060-4f11-f8f7-08dab57c6c44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /OMe2PvdkMyZf4fBGiNjH/aoZmhQJkDqFbwpKmkZoSTrAYDfjaF6fA8bvHVJ+K7QmiH8Hp769Q8lu/XDNral1YvAEBs+TAlKkFK+8SyeTk/OKlToj/wPSSC7IS+hUxJpJnfOOU9x2NS8bmQbOYqXFHOriKk99jVcfRIuRX0/Fbs15rX3mkYBQUROQasIrV240aAGOeaS5CZPyKbiJ4IcasuMF9ZChSJczav5E53f3lmsp5KJG6cHy0uTJNOd5Tlr7K5v1TD5OtlEm8m3PSOWRNcB3Xz89lrJklSi1Doggltz8EqHdZ19IqlFpZ9mnVhMHB+7idhCjrfhxJvyOcl93nOrXeRgdP95ZyN4Ou+CefuRqmdPUKPiAj2QTCxA1znrSvkaztpBELOCcunvxaLsi3byZhTaDYIL3ggIrgVCkr7E5BHzmChb3dtKxtgbJcVup9L1tjukjrDV/c/uZm9YkQ0srJlPHOXLmOgqWGkui2/OO1vCw1sBJ3+KSjmH4MIpSw6J9g1Z0MdjCPtB9mxXaah43W3zVb17nUqLjgHH2Kl29vJKzTI64T7KqR/CnGq1d8BLLauyTXKnvozgqK74dWnp1Gwh3lT3R5m3ut00h5++mMwJI1JTsFvXc12yEoiAjWi7A5TDpfxe1nYKw0iN+FdV9bgq5DaZ/mkxbvB9e3gV7msCMxvdQc8KrlCkBVkzjBo9cUXsrqlCJOoUmMv07pTix7+kDdHWPddJHHqUEg2HzBCkOdraNm5Pha5SAmET3DIVo4iGIpp9IIEw27Fqvg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T52xB8+q8sS0xt7ouPq3bcJpZHAVGZGVgOa+0Qubq2ojje04EmFEE4JJVdEGrzmgWATT99cvu9J0GX+k2KgPviN0FFOHfcxK9fPmgnG/6oIniNP5Y3Fw0bDiMmmX+x4KHgSA0BVcxBz+K8J1/z2ydoPU4KVYfvSTVt6fX1Ih52Pln6stmxk6eYbMZSTLNjHnCwyk0fn9hCbTU8AQSiRBCaAPPywmkj3VRwtFoLJwY/iTXNYTGFLriyzVu1gzA+bHixrIPYAF7bFuPfje+FBtCNfq6FBsr/YdGa9cRCPYm1V80j9BvFIIeiL7+TdcCUnKRMXHBWsiEk5B/7X+vDgE18Afy2QxunNPqBk3Ha2aItR9BxR9o24pQiFWuhB+UJjlOGMjq9OFbkeS5JmiXSUYhdKiqSXUVSH7pfRidKApUxW+SxaI92jJ6l8nNPZRnx/H9rV/wsr2B/nqa1Svak+BIunQlZZD2iiOfKEZXCxyzBfIKMLfFHJVIciaPriywAobl19/Tw8dA7L24cu8ntHgS45kp1gU/hUE4u1855Krh4bXUok2KuVl2rsk6xVXpJX2hxxsx1wL5UUI6uX4aIwop1NPvvkiqqyRxj/a+o15uzcnGpJA/oMYPVJVKwY55fF1yK4lAyInwLRMg7dN+NeZ33wY/6k6F6M6JoEPgqa0kNK0aTfS+PyfH29juD7te9xc51CU+OEJp+24hvTggYnWUxsb2tY0TD1H5hiG5IUQTg1hhFSNgmyRiESGlnz+vBYkroKuzCbgJMBtq30r0jvCQFWffRt+Iz/YZI4QpwWyUDiAfV7wphE/p6J8/I8bfVQpwCL0kujsANan5FlpnHGKo4us3FYhRWnrmqc0+fRZk2kfHoVXvUgxdxH8/mnN6swIena4eqwwczAtOG9B94Jmjv+zjNnhY1+A7glLcewvGUH9qsJuONkTjNCVh3dQE7XsEkO1ImTVESqxws7pAFX9vRO4GnA3jAX1fNPjzVy7JntnfXW0soHNvUmUHfh46jpIyKwxYej8BUBAxCo0kXL+63rjWq3cFGwJLVlNf+RIxtcgSSR/Egebz3lUloqaiKdfl2VdcPG1t7yjallf8yk4Z5cM5izzzO13QmOW9m4BaPR+dAv0R8HxmJeMVVw4iOgBubtSuJgqQEQPahtnr6kwvQiZJEEWocz9W/Su+HE3niDhAgyYA2idaG7uILkTVNgKypswijb6OLuaKPCqxGOgvTYYQlvme40Kkfkn6cVfxOZIssYcjgKVjDbKpbGF1K/AJx7T+fMFarHZ6QVbq5pTg2C/EqKOoTE7j9y7VusUvWG/dZb8NGR2YgBk5Tzdagyz0Grd5AwQTe83QWn9ZJWtEq+N6YesrxjB4zUDbZBxjegtLpflEjyjHO59Xz1k4owZjm9w9KrIzSri7PeCvxjx98hF/LjkoVk+61uGXBpRzEZKRrgs/UNDOb73/idQWHXMuD5JaehewEL6iKLr26qcQmdokktF9Rb61U3ArJIsQvDCE7aOVQ33aBqTKLRPGYgvY8e6uney2/yRuWVGHVOP5KBok2jcZMsYR3oZYR3n/KIcRMF/JxEG5IcB25b6tbFw8QLzSZD8EIqYAafK7XtgsA== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9611af09-8060-4f11-f8f7-08dab57c6c44 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:42.5565 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DzHZJ+yuhCeeCd7rtju5deF47H+fdWbW8e/tuaOsRfC1t6b85BkkEiAC/H+sD77XHINRgGW4tyBo6Z0E4ZtroA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: Z5roiwr25a1SrnU0dfToru1vmIaXyosr X-Proofpoint-GUID: Z5roiwr25a1SrnU0dfToru1vmIaXyosr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=577 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi We don't plan to support 'proxy' file system driver for 9pfs on Windows. Disable it for Windows build. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- fsdev/qemu-fsdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index 3da64e9f72..58e0710fbb 100644 --- a/fsdev/qemu-fsdev.c +++ b/fsdev/qemu-fsdev.c @@ -89,6 +89,7 @@ static FsDriverTable FsDrivers[] = { NULL }, }, +#ifndef CONFIG_WIN32 { .name = "proxy", .ops = &proxy_ops, @@ -100,6 +101,7 @@ static FsDriverTable FsDrivers[] = { NULL }, }, +#endif }; static int validate_opt(void *opaque, const char *name, const char *value, From patchwork Mon Oct 24 04:57:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6780FC3A59D for ; Mon, 24 Oct 2022 06:17:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYh-0004t3-63; Mon, 24 Oct 2022 00:59:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompYF-0004JI-BN for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:03 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompYC-0006D5-D0 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:02 -0400 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4rWf1025182; Sun, 23 Oct 2022 21:58:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=A8rMuHBIpTw3noUrUHbCRcArxsTXdLFPt4FCt/dN2gY=; b=MAEI4HPlkRmp9zL0Nk3RHDNpSWhogxRh4ud7ZWEJiuPvqshwmVb9wSB3BkjpPey73Irg XZ3eFvgFrQPxLa/4mfICinuOFDF5ebFLiMjsNfk+u85ao0vffdNfwN98Wf6eY5v3doNu YxKrjp7+hei7FThZl9E8a5vt0pqNeUfzeSHpmvTC/5ZZklZmaJLzZ5F5s45596oF9z8+ fAVIoPwx65kufoqQjg9k9VKwrNZITOD/aKgujRyJLdc7r/v3Ot9MaI23pJEn75xzSM89 bW8N0KgoNbbZn4xdB18MmH2sAhusOOrHtfgvlpbelxC4l73ZbzA7qCs9o/h0qcO5kCi0 2Q== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksmag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3y0e72Kunnll6vdj5/OL3iWfezH/UQxwJ7hKmDYUa5T9OOPao2y7r7UfRGxftiQKqrX4Hpw24Qy6qa5x2H8ZeQJWrn7RpX6CLJQavxPQbxmYC7+PsifPWqwmj7wGIr29F9weT79ty1JMg/A/kz5Vp478L2ArskCOignhW502s1luo4GD0uaQK5Tdit79LQmLsC14NEtkO6BYTzbm/iMf4alpathPa06vQna3X5naX6ghk2gn6gVRUteq23vo/eaHNBnIL4TCbganxjnzAJR45pGd+A0MuZTSYzhBMahjuFkHmW2SU/X72BDJk7P20d86nohxtI7Ff8cCwqXMbVb5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A8rMuHBIpTw3noUrUHbCRcArxsTXdLFPt4FCt/dN2gY=; b=J/bwD1x0LNVkJIYNk6vudND2tD283e+UC6BHFe1c/T8gXAchnqzBbHX6jAjTngHo87fgLA7mdCZ/Qfg6n036bgPBWW+ah/t+M+Rq6/AoqL81sc4OAQAz4BFUDhjdr9QcNW5b/SXEGFV6vrhdOyWvGfQiv7ol3vj13zjvM2hH5wuJEXN6qlMZzP61MW3FKs0S3zuBrDXcxzDC7b+iJibWuokkkgAwaPLaD5TnMN3sChCf1MuT8fReLmxvmAM1+BoYb7/K33gxjqQPiWH5LdYU/GuBnJ/b5jBlwabYs7Goqt5omOuWMNYKNIZE57wH6rk98e63waNZ8r3/YjNKrHT+lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:45 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:44 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 14/16] hw/9pfs: Update synth fs driver for Windows Date: Mon, 24 Oct 2022 12:57:57 +0800 Message-Id: <20221024045759.448014-15-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 778a3ab2-dd91-4cae-0d4f-08dab57c6d9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IjSgZTi80sQzL6KVwD9/7M9lVmB7jmnzTMSlfVTC3gglC8Iv2DUHaoHrDNNJkvUgKMpGsdCVkaEik7MYNspLVl/vuZway/ETeZmjd9Tm9Oc9xKIzaXEDoSKQjzDnPhTAJXpUAOxLFgkbqIhR24e5uTKPlQJP9WNK9FidLlrpYYRSreZ9r0y7Jo5sX7tLz4bBVFAUzZ8MXoKwzBphrhlRlKI0GHcM48FNl2iVqeEKWC/XU/sM3qvOcFfS258h0dcicuDsENo8D6TbbEmjEWoHHnpxx3GqIBTHF3IJE/q5V6EX8lxiYQk1Mmn5OObILd2OKmKGCB4j+/cy7orUQxbCNt3QgGnvrOYFibsFLXR6yA/hsqY8e6M5wh0Y3WnZF75GAVWvahCLr1I/boEtcyGVnuoonH36b6mfHgsBCsd5+97jnvjUeiRBMPec73k6Mf2P+hjdVFPz9kqOz6mVgpg/DbbyLWJD1unf1S9A1CZ8T0rcJps7b+xuzvcInuMEyHh8cH39iBA5eb5VNWlcH3k/jW+28Lx6fn27ULqlTIYlPyENok+gxF9MNAwFptzHdy+r0h5qZABMRAtg1Uhm1zRzwAp5zA190KUalVxVGCZT5FUsDb92ncahUAK8KWfB9R/z7AummcZz5gnFNKTXfWOkxnvZk5BngewMsGOGtQmK3KrEbHn1P5ZKICa2sFL2q2ibkQAnqpVhaqqeT7Umtbd4/sCRt3tRkP4IpPFg+wx1Pt7+AUUFzsk4FH981VZ0BEy7t/a6J9fGMPdmAWML+KBEJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2i6ZwS58Uwv6+iXzx+iTx4uQuxIUQpEq6oWQipNv2ccELstQtpKNfVYdl9Sb2Box+us5kqeKgsKYjfgOcAjXcwG3XjK4mF8P3zWce4YSq8163TPxxJOs0BhD0DxTagYWbpsuwZ+PSnU0KYWa3ON13th6Duyt3wliI0OVJIgmLfeoxa4KKUMegbI9bU0XaTx7vp2yW8ehruZ2A7V96sTbLmiPWXVIwHPYCVqznRdcCT1d+yKcGepRvgxXsPODVZf9anwDhU67tdWYLURuhIWsDSBdA/udEwaeiKbY+a+pRiSDf/og4KylZvfC1EcMCWxCp+mu83o7QHEa3ysz/tBssBqMkz0Ibars/4szrLcb+6uD79JAexPzLvGn9U4jDnlgpxbcS/0UD+fveOEd2Hd3PHHYkOCiYMnabvg3/jSXDGVeujMNPHfwM+pNo1uLtUeXvw0tAb8pM3rRU5P2Hh05gsdb1snX9XiwUt5DF82jJO5Z3x1QFQoPYAg0ZDJgQDrHS0A1KXYjaYi0x1Vuqe7fHJNnIS3cPi/7PkSLcI0djBf5LRmjqI6jInNXE3kEAK9zk5WlulrQVmt7vyLLrSs82kysAODHvt56NNLqQ3MLFaXxbyWYO4QQDUwfsSfGIGmgBETS/ynTKUH7PbeoFDh90BvV0h9Rq4UxoCGtSRUvhw/DcnP1ya46DHBTiWBsjj6gwvdDt9xOEIrni558IRhczG5Sg5yUyEQLl7/c66JT/4zO0NTF+M+q8j6/qoHZQ+6XQ8dsrVjospnvSEeGVyqoHkYyPW5nAB+c0EOEnaFeP7ZYbxPHEg+kEatQjMjLMp+IIzETnKWpU7vRZfiwsr3OI8Hzh+/HcPYDCvzosSk/iuiRSPTJoF4Q/o+GNf1wMqRbjnj6gB00F3KdlMx1leQq1jOk8WBNDb/Gq4RI0aCmVEFFPixHtyxudL6pX8BHBrMdvFfatci4C2Oy/E/uCSR1/fCU/26vuah7CJ7kFU3iaKXgsfuURlM/2tUnhEUABQJngdKgOstmOUFcgtmGMzgYMXt6wHoESHM1yZi6YNT0+ZTYoSuJE+mRkHGixR35GF1/c/J8FwQUwHT66o5HWFuIHtLT93gdRvu7PY6ckyKTsNadNibkCzSZf3oZS6LLpLLNzdFpGuSuSEX2k8xEt/iP3+0wXH8hmHrgKY9jDRhQgFRkMavwR1cHzv/mlThlvmbdaZSYB+BYCROfuQDcneDZEiFsJiMN1RqPQGqb+/arOhhLDmziCStsPyKK4zjsPe6DuP7WeWx+WJ0Veei+HLgrB+7hk/UclEWxSYubyg3yTn6/OcJY0XBXgy9C5bwVTL8CpUlBFLAtxZIzSuJvSCfflyymf3KahvOsvf4xPcAEauJ+DeEiz6cVVPrOMkVsZ7hkJG+vhJ2PZGaV0GAkutPLHS9A+5+AqFerD3AVs8pY/VAGFtNLFs+7rTSvsjf6xQndAX/XjhhUz5uHbT7YaDID+PoQ8DOprVsKM47BRkjkldseP4/BvBg2+6U2zhMHYSiT8xJhjnmLWHgnvmNu4rW4niCDthXCpAZihrTZ3q7tsUkYLeWeTXFpwRA8rv0r0/zBSZm3caD8w09vlVii++Zi7A== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 778a3ab2-dd91-4cae-0d4f-08dab57c6d9a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:44.7917 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: va7RaoL97J6s/s4dsbf+qPgVZdJvp2YCMoYqB0JbzfNUtDLhip1hYUUHbJc2HJzDwl+LdAKWu+UoT2sDSbKcFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: eBdzmNnwJBQKX--60CcaWf9oJUBoWObS X-Proofpoint-GUID: eBdzmNnwJBQKX--60CcaWf9oJUBoWObS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=942 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Adapt synth fs driver for Windows in preparation to running qtest 9p testing on Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-synth.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 1c5813e4dd..6d33eb1cf3 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -152,8 +152,10 @@ static void synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf) stbuf->st_gid = 0; stbuf->st_rdev = 0; stbuf->st_size = 0; +#ifndef CONFIG_WIN32 stbuf->st_blksize = 0; stbuf->st_blocks = 0; +#endif stbuf->st_atime = 0; stbuf->st_mtime = 0; stbuf->st_ctime = 0; @@ -236,7 +238,8 @@ static void synth_direntry(V9fsSynthNode *node, entry->d_ino = node->attr->inode; #ifdef CONFIG_DARWIN entry->d_seekoff = off + 1; -#else +#endif +#ifdef CONFIG_LINUX entry->d_off = off + 1; #endif } From patchwork Mon Oct 24 04:57:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4963DC38A2D for ; Mon, 24 Oct 2022 06:52:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYi-0004uL-Kh; Mon, 24 Oct 2022 00:59:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompYG-0004KV-Hu for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:05 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompYE-0006DE-U2 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:04 -0400 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4wo6C023768; Sun, 23 Oct 2022 21:58:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=olQOEYv7nNzRorXdnDXFKA4SrIIv6h/+VhWOvsF7C08=; b=PSuOuw2KqKcb9qO6jhKWbSYS/BbVe0R2HrWHYZR2UWldDxRdM5AFKoaP45rRIrWoqWSU Zy8G1ouAGmoXvuAWxHwPfM8Wgiaw/YdTOBpqEA/ah4lEmHF/XzYX8+8x1qFm0Sfaqy1v wxV/D/hzin6ZCMrH36myZDGwD8XNMw/TSLkdSTXRefSQ40POtUkwlR+Tpt8RPa0oH+Q4 LCcMA9nw8BydYTVOT+GFjRLcWP3ExoCotH9u8/0goDwAYB1THtwWKrBP42zteMFwKMDM djX8xyp2aKiEwCMy8F+54AYdRPolmfJHO1EwREBl8Ux/BMfNxaiKxRGqB0mmS29Af1Os yg== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcbt51s1g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=boy4sqOH5g4fftPigCxTQ3TQgXSFr0oVMlR/j4fHFRH7I9bkXgxFUT8wjbiF2N5ofpzP5UgvS3WkzVtCJV6+9oIXlICicmpCUh30K54t8vY3LtA3eTUXCd+M74BXq+gI48k6LX/smnKoQ5o+mAHkUV9+up7XyBlrHh+Do+DKP2f2W9m/LChW0PZjo7E6pJ6UGz0V6nb6SuC7IQ/CHecyKNn+3HOX+/PYp5p+mZrDykJBsokc7p+aiv2YEYGi8Hid6sydeGlq5LJg0rkvUFRWset55R/9vaXpfX9DsnYwt/0WDfDQNy8VUEaQQcaWVq2cJzO2HUevKwfDljoKve/6eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=olQOEYv7nNzRorXdnDXFKA4SrIIv6h/+VhWOvsF7C08=; b=kwdNF+hT9w45TfLIiSJNgKyRc/vTTfr5ujLb76H9fsAFltaS1gGJa4L1OLjXDuRJN7xdHrV2LzaVrq45MnEwuX5UD14UgZVSH5MOLh9mi+xgmpXqnn8vpbquK+oG2mHKa664secI2kFii74sOF5tfKj7vyaTwYc9a0UZBqHFOOFz7unI161VVrQ9QUISuOivzJ6v/4FSfNu9LI+2YfqfdknZaFKYSWKOTXyLyqkkccWBEq7e8ajcUT4ELvOOWHQZQfvwPu9ZifTRvvcuX4eJBZgKHs0w+wwt1iSIaaVybd7oaNIwPGqoMa3QJ5jCZpGBuMWtP7XVelqUBJuvi4m10Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:48 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:48 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Xuzhou Cheng , Christian Schoenebeck , Greg Kurz , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 15/16] tests/qtest: virtio-9p-test: Adapt the case for win32 Date: Mon, 24 Oct 2022 12:57:58 +0800 Message-Id: <20221024045759.448014-16-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: caf3e498-6f05-4ab5-7875-08dab57c6ffc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mce+lUuj1iGQpRAauiBt1Y7Ic5QzBW4bAz9H1f6uKja6qBQcsoh8e7AYyXDhEABLoopRHQN0sIQycnNOeySfPo7JfyXOrLrNZKqgbdhia52RIuYYDJFI6JmyVLgLDYUvcZa5h01ZicAHL+D+27w+0MPjs8qPFcJ/zq7cNy7t0rUoZSSxRxIizdVtoS2Tlyy7kI2FMxoua0BsqE+6Om0vaNCWHNbvSiBYs8HpF1xMWHrzAa+5dNCDSeppAEgdryBVOMdEwo/VeAXhAxqszDV8U6oTImcUa91uZvwr1I3OhgcBjn/n2w641GQaXCXxdV8yGR7B301MIQEeUICoPqNp+S2b+omvaMDgIoIj+mq/wu+eBLsz4poMJNkh7yx3iKTL1Ry0t+pdUh69B+kZeL5BAaslaU8n2yFpPOeRWQma4G0ndCj+iElRpkUtZDI99bQqNsg7N4W2KTS2HNg+mO1cEGIs3GTRnADxoD1/vxlnyyoDIQZZtPQ49nmVqbN9Lu+uDgGakzsz/ymv45bROf9lrT2rHGhqKl4AmpLrljfoH0aC+pjEsCojxkfAcgxDRYMZ+pFQhqMlvVkmZS9VPLFNNJ6cDdVzlmIvu9E73TxHqf6lw3AhBfHYLpdVrPyEhopQWaZ9Tpt863Cf4vhdGZFgBVYOigAO6F/+QJiISA1QbaXDjTBf7AaLtYpPdPR8kX7b5JbFBFeJnKt5kQoy/lmoLDF7izh99w7oUB5xtoszqiPgspwPY3ly8WXjnl+QhO53mMskYwC3RyaM/RwGpT3plA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cc+IZzSGQQDXSGdYWb/9W1YfYghZxrzDhC6WAKYXlmVu2Z7lbn864rfbxpSg9M892Pz5RGAHB1+9qDPP3n66sMbWJIlIEeZOhkHTFX865rJ2/BQqNcAOpAdncHG0l5BhHmjA0ok5jEEL9F4FtpHznc3eL1KS/WbJ5XOmYOU2Ict+G61cAvBa//lF91SCGH+8A6WGuG/bciyISU1yGKvn/i+3SqgdzOR69mQsn+u93cTSBPI5yxSSh3lbmGOXAjKPueA0o7omL7L5KPvxM0fL3lA+9g/XU6d+efqe8q0nyyDhnbvh9SeFYPX+sb8Y5HazfiTWzbARm/SVLQrcftjoNScLpG0jeebuUu67S7Gjz5NBIfb1Eq+4P7nTkDgZRZEuEAuDUVC83IKxR0/EiqhcCVmexFipoKRdKJXxEQ4TfX3aaRaaOkObSuVo6pkRQ2UhzFrR3+n0LtO1JDShhHPT2y5rkxpu5IHA2JUNifgYoCQpUZf23PHBvzz4uXV5Pep+20DO2cCg2ZEp5SZCuI/83yHRks+peyLLqg7SMrBc794/gQ98I2oSf6dNKcKPRx5RA6kHzr5I9aLC1ojJ1KYURYmpaT6f81hQfEBP4P+ILIoAm7sY+UxThH7cT3bscEz9ThmhpzWI2R9+IfovfjhSvwsdBRh2Tk9gNGK+uA29NH/vUv0SjQ/OPXoQlfeUJlTB+ouI9vCBRzb8VCx0yCf7B1AlS3uyaCNaaLYL3VWGTi95VV3W5bB8zcsMh5SKQqDabQi7us7n78NyVueiZRTV3+X39ERSISFhQgaueHEGVCnqnXpHesgRoIbhE6e/TEXAtRxhGiu7OlyesRWiAWb19lfSlv9oMmujnbIE5TUhqmYqplehCCNEV26s/8etj/LNt29j7nJEI1910/OHjYYXLJF7PJQrD1W1L0FNkRmhZsaVXOlIBzauc8Eb5evPnWleoPABG9Ypg1Pv+1C6DGbud1vch3Ev1Hk0VZIL85wkBY4xg+mrnBK/dE1Uqnb280mLGGUNEmu3eOu7UkCbok4T20dVm2QMZ54QpEPdKrSo+LNVTwwBUttV4RFe4Npj5PFfJFbMt75s7yyO06NsPQfXGydg9ExbxM639ptL1bh9og8cpsXwruajmB9osCAcl6u92Oxio6bdo3AaoJAHidTvTUEeZmLZO9UBNnLMPL7z/ajWpJpxr7G7BxMB6Euswrw5XSoed5i5LjkPKioptD5ZVGJ2M4xV7sXSiY9I01er3/oj8kWDA46BLrbEbVgRPte6K28IjGo83xeiPWA0nbbDKJqV/JCfluhLLB56aeAkTy/1Zm7Lnrq9m3AnI9W4t5ExIzOtUl3L3siv7H7pv4syRdaNdPevfStz8TOmqWMzVRgFwK4ur6pBVjwvbGIbzFQ220TRG8tu55puwwRPCt8SHG/RcOMzdT/HJkfeGauZLJhaEvim5/zJIQ73tddj63AEMjhsji+Vjt/k3a8OwGHB4OO874jgTmFvOJLLgO0rNwGZkVfTo+RQti6V+KqO8LOca6QG0vbOY9u+/LeyB7Id02C+szao11Y5ZJ7njQT+cTGzQE7fEu9Iy8G2ntQtUX9+FPlmHKuv/gdw4jt/zqIpEg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: caf3e498-6f05-4ab5-7875-08dab57c6ffc X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:48.7766 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zG7yF9Nt+STGNqjoiwQIeXY8hirdybqvSv/4PO+e1CEAXguOzOOjpg67mcoo0llpZb+eqYbAA53VYjmsnu7k0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: 7rDIQaoP_blqt-L1pXPlIiQvfAUoFh1g X-Proofpoint-GUID: 7rDIQaoP_blqt-L1pXPlIiQvfAUoFh1g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Windows does not provide the getuid() API. Let's create a local one and return a fixed value 0 as the uid for testing. Signed-off-by: Guohuai Shi Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Acked-by: Thomas Huth --- tests/qtest/virtio-9p-test.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 25305a4cf7..e81e3e3709 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -34,6 +34,13 @@ static uint32_t genfid(void) return fid_generator++; } +#ifdef CONFIG_WIN32 +static uint32_t getuid(void) +{ + return 0; +} +#endif + /** * Splits the @a in string by @a delim into individual (non empty) strings * and outputs them to @a out. The output array @a out is NULL terminated. From patchwork Mon Oct 24 04:57:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13016651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A376AC3A59D for ; Mon, 24 Oct 2022 05:08:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompZ6-00058t-Kz; Mon, 24 Oct 2022 00:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompYH-0004MH-UU for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:07 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ompYF-0006DP-JZ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:05 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 29O4aBdG004966; Mon, 24 Oct 2022 04:58:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=HYLliU5SInIaZI2Sm1MxYUuuakbxSydGL3cJiGUQUcI=; b=E553md43ATWQanUfd7UNkLqiKBiqLsAqNp8tBTb/LeVhd8GsBYm4Ls8emlrsa/vKngGi CylPQZ8maKx0RrVt5kRohlvZ290sEEGBaR0dqvoopYYrh2nRr3Kd3dH78N6Xz7NHVE5x pqNmCURA+rYlRtYdRA7tuqryQm4urs8LCSk280vnX2ecjn7S7N2hmiWUgc6fvYblE4Aw p1Dn7vvVatzx+dSAtv4mVS74z8M3RBRYaSH5P/v6BHzSfDvDe8FFpFXrZ7/RIqBLZuEj QpxVK0kvpRMJl9EoRQpwsBB9R+f6wYSUoItY9e4Rrlwj4mhsipY+ZM4P/urKtDK/TlJW Ig== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dBzzHP4VkJzml/gujXMDOIuDWddt5/yJRUKaQ0G6l9AnSwHvcmN+0oRR66opPg0ViYX3MwtEfvw2R3LL+7bg23qahsDobX9VM0nXPZO+Viej8xs+xMfRA5MGWjClU2eYm3YdnJ6Ukk/E9juS6zg3ppEixp6dV+lS75lDNXCsV9zIBuMJ1vwAn8aRI+rHKVoKoETV7dcTCYThk+LNu+xCTGdtIT9O1rVxYzDvI4LWq6Ec/+/gHdf4j5kn01RP7hJRnCDCUXhNSwKpHuxPftOq7h2a2TUUT2IwZOKnm0hmDcMekkSkNS3VgWRm0GXS9ncilvw3IB+QF+PLJimtvw0/Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HYLliU5SInIaZI2Sm1MxYUuuakbxSydGL3cJiGUQUcI=; b=ItHEqNqY5irxcuAglnZaGhJlQtPICFzar7PScHmUuDGKUiAJkDMFxePdJZFhCcsHfn+MOY1EBp6mEkFhXuYx/67pvNVh0P+s818UhzuokfwWXQiK0NPC/hvmhYjrGvVSPlDOv07/Wc3djNW9ya8uKYbeTGac8N3VC8ARnu6nV6ur9oZfMGYaI5vaEPYVLey5lYl/GZmg1jKlB9kYoF30tC1/Xzggt/Shr996afRqTLEwmriM2DCerUzf0h8a8t4Dm0zAKyJabf4yy27YMhrLtJDQzONcfLxAKz4K80/A7HBcgEnltNQdllu98sewWC8zAggXwksqaQITtaknF8uPhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:51 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:51 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH 16/16] meson.build: Turn on virtfs for Windows Date: Mon, 24 Oct 2022 12:57:59 +0800 Message-Id: <20221024045759.448014-17-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 8169ae37-a7d7-408d-62b8-08dab57c714a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FXX9jdV/wddt96Dc6uyrO4tOhFhrHM1E0rESby2CNMvkAt/JQlFVzb+NSzMvLfwQE3A0A60iDkHX9+enox3faBfnOtG671B+3jYgRqFnOdBpP8Y5rD4KRhhnqVQpMLyLhkyu2rG41Eqe1wt4T4Eyqqt7XAjqpbVa/npQa8/n7YGzrA7Ca5Pp0v97pitgglliYty7kIglDALbWRB9e1zBsCs2Z8qUJ/pph3qmvZCzR5c4Kez2dJrb2kRw9Bd4Cg+B6yfxN5c/tX45Xv3QJvwKJiO1I2sx3s2F4g1+sN3cJGNcqMkDC/wOmpJN8mTFIMstMUvW7smemGrS3meUc0GM06Je/kOOXgWIR69yobYeRxQCIwY5Tmg4cK+JNVmPsdRKJwCS4Nc3uP6RJPF/QJDLlK1FAX8peqCkfyNsrKmscLn8j/yjqADsExtI1iWww0X2SiTunkIR3lQVRhMYUU45Yce2HNGzvBNuQ2/2NsKSaAhmTuiEacCqbrN1XxmwWsOh21rlelFs+0WDsJsxWwBhfenj4+V9hyAzkqrhtMrykpaGq154l/5gxImTDPRNkdpNQlseK4jYfUJK636qwmBqBHL0kxIFkGHKyHp1fOa5hsmGLV+MQK8WqpqSQj3xAy1Hcjs9kbMJNPA9VO7rZ75mTvmDb2uF95bP6i2zv2kUdb/OemH8etuwNakM7ROORaVbuFV4cljCAsIDQkg1Zt3jW0g4MNNlzBlCMb1TQmG9NP9/AOdP1lIYrslg14eQQZ/7ZcIpiVPTVyTbohVaB9/+4A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FYEfTqK6236nC1p8Ct32TxVLojcG9E8v8ofPDqOsMShdw4nTwT5ffjL+pgvf+dwStPquegRy5Dm4fJDSPpcCzOzdxX69mWQDyeXVmllpebo0eVpKkLjUxcdCmoT09I7M4fHXVYz6CuMr8p3rhOu25Etj4syftOoi/QpyNMYzk5BctLIQDBOdSJerVWbroQlG7ig9REdzEpLO2m/fsRfMO+4NEUcL5xnShZ+equTa9eRccl4nWfydO18QnmKESWeSKRrweHUxxVYnkROH5ViJdZEUc1TlzQP4URXPhxP9ZunhsY/B8luks4QVFbYTj/pJGPFAuYSQ/232TUYEqraLlAJmUERVt5e2Yn0Q002GIKXpZY3COutEWjh+5UD2oAajNRdfu9Sw4q1/F5LgCfw1LyII5ZDYDyyKPKXU64GZmf00D7hCdwPfA+VGeH34cMb4CFYjmF8S8KUyYwOhqav8Z1AxvR+NoZySzHvtKaqJw2raSSWQO2y2KBCoIm9obMhYcLDOGUEZgzT/HBZUAMBP83qw1Umu4sR1BiQCWXE2lODpEE35qnI600hG4qBdo0mxsAmr804W+gAO/z0hR6j8+ZyDKINVlket3q4iVrS2oIc5uuzx4ggp9HSRDVZLTUBdwim4InRzDNjxXLdnn4HVIEn94kxsYUj/gcpwd9HdatoO1z4P440cjCYoQrFY5SZV8xjJkqzbs+BA1esj292kz4aZy+fLgRsz6ZhpxdtFc2r1hk/fEF4pqD8aMxansgvF1iDXDuIdeZ9kYeviYt4blbhpLMyJw3xDaR0ehSfZrL2C7hqXE2l9U3OyXLG25Tn5GdIlIDVQOvD1P7sZ8xwMw+gWfA0ib9a5osVG72qrNwUj/qMum1U7iIpaCkxjlI/dFnw/COdKEgws95muNw5i6L2oEaNjUnaMYSM+NQui4+Ckx1MFSQZmdBN6u596ZN3cuOuYhEzw9C5zumYnKp5AiVLhf6afZ7PRa7jjb2uzeleyEOBFCu7KSzGfE5XCAq5ft4gM9ejwp/4sWDsG2xeCqkIeodHRubbY5EUh3FbZXJ2LTXcthiO5GObZswJt5TrAOjlzRV8dlmRO36LO9rxbrksM5lLw/Dp3asFTP/2jL/o20vb4XGgiTo1qm0cysU39vSK3Px0lvq1ZyQUL/H/sI/XKssTtfzOC+h3HwgiC4RmdzpxMfwTaS0ooR1D+m9jf7YAungcfDjzNlpMy1BBE0B5RFuSaH7bFJL8jmWbaxYNRFswWBbZIvO4tssm4uaqyrhOkRCW8GlHu7LpocSHOFmaG7e720HjAHTEhmuVEnUA1+YHz1XYyLv/X792zkB2JJwsOg5JbrNTsIjmm3Wcx3XdKz/sJ9TskxGvKQ2Oju2Atx8a+RLH53KP4J/sYlKM9KcqCNiu5+jYBss7dfi18GRLMGA9/8VzjTFjBIzZ1ZyD9iakQBmylSs5iEZxj6WB2zPyyKxnbLqYm+8dBPu79h5YRnw8Obt1VlTlzeiD6HHRs27sy6ZTpuKnmSjR1x4EvNGCUsE3d79CS0GDcfeYueY3W7GOQeBte8UgZCkINpJMuLcwWjj8wazl9NJ6zi/GeQfxEoKI0gczi+wYlwssI4g== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8169ae37-a7d7-408d-62b8-08dab57c714a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:50.9962 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QjKr265YSdaAVBKsKJJRdM4pysDVhiMFQspa57SmP/3RNrcNEDMvAsGs6+9MtfQL7we69vcUhoClL+N+D4bl/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: no41bZC6vY0oKHU8GQX1HkU2MefHgbiI X-Proofpoint-ORIG-GUID: no41bZC6vY0oKHU8GQX1HkU2MefHgbiI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=707 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Enable virtfs configuration option for Windows host. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- meson.build | 10 +++++----- fsdev/meson.build | 1 + hw/9pfs/meson.build | 8 +++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index b686dfef75..4c23d18083 100644 --- a/meson.build +++ b/meson.build @@ -1728,16 +1728,16 @@ dbus_display = get_option('dbus_display') \ .allowed() have_virtfs = get_option('virtfs') \ - .require(targetos == 'linux' or targetos == 'darwin', - error_message: 'virtio-9p (virtfs) requires Linux or macOS') \ - .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'), + .require(targetos == 'linux' or targetos == 'darwin' or targetos == 'windows', + error_message: 'virtio-9p (virtfs) requires Linux or macOS or Windows') \ + .require(targetos == 'linux' or targetos == 'windows' or cc.has_function('pthread_fchdir_np'), error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \ - .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()), + .require(targetos == 'darwin' or targetos == 'windows' or (libattr.found() and libcap_ng.found()), error_message: 'virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel') \ .disable_auto_if(not have_tools and not have_system) \ .allowed() -have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools +have_virtfs_proxy_helper = targetos != 'darwin' and targetos != 'windows' and have_virtfs and have_tools if get_option('block_drv_ro_whitelist') == '' config_host_data.set('CONFIG_BDRV_RO_WHITELIST', '') diff --git a/fsdev/meson.build b/fsdev/meson.build index b632b66348..2aad081aef 100644 --- a/fsdev/meson.build +++ b/fsdev/meson.build @@ -8,6 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( ), if_false: files('qemu-fsdev-dummy.c')) softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss) softmmu_ss.add_all(when: 'CONFIG_DARWIN', if_true: fsdev_ss) +softmmu_ss.add_all(when: 'CONFIG_WIN32', if_true: fsdev_ss) if have_virtfs_proxy_helper executable('virtfs-proxy-helper', diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build index 12443b6ad5..aaa50e71f7 100644 --- a/hw/9pfs/meson.build +++ b/hw/9pfs/meson.build @@ -2,7 +2,6 @@ fs_ss = ss.source_set() fs_ss.add(files( '9p-local.c', '9p-posix-acl.c', - '9p-proxy.c', '9p-synth.c', '9p-xattr-user.c', '9p-xattr.c', @@ -13,8 +12,11 @@ fs_ss.add(files( 'coth.c', 'coxattr.c', )) -fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-util-linux.c')) -fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-util-darwin.c')) +fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-proxy.c', + '9p-util-linux.c')) +fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-proxy.c', + '9p-util-darwin.c')) +fs_ss.add(when: 'CONFIG_WIN32', if_true: files('9p-util-win32.c')) fs_ss.add(when: 'CONFIG_XEN', if_true: files('xen-9p-backend.c')) softmmu_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss)